Skip to content

Instantly share code, notes, and snippets.

@unbibium
Last active October 5, 2015 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unbibium/147278c917b50cd576c3 to your computer and use it in GitHub Desktop.
Save unbibium/147278c917b50cd576c3 to your computer and use it in GitHub Desktop.
Demonstration of module failure in Geb 0.12.2
import geb.spock.GebReportingSpec
import groovy.util.logging.Log4j2
import geb.Module
import geb.Page
/**
* The old 0.10.0 module syntax doesn't work in 0.12.2, failing apparently
* because the Geb code still contains a getPage() call.
*
* @author Nick
*/
@Log4j2
class ModulesWithinModules2 extends geb.spock.GebReportingSpec {
def setup() {
to SamplePage2
}
def "can access a nested content item with 0.10.0 module syntax"() {
expect:
levelOne.oldLevelThree.displayed
}
def "can access a nested content item with 0.12.2 module syntax"() {
expect:
levelOne.newLevelThree.displayed
}
}
class SamplePage2 extends Page {
static url = "file:///C:/Users/Nick/geb12bug.html"
static content = {
levelOne { module LevelOne }
}
}
class LevelOne extends Module {
static base = { $("div.one") }
static content = {
newLevelTwo { $("div.two").module LevelTwo }
newLevelThree { newLevelTwo.module LevelThree }
oldLevelTwo { module LevelTwo, $("div.two") }
oldLevelThree { module LevelThree, oldLevelTwo }
}
}
class LevelTwo extends Module {
}
class LevelThree extends Module {
}
/*
*/
<html>
<div class="one">
<div class="two">
<div class="three"> a third thing </div>
</div>
</div>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment