mediawiki-skins-MinervaNeue/tests/browser/features/step_definitions/common_article_steps.rb
jdlrobson c0c90234d0 Port browser tests from MobileFrontend to Minerva
This moves all browser tests from MobileFrontend to the Minerva repo
in preparation for separating the two.

Note, this means browser tests will exist in both repositories for a
period of time. This is important and necessary to ensure we do not
break anything.

See:
https://lists.wikimedia.org/pipermail/mobile-l/2017-July/010536.html

Bug: T168758
Change-Id: I84ae3ea14191f672cabcd52020e80b0a40a72ce1
2017-07-11 14:11:03 -07:00

53 lines
1.5 KiB
Ruby

Given(/^I click continue$/) do
on(ArticlePage).continue_button_element.when_present.click
end
Given(/^I click submit$/) do
on(ArticlePage) do |page|
page.spinner_loading_element.when_not_present
page.submit_button_element.when_present.click
end
end
When(/^I click on the history link in the last modified bar$/) do
on(ArticlePage).last_modified_bar_history_link_element.when_present.click
expect(on(SpecialHistoryPage).side_list_element.when_present(10)).to be_visible
end
When(/^I click on the page$/) do
on(ArticlePage).content_wrapper_element.click
end
When(/^I click the unwatch star$/) do
on(ArticlePage).unwatch_star_element.when_present.click
end
When(/^I click the watch star$/) do
on(ArticlePage).watch_star_element.when_present.click
end
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 drawer with message "(.+)"$/ do |text|
expect(on(ArticlePage).drawer_element.when_present.text).to match text
end
Then(/^the text of the first heading should be "(.*)"$/) do |title|
on(ArticlePage) do |page|
page.wait_until do
page.first_heading_element.when_present.text.include? title
end
expect(page.first_heading_element.when_present.text).to match title
end
end
Then /^the watch star should be selected$/ do
expect(on(ArticlePage).unwatch_star_element).to be_visible
end
Then /^the watch star should not be selected$/ do
expect(on(ArticlePage).watch_star_element).to be_visible
end