diff --git a/modules/ve-mw/test/browser/Gemfile.lock b/modules/ve-mw/test/browser/Gemfile.lock index 816cda7131..926178e909 100644 --- a/modules/ve-mw/test/browser/Gemfile.lock +++ b/modules/ve-mw/test/browser/Gemfile.lock @@ -17,8 +17,11 @@ GEM faker (1.2.0) i18n (~> 0.5) ffi (1.9.0) + ffi (1.9.0-x86-mingw32) gherkin (2.12.1) multi_json (~> 1.3) + gherkin (2.12.1-x86-mingw32) + multi_json (~> 1.3) i18n (0.6.5) json (1.8.0) multi_json (1.8.0) @@ -46,6 +49,7 @@ GEM PLATFORMS ruby + x86-mingw32 DEPENDENCIES cucumber diff --git a/modules/ve-mw/test/browser/features/step_definitions/visual_editor_bullets_steps.rb b/modules/ve-mw/test/browser/features/step_definitions/visual_editor_bullets_steps.rb new file mode 100644 index 0000000000..591e132a1b --- /dev/null +++ b/modules/ve-mw/test/browser/features/step_definitions/visual_editor_bullets_steps.rb @@ -0,0 +1,103 @@ +Given(/^I close the VE information window$/) do + pending # express the regexp above with the code you wish you had +end + + When(/^I type in an input string$/) do + on(VisualEditorPage) do |page| + page.content_element.when_present.send_keys "This is a new line" + page.content_element.when_present.send_keys :return + end +end + +When(/^select the string$/) do + require "watir-webdriver/extensions/select_text" + on(VisualEditorPage).content_element.select_text "This is a new line" + #sleep 1 # turn the sleep on if this test fails with bullet/number in front of string NOT "This is.." +end + +When(/^I click Numbering$/) do + on(VisualEditorPage).ve_numbering_element.when_present.click +end + +Then(/^a \# is added in front of input string in the diff view$/) do + on(VisualEditorPage) do |page| + page.wait_until(10) do + page.heading_diff_view.include? '# This ' + end + page.heading_diff_view.should match Regexp.new(/^\# This is a new line/) + end +end + +When(/^I click Bullets$/) do + on(VisualEditorPage).ve_bullets_element.when_present.click +end + +Then(/^a \* is added in front of input string in the diff view$/) do + on(VisualEditorPage) do |page| + page.wait_until(10) do + page.heading_diff_view.include? '* This ' + end + page.heading_diff_view.should match Regexp.new(/^\* This is a new line/) + end +end + +When(/^I click Increase indentation$/) do + on(VisualEditorPage).increase_indentation_on_element.when_present.click +end + +Then(/^a \#\# is added in front of input string in the diff view$/) do + on(VisualEditorPage) do |page| + page.wait_until(10) do + page.heading_diff_view.include? '## This ' + end + page.heading_diff_view.should match Regexp.new(/^\#\# This is a new line/) + end +end + +Then(/^a \*\* is added in front of input string in the diff view$/) do + on(VisualEditorPage) do |page| + page.wait_until(10) do + page.heading_diff_view.include? '** This ' + end + page.heading_diff_view.should match Regexp.new(/^\*\* This is a new line/) + end +end + + +When(/^I click Decrease indentation$/) do + on(VisualEditorPage).decrease_indentation_on_element.when_present.click +end + +Then(/^nothing is added in front of input string in the diff view$/) do + on(VisualEditorPage) do |page| + page.wait_until(10) do + page.heading_diff_view.include? 'This ' + end + page.heading_diff_view.should match Regexp.new(/^This is a new line/) + end +end + +Then(/^Decrease indentation should be disabled$/) do + on(VisualEditorPage).decrease_indentation_element.class_name.should match /disabled/ +end + +Then(/^Increase indentation should be disabled$/) do + on(VisualEditorPage).increase_indentation_element.class_name.should match /disabled/ +end + + +Then(/^Decrease indentation should be enabled$/) do + on(VisualEditorPage).decrease_indentation_on_element.class_name.should_not match /disabled/ +end + +Then(/^Increase indentation should be enabled$/) do + on(VisualEditorPage).increase_indentation_on_element.class_name.should_not match /disabled/ +end + +When(/^I undo Bullets$/) do + on(VisualEditorPage).ve_bullets_element.when_present.click +end + +When(/^I undo Numbering$/) do + on(VisualEditorPage).ve_numbering_element.when_present.click +end diff --git a/modules/ve-mw/test/browser/features/step_definitions/visual_editor_references_steps.rb b/modules/ve-mw/test/browser/features/step_definitions/visual_editor_references_steps.rb index 9379b04266..eb45647386 100644 --- a/modules/ve-mw/test/browser/features/step_definitions/visual_editor_references_steps.rb +++ b/modules/ve-mw/test/browser/features/step_definitions/visual_editor_references_steps.rb @@ -14,6 +14,7 @@ When(/^I click Edit for VisualEditor$/) do page.beta_warning_element.when_present.click rescue end + page.content_element.fire_event('onfocus') end end diff --git a/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb b/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb index 09ab2e56fc..153238bc26 100644 --- a/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb +++ b/modules/ve-mw/test/browser/features/support/pages/visual_editor_page.rb @@ -4,6 +4,8 @@ class VisualEditorPage include URL page_url URL.url('User:Selenium_user') + a(:decrease_indentation, class: 've-ui-widget ve-ui-tool ve-ui-tool-outdent ve-ui-widget-disabled') + a(:decrease_indentation_on, title: 'Decrease indentation [SHIFT+TAB]') div(:container_disabled, class: 've-ui-widget ve-ui-widget-disabled ve-ui-flaggableElement-constructive ve-ui-buttonWidget') div(:content, class: 've-ce-documentNode ve-ce-branchNode') text_area(:describe_change, id: 've-init-mw-viewPageTarget-saveDialog-editSummary') @@ -12,6 +14,8 @@ class VisualEditorPage span(:heading, text: 'Heading') a(:edit_ve, title: 'Edit this page with VisualEditor [alt-shift-v]') div(:heading_diff_view, class: 've-init-mw-viewPageTarget-saveDialog-viewer') + a(:increase_indentation, class: 've-ui-widget ve-ui-tool ve-ui-tool-indent ve-ui-widget-disabled') + a(:increase_indentation_on, title: 'Increase indentation [TAB]') div(:insert_references, class: 've-ui-window-title') div(:internal_diff_view, class: 've-init-mw-viewPageTarget-saveDialog-viewer') span(:internal_linksuggestion, text: 'Main Page') @@ -32,15 +36,13 @@ class VisualEditorPage div(:save_disabled, class: 've-ui-widget ve-ui-widget-disabled ve-ui-flaggableElement-constructive ve-ui-buttonWidget') span(:save_page, class: 've-ui-labeledElement-label', text: 'Save page') span(:second_save_page, class: 've-ui-labeledElement-label', text: 'Save page', index: 1) - span(:subheading1, text: 'Sub-heading 1') - span(:subheading2, text: 'Sub-heading 2') - span(:subheading3, text: 'Sub-heading 3') - span(:subheading4, text: 'Sub-heading 4') div(:uparrow, class:'ve-init-mw-viewPageTarget-saveDialog-closeButton') + span(:ve_bullets, class: 've-ui-iconedElement-icon ve-ui-icon-bullet-list') div(:ve_heading_menu, class: 've-ui-dropdownTool-icon ve-ui-icon-down') span(:ve_heading_ui, text: 'Paragraph') span(:ve_link_icon, class: 've-ui-iconedElement-icon ve-ui-icon-link') span(:ve_references, text: 'Reference') + span(:ve_numbering, class: 've-ui-iconedElement-icon ve-ui-icon-number-list') div(:visual_editor_toolbar, class: 've-ui-toolbar-tools') span(:transclusion, text: 'Transclusion') diff --git a/modules/ve-mw/test/browser/features/visual_editor_bullets.feature b/modules/ve-mw/test/browser/features/visual_editor_bullets.feature new file mode 100644 index 0000000000..65331a4e4f --- /dev/null +++ b/modules/ve-mw/test/browser/features/visual_editor_bullets.feature @@ -0,0 +1,75 @@ +@ie6-bug @ie7-bug @ie8-bug @ie9-bug @ie10-bug @test2.wikipedia.org @login +Feature: VisualEditor Bullets, Numbering, Indent, Outdent + + Background: + Given I am logged in + And I am at my user page + And I click Edit for VisualEditor + And I type in an input string + And select the string + + Scenario: Check indentation controls disabled by default + Then Decrease indentation should be disabled + And Increase indentation should be disabled + + Scenario: Check indentation controls enabled upon creating Bullet + When I click Bullets + Then Decrease indentation should be enabled + And Increase indentation should be enabled + + Scenario: Check indentation controls enabled upon creating Numbering + When I click Numbering + Then Decrease indentation should be enabled + And Increase indentation should be enabled + + Scenario: Check indentation controls disabled upon undoing Bullet + When I click Bullets + And I undo Bullets + Then Decrease indentation should be disabled + And Increase indentation should be disabled + + Scenario: Check indentation controls enabled upon creating Numbering + When I click Numbering + And I undo Numbering + Then Decrease indentation should be disabled + And Increase indentation should be disabled + + Scenario: Test Numbering + When I click Numbering + And I click Save page + And I click Review your changes + Then a # is added in front of input string in the diff view + + Scenario: Test Bullets + When I click Bullets + And I click Save page + And I click Review your changes + Then a * is added in front of input string in the diff view + + Scenario: Indents for Numbering + When I click Numbering + And I click Increase indentation + And I click Save page + And I click Review your changes + Then a ## is added in front of input string in the diff view + + Scenario: Indents for Bullets + When I click Bullets + And I click Increase indentation + And I click Save page + And I click Review your changes + Then a ** is added in front of input string in the diff view + + Scenario: Outdents for Numbering + When I click Numbering + And I click Decrease indentation + And I click Save page + And I click Review your changes + Then nothing is added in front of input string in the diff view + + Scenario: Outdents for Bullets + When I click Bullets + And I click Decrease indentation + And I click Save page + And I click Review your changes + Then nothing is added in front of input string in the diff view