How to use WebApplicationFactory for integration tests together with Hangfire?

I want to add integration tests to the project. The project also has a Hangfire. I decided to do it using test containers and WebApplicationFactory. But when trying to add to Hangfire services

services.AddHangfire(config =>
        config.UsePostgreSqlStorage(c =>
            c.UseNpgsqlConnection(
                postgresConnectionString)))

Errors occur

Inner exception 1:

ArgumentException: Couldn't set user (Parameter 'user')

Inner exception 2:

KeyNotFoundException: The given key was not present in the dictionary.

The postgresConnectionString itself is passed correctly. What could be the problem with hangfire and how to use it correctly in the web application factory?

I tried to remove all Hangfire services and replace them with mocks, but it doesn’t work.
How should i implement WebApplicationFactory with Hangfire service?