Browser tests: Use generic toast step

Introduces a new generic
"I should see a toast with message ".*""
step reducing toast steps to two generic ones.

Change-Id: Ic8b91c78f6df088244f15223ee4ed658847a05b5
This commit is contained in:
jdlrobson 2017-07-27 13:36:04 -07:00
parent bd898e2be4
commit d5a60fdd43
7 changed files with 9 additions and 25 deletions

View File

@ -27,7 +27,7 @@ Feature: Language selection
Scenario: Tapping the disabled icon shows a toast
Given I go to a page that does not have languages
When I click the switch-language page action
Then I should see a toast with message about page not being available in other languages
Then I should see a toast with message "This page is not available in other languages."
Scenario: Closing language overlay (overlay button)
Given I go to a page that has languages

View File

@ -12,4 +12,4 @@ Feature: Search
And I see the search overlay
And I type into search box "Selenium search tes"
When I click a search watch star
Then I should see a toast
Then I should see a toast notification

View File

@ -30,6 +30,11 @@ Then(/^I should see a toast notification$/) do
expect(on(ArticlePage).toast_element.when_present(10)).to be_visible
end
Then(/^I should see a toast with message "(.+)"$/) do |msg|
step "I should see a toast notification"
expect(on(ArticlePage).toast_element.when_present.text).to match msg
end
Then /^I should see a drawer with message "(.+)"$/ do |text|
expect(on(ArticlePage).drawer_element.when_present.text).to match text
end

View File

@ -10,10 +10,6 @@ When /^I click on a language from the list of all languages$/ do
on(ArticlePage).non_suggested_language_link_element.when_present.click
end
Then(/^I should see a toast with message about page not being available in other languages$/) do
expect(on(ArticlePage).toast_element.when_present.text).to match 'This page is not available in other languages.'
end
Then(/^I should not see the languages overlay$/) do
expect(on(ArticlePage).overlay_languages_element).not_to be_visible
end

View File

@ -78,7 +78,3 @@ end
Then(/^I should not see '#\/search' in URL$/) do
expect(on(ArticlePage).current_url.end_with? '#/search').to be false
end
Then(/^I should see a toast$/) do
expect(on(ArticlePage).toast_element.when_present).to be_visible
end

View File

@ -9,16 +9,3 @@ Given(/^I am viewing an unwatched page$/) do
api.unwatch_page 'Selenium mobile watch test'
step 'I am on the "Selenium mobile watch test" page'
end
Then(/^I should see a toast with message about watching the page$/) do
expect(on(ArticlePage).toast_element.when_present.text).to match 'Added Selenium mobile watch test to your watchlist'
end
Then(/^I should see a toast with message about unwatching the page$/) do
on(ArticlePage) do |page|
page.wait_until do
page.text.include? 'Removed' # Chrome needs this, FF does not
end
expect(page.toast_element.when_present.text).to match 'Removed Selenium mobile watch test from your watchlist'
end
end

View File

@ -7,11 +7,11 @@ Feature: Manage Watchlist
Scenario: Add an article to the watchlist
Given I am viewing an unwatched page
When I click the watch star
Then I should see a toast with message about watching the page
Then I should see a toast with "Added Selenium mobile watch test to your watchlist"
And the watch star should be selected
Scenario: Remove an article from the watchlist
Given I am viewing a watched page
When I click the unwatch star
Then I should see a toast with message about unwatching the page
Then I should see a toast with message "Removed Selenium mobile watch test from your watchlist"
And the watch star should not be selected