Search code examples
cucumbercucumber-jvmcucumber-junitthucydidescucumber-java

Facing issues while navigating between the reports in Serenity


I am able to run the serenity test cases by using gradle. I use the command $ gradle clean test aggregate. Reports are also getting generated however when I click on the links provided in the Reports it fails to navigate and gives an error message. I have created the package structure as mentioned in the link below. http://thucydides.info/docs/articles/an-introduction-to-serenity-bdd-with-cucumber.html However still I'm not able to resolve this. Below are my Runner, Step definition and repository class. Runner Class:

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "src/test/resources/features/LoginFeatureSerenity.feature")
public class TestRunnerSerenity { 
}

Step Definition class:

package org.gradle.stepdef;
public class LoginStepDefSerenity {

    @Managed
    public WebDriver driver;

    @ManagedPages
    public Pages pages;

    LoginPageRepository page;

    // Scenario 1: Verify New Serenity Test Case
    @Step
    @Given("^User is on LoginSerenity Page$")
    public void user_is_on_LoginSerenity_Page() throws Throwable {
        page.open();
    }

    @Step
    @When("^User enters valid Serenity credentials$")
    public void user_enters_valid_Serenity_credentials() throws Throwable {
        page.setusername("kaustubhsaxena");
        page.setpassword("saxenasdhfghjfg");

        page.loginButton.click();
    }

    @Step
    @Then("^User is able to login Serenity$")
    public void user_is_able_to_login_Serenity() throws Throwable {

        assertThat(page.loginValidationMessage.getText(), is("Login failed"));
        // page.logoutButon.click();
        driver.close();
    }
}

Repository Class

@DefaultUrl("http://localhost:8000/app/#/login")
public class LoginPageRepository extends PageObject {

    @FindBy(id = "username")
    protected WebElement username;

    public void setusername(String value) {
        element(username).type(value);
    }

    public WebElementFacade username() {
        return element(username);
    }
    // Fields for Password
    @FindBy(id = "password")
    protected WebElement password;

    public void setpassword(String value) {
        element(password).type(value);
    }

    public WebElementFacade password() {
        return element(password);
    }
}

Can you please help me on this. Thanks in advance


Solution

  • Fortunately I got the solution of this. In the build.gradle below plugin needs to be added so that it will handle the reporting part.

    apply plugin: 'com.jfrog.bintray'
    

    Thanks for your help on this.