Cmcmahon has uploaded a new change for review.

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

Change subject: [browser test] Fix edit mode test.
......................................................................

[browser test] Fix edit mode test.

This test never worked.  Last week this feature broke but the
test continued to pass.  Let's not do that again.

Change-Id: I9819a3304191959b9b194b3e675dfdd273618881
---
M 
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
M modules/ve-mw/test/browser/features/switch_editing_mode.feature
3 files changed, 30 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/62/124362/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 92e12aa..7fe6695 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
@@ -1,11 +1,19 @@
-When(/^I click the Edit source tab$/) do
-  on(VisualEditorPage).edit_wikitext_element.when_present.click
+When(/^I enter the wikitext editor$/) do
+  on(VisualEditorPage) do |page|
+    page.edit_wikitext_element.when_present.click
+    page.wikitext_editor_element.when_present
+  end
 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
+      page.tools_menu_element.when_present.fire_event("onfocus")
+      page.tools_menu_element.when_present.click
+      #page.wait_until do
+      #  page.switch_to_source_editing_element.visible?
+      # end
+      page.switch_to_source_editing_element.when_present.click
     end
   end
 end
@@ -13,9 +21,13 @@
 When(/^I click Edit for VisualEditor from this page$/) do
   on(VisualEditorPage) do |page|
     page.alert do
-      page.edit_ve_element
+      page.edit_ve_element.when_present.click
     end
   end
+end
+
+When(/^I see the wikitext editor$/) do
+  on(VisualEditorPage).wikitext_editor_element.when_present(10).should 
be_visible
 end
 
 Then(/^I should be in wikitext editing mode$/) do
@@ -42,7 +54,6 @@
     page.wait_until(15) do
       page.text.include? "User:"
     end
+    page.content_element.when_present.should be_visible
   end
-  expected_url = /wiki\/User:(.+)?veaction=edit/
-  @browser.url.should match Regexp.new(expected_url)
 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 a21a8d1..cd96907 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
@@ -33,8 +33,13 @@
   a(:subheading3, text: /Sub-heading 3/)
   a(: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")
+
+  if ENV["BROWSER"] == "chrome"
+    div(:tools_menu, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-toolGroup 
oo-ui-iconedElement oo-ui-popupToolGroup oo-ui-listToolGroup")
+  else
+    span(:tools_menu, class: "oo-ui-iconedElement-icon oo-ui-icon-menu")
+  end
+
   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")
   div(:ve_heading_menu, class: "oo-ui-iconedElement-icon oo-ui-icon-down")
@@ -50,6 +55,7 @@
   span(:ve_underline, class: "oo-ui-iconedElement-icon oo-ui-icon-underline-u")
   div(:visual_editor_toolbar, class: "oo-ui-toolbar-tools")
   span(:transclusion, class: "oo-ui-iconedElement-icon oo-ui-icon-template")
+  text_area(:wikitext_editor, id: "wpTextbox1")
 
   in_iframe(index: 0) do |frame|
     a(:beta_warning, title: "Close", frame: frame)
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 64be3d3..0ea03bd 100644
--- a/modules/ve-mw/test/browser/features/switch_editing_mode.feature
+++ b/modules/ve-mw/test/browser/features/switch_editing_mode.feature
@@ -5,15 +5,16 @@
 
   Background:
     Given I am logged in
-    And I am at my user page
+      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
+    When I enter the wikitext editor
+      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
+      And I see the wikitext editor
+      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/124362
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9819a3304191959b9b194b3e675dfdd273618881
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <cmcma...@wikimedia.org>

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

Reply via email to