mediawiki-extensions-Revisi.../tests/browser/features/support/step_definitions/common_steps.rb
Leszek Manicki e243ca2746 Do not load RevisionSlider initially, add a button to show/hide it
Instead of loading RevisionSlider only add a little button
to expand RevisionSlider on top of the diff page.

This makes RevisionSlider only steal a bit of space over the
diff, and only inserts quite a big slider to users that want
to have it visible for the particular diff.

API calls are only made once RevisionSlider has been expanded.

This is re-submit of b0f229d75f
that was reverted in I26427faaa00b38c2aa1377a66224c9062dcca302.

Bug: T141871
Change-Id: I879de5774b2cce7b908e73cbbe869fd48d6afa23
2016-08-10 16:26:54 +02:00

63 lines
1.8 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
Given(/^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(/^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(/^There should be a RevisionSlider expand button/) do
expect{ on(DiffPage).revisionslider_toggle_button }.not_to raise_error
end
Then(/^There should not be a RevisionSlider expand button/) do
expect{ on(DiffPage).revisionslider_toggle_button }.to raise_error
end
Then(/^RevisionSlider wrapper should be hidden/) do
on(DiffPage).revisionslider_wrapper_element.visible?.should be_falsey
end
Then(/^RevisionSlider wrapper should be visible/) do
on(DiffPage).revisionslider_wrapper_element.visible?.should be_truthy
end
Given(/^I click on the expand button/) do
on(DiffPage).revisionslider_toggle_button_element.click
end