diff --git a/modules/ve-mw/tests/browser/features/step_definitions/bullets_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/bullets_steps.rb index 4d76e0e72e..7c2ee42543 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/bullets_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/bullets_steps.rb @@ -1,9 +1,34 @@ - -Given(/^I close the VE information window$/) do - pending # express the regexp above with the code you wish you had +When(/^I click Bullets$/) do + on(VisualEditorPage) do |page| + page.bullet_number_selector_element.when_present(15).click + page.ve_bullets_element.when_present.click + end end - When(/^I type in an input string$/) do +When(/^I click Decrease indentation$/) do + on(VisualEditorPage) do |page| + sleep 2 #this is waiting for the Review Your Changes iframe to disappear + step "I click in the editable part" + page.bullet_number_selector_element.when_present(15).click + page.decrease_indentation_element.when_present.click + end +end + +When(/^I click Increase indentation$/) do + on(VisualEditorPage) do |page| + page.bullet_number_selector_element.when_present(15).click + page.increase_indentation_element.when_present.click + end +end + +When(/^I click Numbering$/) do + on(VisualEditorPage) do |page| + page.bullet_number_selector_element.when_present(15).click + page.ve_numbering_element.when_present.click + end +end + +When(/^I type in an input string$/) do on(VisualEditorPage) do |page| #extra space after 'line' below is a workaround for FF issue where VE is sending BACKSPACE before RETURN #probably caused by https://bugzilla.wikimedia.org/show_bug.cgi?id=56274 @@ -12,19 +37,26 @@ end 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.." +When(/^I undo Bullets$/) do + on(VisualEditorPage) do |page| + page.bullet_number_selector_element.when_present(15).click + page.ve_bullets_element.when_present.click + end end -When(/^I click Numbering$/) do +When(/^I undo Numbering$/) do on(VisualEditorPage) do |page| page.bullet_number_selector_element.when_present(15).click page.ve_numbering_element.when_present.click 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 + Then(/^a \# is added in front of input string in the diff view$/) do on(VisualEditorPage) do |page| page.wait_until(10) do @@ -34,13 +66,6 @@ Then(/^a \# is added in front of input string in the diff view$/) do end end -When(/^I click Bullets$/) do - on(VisualEditorPage) do |page| - page.bullet_number_selector_element.when_present(15).click - page.ve_bullets_element.when_present.click - 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 @@ -50,13 +75,6 @@ Then(/^a \* is added in front of input string in the diff view$/) do end end -When(/^I click Increase indentation$/) do - on(VisualEditorPage) do |page| - page.bullet_number_selector_element.when_present(15).click - page.increase_indentation_element.when_present.click - 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 @@ -75,14 +93,20 @@ Then(/^a \*\* is added in front of input string in the diff view$/) do end end +Then(/^Decrease indentation should be enabled$/) do + on(VisualEditorPage).decrease_indentation_element.class_name.should_not match /disabled/ +end -When(/^I click Decrease indentation$/) do - on(VisualEditorPage) do |page| - sleep 2 #this is waiting for the Review Your Changes iframe to disappear - step "I click in the editable part" - page.bullet_number_selector_element.when_present(15).click - page.decrease_indentation_element.when_present.click - end +Then(/^Decrease indentation should be disabled$/) do + on(VisualEditorPage).decrease_indentation_element.should_not be_visible +end + +Then(/^Increase indentation should be enabled$/) do + on(VisualEditorPage).increase_indentation_element.class_name.should_not match /disabled/ +end + +Then(/^Increase indentation should be disabled$/) do + on(VisualEditorPage).increase_indentation_element.should_not be_visible end Then(/^nothing is added in front of input string in the diff view$/) do @@ -93,34 +117,3 @@ Then(/^nothing is added in front of input string in the diff view$/) do page.review_failed_element.when_present.text.should match "No changes to review" end end - -Then(/^Decrease indentation should be disabled$/) do - on(VisualEditorPage).decrease_indentation_element.should_not be_visible -end - -Then(/^Increase indentation should be disabled$/) do - on(VisualEditorPage).increase_indentation_element.should_not be_visible -end - - -Then(/^Decrease indentation should be enabled$/) do - on(VisualEditorPage).decrease_indentation_element.class_name.should_not match /disabled/ -end - -Then(/^Increase indentation should be enabled$/) do - on(VisualEditorPage).increase_indentation_element.class_name.should_not match /disabled/ -end - -When(/^I undo Bullets$/) do - on(VisualEditorPage) do |page| - page.bullet_number_selector_element.when_present(15).click - page.ve_bullets_element.when_present.click - end -end - -When(/^I undo Numbering$/) do - on(VisualEditorPage) do |page| - page.bullet_number_selector_element.when_present(15).click - page.ve_numbering_element.when_present.click - end -end