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:
parent
bd898e2be4
commit
d5a60fdd43
|
@ -27,7 +27,7 @@ Feature: Language selection
|
||||||
Scenario: Tapping the disabled icon shows a toast
|
Scenario: Tapping the disabled icon shows a toast
|
||||||
Given I go to a page that does not have languages
|
Given I go to a page that does not have languages
|
||||||
When I click the switch-language page action
|
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)
|
Scenario: Closing language overlay (overlay button)
|
||||||
Given I go to a page that has languages
|
Given I go to a page that has languages
|
||||||
|
|
|
@ -12,4 +12,4 @@ Feature: Search
|
||||||
And I see the search overlay
|
And I see the search overlay
|
||||||
And I type into search box "Selenium search tes"
|
And I type into search box "Selenium search tes"
|
||||||
When I click a search watch star
|
When I click a search watch star
|
||||||
Then I should see a toast
|
Then I should see a toast notification
|
||||||
|
|
|
@ -30,6 +30,11 @@ Then(/^I should see a toast notification$/) do
|
||||||
expect(on(ArticlePage).toast_element.when_present(10)).to be_visible
|
expect(on(ArticlePage).toast_element.when_present(10)).to be_visible
|
||||||
end
|
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|
|
Then /^I should see a drawer with message "(.+)"$/ do |text|
|
||||||
expect(on(ArticlePage).drawer_element.when_present.text).to match text
|
expect(on(ArticlePage).drawer_element.when_present.text).to match text
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
on(ArticlePage).non_suggested_language_link_element.when_present.click
|
||||||
end
|
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
|
Then(/^I should not see the languages overlay$/) do
|
||||||
expect(on(ArticlePage).overlay_languages_element).not_to be_visible
|
expect(on(ArticlePage).overlay_languages_element).not_to be_visible
|
||||||
end
|
end
|
||||||
|
|
|
@ -78,7 +78,3 @@ end
|
||||||
Then(/^I should not see '#\/search' in URL$/) do
|
Then(/^I should not see '#\/search' in URL$/) do
|
||||||
expect(on(ArticlePage).current_url.end_with? '#/search').to be false
|
expect(on(ArticlePage).current_url.end_with? '#/search').to be false
|
||||||
end
|
end
|
||||||
|
|
||||||
Then(/^I should see a toast$/) do
|
|
||||||
expect(on(ArticlePage).toast_element.when_present).to be_visible
|
|
||||||
end
|
|
||||||
|
|
|
@ -9,16 +9,3 @@ Given(/^I am viewing an unwatched page$/) do
|
||||||
api.unwatch_page 'Selenium mobile watch test'
|
api.unwatch_page 'Selenium mobile watch test'
|
||||||
step 'I am on the "Selenium mobile watch test" page'
|
step 'I am on the "Selenium mobile watch test" page'
|
||||||
end
|
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
|
|
||||||
|
|
|
@ -7,11 +7,11 @@ Feature: Manage Watchlist
|
||||||
Scenario: Add an article to the watchlist
|
Scenario: Add an article to the watchlist
|
||||||
Given I am viewing an unwatched page
|
Given I am viewing an unwatched page
|
||||||
When I click the watch star
|
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
|
And the watch star should be selected
|
||||||
|
|
||||||
Scenario: Remove an article from the watchlist
|
Scenario: Remove an article from the watchlist
|
||||||
Given I am viewing a watched page
|
Given I am viewing a watched page
|
||||||
When I click the unwatch star
|
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
|
And the watch star should not be selected
|
||||||
|
|
Loading…
Reference in New Issue