Cmcmahon has uploaded a new change for review. https://gerrit.wikimedia.org/r/93069
Change subject: new test for editing existing title, also alphabetize and cleanup ...................................................................... new test for editing existing title, also alphabetize and cleanup Change-Id: I68939276503c33e2354c0f4976d09f7bccf34485 --- A tests/browser/features/flow_edit_title_anon.feature M tests/browser/features/step_definitions/flow_steps.rb M tests/browser/features/support/pages/flow_page.rb 3 files changed, 76 insertions(+), 40 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/69/93069/1 diff --git a/tests/browser/features/flow_edit_title_anon.feature b/tests/browser/features/flow_edit_title_anon.feature new file mode 100644 index 0000000..359eb3d --- /dev/null +++ b/tests/browser/features/flow_edit_title_anon.feature @@ -0,0 +1,11 @@ [email protected] @ee-prototype.wmflabs.org + +Feature: Edit title + + Scenario: Click edit title + Given I am on Flow page + When I hover over the topic post + And I click the pencil icon + Then the title text field should be visible + And the Change Title button should be enabled + And the Cancel button should be visible \ No newline at end of file diff --git a/tests/browser/features/step_definitions/flow_steps.rb b/tests/browser/features/step_definitions/flow_steps.rb index 9a8b186..121f68c 100644 --- a/tests/browser/features/step_definitions/flow_steps.rb +++ b/tests/browser/features/step_definitions/flow_steps.rb @@ -2,43 +2,6 @@ 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 + @random_string + @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 + @random_string + @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 + @random_string + @automated_test_marker) -end - -When(/^I click New topic save$/) do - on(FlowPage).new_topic_save_element.when_present.click -end - -Then(/^the Flow page should contain (.+)$/) do |flow_topic| - on(FlowPage) do |page| - page.wait_until(20) do # 10 seconds wasn't enough on ee-flow... - # TODO Also match the regexp '[2-9] seconds ago' in case of delays. - # TODO This should look in the particular topic that was added, not - # blindly look for text. - # It could note the ID of the first div with id 'flow-topic-<UUID>' - # before submitting the new topic post, - # then afterwards find the flow-topic-<UUID> div *preceding* that and search in there. - # Or after submit it could look for the Title of Flow Topic, find the - # flow-topic-container containing that and search in there. - page.text.include? '1 second ago' or page.text.include? 'just now' - end - page.flow_body.should match(flow_topic + @random_string + @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' @@ -66,6 +29,34 @@ end end +When(/^I click New topic save$/) do + on(FlowPage).new_topic_save_element.when_present.click +end + +When(/^I click the pencil icon$/) do + on(FlowPage).pencil_icon_element.when_present.click +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 + @random_string + @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 + @random_string + @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 + @random_string + @automated_test_marker) +end + +When(/^I hover over the topic post$/) do + on(FlowPage).topic_post_element.hover +end + When(/^I hover over the author link$/) do on(FlowPage).author_link_element.fire_event('onmouseover') end @@ -76,3 +67,32 @@ page.contrib_link_element.should be_visible end end + +Then(/^the Cancel button should be visible$/) do + on(FlowPage).cancel_button_element.should exist +end + +Then(/^the Change Title button should be enabled$/) do + on(FlowPage).change_title_element.should be_visible +end + +Then(/^the Flow page should contain (.+)$/) do |flow_topic| + on(FlowPage) do |page| + page.wait_until(20) do # 10 seconds wasn't enough on ee-flow... + # TODO Also match the regexp '[2-9] seconds ago' in case of delays. + # TODO This should look in the particular topic that was added, not + # blindly look for text. + # It could note the ID of the first div with id 'flow-topic-<UUID>' + # before submitting the new topic post, + # then afterwards find the flow-topic-<UUID> div *preceding* that and search in there. + # Or after submit it could look for the Title of Flow Topic, find the + # flow-topic-container containing that and search in there. + page.text.include? '1 second ago' or page.text.include? 'just now' + end + page.flow_body.should match(flow_topic + @random_string + @automated_test_marker) + end +end + +Then(/^the title text field should be visible$/) do + on(FlowPage).title_textfield_element.when_present.should be_visible +end diff --git a/tests/browser/features/support/pages/flow_page.rb b/tests/browser/features/support/pages/flow_page.rb index 431eaf8..074d0bd 100644 --- a/tests/browser/features/support/pages/flow_page.rb +++ b/tests/browser/features/support/pages/flow_page.rb @@ -7,11 +7,16 @@ page_url URL.url('Special:Flow/Flow_QA') span(:author_link, class: 'flow-creator-simple') - a(:talk_link, text: 'Talk') + a(:cancel_button, class: 'flow-cancel-link mw-ui-button mw-ui-text') + button(:change_title, value: 'Change title') a(:contrib_link, text: 'contribs') - text_field(:new_topic_title, name: 'topic_list[topic]') + div(:flow_body, class: 'flow-container') text_area(: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') + text_field(:new_topic_title, name: 'topic_list[topic]') + a(:pencil_icon, text: 'Edit title') + a(:talk_link, text: 'Talk') + text_field(:title_textfield, class: 'mw-ui-input flow-edit-title-textbox') + unordered_list(:topic_post, class: 'flow-topic-posts-meta') end -- To view, visit https://gerrit.wikimedia.org/r/93069 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I68939276503c33e2354c0f4976d09f7bccf34485 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Cmcmahon <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
