34. PROCESS
‣ Connect to the web driver
‣ Create page object
‣ Find / select elements on the page to interact with
‣ Interact (click, fill in text, submit form, …)
‣ Make assertions about the expected result
‣ Destroy page object
35. CONNECTING TO THE WEB DRIVER
var err error
capabilities :=
agouti.NewCapabilities().Browser("firefox").Platform("linux").
With("javascriptEnabled")
page, err = agouti.NewPage("http://selenium:4444/wd/
hub", agouti.Desired(capabilities))
Expect(err).NotTo(HaveOccurred())
page.Size(1360, 768)
37. MORE FINDERS
‣ FindByButton(text string) *Selection
‣ FindByLabel(text string) *Selection
‣ FindByLink(text string) *Selection
‣ FindByName(name string) *Selection
‣ FindByXPath(selector string) *Selection
‣ and many more…
38. THINGS TO DO WITH THE PAGE
‣ GetCookies() ([]*http.Cookie, error)
‣ Navigate(url string) error
‣ RunScript(body string, arguments map[string]interface{},
result interface{}) error
‣ Screenshot(filename string) error
‣ SetCookie(cookie *http.Cookie) error
‣ Size(width, height int) error
‣ and so on…
39. THINGS TO DO WITH THE SELECTION
‣ Check() error
‣ Click() error
‣ Fill(text string) error
‣ Submit() error
‣ UploadFile(filename string) error
‣ FlickFinger(xOffset, yOffset int, speed uint) error
‣ and so on…
42. ENVIRONMENT VARIABLES
‣ ENV: {staging, review, integration, www}
‣ which server to test against
‣ SCREENSHOT: {yes, no}
‣ whether or not to record screenshots
43. IN DOCKER-COMPOSE.YML
kitten:
<<: *smoketests
command: go test -test.timeout 15m -ginkgo.progress -ginkgo.v -
ginkgo.focus Kitten
campaign_management:
<<: *smoketests
command: go test -test.timeout 15m -ginkgo.progress -ginkgo.v -
ginkgo.focus Campaign
44. FROM THE COMMAND LINE
docker-compose run -e ENV=staging -e SCREENSHOT=yes all
docker-compose run -e ENV=staging -e SCREENSHOT=yes kitten
docker-compose run -e ENV=staging -e SCREENSHOT=yes campaign_management