Native Automation with Geb/Cucumber?

Hey everyone.

Does anyone have any experience with using Geb and Cucumber in testing Native Apps?

Trying to figure out why I cant use the Geb Page object in my tests. Seems to time out on me and throw the following …

Caused by: geb.error.UndefinedAtCheckerException: No at checker has been defined for page class geb.Page.
	at geb.Page.verifyThisPageAtOnly(Page.groovy:231)
	at geb.Page.verifyAt(Page.groovy:182)
	at geb.Browser.methodMissing(Browser.groovy:207)
	at com.pages.Workflows$_navigate_closure1$_closure3.doCall(Workflows.groovy:29)
	at com.pages.Workflows$_navigate_closure1$_closure3.doCall(Workflows.groovy)
	at geb.waiting.Wait.waitFor(Wait.groovy:127)
	at geb.waiting.Wait$ Source)
	at geb.waiting.DefaultWaitingSupport.doWaitFor(DefaultWaitingSupport.groovy:51)
	at geb.waiting.DefaultWaitingSupport.this$2$doWaitFor(DefaultWaitingSupport.groovy)
	at geb.waiting.DefaultWaitingSupport.waitFor(DefaultWaitingSupport.groovy:38)
	at geb.waiting.WaitingSupport$ Source)
	at geb.Page.waitFor(Page.groovy:506)
	at geb.Page.waitFor(Page.groovy)
	at geb.Browser.methodMissing(Browser.groovy:207)
	at geb.Browser.invokeMethod(Browser.groovy)
	at com.pages.Workflows$_navigate_closure1.doCall(Workflows.groovy:29)
	at com.pages.Workflows$_navigate_closure1.doCall(Workflows.groovy)
	at geb.Browser$drive$1.callStatic(Unknown Source)
	at geb.Browser$drive$ Source)
	at com.pages.Workflows.navigate(Workflows.groovy:27)
	at com.pages.Workflows$ Source)
	at com.stepDefs.LoginPageSteps$_run_closure3.doCall(LoginPageSteps.groovy:51)
	at cucumber.runtime.groovy.GroovyBackend.invoke(
	at cucumber.runtime.groovy.GroovyStepDefinition$
	at cucumber.runtime.Timeout.timeout(
	at cucumber.runtime.groovy.GroovyStepDefinition.execute(
	at cucumber.runtime.StepDefinitionMatch.runStep(
	at cucumber.runtime.Runtime.runStep(
	at cucumber.runtime.model.StepContainer.runStep(
	at cucumber.runtime.model.StepContainer.runSteps(
	at cucumber.api.cli.Main.main(

Thus may be a result of how I am implementing this?

Can you paste the contents of at block in your GEB code ?

Here you go, its kept very simple for my purposes of making this work.

package com.pages

import geb.Browser
import geb.Page
import org.openqa.selenium.By

class Workflows extends Page {

    static at = {
        signIn.text() == "Sign In"
    static content = {
        signIn { $('signInButton')) }
        email { $('emailTextField')).firstElement() }
        accessCode { $('accessCodeTextField')).firstElement() }
        resendAccessButton { $('resendAccessButton')) }
        ccLogo { $('ccLogoImage')) }

     * Navigate user login screen
    static void navigate(){ {
            //to LRLoginScreen
            waitFor { browser.verifyAt() }

I think it should be .equals() instead of ==

signIn.text() == "Sign In"

No dice. Exact same error.
Seems almost like it doesn’t know what to do with Gebs Page class for some reason. I don’t think its even getting into the check itself and falling down before that.

I know, you might have done this before, just to rule this option out, i want you to clean and rebuild the project.

Yeah, I have done it before but just did it again as a sanity check for me and no luck :frowning:
This one is a real head scratcher, not sure why it is not licking the ‘at’ check.

Caused by: geb.error.UndefinedAtCheckerException: No at checker has been defined for page class geb.Page.

Just makes no sense lol

Try something like this and see (just for debugging). use waitFor() {}

   ` waitFor (message: 'Some message to display upon failure') {signIn.text().equals("Sign In")}`

Boooo! Same outcome.

go “http://link to login screen”

have you done this ?

No, because this is a native application, not a web app.
So there is no http reference link.

Put page Workflows before browser.verifyAt()

I assume mean something like this? …

static void navigate(){ {
            //to LRLoginScreen
            waitFor { Workflows browser.verifyAt() }

If so, still the same error, it keeps getting hung up on the ‘at’ checker for some reason.

I meant something like this

static void navigate(){ {
            //to LRLoginScreen
           page Workflows 
            waitFor { browser.verifyAt() }

Holy @#%&^% that worked!

Can you explain to me how or why it did? I am not completely clear.

You need to let GEB know the page in which it should verify the at condition. you can also use something like this.

at Workflows

instead of

page Workflows 
waitFor { browser.verifyAt() }

Ah, yes. That makes sense then.
I tried your other suggestion and just went with

at Workflows

It is much cleaner and works just as well.
Appreciate the help here, you have been a life saver. I was stuck on this for a few days.

1 Like

Perfect ! :relieved: