mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-12 15:35:11 +00:00
12e6631dde
The waitr click on the checkbox seems to be broken or is broken with intend since the actual OOUI checkbox has an opacity of 0. Additionally when_visible fails when the element is not present yet. The the way to go here seems to wait for the element to be there and then check for visibility. Also made use of PageObject method for checkboxes, the name selector and the link element. Bug: T158074 Change-Id: I2c3d6d963c8bcdc420bfbc57c1c2380bce7ef2f1
93 lines
2.9 KiB
Ruby
93 lines
2.9 KiB
Ruby
Given(/^I am on the page$/) do
|
|
visit(ArticlePage, using_params: { article_name: "RevisionSlider-#{@random_string}" })
|
|
end
|
|
|
|
Given(/^I am on the diff page$/) do
|
|
visit(ArticlePage, using_params: { article_name: "RevisionSlider-#{@random_string}", query: 'type=revision&diff=' })
|
|
end
|
|
|
|
Given(/^a page with (\d+) revision\(s\) exists$/) do |number_of_revisions|
|
|
(1..number_of_revisions.to_i).each do |i|
|
|
api.edit(title: "RevisionSlider-#{@random_string}", text: "RS-Text-#{i}", summary: "RS-Summary-#{i}")
|
|
end
|
|
end
|
|
|
|
Given(/^I refresh the page$/) do
|
|
on(ArticlePage) do |page|
|
|
page.refresh
|
|
end
|
|
end
|
|
|
|
When(/^I click the browser back button$/) do
|
|
on(ArticlePage).back
|
|
end
|
|
|
|
When(/^I click the browser forward button$/) do
|
|
on(ArticlePage).forward
|
|
end
|
|
|
|
When(/^I wait until the RevisionSlider has loaded$/) do
|
|
step 'The RevisionSlider has loaded'
|
|
end
|
|
|
|
When(/^I have loaded the RevisionSlider and dismissed the help dialog$/) do
|
|
step 'I click on the expand button'
|
|
step 'I wait until the RevisionSlider has loaded'
|
|
step 'I have dismissed the help dialog'
|
|
end
|
|
|
|
Then(/^The RevisionSlider has loaded$/) do
|
|
on(DiffPage).wait_for_slider_to_load
|
|
end
|
|
|
|
Given(/^The window size is (\d+) by (\d+)$/) do |width,height|
|
|
browser.window.resize_to(width.to_i, height.to_i)
|
|
end
|
|
|
|
Then(/^The auto expand button should be visible/) do
|
|
expect(on(DiffPage).revisionslider_auto_expand_button_element.when_visible).to be_visible
|
|
end
|
|
|
|
Given(/^I wait for the setting to be saved$/) do
|
|
on(DiffPage).wait_for_ajax_calls
|
|
end
|
|
|
|
Then(/^RevisionSlider is enabled as a beta feature$/) do
|
|
visit(SpecialPreferencesPage).enable_revisionslider
|
|
end
|
|
|
|
Then(/^RevisionSlider is disabled as a beta feature$/) do
|
|
visit(SpecialPreferencesPage).disable_revisionslider
|
|
end
|
|
|
|
Then(/^The auto expand button should be off/) do
|
|
expect(on(DiffPage).revisionslider_auto_expand_button_element.class_name).to match 'oo-ui-toggleWidget-off'
|
|
end
|
|
|
|
Then(/^The auto expand button should be on/) do
|
|
expect(on(DiffPage).revisionslider_auto_expand_button_element.class_name).to match 'oo-ui-toggleWidget-on'
|
|
end
|
|
|
|
Then(/^There should be a RevisionSlider expand button/) do
|
|
expect(on(DiffPage).revisionslider_toggle_button_element.when_present).to be_visible
|
|
end
|
|
|
|
Then(/^There should not be a RevisionSlider expand button/) do
|
|
expect(on(DiffPage).revisionslider_toggle_button_element.when_not_present).not_to be_present
|
|
end
|
|
|
|
Then(/^RevisionSlider wrapper should be hidden/) do
|
|
expect(on(DiffPage).revisionslider_wrapper_element.when_not_visible).not_to be_visible
|
|
end
|
|
|
|
Then(/^RevisionSlider wrapper should be visible/) do
|
|
expect(on(DiffPage).revisionslider_wrapper_element.when_present).to be_visible
|
|
end
|
|
|
|
Given(/^I click on the auto expand button/) do
|
|
on(DiffPage).revisionslider_auto_expand_button_element.when_visible.click
|
|
end
|
|
|
|
Given(/^I click on the expand button/) do
|
|
on(DiffPage).revisionslider_toggle_button_element.when_visible.click
|
|
end |