Sbisson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/232480
Change subject: Browser tests: update for new Flow editor
......................................................................
Browser tests: update for new Flow editor
Change-Id: Ic12a4c68fbd8d15e268e26a9bb6ef40650bd46b0
---
M tests/browser/features/step_definitions/description_steps.rb
M tests/browser/features/step_definitions/special_enable_flow_steps.rb
A tests/browser/features/support/components/board_description.rb
A tests/browser/features/support/components/flow_editor.rb
M tests/browser/features/support/pages/abstract_flow_page.rb
M tests/browser/features/support/pages/special_enable_flow_page.rb
6 files changed, 81 insertions(+), 50 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/80/232480/1
diff --git a/tests/browser/features/step_definitions/description_steps.rb
b/tests/browser/features/step_definitions/description_steps.rb
index 75a0edd..c4ee72d 100644
--- a/tests/browser/features/step_definitions/description_steps.rb
+++ b/tests/browser/features/step_definitions/description_steps.rb
@@ -1,18 +1,17 @@
Then(/^the description should be "(.*?)"$/) do |content|
on(FlowPage) do |page|
- page.description_content_element.when_present
- page.description_content.should eq(content)
+ page.description.content_element.when_present
+ page.description.content.should eq(content)
end
end
When(/^I set the description to "(.*?)"$/) do |description_text|
on(FlowPage) do |page|
- page.edit_description_link_element.click
- page.edit_description_form_element.when_visible
- page.edit_description_textbox_element.when_present.clear
- page.edit_description_textbox_element.when_present.send_keys
description_text
- page.edit_description_save_element.when_present.click
- page.description_content_element.when_present
+ page.description.edit
+ page.description.editor_element.when_present.clear
+ page.description.editor_element.when_present.send_keys description_text
+ page.description.save
+ page.description.content_element.when_present
end
end
diff --git
a/tests/browser/features/step_definitions/special_enable_flow_steps.rb
b/tests/browser/features/step_definitions/special_enable_flow_steps.rb
index 1f49c0c..fedffcb 100644
--- a/tests/browser/features/step_definitions/special_enable_flow_steps.rb
+++ b/tests/browser/features/step_definitions/special_enable_flow_steps.rb
@@ -18,8 +18,9 @@
When(/^I enable a new Flow board on article (.*?)$/) do |article|
on(EnableFlowPage) do |page|
- page.page_name.when_present.send_keys(article)
- page.submit_button.when_present.click
+ page.page_name_element.when_present.send_keys article
+ page.page_header_element.when_present.send_keys 'header'
+ page.submit
end
end
@@ -41,8 +42,8 @@
Then(/^I click the archive link$/) do
on(AbstractFlowPage) do |page|
- page.sidebar_toggle_element.when_present.click unless
page.description_content_element.visible?
- page.description_archive_link.when_present.click
+ page.description.toggle_element.when_present.click unless
page.description.content_element.visible?
+ page.description.archive_link_element.when_present.click
end
end
diff --git a/tests/browser/features/support/components/board_description.rb
b/tests/browser/features/support/components/board_description.rb
new file mode 100644
index 0000000..5f9cc77
--- /dev/null
+++ b/tests/browser/features/support/components/board_description.rb
@@ -0,0 +1,26 @@
+require_relative 'flow_editor'
+
+class BoardDescription
+ include PageObject
+ include FlowEditor
+
+ # board description
+ a(:edit, text: "Edit description")
+ div(:content, class: 'flow-ui-boardDescriptionWidget-content')
+
+ a(:toggle, class: "side-rail-toggle-button")
+
+ div(:editor_widget, class: 'flow-ui-boardDescriptionWidget-editor')
+
+ def editor_element
+ visualeditor_or_textarea editor_widget_element
+ end
+
+ link(:save, text: "Save description")
+
+ # If page has an archive template from a flow conversion
+ # find the link
+ link(:archive_link) do
+ content_element.link_element
+ end
+end
diff --git a/tests/browser/features/support/components/flow_editor.rb
b/tests/browser/features/support/components/flow_editor.rb
new file mode 100644
index 0000000..f1d8ccd
--- /dev/null
+++ b/tests/browser/features/support/components/flow_editor.rb
@@ -0,0 +1,11 @@
+module FlowEditor
+ def visualeditor_or_textarea(form)
+ parent = form.is_a?(String) ? form_element(css: form) : form
+ parent.when_present
+ if parent.div_element(class: 'flow-ui-wikitextEditorWidget').exists?
+ parent.div_element(class:
'flow-ui-wikitextEditorWidget').text_area_element
+ else
+ parent.div_element(class: 've-ce-documentNode')
+ end
+ end
+end
diff --git a/tests/browser/features/support/pages/abstract_flow_page.rb
b/tests/browser/features/support/pages/abstract_flow_page.rb
index e77e960..b0e5edd 100644
--- a/tests/browser/features/support/pages/abstract_flow_page.rb
+++ b/tests/browser/features/support/pages/abstract_flow_page.rb
@@ -1,34 +1,14 @@
require_relative 'wiki_page'
class AbstractFlowPage < WikiPage
- def visualeditor_or_textarea(form)
- parent = form.is_a?(String) ? form_element(css: form) : form
- parent.when_present
- if parent.div_element(class: 'flow-editor-visualeditor').exists?
- parent.div_element(class: 've-ce-documentNode')
- else
- parent.div_element(class: 'oo-ui-textInputWidget').text_area_element
- end
- end
+ include FlowEditor
+
+ page_section(:description, BoardDescription, class: 'flow-board-header')
# board component
div(:flow_component, class: 'flow-component')
div(:flow_board, class: 'flow-board')
- # board description
- a(:edit_description_link, title: "Edit description")
- div(:description_content, css: ".flow-board-header-content")
- form(:edit_description_form, css: ".edit-header-form")
- a(:sidebar_toggle, class: "side-rail-toggle-button")
- def edit_description_textbox_element
- visualeditor_or_textarea '.edit-header-form'
- end
-
- # If page has an archive template from a flow conversion
- # find the link
- def description_archive_link
- div_element(class: 'flow-board-header-content').link_element
- end
a(:author_link, css: ".flow-author a", index: 0)
a(:cancel_button, text: "Cancel")
@@ -238,32 +218,43 @@
# New topic creation
a(:new_topic_link, text: "Start a new topic")
form(:new_topic_form, css: ".flow-newtopic-form")
- text_field(:new_topic_title, name: "topiclist_topic")
+ text_field(:new_topic_title, css: ".flow-ui-newTopicWidget-title > input")
+ div(:new_topic_widget, class: 'flow-ui-newTopicWidget')
def new_topic_body_element
- visualeditor_or_textarea '.flow-newtopic-form'
+ visualeditor_or_textarea new_topic_widget_element
end
- button(:new_topic_cancel, css: ".flow-newtopic-form .mw-ui-destructive")
- # FIXME: Remove flow-ui-constructive reference when cache has cleared
- button(:new_topic_save, css: ".flow-newtopic-form .mw-ui-constructive,
.flow-newtopic-form .flow-ui-constructive")
+ link(:new_topic_cancel) do
+ new_topic_widget_element.link_element(text: 'Cancel')
+ end
+
+ link(:new_topic_save) do
+ new_topic_widget_element.link_element(text: 'Add topic')
+ end
# Replying
# TODO (mattflaschen, 2014-06-24): Should distinguish between
# top-level replies to the topic, and replies to regular posts
form(:new_reply_form, css: ".flow-reply-form")
- text_area(:new_reply_placeholder) do |page|
- page.new_reply_form_element.text_area_element
+ div(:new_reply_placeholder, class: 'flow-ui-replyWidget')
+
+ div(:first_reply_widget) do
+ flow_first_topic_element.div_element(class: 'flow-ui-replyWidget')
end
def new_reply_editor_element
- form = flow_first_topic_element.form_element(class: 'flow-reply-form')
- visualeditor_or_textarea form
+ visualeditor_or_textarea first_reply_widget_element
end
- button(:new_reply_cancel, css: ".flow-reply-form .mw-ui-destructive")
- button(:new_reply_save, css: ".flow-reply-form .mw-ui-constructive")
+ link(:new_reply_cancel) do
+ first_reply_widget_element.link_element(text: 'Cancel')
+ end
+ link(:new_reply_save) do
+ first_reply_widget_element.link_element(text: 'Reply')
+ end
+
button(:keep_editing, text: "Keep editing")
# Editing post workflow
@@ -275,8 +266,6 @@
button(:change_post_save, css: ".flow-edit-post-form .mw-ui-constructive")
div(:small_spinner, class: "mw-spinner mw-spinner-small mw-spinner-inline")
-
- button(:edit_description_save, text: "Save description")
# No javascript elements
button(:no_javascript_add_topic, text: "Add topic")
diff --git a/tests/browser/features/support/pages/special_enable_flow_page.rb
b/tests/browser/features/support/pages/special_enable_flow_page.rb
index be3cc2c..4bfcc6d 100644
--- a/tests/browser/features/support/pages/special_enable_flow_page.rb
+++ b/tests/browser/features/support/pages/special_enable_flow_page.rb
@@ -5,13 +5,18 @@
# form elements
div(:page_name_div, id: 'mw-input-wppage')
+ div(:page_header_div, id: 'mw-input-wpheader')
div(:submit_button_div, class: 'oo-ui-buttonElement')
- def page_name
+ text_field(:page_name) do
page_name_div_element.text_field_element
end
- def submit_button
+ text_area(:page_header) do
+ page_header_div_element.text_area_element
+ end
+
+ button(:submit) do
submit_button_div_element.button_element
end
end
--
To view, visit https://gerrit.wikimedia.org/r/232480
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic12a4c68fbd8d15e268e26a9bb6ef40650bd46b0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits