Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/141073
Change subject: QA: Add browser tests for close and reopen behaviour
......................................................................
QA: Add browser tests for close and reopen behaviour
Change-Id: I4f48c77c33de8cea1f3ba27cf902c7106ea08e83
---
A tests/browser/features/close_reopen_topics.feature
A tests/browser/features/step_definitions/close_reopen_topics_steps.rb
M tests/browser/features/support/pages/flow_page.rb
3 files changed, 113 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/73/141073/1
diff --git a/tests/browser/features/close_reopen_topics.feature
b/tests/browser/features/close_reopen_topics.feature
new file mode 100644
index 0000000..1859b52
--- /dev/null
+++ b/tests/browser/features/close_reopen_topics.feature
@@ -0,0 +1,40 @@
+@chrome @clean @ee-prototype.wmflabs.org @en.wikipedia.beta.wmflabs.org
@firefox @internet_explorer_10 @test2.wikipedia.org
+Feature: Close and open topics
+
+ Background:
+ Given I am logged in
+
+ Scenario: Closing a topic and then changing your mind
+ Given I am on Flow page
+ And I have created a Flow topic
+ When I click the Topic Actions link
+ And I click the Close topic button
+ And I cancel the close/reopen topic form
+ And the page renders in 1 seconds
+ Then the top post is an open discussion
+ And I do not see the close/reopen form
+
+ Scenario: Closing a topic
+ Given I am on Flow page
+ And I have created a Flow topic
+ When I click the Topic Actions link
+ And I click the Close topic button
+ And I type "This is a bikeshed" as the reason
+ And I submit the close/reopen topic form
+ And the page renders in 2 seconds
+ Then the top post is a closed discussion
+ And I expand the top post
+ And the topic summary of the first topic is "This is a bikeshed"
+
+ Scenario: Opening a topic
+ Given I am on Flow page
+ And I have created a Flow topic
+ And the top post has been closed
+ And I click the Topic Actions link
+ And I click the Reopen topic button
+ When I type "Fun discussion" as the reason
+ And I submit the close/reopen topic form
+ And the page renders in 2 seconds
+ Then the top post is an open discussion
+ And I expand the top post
+ And the topic summary of the first topic is "Fun discussion"
diff --git
a/tests/browser/features/step_definitions/close_reopen_topics_steps.rb
b/tests/browser/features/step_definitions/close_reopen_topics_steps.rb
new file mode 100644
index 0000000..e3b10ac
--- /dev/null
+++ b/tests/browser/features/step_definitions/close_reopen_topics_steps.rb
@@ -0,0 +1,53 @@
+Given(/^the top post has been closed$/) do
+ step 'I click the Topic Actions link'
+ step 'I click the Close topic button'
+ step 'I type "This is a bikeshed" as the reason'
+ step 'I submit the close/reopen topic form'
+ step 'the page renders in 2 seconds'
+end
+
+Given(/^I click the Close topic button$/) do
+ on(FlowPage).topic_close_button_element.when_present.click
+end
+
+Given(/^I click the Reopen topic button$/) do
+ on(FlowPage).topic_reopen_button_element.when_present.click
+end
+
+Given(/^I see a form to close the topic$/) do
+ on(FlowPage).topic_close_form_element.when_present.should be_visible
+end
+
+When(/^I type "(.*?)" as the reason$/) do |reason|
+ on(FlowPage).topic_close_form_reason_element.when_present.clear()
+ on(FlowPage).topic_close_form_reason_element.send_keys(reason)
+end
+
+When(/^I cancel the close\/reopen topic form$/) do
+ on(FlowPage).topic_close_form_cancel_button_element.when_present.click
+end
+
+When(/^I submit the close\/reopen topic form$/) do
+ on(FlowPage).topic_close_form_close_button_element.when_present.click
+end
+
+Then(/^the top post is a closed discussion$/) do
+ on(FlowPage).flow_first_topic_moderated_message_element.when_present.should
be_visible
+end
+
+Then(/^the top post is an open discussion$/) do
+ on(FlowPage).flow_first_topic_moderated_message_element.when_not_present
+end
+
+Then(/^the topic summary of the first topic is "(.*?)"$/) do |text|
+ on(FlowPage).flow_first_topic_summary_element.text.should match text
+end
+
+Then(/^I expand the top post$/) do
+ on(FlowPage).flow_first_topic_heading_element.when_present.click
+end
+
+Then(/^I do not see the close\/reopen form$/) do
+ on(FlowPage).topic_close_form_element.when_not_present
+end
+
diff --git a/tests/browser/features/support/pages/flow_page.rb
b/tests/browser/features/support/pages/flow_page.rb
index eab9544..dfa3d3a 100644
--- a/tests/browser/features/support/pages/flow_page.rb
+++ b/tests/browser/features/support/pages/flow_page.rb
@@ -35,8 +35,15 @@
# Posts
## Top post
+ div(:flow_first_topic, css: ".flow-topic", index: 0)
h2(:flow_first_topic_heading, css: ".flow-topic h2", index: 0)
div(:flow_first_topic_body, css: ".flow-post-content", index: 0)
+ div(:flow_first_topic_summary) do |page|
+ page.flow_first_topic_element.div_element(css: ".flow-topic-summary")
+ end
+ div(:flow_first_topic_moderated_message) do |page|
+ page.flow_first_topic_element.div_element(css:
".flow-moderated-topic-title")
+ end
### Hover over username behaviour
a(:talk_link, css: ".mw-usertoollinks a", index: 0)
@@ -48,6 +55,7 @@
a(:collapsed_view, href: "#collapser/topics")
# Topic actions menu
+ div(:topic_titlebar, css: ".flow-topic .flow-topic-titlebar")
a(:topic_actions_link, css: ".flow-topic .flow-topic-titlebar
.flow-menu-js-drop a", index: 0)
## Menu
ul(:topic_actions_menu, css: ".flow-topic .flow-topic-titlebar .flow-menu
ul", index: 0)
@@ -60,6 +68,18 @@
a(:topic_suppress_button) do |page|
page.topic_actions_menu_element.link_element(title: "Suppress topic")
end
+ a(:topic_close_button) do |page|
+ page.topic_actions_menu_element.link_element(title: "Close topic")
+ end
+ a(:topic_reopen_button) do |page|
+ page.topic_actions_menu_element.link_element(title: "Reopen topic")
+ end
+
+ ## Close topic workflow
+ form(:topic_close_form, css: ".flow-edit-form")
+ textarea(:topic_close_form_reason, css: ".flow-edit-form textarea")
+ button(:topic_close_form_close_button, css: ".flow-edit-form
.flow-ui-constructive")
+ button(:topic_close_form_cancel_button, css: ".flow-edit-form
.flow-ui-destructive")
# Post actions menu
a(:post_actions_link, css: ".flow-topic .flow-post .flow-menu-js-drop a",
index: 0)
--
To view, visit https://gerrit.wikimedia.org/r/141073
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f48c77c33de8cea1f3ba27cf902c7106ea08e83
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: frontend-rewrite
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits