Search code examples
linuxjenkinsdocker-composeautomationwebdriver-manager

Automation ui test in docker


I have a task to run a UI automated test in a container, and I need help.

docker, docker-compose, java, webdrivermanager, linux, Jenkins

enter image description here

Error: ProfileListTest > initializationError FAILED

io.github.bonigarcia.wdm.config.WebDriverManagerException at WebDriverManager.java:1760

    Caused by: java.lang.RuntimeException at ApacheDockerHttpClientImpl.java:195

        Caused by: java.io.IOException at DomainSocket.java:63

            Caused by: com.sun.jna.LastErrorException at LinuxDomainSocket.java:-2

Test code:

static WebDriverManager wdm = WebDriverManager.chromedriver().browserInDocker().enableVnc().enableRecording();
@BeforeAll

public static void setUp(){

    // Настройки браузера

    wdm.create();      //add browserInDocker and change setup on create()

    Configuration.browser = "chrome";

    Configuration.browserSize = "1920x1080";

    Configuration.headless = true;                                  // для работы в контейнере "true" выставлять

    // Вход в систему

    open(BASE_URL);

    SelenideElement searchLogin = $(By.id("login"));

    searchLogin.setValue(LOGIN);

    SelenideElement searchPassword = $(By.id("password"));

    searchPassword.setValue(PASSWORD).pressEnter();

}


@AfterAll

public static void tearDown(){

    // Выход из системы (logout)

    open(BASE_URL);

    SelenideElement dropDownListProfile = $(By.linkText(LOGIN));

    dropDownListProfile.click();

    $(By.partialLinkText("Выход")).click();

    // Чистка куки и localStorage

    Selenide.clearBrowserCookies();

    Selenide.clearBrowserLocalStorage();

    // Откл драйвера

    wdm.quit();

}

}

I'm the only QA in the company, so I have no one else to ask for hel p.

I just don't have idea what can trying


Solution

  • what is help: chmod a+rw /var/run/docker.sock

    For those who encounter build errors, here's a logging tip. Add the following to the test{} block in your gradle.build:

    testLogging { events "passed", "skipped", "failed", "standardOut", "standardError" exceptionFormat "full" showStandardStreams = true // This sets the logging level to "debug" }

    This way, you'll be able to see which specific test is failing and get detailed logs for all stages of the build and execution.