Jmix UI tests not working after integrating embedded postgresql

We have integrated embedded postgresql for running UI and DB tests in our jmix project.
DB tests are working fine but we are unable to run UI tests in headless chrome. Facing the following error:
unknown error: net::ERR_CONNECTION_REFUSED
** (Session info: headless chrome=102.0.5005.61)**
Build info: version: ‘4.2.1’, revision: 'ac4d0fdd4a’
System info: host: ‘sachin.kumar’, ip: ‘2401:4900:1c5c:cab0:a0e6:8700:ee4e:417e%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘12.6’, java.version: '17.0.4.1’
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [c3c12e05f5b44dce66e259f5d49c1b0a, get {url=http://localhost:5050/tau/#login/}]
selenide.url: http://localhost:5050/tau/#login/
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 102.0.5005.61, chrome: {chromedriverVersion: 102.0.5005.61 (0e59bcc00cc4…, userDataDir: /tmp/.com.google.Chrome.pXvhve}, goog:chromeOptions: {debuggerAddress: localhost:9222}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: LINUX, proxy: Proxy(), se:cdp: ws://172.17.0.5:4444/sessio…, se:cdpVersion: 102.0.5005.61, se:vnc: ws://172.17.0.5:4444/sessio…, se:vncEnabled: true, se:vncLocalAddress: ws://172.17.0.5:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: http://host.testcontainers.internal:5050/tau/#login
Session ID: c3c12e05f5b44dce66e259f5d49c1b0a
org.openqa.selenium.WebDriverException: unknown error: net::ERR_CONNECTION_REFUSED
** (Session info: headless chrome=102.0.5005.61)**
Build info: version: ‘4.2.1’, revision: 'ac4d0fdd4a’
System info: host: ‘sachin.kumar’, ip: ‘2401:4900:1c5c:cab0:a0e6:8700:ee4e:417e%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘12.6’, java.version: '17.0.4.1’
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Command: [c3c12e05f5b44dce66e259f5d49c1b0a, get {url=http://localhost:5050/tau/#login/}]
selenide.url: http://localhost:5050/tau/#login/
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 102.0.5005.61, chrome: {chromedriverVersion: 102.0.5005.61 (0e59bcc00cc4…, userDataDir: /tmp/.com.google.Chrome.pXvhve}, goog:chromeOptions: {debuggerAddress: localhost:9222}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: LINUX, proxy: Proxy(), se:cdp: ws://172.17.0.5:4444/sessio…, se:cdpVersion: 102.0.5005.61, se:vnc: ws://172.17.0.5:4444/sessio…, se:vncEnabled: true, se:vncLocalAddress: ws://172.17.0.5:7900, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
selenide.baseUrl: http://host.testcontainers.internal:5050/tau/#login
Session ID: c3c12e05f5b44dce66e259f5d49c1b0a
** at java.base@17.0.4.1/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)**
** at java.base@17.0.4.1/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)**
** at java.base@17.0.4.1/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)**
** at java.base@17.0.4.1/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)**
** at java.base@17.0.4.1/java.lang.reflect.Constructor.newInstance(Constructor.java:480)**
** at app//org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200)**
** at app//org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133)**
** at app//org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)**
** at app//org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)**
** at app//org.openqa.selenium.remote.TracedCommandExecutor.execute(TracedCommandExecutor.java:51)**
** at app//org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:551)**
** at app//org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:314)**
** at app//org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:1009)**
** at app//com.codeborne.selenide.drivercommands.Navigator.lambda$navigateTo$0(Navigator.java:74)**
** at app//com.codeborne.selenide.logevents.SelenideLogger.run(SelenideLogger.java:152)**
** at app//com.codeborne.selenide.drivercommands.Navigator.navigateTo(Navigator.java:70)**
** at app//com.codeborne.selenide.drivercommands.Navigator.open(Navigator.java:32)**
** at app//com.codeborne.selenide.SelenideDriver.open(SelenideDriver.java:101)**
** at app//com.codeborne.selenide.Selenide.open(Selenide.java:52)

build.gradle changes:
testRuntimeOnly 'com.playtika.testcontainers:embedded-postgresql:2.3.1'
testImplementation 'com.codeborne:selenide:5.20.1'
testImplementation 'org.testcontainers:selenium:1.17.6'
testImplementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:3.1.5'

application-test.properties:
embedded.postgresql.dockerImage=postgres:13-alpine
main.datasource.url=jdbc:postgresql://${embedded.postgresql.host}:${embedded.postgresql.port}/${embedded.postgresql.schema}
main.datasource.username=${embedded.postgresql.user}
main.datasource.password=${embedded.postgresql.password}
jmix.liquibase.contexts=test

We are using the following extension classes:

` public class ChromeExtensionTau implements BeforeEachCallback, AfterEachCallback {

protected static final String LOCAL_SERVER_PORT_PROPERTY = "local.server.port";

@Rule
public BrowserWebDriverContainer<?> browser = new BrowserWebDriverContainer()
        .withCapabilities(new ChromeOptions().addArguments("--no-sandbox", "--headless", "--disable-dev-shm-usage",
                "--disable-extensions", "--verbose", "--remote-debugging-port=9222", "--disable-gpu"));

@Override
public void beforeEach(ExtensionContext context) throws Exception {
    browser.withAccessToHost(true);
    Environment environment = getApplicationContext(context).getEnvironment();
    String localServerPort = environment.getProperty(LOCAL_SERVER_PORT_PROPERTY);
    Testcontainers.exposeHostPorts(parseInt(localServerPort));
   // browser.addExposedPorts(parseInt(localServerPort), 8080);
    browser.start();
    //browser.getHost();
   // browser.getCurrentContainerInfo().getNetworkSettings().getIpAddress();
    WebDriverRunner.setWebDriver(browser.getWebDriver());
}

@Override
public void afterEach(ExtensionContext context) throws Exception {
    WebDriverRunner.getWebDriver().manage().deleteAllCookies();
    Selenide.closeWebDriver();
    browser.stop();
}

}`

` public class TestSpringExtension extends SpringExtension {

protected static final String LOCAL_SERVER_PORT_PROPERTY = "local.server.port";
protected static final String SELENIDE_BASE_URL_PROPERTY = "selenide.baseUrl";
private static final String TEST_CONTAINER_BASE_URL = "http://host.testcontainers.internal";
private static final String TAU_PLATFORM_URL = "/#login";

@Autowired
private Environment environment;

@Override
public void beforeAll(ExtensionContext context) throws Exception {
    super.beforeAll(context);
    initSelenideBaseUrl(getApplicationContext(context));
}

@Override
public void beforeEach(ExtensionContext context) throws Exception {
    super.beforeEach(context);
    initSelenideBaseUrl(getApplicationContext(context));
}

@Override
public void afterEach(ExtensionContext context) throws Exception {
    super.afterEach(context);
    initSelenideBaseUrl(getApplicationContext(context));
}

protected void initSelenideBaseUrl(ApplicationContext applicationContext) {
    Environment environment = applicationContext.getEnvironment();
    String localServerPort = environment.getProperty(LOCAL_SERVER_PORT_PROPERTY);
    String selenideBaseUrl = TEST_CONTAINER_BASE_URL + ':' + localServerPort +
            Strings.nullToEmpty(environment.getProperty(SERVLET_CONTEXT_PATH))
            + TAU_PLATFORM_URL;
    System.setProperty(SELENIDE_BASE_URL_PROPERTY, selenideBaseUrl);
}

}`