Skip to content

Instantly share code, notes, and snippets.

@unbibium

unbibium/geb12bug.groovy

Last active Oct 5, 2015
Embed
What would you like to do?
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