Jhall has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/102040


Change subject: [Browser test] New test for switching between editing modes
......................................................................

[Browser test] New test for switching between editing modes

Per earlier reviewer comments, now using native page-objects
methods for dealing with Javascript alerts.

Change-Id: I3e9d9ae16f1c880878c8e198c647376a0b9aed37
---
M 
modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
M modules/ve-mw/test/browser/features/switch_editing_mode.feature
2 files changed, 18 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/40/102040/1

diff --git 
a/modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
 
b/modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
index 2ef5d3b..39b6d30 100644
--- 
a/modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
+++ 
b/modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
@@ -4,22 +4,17 @@
 
 When(/^I click the Switch to source editing menu option$/) do
   on(VisualEditorPage) do |page|
-    page.tools_menu_element.when_present.click
-    page.switch_to_source_editing_element.when_present.click
+    page.alert do
+      page.switch_to_source_editing_element
+    end
   end
-end
-
-Then(/^I should see a popup window$/) do
-  @browser.alert.exists?
-end
-
-When(/^I click OK in the popup window$/) do
-  @browser.alert.ok
 end
 
 When(/^I click Edit for VisualEditor from this page$/) do
   on(VisualEditorPage) do |page|
-    page.edit_ve_element.when_present(15).click
+    page.alert do
+      page.edit_ve_element
+    end
   end
 end
 
@@ -38,6 +33,15 @@
       page.text.include? "User:"
     end
   end
-  # Not using an equality matcher below since the VE URL won't match the 
MEDIAWIKI_URL stem
-  @browser.url.should match("title=User:" + ENV['MEDIAWIKI_USER'] + 
"&veaction=edit")
+  expected_url = /index\.php\?title=User:Selenium_user&veaction=edit/
+  @browser.url.should match Regexp.new(expected_url)
+end
+
+Then(/^I should be in Visual Editor editing alternate mode$/) do
+  on(VisualEditorPage) do |page|
+    page.wait_until(15) do
+      page.text.include? "User:"
+    end
+  end
+  @browser.url.should eql(ENV['MEDIAWIKI_URL'] + "User:" + 
ENV['MEDIAWIKI_USER'] + "?veaction=edit")
 end
\ No newline at end of file
diff --git a/modules/ve-mw/test/browser/features/switch_editing_mode.feature 
b/modules/ve-mw/test/browser/features/switch_editing_mode.feature
index efed35a..abb1d00 100644
--- a/modules/ve-mw/test/browser/features/switch_editing_mode.feature
+++ b/modules/ve-mw/test/browser/features/switch_editing_mode.feature
@@ -12,13 +12,7 @@
     And I click Edit for VisualEditor
     Then I should be in Visual Editor editing mode
 
-  Scenario: Pop-up displays via drop-down menu selection
-    When I click the Switch to source editing menu option
-    Then I should see a popup window
-
   Scenario: Switch editing modes via Page Settings drop-down menu
     When I click the Switch to source editing menu option
-    And I click OK in the popup window
     And I click Edit for VisualEditor from this page
-    And I click OK in the popup window
-    Then I should be in Visual Editor editing mode
\ No newline at end of file
+    Then I should be in Visual Editor editing alternate mode
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e9d9ae16f1c880878c8e198c647376a0b9aed37
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jhall <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to