jenkins-bot has submitted this change and it was merged.

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


[Browser test] New test for switching between editing modes

1) Using native page-objects methods for dealing with Javascript alerts.
2) Added tags to feature file per reviewer comment.

Change-Id: I3e9d9ae16f1c880878c8e198c647376a0b9aed37
---
A 
modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
M modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb
A modules/ve-mw/test/browser/features/switch_editing_mode.feature
3 files changed, 69 insertions(+), 0 deletions(-)

Approvals:
  Cmcmahon: Looks good to me, approved
  jenkins-bot: Verified



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
new file mode 100644
index 0000000..03bcccc
--- /dev/null
+++ 
b/modules/ve-mw/test/browser/features/step_definitions/switch_editing_mode_steps.rb
@@ -0,0 +1,47 @@
+When(/^I click the Edit source tab$/) do
+  on(VisualEditorPage).edit_wikitext_element.when_present.click
+end
+
+When(/^I click the Switch to source editing menu option$/) do
+  on(VisualEditorPage) do |page|
+    page.alert do
+      page.switch_to_source_editing_element
+    end
+  end
+end
+
+When(/^I click Edit for VisualEditor from this page$/) do
+  on(VisualEditorPage) do |page|
+    page.alert do
+      page.edit_ve_element
+    end
+  end
+end
+
+Then(/^I should be in wikitext editing mode$/) do
+  on(VisualEditorPage) do |page|
+    page.wait_until(15) do
+      page.text.include? "Editing User:"
+    end
+  end
+  @browser.url.should eql(ENV['MEDIAWIKI_URL'] + "User:" + 
ENV['MEDIAWIKI_USER'] + "?action=submit")
+end
+
+Then(/^I should be in Visual Editor editing mode$/) do
+  on(VisualEditorPage) do |page|
+    page.wait_until(15) do
+      page.text.include? "User:"
+    end
+  end
+  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
diff --git 
a/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb 
b/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb
index a0ffda5..faa1572 100644
--- a/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb
+++ b/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb
@@ -10,6 +10,7 @@
   a(:decrease_indentation_on, title: /Decrease indentation/)
   span(:downarrow, class: 'oo-ui-iconedElement-icon oo-ui-icon-down')
   a(:edit_ve, title: /Edit this page with VisualEditor/)
+  a(:edit_wikitext, title: /You can edit this page\./)
   span(:heading, text: 'Heading')
   span(:increase_indentation, class: 'oo-ui-widget oo-ui-tool 
oo-ui-tool-name-indent oo-ui-widget-disabled')
   a(:increase_indentation_on, title: /Increase indentation/)
@@ -31,6 +32,8 @@
   span(:subheading2, text: 'Sub-heading 2')
   span(:subheading3, text: 'Sub-heading 3')
   span(:subheading4, text: 'Sub-heading 4')
+  span(:switch_to_source_editing, class: 'oo-ui-iconedElement-icon 
oo-ui-icon-source')
+  span(:tools_menu, class: 'oo-ui-iconedElement-icon oo-ui-icon-menu')
   span(:ve_bold_text, class: 'oo-ui-iconedElement-icon oo-ui-icon-bold-b')
   span(:ve_bullets, class: 'oo-ui-iconedElement-icon oo-ui-icon-bullet-list')
   span(:ve_computer_code, class: 'oo-ui-iconedElement-icon oo-ui-icon-code')
diff --git a/modules/ve-mw/test/browser/features/switch_editing_mode.feature 
b/modules/ve-mw/test/browser/features/switch_editing_mode.feature
new file mode 100644
index 0000000..64be3d3
--- /dev/null
+++ b/modules/ve-mw/test/browser/features/switch_editing_mode.feature
@@ -0,0 +1,19 @@
+@ie6-bug  @ie7-bug  @ie8-bug  @ie9-bug @ie10-bug 
@en.wikipedia.beta.wmflabs.org @test2.wikipedia.org @login
+Feature: Switching between wikitext and Visual Editor modes
+
+  Test for both pathways that allow switching between Visual Editor and 
wikitext editing modes.
+
+  Background:
+    Given I am logged in
+    And I am at my user page
+    When I click Edit for VisualEditor
+
+  Scenario: Switch editing modes via toolbar
+    When I click the Edit source tab
+    And I click Edit for VisualEditor
+    Then I should be in Visual Editor editing mode
+
+  Scenario: Switch editing modes via Page Settings drop-down menu
+    When I click the Switch to source editing menu option
+    And I click Edit for VisualEditor from this page
+    Then I should be in Visual Editor editing alternate mode

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3e9d9ae16f1c880878c8e198c647376a0b9aed37
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jhall <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to