jenkins-bot has submitted this change and it was merged. 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(+), 1 deletion(-) Approvals: EBernhardson: Looks good to me, approved jenkins-bot: Verified 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..127aaee --- /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_moderation_msg_element.when_present.should be_visible +end + +Then(/^the top post is an open discussion$/) do + on(FlowPage).flow_first_topic_moderation_msg_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 a883499..5c332b7 100644 --- a/tests/browser/features/support/pages/flow_page.rb +++ b/tests/browser/features/support/pages/flow_page.rb @@ -31,15 +31,22 @@ div(:highlighted_post, css: ".flow-post-highlighted") ## First topic + 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_moderation_msg, css: '.flow-moderated-topic-title', index: 0) + div(:flow_first_topic_moderation_msg) do |page| + page.flow_first_topic_element.div_element(css: '.flow-moderated-topic-title', index: 0) + end + div(:flow_first_topic_summary) do |page| + page.flow_first_topic_element.div_element(css: ".flow-topic-summary") + end ### Hover over username behaviour a(:talk_link, css: "..flow-author:hover mw-usertoollinks a", index: 0) a(:block_user, css: ".flow-author:hover .mw-usertoollinks a", index: 1) ### First Topic actions menu + # For topic collapsing testing # Watir WebDriver apparently doesn't support CSS :not (https://developer.mozilla.org/en-US/docs/Web/CSS/:not), so using XPath h2(:first_non_moderated_topic_title, xpath: '(//*[contains(@class, "flow-topic ") and not(contains(@class, "flow-topic-moderated"))]//h2[contains(@class, "flow-topic-title")])[1]') @@ -83,6 +90,18 @@ a(:edit_title_button) do |page| page.topic_actions_menu_element.link_element(text: "Edit title") 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") ### Editing title of first topic text_field(:title_edit, css: ".flow-topic-titlebar form .mw-ui-input", index: 0) -- To view, visit https://gerrit.wikimedia.org/r/141073 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4f48c77c33de8cea1f3ba27cf902c7106ea08e83 Gerrit-PatchSet: 14 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: frontend-rewrite Gerrit-Owner: Jdlrobson <[email protected]> Gerrit-Reviewer: EBernhardson <[email protected]> Gerrit-Reviewer: SG <[email protected]> Gerrit-Reviewer: Spage <[email protected]> Gerrit-Reviewer: Werdna <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
