Created
June 26, 2014 02:46
-
-
Save s992/a935c39fa2c600cee740 to your computer and use it in GitHub Desktop.
Learning geb!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geb.Browser | |
import geb.Page | |
import geb.Module | |
class NavigationLink extends Module { | |
def linkText | |
static content = { | |
link { $("a", text: linkText) } | |
} | |
} | |
class NavigationBar extends Module { | |
static content = { | |
homeLink { module NavigationLink, linkText: "Home" } | |
archiveLink { module NavigationLink, linkText: "Archives" } | |
aboutLink { module NavigationLink, linkText: "About" } | |
} | |
} | |
class SwalshPage extends Page { | |
static content = { | |
navBar { module NavigationBar } | |
} | |
} | |
class HomePage extends SwalshPage { | |
static url = "http://swalsh.org" | |
static at = { title == "Sean Walsh" } | |
} | |
class ArchivesPage extends SwalshPage { | |
static url = "http://swalsh.org/archives" | |
static at = { title == "Blog Archive - Sean Walsh" } | |
} | |
class AboutPage extends SwalshPage { | |
static url = "http://swalsh.org/about" | |
static at = { title == "About - Sean Walsh" } | |
} | |
Browser.drive { | |
to HomePage | |
assert at( HomePage ) | |
navBar.archiveLink.link.click() | |
assert at( ArchivesPage ) | |
navBar.aboutLink.link.click() | |
assert at( AboutPage ) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment