Phuedx has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327016 )

Change subject: WIP Hygiene: Tidy up "settings" feature
......................................................................

WIP Hygiene: Tidy up "settings" feature

Change-Id: I91036c5d158fc08694cc7eadfe0b28cdbad1080c
---
D tests/browser/features/popups_settings.feature
A tests/browser/features/settings.feature
A tests/browser/features/support/step_definitions/settings.rb
3 files changed, 52 insertions(+), 48 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/16/327016/1

diff --git a/tests/browser/features/popups_settings.feature 
b/tests/browser/features/popups_settings.feature
deleted file mode 100644
index 26b2553..0000000
--- a/tests/browser/features/popups_settings.feature
+++ /dev/null
@@ -1,48 +0,0 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
-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
diff --git a/tests/browser/features/settings.feature 
b/tests/browser/features/settings.feature
new file mode 100644
index 0000000..32e5443
--- /dev/null
+++ b/tests/browser/features/settings.feature
@@ -0,0 +1,25 @@
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
+Feature: Settings
+  Background:
+    Given I am logged in
+    And I have enabled the beta feature
+    And I am on the test page
+
+  Scenario: Disabling previews via the settings modal
+    When I dwell on the first valid link
+    And I see a preview
+    And I click the cog button
+    And I disable previews via the settings modal
+    And I dwell on the first valid link
+    Then I should not see a preview
+    And I should see the footer link
+
+  Scenario: Enabling previews via the settings modal
+    When I dwell on the first valid link
+    And I see a preview
+    And I click the cog button
+    And I disable previews via the settings modal
+    And I click the footer link
+    And I dwell on the first valid link
+    Then I should see a preview
+    And I should not see the footer link
diff --git a/tests/browser/features/support/step_definitions/settings.rb 
b/tests/browser/features/support/step_definitions/settings.rb
new file mode 100644
index 0000000..3795e52
--- /dev/null
+++ b/tests/browser/features/support/step_definitions/settings.rb
@@ -0,0 +1,27 @@
+When(/^I see a preview$/) do
+  on(ArticlePage).hovercard_element.when_present
+end
+
+When(/^I click the cog button$/) do
+  on(ArticlePage).settings_icon_element.when_present.click
+end
+
+When(/^I disable previews via the settings modal$/) do
+  on(ArticlePage) do |page|
+    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
+
+Then(/^I should see the footer link$/) do
+  expect(on(ArticlePage).last_link_in_the_footer_element.when_present.text).to 
match 'Enable previews'
+end
+
+When(/^I click the footer link$/) do
+  on(ArticlePage).last_link_in_the_footer_element.when_present.click
+end
+
+Then(/^I should not see the footer link$/) do
+  
expect(on(ArticlePage).last_link_in_the_footer_element.when_present.text).not_to
 match 'Enable previews'
+end

-- 
To view, visit https://gerrit.wikimedia.org/r/327016
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I91036c5d158fc08694cc7eadfe0b28cdbad1080c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: mpga
Gerrit-Owner: Phuedx <samsm...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to