lundi 21 septembre 2015

geb.error.RequiredPageContentNotPresent: The required page content 'loginButton is not present

Hi i got this error when i try to launch my test.

Please help me to see why it can't click on my submit button

geb.error.RequiredPageContentNotPresent: The required page content 'loginButton - SimplePageContent (owner: LoginPage, args: [], value: null)' is not present

Below my LoginPage

import geb.Page
import pages.IndexPage

class LoginPage extends Page {

    static url = "login/auth"

    static at = { title == "[Paynum] Identification" }

    static content = {
        loginForm { $("form") }
        loginButton { $("input", type: "submit") }
    }
}

Below my test page

import geb.spock.GebReportingSpec
import pages.*
import spock.lang.Stepwise

@Stepwise
class FactControllerSpec extends GebReportingSpec {

    def "invalid login"() {
        given: "I am at the login page"
        to LoginPage

        when: "I am entering invalid password" 
        loginForm.j_username = "bba"
        loginForm.j_password = "Bocxy1990"
        loginButton.click()

        then: "I am being redirected to the login page, the password I entered is wrong"
        at LoginPage
        loginForm.j_username == "bba"
        !loginButton.j_password
    }
}

And here a snippet of my submit button

<div>
      <button id='submit' type='submit'>
        <em class='fa fa-sign-in fa-lg'></em>
        <g:message code='springSecurity.login.button' />
      </button>
    </div>

Aucun commentaire:

Enregistrer un commentaire