Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Latest commit

 

History

History
37 lines (27 loc) · 2.14 KB

README.md

File metadata and controls

37 lines (27 loc) · 2.14 KB

Lab 05 - Going into the details

Objectives

In this lab we will evolve the Beer Advisor application from the previous installment, so you can learn how to write acceptance tests in Behaviour Driven Development using Spock with Arquillian Drone.

After this lab you will be able to:

  • Test your application from outside of the container (black box), using Arquillian to deploy the bundle and Drone to drive the browser.
  • Write clean and concise Selenium/WebDriver UI tests using Page Objects.
  • Test your web application in different browsers and different application servers with minimal configuration thanks to Arquillian.

Task

You will need to make another acceptance test passing

@Test
def "Details of the beer should be accessible from the main page"() {
  given: "I'm on the main page"
    	def beerAdvisor = new BeerAdvisorPage(driver, deploymentUrl.toString())

 	when: "I choose on 'End of History'"
    	def endOfHistory = beerAdvisor.detailsOf "End of history"

  then: "I should see all the details"
    	endOfHistory.shouldBeNamed("End of history")
                    .shouldCosts(765)
                    .shouldBeFrom("Brew Dog")
                    .shouldHaveAlcoholPercentageOf(55)
}

Here are the steps:

  • Implement new Page Object BeerDetailsPage which will encapsulate web elements from the web site and expose Beer details as simple POJO
  • Extend BeerAdvisorPage by implementing the detailsOf method which will allow to
    • click on the link with the name of the beer (taken as parameter) (hint you can use an XPath expression to find the matching link)
    • instantiate the BeerDetailsPage which will fetch web elements from the opened page with details of the selected beer
    • extract this information and create a Beer POJO containing them