Cmcmahon has uploaded a new change for review. https://gerrit.wikimedia.org/r/86003
Change subject: WIP make test DRY, use Before hook ...................................................................... WIP make test DRY, use Before hook Change-Id: I6f127e675a3c9e7b6126c0f052dce781d1103b52 --- M modules/ve-mw/test/browser/features/step_definitions/visual_editor_headings_steps.rb A modules/ve-mw/test/browser/features/support/hooks.rb M modules/ve-mw/test/browser/features/visual_editor_headings.feature 3 files changed, 32 insertions(+), 126 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/03/86003/1 diff --git a/modules/ve-mw/test/browser/features/step_definitions/visual_editor_headings_steps.rb b/modules/ve-mw/test/browser/features/step_definitions/visual_editor_headings_steps.rb index 09304fc..a3c4eed 100644 --- a/modules/ve-mw/test/browser/features/step_definitions/visual_editor_headings_steps.rb +++ b/modules/ve-mw/test/browser/features/step_definitions/visual_editor_headings_steps.rb @@ -6,12 +6,12 @@ on(VisualEditorPage).paragraph_element.when_present.click end -Then(/^a paragraph should appear in the diff view$/) do +Then(/^a (.+) should appear in the diff view$/) do |headings_value| on(VisualEditorPage) do |page| page.wait_until(10) do - page.paragraph_diff_view.include? 'Editing ' + page.paragraph_diff_view.include? headings_value end - page.paragraph_diff_view.should match Regexp.new(/^Editing with /) + page.paragraph_diff_view.should match Regexp.new(headings_value) end end @@ -23,89 +23,26 @@ on(VisualEditorPage).heading_element.when_present.click end -Then(/^a heading should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? '==Editing ' - end - page.heading_diff_view.should match Regexp.new(/^==Editing with /) - end -end - -When(/^I click Sub\-Heading1$/) do +When(/^I click Subheading1$/) do on(VisualEditorPage).subheading1_element.when_present.click end -Then(/^a sub\-heading1 should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? '===Editing ' - end - page.heading_diff_view.should match Regexp.new(/^===Editing with /) - end -end - -When(/^I click Sub\-Heading2$/) do +When(/^I click Subheading2$/) do on(VisualEditorPage).subheading2_element.when_present.click end -Then(/^a sub\-heading2 should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? '====Editing ' - end - page.heading_diff_view.should match Regexp.new(/^====Editing with /) - end -end - -When(/^I click Sub\-Heading3$/) do +When(/^I click Subheading3$/) do on(VisualEditorPage).subheading3_element.when_present.click end -Then(/^a sub\-heading3 should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? '=====Editing ' - end - page.heading_diff_view.should match Regexp.new(/^=====Editing with /) - end -end - -When(/^I click Sub\-Heading4$/) do +When(/^I click Subheading4$/) do on(VisualEditorPage).subheading4_element.when_present.click -end - -Then(/^a sub\-heading4 should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? '======Editing ' - end - page.heading_diff_view.should match Regexp.new(/^======Editing with /) - end end When(/^I click Preformatted$/) do on(VisualEditorPage).preformatted_element.when_present.click end -Then(/^a Preformatted should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? ' Editing ' - end - page.heading_diff_view.should match Regexp.new(/^ Editing with /) - end -end - When(/^I click Page title$/) do on(VisualEditorPage).page_title_element.when_present.click -end - -Then(/^a Page title should appear in the diff view$/) do - on(VisualEditorPage) do |page| - page.wait_until(10) do - page.heading_diff_view.include? '=Editing ' - end - page.heading_diff_view.should match Regexp.new(/^=Editing with /) - end end diff --git a/modules/ve-mw/test/browser/features/support/hooks.rb b/modules/ve-mw/test/browser/features/support/hooks.rb new file mode 100644 index 0000000..ef4de53 --- /dev/null +++ b/modules/ve-mw/test/browser/features/support/hooks.rb @@ -0,0 +1,9 @@ + +Before('@set_up_edited_page') do + #if !$set_up_edited_page + step 'I am logged in' + step 'I am at my user page' + step 'I edit the page with a string' + $set_up_edited_page=true + #end +end \ No newline at end of file diff --git a/modules/ve-mw/test/browser/features/visual_editor_headings.feature b/modules/ve-mw/test/browser/features/visual_editor_headings.feature index 1aced46..09b6fc3 100644 --- a/modules/ve-mw/test/browser/features/visual_editor_headings.feature +++ b/modules/ve-mw/test/browser/features/visual_editor_headings.feature @@ -1,61 +1,21 @@ @ie6-bug @ie7-bug @ie8-bug @ie9-bug @ie10-bug @test2.wikipedia.org @en.wikipedia.beta.wmflabs.org @login Feature: VisualEditor Headings - Background: Open VE and edit page with string - Given I am logged in - And I am at my user page - When I edit the page with a string - And I click the down arrow on Headings interface - - Scenario: Choose Paragraph Heading - When I click Paragraph - And I click Save page - And I click Review your changes - Then a paragraph should appear in the diff view - - Scenario: Choose Heading Headinge - When I click Heading - And I click Save page - And I click Review your changes - Then a heading should appear in the diff view - - Scenario: Choose Subheading1 Heading - When I click Sub-Heading1 + @set_up_edited_page + Scenario Outline: Cycle through headings values + When I click the down arrow on Headings interface + And I click <headings_value> And I click Save page And I click Review your changes - Then a sub-heading1 should appear in the diff view - - Scenario: Choose Sub-Heading2 Heading - And I click Sub-Heading2 - And I click Save page - And I click Review your changes - Then a sub-heading2 should appear in the diff view - And I should be able to click the up arrow on the save box - - Scenario: Choose Sub-Heading3 Heading - And I click Sub-Heading3 - And I click Save page - And I click Review your changes - Then a sub-heading3 should appear in the diff view - And I should be able to click the up arrow on the save box - - Scenario: Choose Sub-Heading4 Heading - And I click Sub-Heading4 - And I click Save page - And I click Review your changes - Then a sub-heading4 should appear in the diff view - And I should be able to click the up arrow on the save box - - Scenario: Choose Preformatted Headinge - And I click Preformatted - And I click Save page - And I click Review your changes - Then a Preformatted should appear in the diff view - And I should be able to click the up arrow on the save box - - Scenario: Choose Page title Heading - And I click Page title - And I click Save page - And I click Review your changes - Then a Page title should appear in the diff view - And I should be able to click the up arrow on the save box + Then a <headings_string> should appear in the diff view + Examples: + | headings_value | headings_string | + | Paragraph | Editing | + | Heading | ==Editing | + | Subheading1 | ===Editing | + | Subheading2 | ====Editing | + | Subheading3 | =====Editing | + | Subheading4 | ======Editing | + | Preformatted | Editing | + | Page title | =Editing | + \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/86003 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6f127e675a3c9e7b6126c0f052dce781d1103b52 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Cmcmahon <cmcma...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits