2016-07-04 13:56:00 +00:00
|
|
|
Given(/^I am on the diff page$/) do
|
|
|
|
visit(ArticlePage, using_params: { article_name: "RevisionSlider-#{@random_string}", query: 'type=revision&diff=' })
|
2018-08-14 07:04:02 +00:00
|
|
|
sleep 0.7
|
2016-06-27 12:38:23 +00:00
|
|
|
end
|
|
|
|
|
2016-07-04 13:56:00 +00:00
|
|
|
Given(/^a page with (\d+) revision\(s\) exists$/) do |number_of_revisions|
|
|
|
|
(1..number_of_revisions.to_i).each do |i|
|
2016-07-04 16:26:13 +00:00
|
|
|
api.edit(title: "RevisionSlider-#{@random_string}", text: "RS-Text-#{i}", summary: "RS-Summary-#{i}")
|
2016-07-04 13:56:00 +00:00
|
|
|
end
|
2016-06-27 12:38:23 +00:00
|
|
|
end
|
|
|
|
|
2016-06-29 10:52:05 +00:00
|
|
|
Given(/^I refresh the page$/) do
|
|
|
|
on(ArticlePage) do |page|
|
|
|
|
page.refresh
|
2018-08-14 07:04:02 +00:00
|
|
|
sleep 0.7
|
2016-06-29 10:52:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-05 14:16:22 +00:00
|
|
|
When(/^I click the browser back button$/) do
|
|
|
|
on(ArticlePage).back
|
|
|
|
end
|
|
|
|
|
|
|
|
When(/^I click the browser forward button$/) do
|
|
|
|
on(ArticlePage).forward
|
|
|
|
end
|
|
|
|
|
2016-10-07 14:02:46 +00:00
|
|
|
When(/^I wait until the RevisionSlider has loaded$/) do
|
|
|
|
step 'The RevisionSlider has loaded'
|
|
|
|
end
|
|
|
|
|
2016-10-07 15:06:59 +00:00
|
|
|
When(/^I have loaded the RevisionSlider and dismissed the help dialog$/) do
|
2018-06-29 07:49:09 +00:00
|
|
|
step 'I am on the diff page and disabled the help dialog'
|
2016-10-07 15:06:59 +00:00
|
|
|
step 'I click on the expand button'
|
|
|
|
step 'I wait until the RevisionSlider has loaded'
|
|
|
|
end
|
|
|
|
|
2016-10-07 13:23:51 +00:00
|
|
|
Then(/^The RevisionSlider has loaded$/) do
|
2016-06-27 12:38:23 +00:00
|
|
|
on(DiffPage).wait_for_slider_to_load
|
|
|
|
end
|
|
|
|
|
2017-03-08 11:24:05 +00:00
|
|
|
Given(/^The window size is (\d+) by (\d+)$/) do |width, height|
|
2016-07-04 14:43:47 +00:00
|
|
|
browser.window.resize_to(width.to_i, height.to_i)
|
|
|
|
end
|
|
|
|
|
2016-10-07 13:23:51 +00:00
|
|
|
Then(/^The auto expand button should be visible/) do
|
2018-08-14 07:04:02 +00:00
|
|
|
expect(on(DiffPage).revisionslider_auto_expand_button_element.when_present).to be_present
|
2016-08-12 07:35:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Given(/^I wait for the setting to be saved$/) do
|
|
|
|
on(DiffPage).wait_for_ajax_calls
|
|
|
|
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
|
|
|
|
|
2016-08-05 16:14:28 +00:00
|
|
|
Then(/^There should be a RevisionSlider expand button/) do
|
2018-08-14 07:04:02 +00:00
|
|
|
expect(on(DiffPage).revisionslider_toggle_button_element.when_present).to be_present
|
2016-06-27 12:38:23 +00:00
|
|
|
end
|
|
|
|
|
2016-08-05 16:14:28 +00:00
|
|
|
Then(/^There should not be a RevisionSlider expand button/) do
|
2017-02-28 12:03:53 +00:00
|
|
|
expect(on(DiffPage).revisionslider_toggle_button_element.when_not_present).not_to be_present
|
2016-08-05 16:14:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Then(/^RevisionSlider wrapper should be hidden/) do
|
2018-08-14 07:04:02 +00:00
|
|
|
expect(on(DiffPage).revisionslider_wrapper_element.when_not_present).not_to be_present
|
2016-08-05 16:14:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
Then(/^RevisionSlider wrapper should be visible/) do
|
2018-08-14 07:04:02 +00:00
|
|
|
expect(on(DiffPage).revisionslider_wrapper_element.when_present).to be_present
|
2016-08-05 16:14:28 +00:00
|
|
|
end
|
|
|
|
|
2016-08-12 07:35:12 +00:00
|
|
|
Given(/^I click on the auto expand button/) do
|
2018-08-14 07:04:02 +00:00
|
|
|
on(DiffPage).revisionslider_auto_expand_button_element.when_present.click
|
2016-08-12 07:35:12 +00:00
|
|
|
end
|
|
|
|
|
2016-08-05 16:14:28 +00:00
|
|
|
Given(/^I click on the expand button/) do
|
2018-08-14 07:04:02 +00:00
|
|
|
on(DiffPage).revisionslider_toggle_button_element.when_present.click
|
2017-03-08 11:24:05 +00:00
|
|
|
end
|