mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
QA: add a browser test to cover "enable previews" feature
Test whether: * "Enable previews" footer link correctly appears/disappears; * A hovercard correctly shows/doesn't show when enabled/disabled. Bug: T133054 Change-Id: I55f311b6b8845e6ebf4cc5698758afd1f9042a45
This commit is contained in:
parent
28af47b231
commit
85cc7e2257
48
tests/browser/features/popups_settings.feature
Normal file
48
tests/browser/features/popups_settings.feature
Normal file
|
@ -0,0 +1,48 @@
|
|||
@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org @vagrant @integration
|
||||
Feature: Popups settings
|
||||
Background:
|
||||
Given the hover cards test page is installed
|
||||
And I am logged in
|
||||
And HoverCards is enabled as a beta feature
|
||||
And I am on the "Popups test page" page
|
||||
And the Hovercards JavaScript module has loaded
|
||||
|
||||
Scenario: "Enable previews" footer link correctly appears
|
||||
And I do not see the enable previews link in the footer
|
||||
And I hover over the first valid link
|
||||
And I see a hover card
|
||||
And I disable previews in the popups settings
|
||||
Then I should see the enable previews link in the footer
|
||||
|
||||
Scenario: Disabling previews in the popup settings correctly disables popups
|
||||
And I do not see the enable previews link in the footer
|
||||
And I hover over the first valid link
|
||||
And I see a hover card
|
||||
And I disable previews in the popups settings
|
||||
And I hover over the first valid link
|
||||
Then I should not see a hover card
|
||||
|
||||
Scenario: "Enable previews" footer link correctly disappears
|
||||
And I do not see the enable previews link in the footer
|
||||
And I hover over the first valid link
|
||||
And I see a hover card
|
||||
And I disable previews in the popups settings
|
||||
And I enable previews in the popups settings
|
||||
Then I should not see the enable previews link in the footer
|
||||
|
||||
Scenario: Popups can be enabled via the "Enable previews" footer link
|
||||
And I do not see the enable previews link in the footer
|
||||
And I hover over the first valid link
|
||||
And I see a hover card
|
||||
And I disable previews in the popups settings
|
||||
And I enable previews in the popups settings
|
||||
And I hover over the first valid link
|
||||
Then I should see a hover card
|
||||
|
||||
Scenario: Dismissing settings dialog does not change popups settings
|
||||
And I hover over the first valid link
|
||||
And I see a hover card
|
||||
And I open the popups settings dialog of the first valid link
|
||||
And I dismiss the popups settings dialog of the first valid link
|
||||
And I hover over the first valid link
|
||||
Then I should see a hover card
|
|
@ -8,4 +8,11 @@ class ArticlePage
|
|||
div(:page_header, css: '#mw-head')
|
||||
a(:first_valid_link, css: 'ul a', index: 0)
|
||||
div(:hovercard, css: '.mwe-popups')
|
||||
a(:settings_icon, css: '.mwe-popups-settings-icon')
|
||||
radio(:enable_previews_radio, id: 'mwe-popups-settings-simple')
|
||||
radio(:disable_previews_radio, id: 'mwe-popups-settings-disable_previews')
|
||||
button(:cancel_settings_button, css: '#mwe-popups-settings-form button', index: 0)
|
||||
button(:save_settings_button, css: '#mwe-popups-settings-form button', index: 1)
|
||||
button(:settings_help_ok_button, css: '#mwe-popups-settings-help button', index: 0)
|
||||
a(:last_link_in_the_footer, css: '#footer-places a', index: -1)
|
||||
end
|
||||
|
|
|
@ -6,6 +6,49 @@ When(/^I hover over the first valid link$/) do
|
|||
on(ArticlePage).first_valid_link_element.hover
|
||||
end
|
||||
|
||||
When(/^I see a hover card$/) do
|
||||
on(ArticlePage).hovercard_element.when_present
|
||||
end
|
||||
|
||||
When(/^I open the popups settings dialog of the first valid link$/) do
|
||||
step("I hover over the first valid link")
|
||||
on(ArticlePage).settings_icon_element.when_present.click
|
||||
end
|
||||
|
||||
When(/^I dismiss the popups settings dialog of the first valid link$/) do
|
||||
on(ArticlePage).cancel_settings_button_element.when_present.click
|
||||
end
|
||||
|
||||
When(/^I disable previews in the popups settings$/) do
|
||||
on(ArticlePage) do |page|
|
||||
page.settings_icon_element.when_present.click
|
||||
page.disable_previews_radio_element.when_present.click
|
||||
page.save_settings_button_element.when_present.click
|
||||
page.settings_help_ok_button_element.when_present.click
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I enable previews in the popups settings$/) do
|
||||
step("I see the enable previews link in the footer")
|
||||
on(ArticlePage) do |page|
|
||||
page.last_link_in_the_footer_element.when_present.click
|
||||
page.enable_previews_radio_element.when_present.click
|
||||
page.save_settings_button_element.when_present.click
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I see the enable previews link in the footer$/) do
|
||||
on(ArticlePage) do |page|
|
||||
page.wait_until do
|
||||
page.last_link_in_the_footer_element.when_present.text.include? 'Enable previews'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I do not see the enable previews link in the footer$/) do
|
||||
!on(ArticlePage).last_link_in_the_footer_element.when_present.text.include? 'Enable previews'
|
||||
end
|
||||
|
||||
Then(/^I should see a hover card$/) do
|
||||
expect(on(ArticlePage).hovercard_element.when_present(5)).to be_visible
|
||||
end
|
||||
|
@ -15,3 +58,17 @@ Then(/^I should not see a hover card$/) do
|
|||
sleep 5
|
||||
expect(on(ArticlePage).hovercard_element).not_to be_visible
|
||||
end
|
||||
|
||||
Then(/^I should see the enable previews link in the footer$/) do
|
||||
on(ArticlePage) do |page|
|
||||
page.wait_until do
|
||||
page.last_link_in_the_footer_element.when_present.text.include? 'Enable previews'
|
||||
end
|
||||
expect(page.last_link_in_the_footer_element.when_present.text).to match 'Enable previews'
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I should not see the enable previews link in the footer$/) do
|
||||
expect(on(ArticlePage).last_link_in_the_footer_element.when_present.text).not_to match 'Enable previews'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue