Hello. If I have a single-page webapp and if I want to set up the content to be a hierarchy of Modules, how can I ensure that if I navigate to a page object, it will look at the hierarchy of modules and verify the content? For example, if I have the following page class:
class HomePage extends Page {
static url = 'home'
static at = {
title == 'Home Page' && mainViewModule.displayed
}
static content = {
mainViewModule { module MainViewModule }
}
}
and then MainViewModule is defined like this:
class MainViewModule extends Module {
static content = {
mainView { $('div', class: 'main-view') }
dashboardModule { module DashboardModule }
}
}
then DashboardModule:
class DashboardModule extends Module {
static content = {
dashboard = { MainViewModule.find 'dashboard' }
subModule1 = { module SubModule1 }
subModule2 = { module SubModule2 }
}
}
where the submodules generally look like this:
class SubModuleX extends Module {
static content = {
...
}
}
If my tests (using Spock) do the following:
class SomeSpec extends GebReportingSpec {
def 'navigate to the home page'() {
when:
to HomePage
then:
at HomePage
}
}
How can I ensure that it verifies the content defined in the HomePage class, as well as down through the hierarchy of modules? The way that I have the code (as described above), I can change the selectors to incorrect values, but it still doesn't fail the test.
Thanks,
Steve