Created
October 15, 2018 22:12
-
-
Save javigomez/2b8dc3b8cd825847233ac3cfa92488d2 to your computer and use it in GitHub Desktop.
page object test
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
require 'rubygems' | |
require 'selenium-webdriver' | |
require 'page-object/page_factory' | |
require_relative 'pages/duckduckgo_page' | |
World(PageObject::PageFactory) | |
browser = Selenium::WebDriver.for :chrome | |
# browser.get "http://duckduckgo.com" | |
my_page_object = DuckduckgoSearchPage.new(browser) | |
# require 'page-object' | |
# class DuckduckgoSearchPage | |
# include PageObject | |
# page_url "http://duckduckgo.com" | |
# text_field(:search_box, :name => 'q') | |
# button(:perform_search, :id => 'search_button_homepage') | |
# a(:thoughworks_url, :href => 'https://www.thoughtworks.com/') | |
# end | |
Given("I am on duckduckgo.com") do | |
my_page_object.goto | |
end | |
When("I search for Thoughtworks") do | |
my_page_object.search_box = "thoughworks.com" | |
my_page_object.perform_search | |
end | |
Then("I should see the official site") do | |
my_page_object.thoughworks_url.when_visible.click | |
assert(my_page_object.title).eql?('Thoughtworks') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment