mardi 22 septembre 2015

Redirection to an url after logging in

I want to access to my page http:localhost:8080/ppf/fact/mmapay after logging in and displayed the index page.

I use given -via -expect - at , But it seems doesn't redirect me to the correct page..

Please help me to do that

Below the code of login and redirection

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

@Stepwise
class FactControllerSpec extends GebReportingSpec {

def "redirecton vers la methode fact"() {
        given:
        via TableauBordPage
        expect: 
        at FactPage
    }
}

Below the GEBCONFIG

environments {

    chrome { driver = { new ChromeDriver() } }
    System.setProperty("webdriver.firefox.bin", "C:/Program Files (x86)/Mozilla Firefox/firefox.exe")
    driver = {
        FirefoxProfile profile = new FirefoxProfile()
        profile.setPreference("intl.accept_languages", "en-us")
        def driverInstance = new FirefoxDriver(profile)
        driverInstance.manage().window().maximize()
        driverInstance
    }
    baseUrl = "http://localhost:8080/ppf/"
}

And the page desciption who to redirect

package pages

import geb.Page

class FactPage extends Page {

    static url = "fact/mmapay"

    static at = { title == "[Paynum] Paiement en ligne de votre facture" }

    static content = {
        codeFactureField { $("input", name: "code") }
        nomField { $("input", name: "nom") }
        prenomField { $("input", name: "prenom") }
        rechercheCodeFactureButton { $("button", type: "submit") }
        aurevoirButton1 { $("a", text: "Abandonner") }
        rechercheFactureButton { $("button", type: "submit") }
        aurevoirButton2 { $("a", text: "Abandonner") }
    }
}

Aucun commentaire:

Enregistrer un commentaire