mediawiki-extensions-Popups/tests/browser/features/support/pages/special_preferences_page.rb
Baha 728073d9e4 QA: Updates to browser tests to avoid flakiness
* Wait until the form submits successfully, verifying it
worked by testing for the notification toast.
* Drop sleep statements where possible - instead use when_present
Use one when asserting something doesn't show to avoid false positives
* Allow more time for the hovercard to show (5s) - API requests might take
longer than default time.
* Assert popups JavaScript loads before continuing with test. This
helped trap a bug in testing and will be useful for future.

Bug: T133019
Depends-On: Icb1e6ddc8f95da5e4b4de2916d292694c11ba731
Change-Id: Iacd3beedf44cadffcf0285231b2df7e5b64294f6
2016-04-20 20:02:13 +00:00

21 lines
721 B
Ruby

class SpecialPreferencesPage
include PageObject
page_url 'Special:Preferences'
a(:beta_features_tab, css: '#preftab-betafeatures')
text_field(:hovercards_checkbox, css: '#mw-input-wppopups')
button(:submit_button, css: '#prefcontrol')
div(:notification, css: ".mw-notification")
def enable_hovercards
beta_features_tab_element.when_present.click
return unless hovercards_checkbox_element.attribute('checked').nil?
hovercards_checkbox_element.click
submit_button_element.when_present.click
# Note well that Element#wait_until_present is more semantic but is
# deprecated. Fortunately, #when_present simply wraps #wait_until_present.
notification_element.when_present
end
end