mediawiki-extensions-Revisi.../tests/browser/features/support/step_definitions/help.rb
Thiemo Kreuz 407c1de800 Use cookie to dismiss help dialog and fix failing browser tests
I have seen this failing:
https://integration.wikimedia.org/ci/job/mwext-mw-selenium-jessie/9255/console

The idea is to pre-set this cookie so the help dialog never shows up
in the first place. The tests do not need to look for the element, click
it, wait for the dialog to close. This should even speed up the browser
tests, I believe.

Also this adjustes waiting conditions in several places to address
timing issues with failing browser tests.

Since these tests should be replaced by Node.js on the long run I
added "sleep" in the cases although it's not recommended.

Change-Id: Ida381faa390aa62ebaadd3713864676be80abd51
2018-07-03 16:44:28 +02:00

34 lines
1 KiB
Ruby

When(/^I am on the diff page and disabled the help dialog$/) do
step 'I am on the diff page'
browser.execute_script('mediaWiki.cookie.set( "-revslider-hide-help-dialogue", "1" );')
end
When(/^I have closed the help dialog at the start$/) do
on(DiffPage).revisionslider_help_close_start_element.when_present.click
step 'I wait until help dialog is hidden'
end
When(/^I have closed the help dialog at the end/) do
on(DiffPage).revisionslider_help_close_end_element.when_present.click
end
When(/^I have moved to the next step$/) do
on(DiffPage).revisionslider_help_next_element.when_present.click
end
When(/^I wait until help dialog is hidden$/) do
step 'The help dialog is hidden'
end
Given(/^The help dialog is hidden$/) do
on(DiffPage).wait_for_help_dialog_to_hide
end
Then(/^The help dialog should be visible/) do
expect(on(DiffPage).revisionslider_help_dialog_element.when_present).to be_visible
end
Then(/^The help dialog should not be present/) do
expect(on(DiffPage).revisionslider_help_dialog_element.when_not_present).not_to be_present
end