I have a strange problem with the Firefox driver.

When I launch a simple test. It works.
But when I duplicate this test it works not.
But with chrome  it works. The problem is only with firefox driver.

My test is simple: I go to the login page. write user and password and 
click on the login button to go to the homepage.

This is my test with the duplication : 


  def "login with valid user in the login page"() {


        when: "I try to to go the login page"
        go "/"
        then: "I should be to the login page"
        def loginPage = at LoginPage


        when: "I log in with valid identifiers user:password"
        loginPage.login("user", "password")
        then: "I should be on the home page"
        at HomePage


        cleanup:
        logout()




    }


    def "login with valid user in the login page2 "() {


        when: "I try to to go the login page"
        go "/"
        then: "I should be to the login page"
        def loginPage = at LoginPage


        when: "I log in with valid identifiers user:password"
        loginPage.login("user", "password")
        then: "I should be on the home page"
        at HomePage


        cleanup:
        logout()




    }


I use the gecko driver version : v0.16.1
selenium version : 3.4.0
Geb version 1.1.1

I use the systemProperty 'webdriver.gecko.driver' to define the gecko 
driver location 
and I instantiate the driver like this 
```
  driver = {new FirefoxDriver()}


The error message is : 

Condition failed with Exception:


at HomePage
|
Assertion failed: 
 
title == "Home page"
|     |
|     false
Login Page


 at org.openclassrooms.cities.web.geb.LoginAccessPage2.login with valid 
user in the login page2 (LoginAccessPage2.groovy:46)
Caused by: Assertion failed: 


title == "Home page"
|     |
|     false
Login Page


 at org.openclassrooms.cities.web.geb.page.HomePage._clinit__closure1(
HomePage.groovy:11)
 at org.openclassrooms.cities.web.geb.page.HomePage._clinit__closure1(
HomePage.groovy)
 at geb.Page.verifyThisPageAtOnly(Page.groovy:245)
 at geb.Page.getAtVerificationResult(Page.groovy:223)
 at geb.Page.verifyAt(Page.groovy:194)
 at geb.Browser.doAt(Browser.groovy:457)
 at geb.Browser.at(Browser.groovy:339)
 at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56)




The problem is that the click() method on the login button not work the 
second time I think. But it works the first time. I guess it is more that 
the second time we are not in a clean context, but I don't know why :
This is a part of  the code of my LoginPage : 

static content = {
        loginForm { $("#login-form") }
        usernameInputField { loginForm.username() }
        passwordInputField { loginForm.password() }
        submitButton() {
            loginForm.find("input", type: "submit")
        }
…
}
…
void login(String username, String password) {
        usernameInputField << username
        passwordInputField << password
        submitButton.click()


    }



Do you have some idea of what can happens ? 

Thank you

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to geb-user+unsubscr...@googlegroups.com.
To post to this group, send email to geb-user@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/6967bb84-bca0-479b-bdaa-4744ec0dfe8c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to