serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
721 stars 518 forks source link

Feature X fails when i execute my yaml #3302

Open SorayaAzzaoui opened 1 year ago

SorayaAzzaoui commented 1 year ago

What happened?

Hello everyone I have a problem with my project, the tests are not running I have a buid failure error, locally it works who could help me please thank you

What did you expect to happen?

4.0.0 com.Gex SerenityBDDFramworkSoraya 0.0.1-SNAPSHOT 3.6.21 UTF-8 UTF-8 org.slf4j slf4j-simple 1.7.30 test net.serenity-bdd serenity-core ${serenity.version} com.squareup.okhttp3 okhttp 4.9.1 org.seleniumhq.selenium selenium-java 4.8.1 net.serenity-bdd serenity-junit ${serenity.version} test net.serenity-bdd serenity-cucumber ${serenity.version} test org.apache.poi poi 4.1.1 org.apache.poi poi-ooxml 4.1.1 dom4j dom4j 1.6.1 org.apache.xmlbeans xmlbeans 3.1.0 org.apache.poi poi-ooxml-schemas 4.1.1 io.github.bonigarcia webdrivermanager LATEST org.seleniumhq.selenium selenium-http-jdk-client 4.8.1 org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5 ${XRAY_TEST_PLAN_KEY} true maven-failsafe-plugin 3.0.0-M5 **/runners/*.java classes 2 2C integration-test verify org.apache.maven.plugins maven-compiler-plugin 3.7.0 17 17 net.serenity-bdd.maven.plugins serenity-maven-plugin 3.6.21 serenity-reports post-integration-test aggregate

package com.PageObject;

import io.github.bonigarcia.wdm.WebDriverManager; import net.serenitybdd.core.pages.PageObject;

import java.time.Duration;

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait;

public class LoginPage extends PageObject{

private WebDriver driver;

public LoginPage(WebDriver driver) {
    this.driver = driver;
}

public void openGex() {
    WebDriverManager.chromedriver().setup();

    // Manually navigate to the URL
    String url = "https://env11-pre.ivalua.app/buyer/oxylane/prepevol17/j86f4/page.aspx/fr/buy/homepage/cpt";
    driver.get(url);

    // Maximize the window
    driver.manage().window().maximize();

    // Fill in the login form
    WebElement usernameField = driver.findElement(By.id("username"));
    WebElement passwordField = driver.findElement(By.id("password"));
    WebElement loginButton = driver.findElement(By.id("cnxbton"));

    usernameField.click();
    usernameField.sendKeys("XXXXXXXXX");

    passwordField.click();
    passwordField.sendKeys("XXXXXXX");

    loginButton.click();

    // Click on the user profile dropdown
    WebElement userProfileDropdown = driver.findElement(By.cssSelector("button[id='header_x_prxHeaderLogInfo_x_btnLoginMenu'] i[class='fa-caret-down solid right icon']"));
    userProfileDropdown.click();

    // Select the English language
    WebElement languageDropdown = driver.findElement(By.xpath("//select[@id='ddlLang']"));
    languageDropdown.click();

    WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
    WebElement changeProfileToEnglish = wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("option[value='en']")));
    changeProfileToEnglish.click();
}

}

Serenity BDD version

3.6.21

JDK version

17

Execution environment

package com.gex.runners;

import io.cucumber.junit.CucumberOptions; import net.serenitybdd.core.Serenity; import net.serenitybdd.cucumber.CucumberWithSerenity; import org.junit.runner.RunWith;

@RunWith(CucumberWithSerenity.class) @CucumberOptions( plugin = {"pretty", "json:target/cucumber-reports/Cucumber.json"}, features = {"src/test/resources/features"}, glue = {"com.gex.steps"}

) public class TestRunner { String testPlanKey = Serenity.sessionVariableCalled("xray.testplan.key"); }

How to reproduce the bug.

name: Testing

on: workflow_dispatch: inputs: test_plan_key_variable: description: 'Test Plan Key Variable' default: 'AZ-' # You can set a default value here required: true

jobs: test: timeout-minutes: 180 runs-on: ubuntu-20.04 steps:

Downloaded from central: https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.64/bcprov-jdk15on-1.64.jar (4.8 MB at 15 MB/s) [INFO] Test results for 2 tests generated in 2.3 secs in directory: file:/home/runner/work/GexSerenityBDDFramwork/GexSerenityBDDFramwork/target/site/serenity/ [INFO] ------------------------------------------------ [INFO] | SERENITY TESTS: | ERROR [INFO] ------------------------------------------------ [INFO] | Test scenarios executed | 2 [INFO] | Total Test cases executed | 2 [INFO] | Tests passed | 0 [INFO] | Tests failed | 0 [INFO] | Tests with errors | 2 [INFO] | Tests compromised | 0 [INFO] | Tests aborted | 0 [INFO] | Tests pending | 0 [INFO] | Tests ignored/skipped | 0 [INFO] ------------------------------- | -------------- [INFO] | Total Duration| 10s 123ms [INFO] | Fastest test took| 550ms [INFO] | Slowest test took| 9s 573ms [INFO] ------------------------------------------------ [INFO] [INFO] SERENITY REPORTS [INFO] - Full Report: file:///home/runner/work/GexSerenityBDDFramwork/GexSerenityBDDFramwork/target/site/serenity/index.html [INFO] [INFO] --- maven-failsafe-plugin:3.0.0-M5:verify (default) @ SerenityBDDFramworkSoraya --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 43.386 s [INFO] Finished at: 2023-10-24T11:08:28Z [INFO] ------------------------------------------------------------------------ Error: Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M5:verify (default) on project SerenityBDDFramworkSoraya: There are test failures. Error:
Error: Please refer to /home/runner/work/GexSerenityBDDFramwork/GexSerenityBDDFramwork/target/failsafe-reports for the individual test results. Error: Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. Error: -> [Help 1] Error:
Error: To see the full stack trace of the errors, re-run Maven with the -e switch. Error: Re-run Maven using the -X switch to enable full debug logging. Error:
Error: For more information about the errors and possible solutions, please read the following articles: Error: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

How can we make it happen?

Work on this myself and propose a PR (with Serenity BDD team guidance)

SorayaAzzaoui commented 1 year ago

Caused by: net.thucydides.core.webdriver.DriverConfigurationError: WebDriver was unable to create a new instance of type class org.openqa.selenium.chrome.ChromeDriver WebDriver reported the following message: Could not start a new session. Response code 500. Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn't exist) (The process started from chrome location /opt/google/chrome/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)