I have a cucumber and fluentlenium project that doesn't start when i run the CucumberRunner. It just skips all the tests .I tried to find a solution on internet but didn't figured out the problem so far. A little bit of help would be nice.
This is are my steps:
public class LoginPageSteps extends BaseTest {
public LoginPageSteps() throws Exception {
super();
}
@Page
LoginPage loginPage;
@Given("^I am on login page$")
public void goToLoginPage(){
goTo(loginPage);
}
@When("^I enter username as '(.*?)'$")
public void enterUsername(String username) {
waitAndFill(loginPage.username, username);
}
@And("^I enter password as '(.*?)'$")
public void enterPassword(String password) {
waitAndFill(loginPage.password, password);
waitUntilCliclableAndClick(loginPage.loginButton);
}
@Then("^Login should be succesfull$")
public void checkLoginStatus() {
assertTrue(getDriver().getCurrentUrl().contains("login_attempt=1"));
}
}
This is my BaseTest.class :
public class BaseTest extends FluentCucumberTest {
@Page
AccountPage accountPage;
@Before
public void before(Scenario scenario) {
super.before(scenario);
}
@After
public void after(Scenario scenario) {
super.after(scenario);
}
@Override
public WebDriver newWebDriver() {
System.setProperty("webdriver.gecko.driver", "../cucumber-test/src/test/resources/geckodriver.exe");
FirefoxDriver driver = new FirefoxDriver();
return driver;
}
public void waitUntilCliclableAndClick(FluentWebElement element) {
await().atMost(5, TimeUnit.SECONDS).until(element).clickable();
element.click();
}
public void waitAndFill(FluentWebElement element, String data) {
await().atMost(5, TimeUnit.SECONDS).until(element).displayed();
element.fill().with(data);
}
}
And this is my feature file :
Feature: valid-login
Scenario:
Given I am on login page
When I enter username as "myusername"
And I enter password as "mypassword"
Then Login should be succesfull
And this is the runner :
@RunWith(Cucumber.class)
@CucumberOptions(features={"src/test/resources/features"})
public class CucumberRunner {
}