Search code examples
testingseleniumgroovycucumbergeb

Intellij 13 ultimate runs geb tests smoothly but they wait when run independently


I am using cucumber groovy with geb. Here is my profile and driver

FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setAcceptUntrustedCertificates(true);
firefoxProfile.setAssumeUntrustedCertificateIssuer(false);
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
        "text/csv,application/pdf,application/csv,application/vnd.ms-excel");
firefoxProfile.setPreference("browser.download.manager.showAlertOnComplete",false);
firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false);
firefoxProfile.setPreference("browser.download.manager.useWindow", false);
firefoxProfile.setPreference("browser.helperApps.deleteTempFileOnExit", true);
firefoxProfile.setPreference("webdriver.load.strategy", "unstable")

driver = {
    def driver = new FirefoxDriver(firefoxProfile)
    driver
}

Here is my step definition (FYI, this is the firstmost step)

MyPage.setUrl(Globals.get(key))
to MyPage
waitFor(10,0) {
    ExpectedConditions.presenceOfElementLocated(By.tagName("title"))
}
at MyPage

I noticed that if i put a breakpoint at "at MyPage" in intellij and debug then it breaks at that point and then i can resume. However if I simply run either from Intellij or using ./gradlew clean cucumber then the page loads and waits for a long time. I don't think it ever proceeds (only waited for a minute to check)

Whats the issue here ?


Update 1

class MyPage extends Page{

    static url = ""

    static at = {
        module1.attrib.value() != null
        Globals.get(module1.attrib.value())
    }

    static content = {
        module1 { module Module1 } // Simple Geb Module
        module2 { fieldsMap ->  module Module2, fieldsMap: fieldsMap }
    }
}


class Module2 extends Module {

    def fieldsMap
    static content = {
        textField { $("input", name: fieldsMap['textFieldName']) }
    }
}

Solution

  • Updated version of Selenium and firefox fixed the issue. Closing this