Spage has submitted this change and it was merged. Change subject: POC for flow browser test ......................................................................
POC for flow browser test Simple tests for anonymous adding a topic, and a logged-in user adding a topic that has author links. Change-Id: I63f593c4b3e694dd97d7273a85dbbb77e972404c --- A features/flow_anon.feature A features/flow_logged_in.feature A features/flow_logged_in_visualeditor.feature A features/step_definitions/flow_steps.rb A features/support/pages/flow_page.rb 5 files changed, 131 insertions(+), 0 deletions(-) Approvals: Spage: Looks good to me, approved jenkins-bot: Verified diff --git a/features/flow_anon.feature b/features/flow_anon.feature new file mode 100644 index 0000000..9507cf4 --- /dev/null +++ b/features/flow_anon.feature @@ -0,0 +1,11 @@ [email protected] @ee-prototype.wmflabs.org + +Feature: Create new topic anonymous + + Scenario: Add new Flow topic + Given I am on Flow page + When I create a Title of Flow Topic in Flow new topic + And I create a Body of Flow Topic into Flow body + And I click New topic save + Then the page should contain Title of Flow Topic + And the page should contain Body of Flow Topic diff --git a/features/flow_logged_in.feature b/features/flow_logged_in.feature new file mode 100644 index 0000000..1c0f240 --- /dev/null +++ b/features/flow_logged_in.feature @@ -0,0 +1,17 @@ [email protected] @login + +Feature: Create new topic logged in + +For now this test is assumed to run against http://ee-prototype.wmflabs.org/ only +It requires VisualEditor not be in place, the cldr extension, a "Flow QA" page, and the "Selenium user". +If VisualEditor is enabled for Selenium_user, the flow_page definitions have to change. + +Background: + Given I am logged in + + Scenario: Add new Flow topic + Given I have created a Flow topic + And the author link is visible + And the talk and contrib links are not visible + When I hover over the author link + Then links to talk and contrib should be visible diff --git a/features/flow_logged_in_visualeditor.feature b/features/flow_logged_in_visualeditor.feature new file mode 100644 index 0000000..67fbe0e --- /dev/null +++ b/features/flow_logged_in_visualeditor.feature @@ -0,0 +1,16 @@ [email protected] @login + +Feature: Create new topic logged in + +For now this test is assumed to run against http://en.wikipedia.beta.wmflabs.org/ only +It requires VisualEditor, the cldr extension, a "Flow QA" page, and the "Selenium user". + +Background: + Given I am logged in + + Scenario: Add new Flow topic + Given I have created a VisualEditor Flow topic + And the author link is visible + And the talk and contrib links are not visible + When I hover over the author link + Then links to talk and contrib should be visible diff --git a/features/step_definitions/flow_steps.rb b/features/step_definitions/flow_steps.rb new file mode 100644 index 0000000..d5ccc0d --- /dev/null +++ b/features/step_definitions/flow_steps.rb @@ -0,0 +1,70 @@ +Given(/^I am on Flow page$/) do + visit FlowPage +end + +When(/^I create a (.+) in Flow new topic$/) do |flow_title| + @automated_test_marker = ' browsertest edit' + on(FlowPage) do |page| + page.new_topic_title_element.when_present.click + page.new_topic_title_element.when_present.send_keys(flow_title + @does_not_exist_page_name + @automated_test_marker) + end +end + +When(/^I create a (.+) into VisualEditor Flow body$/) do |flow_body| + on(FlowPage).new_topic_body_ve_element.when_present.send_keys(flow_body + @does_not_exist_page_name + @automated_test_marker) +end + +When(/^I create a (.+) into Flow body$/) do |flow_body| + on(FlowPage).new_topic_body_element.when_present.send_keys(flow_body + @does_not_exist_page_name + @automated_test_marker) +end + +When(/^I click New topic save$/) do + on(FlowPage).new_topic_save_element.when_present.click +end + +Then(/^the page should contain (.+)$/) do |flow_topic| + on(FlowPage) do |page| + page.wait_until(20) do # 10 seconds wasn't enough on ee-flow... + page.text.include? 'just now' + end + page.flow_body.should match(flow_topic + @does_not_exist_page_name + @automated_test_marker) + end +end + +Given(/^I have created a Flow topic$/) do + step 'I am on Flow page' + step 'I create a Title of Flow Topic in Flow new topic' + step 'I create a Body of Flow Topic into Flow body' + step 'I click New topic save' + step 'the page should contain Title of Flow Topic' +end + +Given(/^I have created a VisualEditor Flow topic$/) do + step 'I am on Flow page' + step 'I create a Title of Flow Topic in Flow new topic' + step 'I create a Body of Flow Topic into VisualEditor Flow body' + step 'I click New topic save' + step 'the page should contain Title of Flow Topic' +end + +Given(/^the author link is visible$/) do + on(FlowPage).author_link_element.when_present.should be_visible +end + +Given(/^the talk and contrib links are not visible$/) do + on(FlowPage) do |page| + page.talk_link_element.should_not be_visible + page.contrib_link_element.should_not be_visible + end +end + +When(/^I hover over the author link$/) do + on(FlowPage).author_link_element.fire_event('onmouseover') +end + +Then(/^links to talk and contrib should be visible$/) do + on(FlowPage) do |page| + page.talk_link_element.should be_visible + page.contrib_link_element.should be_visible + end +end diff --git a/features/support/pages/flow_page.rb b/features/support/pages/flow_page.rb new file mode 100644 index 0000000..3410a84 --- /dev/null +++ b/features/support/pages/flow_page.rb @@ -0,0 +1,17 @@ +require 'page-object' + +class FlowPage + include PageObject + + include URL + page_url URL.url('Special:Flow/Flow_QA') + + span(:author_link, class: 'flow-creator-simple') + a(:talk_link, text: 'Talk') + a(:contrib_link, text: 'contribs') + text_area(:new_topic_title, name: 'topic_list[topic]') + textarea(:new_topic_body, class: 'flow-newtopic-content') + div(:new_topic_body_ve, class: 've-ce-documentNode ve-ce-branchNode') + button(:new_topic_save, class: 'flow-newtopic-submit') + div(:flow_body, class: 'flow-container') +end -- To view, visit https://gerrit.wikimedia.org/r/84772 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I63f593c4b3e694dd97d7273a85dbbb77e972404c Gerrit-PatchSet: 7 Gerrit-Project: qa/browsertests Gerrit-Branch: master Gerrit-Owner: Cmcmahon <[email protected]> Gerrit-Reviewer: Cmcmahon <[email protected]> Gerrit-Reviewer: Maryana <[email protected]> Gerrit-Reviewer: Spage <[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
