Vikassy has uploaded a new change for review. https://gerrit.wikimedia.org/r/172245
Change subject: Auto corrected rubocop errors ...................................................................... Auto corrected rubocop errors Change-Id: I3e00339ec9e0360e68fb40bb5b7095ce2445558e --- M modules/ve-mw/tests/browser/features/step_definitions/bullets_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/cite_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/headings_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/multiedit_workflow_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/references_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/shared_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/switch_editing_mode_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/transclusion_steps.rb M modules/ve-mw/tests/browser/features/step_definitions/verify_production_wikis_steps.rb M modules/ve-mw/tests/browser/features/support/env.rb M modules/ve-mw/tests/browser/features/support/hooks.rb M modules/ve-mw/tests/browser/features/support/language_screenshot.rb M modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb M modules/ve-mw/tests/browser/features/support/pages/user_page.rb M modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb M modules/ve-mw/tests/browser/features/support/pages/zarticlepage.rb M modules/ve-mw/tests/browser/spec/rectangle_spec.rb M modules/ve-mw/tests/browser/upload.rb 22 files changed, 376 insertions(+), 386 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/45/172245/1 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 4d76e0e..61eda7f 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 @@ -3,18 +3,18 @@ pending # express the regexp above with the code you wish you had end - When(/^I type in an input string$/) do +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 - page.content_element.when_present(10).send_keys "This is a new line " + # 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 + page.content_element.when_present(10).send_keys 'This is a new line ' page.content_element.when_present(10).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" + 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 @@ -75,11 +75,10 @@ end 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" + 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 @@ -88,9 +87,9 @@ Then(/^nothing is added in front of input string in the diff view$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.review_failed_element.when_present.text.include? "No changes to review" + page.review_failed_element.when_present.text.include? 'No changes to review' end - page.review_failed_element.when_present.text.should match "No changes to review" + page.review_failed_element.when_present.text.should match 'No changes to review' end end @@ -101,7 +100,6 @@ 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/ diff --git a/modules/ve-mw/tests/browser/features/step_definitions/cite_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/cite_steps.rb index 5d7a3c1..aa3f9d3 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/cite_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/cite_steps.rb @@ -105,36 +105,36 @@ Then(/^diff view should show the Book citation added$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "Cite VisualEditor Test" + page.diff_view.include? 'Cite VisualEditor Test' end - page.diff_view.should match Regexp.escape("<ref>{{Cite book|title = Book title|last = Book author last name|first = Book author first name|publisher = Book publisher|year = 2014|isbn = 9780743273565|location = Location of publication|pages = 123|New book field = New book field contents}}</ref>Cite VisualEditor Test") + page.diff_view.should match Regexp.escape('<ref>{{Cite book|title = Book title|last = Book author last name|first = Book author first name|publisher = Book publisher|year = 2014|isbn = 9780743273565|location = Location of publication|pages = 123|New book field = New book field contents}}</ref>Cite VisualEditor Test') end end Then(/^diff view should show the Journal citation added$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "Cite VisualEditor Test" + page.diff_view.include? 'Cite VisualEditor Test' end - page.diff_view.should match Regexp.escape("<ref>{{Cite journal|title = Journal title|date = Journal Source date}}</ref>Cite VisualEditor Test") + page.diff_view.should match Regexp.escape('<ref>{{Cite journal|title = Journal title|date = Journal Source date}}</ref>Cite VisualEditor Test') end end Then(/^diff view should show the News citation added$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "Cite VisualEditor Test" + page.diff_view.include? 'Cite VisualEditor Test' end - page.diff_view.should match Regexp.escape("<ref>{{Cite news|url = News URL|title = News Source title|last = News Last name|first = News First name|date = News Source date|work = News Work|accessdate = News URL access date}}</ref>Cite VisualEditor Test") + page.diff_view.should match Regexp.escape('<ref>{{Cite news|url = News URL|title = News Source title|last = News Last name|first = News First name|date = News Source date|work = News Work|accessdate = News URL access date}}</ref>Cite VisualEditor Test') end end Then(/^diff view should show the Website citation added$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "Cite VisualEditor Test" + page.diff_view.include? 'Cite VisualEditor Test' end - page.diff_view.should match Regexp.escape("<ref>{{Cite web|url = http://en.wikipedia.org/|title = Website Source title|date = Website Source date 28 July 2014|accessdate = {{CURRENTMONTHNAME}} {{CURRENTYEAR}}28 July 2014|website = Website title|publisher = Website publisher|last = Website Last name|first = Website First name|New website field = New website field contents}}</ref>Cite VisualEditor Test") + page.diff_view.should match Regexp.escape('<ref>{{Cite web|url = http://en.wikipedia.org/|title = Website Source title|date = Website Source date 28 July 2014|accessdate = {{CURRENTMONTHNAME}} {{CURRENTYEAR}}28 July 2014|website = Website title|publisher = Website publisher|last = Website Last name|first = Website First name|New website field = New website field contents}}</ref>Cite VisualEditor Test') end end @@ -149,7 +149,3 @@ Then(/^I should see the VisualEditor interface$/) do expect(on(VisualEditorPage).cite_visualeditor_user_interface_element).to be_visible end - - - - diff --git a/modules/ve-mw/tests/browser/features/step_definitions/headings_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/headings_steps.rb index 0083891..bd76d82 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/headings_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/headings_steps.rb @@ -11,9 +11,9 @@ # Contents pulled from the Cucumber tables in the .feature are escaped regexes. # In this case we want unescaped regexes (and in one case a leading space) # So we put single quotes around the entries in the .feature file and strip them here to get unescaped regexes. - headings_string = headings_string.gsub(/"/, "") + headings_string = headings_string.gsub(/"/, '') page.wait_until(10) do - page.diff_view.include? "Your text" + page.diff_view.include? 'Your text' end page.diff_view.should match Regexp.new(headings_string) end @@ -43,6 +43,6 @@ on(VisualEditorPage).preformatted_element.when_present.click end - When(/^I click Page title$/) do +When(/^I click Page title$/) do on(VisualEditorPage).page_title_element.when_present.click end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb index 87e566e..b2dd0cd 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb @@ -1,18 +1,18 @@ Given(/^I go to the "(.*?)" page which has a media image$/) do |page_title| - wikitext = "[[File:2012-07-18 Market Street - San Francisco.webm|thumb]]" + wikitext = '[[File:2012-07-18 Market Street - San Francisco.webm|thumb]]' step "I go to the \"#{page_title}\" page with source content \"#{wikitext}\"" end Given(/^I select the image in VisualEditor$/) do - step "I click in the editable part" + step 'I click in the editable part' on(VisualEditorPage).media_image_element.when_present.click end Given (/^I go to "(.+)" page which has references$/) do |page_title| - wikitext = "VisualEditor is a MediaWiki extension.<ref>[http://www.mediawiki.org/wiki/Extension:VisualEditor Extension:VisualEditor]</ref>" + wikitext = 'VisualEditor is a MediaWiki extension.<ref>[http://www.mediawiki.org/wiki/Extension:VisualEditor Extension:VisualEditor]</ref>' on(APIPage).create page_title, wikitext step "I go to the #{page_title} page for screenshot" - step "I click in the editable part" + step 'I click in the editable part' end Given(/^I go to the "(.*?)" page with source content "(.*?)"$/) do |page_title, page_content| @@ -27,19 +27,19 @@ Given(/^I am editing language screenshot page$/) do step "I go to the \"Language Screenshot\" page with source content \"Language Screenshot\"" - step "I click in the editable part" + step 'I click in the editable part' end Given(/^I am edit language screenshot page with (.+)$/) do |content| - step "I am editing language screenshot page" + step 'I am editing language screenshot page' step "I edit the page with #{content}" end -Given(/^I select an image by searching (.+) in Media option$/) do |content| - step "I click in the editable part" - step "I click Media" - step "I enter San Francisco into media Search box" - step "I select an Image" +Given(/^I select an image by searching (.+) in Media option$/) do |_content| + step 'I click in the editable part' + step 'I click Media' + step 'I enter San Francisco into media Search box' + step 'I select an Image' end Given(/^I enter "(.*?)" in alternative text$/) do |content| @@ -55,8 +55,8 @@ end When(/^I click on the Special character option in Insert menu$/) do - step "I click on the Insert menu" - step "I click on More in insert pull-down menu" + step 'I click on the Insert menu' + step 'I click on More in insert pull-down menu' on(VisualEditorPage).special_character_element.when_present.click end @@ -87,7 +87,7 @@ When(/^I send right arrow times (\d+)$/) do |number| number.to_i.times do on(VisualEditorPage).content_element.send_keys :arrow_right - on(VisualEditorPage).content_element.fire_event("onblur") #gerrit 86800/86801 + on(VisualEditorPage).content_element.fire_event('onblur') # gerrit 86800/86801 end end @@ -96,28 +96,28 @@ end When(/^I click on category in hamburger menu$/) do - step "I click the hamburger menu" + step 'I click the hamburger menu' on(VisualEditorPage).category_link_element.when_present.click end When(/^I click on Formula option in Insert menu$/) do - step "I click on the Insert menu" + step 'I click on the Insert menu' on(VisualEditorPage).formula_link_element.when_present.click end When(/^I type a formula$/) do - on(VisualEditorPage).formula_area_element.when_present.send_keys "2+2" + on(VisualEditorPage).formula_area_element.when_present.send_keys '2+2' end When(/^I go to random page for screenshot$/) do - step "I am at a random page" + step 'I am at a random page' @browser.goto "#{@browser.url}?setlang=#{ENV['LANGUAGE_SCREENSHOT_CODE']}" end When(/^I click on References list in Insert menu$/) do - step "I click in the editable part" - step "I click on the Insert menu" - step "I click on More in insert pull-down menu" + step 'I click in the editable part' + step 'I click on the Insert menu' + step 'I click on More in insert pull-down menu' on(VisualEditorPage).ve_references_element.when_present.click end @@ -128,7 +128,7 @@ Then(/^I should see Headings pull-down menu$/) do on(VisualEditorPage).heading_dropdown_menus_element.when_present.should be_visible - step "I take screenshot of pull-dowm menu" + step 'I take screenshot of pull-dowm menu' end Then(/^I take screenshot of pull-dowm menu$/) do @@ -137,16 +137,16 @@ Then(/^I should see Formatting pull-down menu$/) do on(VisualEditorPage).formatting_option_menus_element.when_present.should be_visible - step "I take screenshot of Formatting pull-down menu" + step 'I take screenshot of Formatting pull-down menu' end Then(/^I take screenshot of Formatting pull-down menu$/) do - capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.ve_text_style_element,@current_page.formatting_option_menus_element]) + capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.ve_text_style_element, @current_page.formatting_option_menus_element]) end Then(/^I should see pull-down menu containing Page Settings$/) do on(VisualEditorPage).page_settings_element.when_present.should be_visible - step "I take screenshot of Visual Editor insert menu" + step 'I take screenshot of Visual Editor insert menu' end Then(/^I take screenshot of Visual Editor insert menu$/) do @@ -155,11 +155,11 @@ Then(/^I should see Insert pull-down menu$/) do on(VisualEditorPage).insert_pull_down_element.when_present.should be_visible - step "I take screenshot of insert pull-down menu" + step 'I take screenshot of insert pull-down menu' end Then(/^I take screenshot of insert pull-down menu$/) do - step "I click on More in insert pull-down menu" + step 'I click on More in insert pull-down menu' capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.insert_menu_element, @current_page.insert_pull_down_element]) highlight @current_page.media_insert_menu_element @@ -297,6 +297,6 @@ end When(/^I go to language screenshot page$/) do - step "I am on the Language Screenshot page" + step 'I am on the Language Screenshot page' @browser.goto "#{@browser.url}&setlang=#{ENV['LANGUAGE_SCREENSHOT_CODE']}" end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb index 1e39390..5649bd9 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb @@ -1,12 +1,12 @@ When(/^I click the Link button$/) do - sleep 1 #Chrome seems to not honor when_present correctly as of 5 Dec 2013 + sleep 1 # Chrome seems to not honor when_present correctly as of 5 Dec 2013 on(VisualEditorPage).ve_link_icon_element.when_present.click end Given(/^I can see the Link User Inteface$/) do on(VisualEditorPage) do |page| page.ve_link_ui_element.when_present - page.ve_link_ui.should match Regexp.escape("Link") + page.ve_link_ui.should match Regexp.escape('Link') end end @@ -17,27 +17,27 @@ Then(/^an external link appears in the diff view$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "example.com" + page.diff_view.include? 'example.com' end - page.diff_view.should match Regexp.escape("[http://www.example.com Links]") + page.diff_view.should match Regexp.escape('[http://www.example.com Links]') end end Then(/^an internal link appears in the diff view$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "Main Page" + page.diff_view.include? 'Main Page' end - page.diff_view.should match Regexp.escape("[[Main Page|Links]]") + page.diff_view.should match Regexp.escape('[[Main Page|Links]]') end end Then(/^a non\-existing link appears in the diff view$/) do on(VisualEditorPage) do |page| page.wait_until(10) do - page.diff_view.include? "DoesNotExist" + page.diff_view.include? 'DoesNotExist' end - page.diff_view.should match Regexp.escape("[[DoesNotExist|Links]]") + page.diff_view.should match Regexp.escape('[[DoesNotExist|Links]]') end end @@ -52,4 +52,3 @@ When(/^I click Links Review your changes$/) do on(VisualEditorPage).review_changes_element.when_present.click end - diff --git a/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb index 35a7226..608742d 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb @@ -11,7 +11,7 @@ When(/^I select an Image$/) do on(VisualEditorPage).media_select_element.when_present.click - end +end Then(/^(.+) should appear in the media diff view$/) do |headings_string| on(VisualEditorPage) do |page| @@ -20,7 +20,7 @@ # So we put single quotes around the entries in the .feature file and strip them here to get unescaped regexes. headings_string = headings_string.gsub(/'/, '') page.wait_until(15) do - page.diff_view.include? "Your text" + page.diff_view.include? 'Your text' end page.diff_view.should match Regexp.new(headings_string) end @@ -28,4 +28,4 @@ Then(/^I can click the X on the media save box$/) do on(VisualEditorPage).media_exit_element.when_present.click -end \ No newline at end of file +end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/multiedit_workflow_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/multiedit_workflow_steps.rb index f8095ab..6f3dacb 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/multiedit_workflow_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/multiedit_workflow_steps.rb @@ -1,11 +1,11 @@ When(/^I enter and save the first edit$/) do - @first_edit_text = "Editing with " + Random.rand.to_s + @first_edit_text = 'Editing with ' + Random.rand.to_s step "I insert the text #{@first_edit_text}" - step "I click Save page" - step "I click This is a minor edit" - step "I click Review your changes" - step "I click Return to save form" - step "I click Save page the second time" + step 'I click Save page' + step 'I click This is a minor edit' + step 'I click Review your changes' + step 'I click Return to save form' + step 'I click Save page the second time' end When(/^I enter and save a (.+) edit$/) do |count| @@ -13,13 +13,13 @@ page.wait_until(10) do page.medium_dialog_element.visible? == false end - edit_text = "Editing with " + Random.rand.to_s + edit_text = 'Editing with ' + Random.rand.to_s instance_variable_set("@#{count}_edit_text", edit_text) sleep 2 - step "I click Edit for VisualEditor" + step 'I click Edit for VisualEditor' step "I insert the text #{edit_text}" - step "I click Save page" - step "I click Save page the second time" + step 'I click Save page' + step 'I click Save page the second time' end end @@ -32,5 +32,5 @@ end Then(/^the saved page should contain all three edits\.$/) do - on(VisualEditorPage).page_text_element.when_present(10).text.should match(@third_edit_text + @second_edit_text + "Editing with " + @random_string + " " + @first_edit_text) -end \ No newline at end of file + on(VisualEditorPage).page_text_element.when_present(10).text.should match(@third_edit_text + @second_edit_text + 'Editing with ' + @random_string + ' ' + @first_edit_text) +end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb index ed0c7b7..40be70d 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb @@ -23,9 +23,9 @@ end Then(/^the options overlay should display Advanced Settings$/) do - expect(on(VisualEditorPage).options_settings_content_element.text).to match "Advanced settings" + expect(on(VisualEditorPage).options_settings_content_element.text).to match 'Advanced settings' end Then(/^the options overlay should display Page Settings$/) do - expect(on(VisualEditorPage).options_settings_content_element.text).to match "Page settings" -end \ No newline at end of file + expect(on(VisualEditorPage).options_settings_content_element.text).to match 'Page settings' +end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/references_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/references_steps.rb index b45e7ed..15909f0 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/references_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/references_steps.rb @@ -4,12 +4,12 @@ ==References== <references />" - on(APIPage).create "Reference VisualEditor Test", wikitext + on(APIPage).create 'Reference VisualEditor Test', wikitext step 'I am on the Reference VisualEditor Test page' end Given(/^I can see the References User Interface$/) do - on(VisualEditorPage).title.should match "Reference" + on(VisualEditorPage).title.should match 'Reference' end When(/^I click Insert references list$/) do @@ -20,7 +20,7 @@ on(VisualEditorPage) do |page| page.edit_ve_element.when_present.click # no longer need to dismiss beta warning here https://gerrit.wikimedia.org/r/#/c/119217/ - page.content_element.when_present(10).fire_event("onfocus") + page.content_element.when_present(10).fire_event('onfocus') end end @@ -48,9 +48,9 @@ end When(/^I create a reference using existing reference$/) do - step("I click Reference") - step("I click use an existing reference button in References User Interface") - step("I click on Extension:VisualEditor reference") + step('I click Reference') + step('I click use an existing reference button in References User Interface') + step('I click on Extension:VisualEditor reference') end Then(/^first link to reference should be visible$/) do @@ -67,4 +67,4 @@ Then(/^link to Insert menu should be visible$/) do on(VisualEditorPage).insert_menu_element.should be_visible -end \ No newline at end of file +end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/shared_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/shared_steps.rb index 7e619d7..f818783 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/shared_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/shared_steps.rb @@ -1,13 +1,13 @@ Given(/^I go to the browser specific edit page page$/) do - page_title = "Edit page for " + ENV['BROWSER'] - page_content = "Edit page for " + ENV['BROWSER'] + page_title = 'Edit page for ' + ENV['BROWSER'] + page_content = 'Edit page for ' + ENV['BROWSER'] on(APIPage).create page_title, page_content step "I am on the #{page_title} page" end Given(/^I am on the (.+) page$/) do |article| article = article.gsub(/ /, '_') - visit(ZtargetPage, :using_params => {:article_name => article}) + visit(ZtargetPage, using_params: { article_name: article }) end Given(/^I go to the "(.+)" page with content "(.+)"$/) do |page_title, page_content| @@ -18,14 +18,14 @@ Given(/^I click in the editable part$/) do on(VisualEditorPage) do |page| - page.content_element.when_present.fire_event("onfocus") - page.content_element.send_keys("") + page.content_element.when_present.fire_event('onfocus') + page.content_element.send_keys('') end end Given(/^I make the text "(.*?)" be selected$/) do |select_text| on(VisualEditorPage).content_element.when_present.click - require "watir-webdriver/extensions/select_text" + require 'watir-webdriver/extensions/select_text' on(VisualEditorPage).content_element.when_present.select_text select_text sleep 1 # turn the sleep on if this test fails with bullet/number in front of string NOT "This is.." end @@ -45,8 +45,8 @@ end When(/^I click This is a minor edit$/) do - #FIXME TEMPORARILY COMMENT THIS OUT WHILE WE FIGURE OUT WHY USERS GET LOGGED OUT - #on(VisualEditorPage).minor_edit_element.when_present(10).click + # FIXME TEMPORARILY COMMENT THIS OUT WHILE WE FIGURE OUT WHY USERS GET LOGGED OUT + # on(VisualEditorPage).minor_edit_element.when_present(10).click end When(/^I click Save page$/) do @@ -57,7 +57,7 @@ end When(/^I click Save page the second time$/) do - on(VisualEditorPage).second_save_page_element.when_present.click + on(VisualEditorPage).second_save_page_element.when_present.click end When(/^I do not see This is a minor edit$/) do @@ -66,7 +66,7 @@ When(/^I edit the page with (.+)$/) do |input_string| on(VisualEditorPage) do |page| - #page is loading everything twice, sleep just to make the test pass + # page is loading everything twice, sleep just to make the test pass sleep 5 page.content_element.when_present.send_keys(input_string + " #{@random_string} ") end @@ -89,7 +89,7 @@ end When(/^I see the IP warning signs$/) do - on(VisualEditorPage).ip_warning.should match Regexp.escape("Your IP address") + on(VisualEditorPage).ip_warning.should match Regexp.escape('Your IP address') end Then(/^Page text should contain (.+)$/) do |output_string| diff --git a/modules/ve-mw/tests/browser/features/step_definitions/switch_editing_mode_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/switch_editing_mode_steps.rb index a0c329c..3c645d6 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/switch_editing_mode_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/switch_editing_mode_steps.rb @@ -42,16 +42,16 @@ Then(/^I should be in wikitext editing mode$/) do on(VisualEditorPage) do |page| page.wait_until(15) do - page.text.include? "Editing Edit page for" + page.text.include? 'Editing Edit page for' end end - @browser.url.should eql(ENV['MEDIAWIKI_URL'] + "Edit page for " + ENV['BROWSER'] + "?action=submit") + @browser.url.should eql(ENV['MEDIAWIKI_URL'] + 'Edit page for ' + ENV['BROWSER'] + '?action=submit') end Then(/^I should be in Visual Editor editing mode$/) do on(VisualEditorPage) do |page| page.wait_until(15) do - page.text.include? "Edit page for" + page.text.include? 'Edit page for' end end expected_url = /w\/index\.php\?title=Edit_page_for_#{ENV['BROWSER']}&veaction=edit/ @@ -61,7 +61,7 @@ Then(/^I should be in Visual Editor editing alternate mode$/) do on(VisualEditorPage) do |page| page.wait_until(15) do - page.text.include? "Edit page for" + page.text.include? 'Edit page for' end page.content_element.when_present.should be_visible end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/transclusion_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/transclusion_steps.rb index 66776c3..06cd368 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/transclusion_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/transclusion_steps.rb @@ -1,7 +1,7 @@ Given(/^I can see the Transclusion User Interface$/) do on(VisualEditorPage) do |page| page.title_element.when_present - page.title.should match "Add a template" + page.title.should match 'Add a template' end end diff --git a/modules/ve-mw/tests/browser/features/step_definitions/verify_production_wikis_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/verify_production_wikis_steps.rb index 0e94fa0..d165937 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/verify_production_wikis_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/verify_production_wikis_steps.rb @@ -1,5 +1,5 @@ When(/^I visit a non-existent page at (.+)$/) do |site| - visit(DummyPage, :using_params => {:site => site}) + visit(DummyPage, using_params: { site: site }) end Then(/^I should see the Visual Editor editing surface$/) do diff --git a/modules/ve-mw/tests/browser/features/support/env.rb b/modules/ve-mw/tests/browser/features/support/env.rb index 4ed657f..1083f49 100644 --- a/modules/ve-mw/tests/browser/features/support/env.rb +++ b/modules/ve-mw/tests/browser/features/support/env.rb @@ -1,6 +1,6 @@ -require_relative "hooks" -require_relative "language_screenshot" -require "mediawiki_selenium" -require "mediawiki_api" +require_relative 'hooks' +require_relative 'language_screenshot' +require 'mediawiki_selenium' +require 'mediawiki_api' include MediawikiApi diff --git a/modules/ve-mw/tests/browser/features/support/hooks.rb b/modules/ve-mw/tests/browser/features/support/hooks.rb index 8c242ef..0bc32da 100644 --- a/modules/ve-mw/tests/browser/features/support/hooks.rb +++ b/modules/ve-mw/tests/browser/features/support/hooks.rb @@ -1,17 +1,17 @@ at_exit do - $browser.close unless ENV["KEEP_BROWSER_OPEN"] == "true" + $browser.close unless ENV['KEEP_BROWSER_OPEN'] == 'true' end -#This is for the multiedit test -Before("@edit_user_page_login") do - if (!$edit_user_page_login or !(ENV["REUSE_BROWSER"] == "true")) and @browser - step "I am logged in" - step "I go to the browser specific edit page page" - step "I edit the page with Editing with" - $edit_user_page_login=true +# This is for the multiedit test +Before('@edit_user_page_login') do + if (!$edit_user_page_login || !(ENV['REUSE_BROWSER'] == 'true')) && @browser + step 'I am logged in' + step 'I go to the browser specific edit page page' + step 'I edit the page with Editing with' + $edit_user_page_login = true end end -Before("@language_screenshot") do |scenario| +Before('@language_screenshot') do |scenario| @scenario = scenario end diff --git a/modules/ve-mw/tests/browser/features/support/language_screenshot.rb b/modules/ve-mw/tests/browser/features/support/language_screenshot.rb index a4cc85d..dad782d 100644 --- a/modules/ve-mw/tests/browser/features/support/language_screenshot.rb +++ b/modules/ve-mw/tests/browser/features/support/language_screenshot.rb @@ -1,5 +1,5 @@ -def capture_screenshot(file_name, page_elements, offset_element=nil, browser_zoom=1) - screenshot_directory = ENV["LANGUAGE_SCREENSHOT_PATH"] || "screenshots" +def capture_screenshot(file_name, page_elements, offset_element = nil, browser_zoom = 1) + screenshot_directory = ENV['LANGUAGE_SCREENSHOT_PATH'] || 'screenshots' FileUtils.mkdir_p screenshot_directory screenshot_path = "#{screenshot_directory}/#{file_name}" @@ -15,11 +15,11 @@ crop_image screenshot_path, page_elements, offset_element end -def crop_image path, page_elements, offset_element +def crop_image(path, page_elements, offset_element) if offset_element offset_rectangle = coordinates_from_page_element(offset_element) else - offset_rectangle = [0,0,0,0] + offset_rectangle = [0, 0, 0, 0] end rectangles = coordinates_from_page_elements(page_elements) crop_rectangle = rectangle(rectangles, offset_rectangle) @@ -29,7 +29,7 @@ width = crop_rectangle[2] height = crop_rectangle[3] - require "chunky_png" + require 'chunky_png' image = ChunkyPNG::Image.from_file path # It happens with some elements that an image goes off the screen a bit, @@ -42,9 +42,9 @@ image.save path end -def rectangle rectangles, offset_rectangle=[0,0,0,0] +def rectangle(rectangles, offset_rectangle = [0, 0, 0, 0]) top_left_x, top_left_y = top_left_x_y rectangles - bottom_right_x , bottom_right_y = bottom_right_x_y rectangles + bottom_right_x, bottom_right_y = bottom_right_x_y rectangles # Finding width and height width = bottom_right_x - top_left_x @@ -55,51 +55,51 @@ y_offset = offset_rectangle[1] # The new rectangle is constructed with all the co-ordinates calculated above - [top_left_x+x_offset, top_left_y+y_offset, width, height] + [top_left_x + x_offset, top_left_y + y_offset, width, height] end -def coordinates_from_page_elements page_elements +def coordinates_from_page_elements(page_elements) page_elements.collect do |page_element| coordinates_from_page_element page_element end end -def coordinates_from_page_element page_element +def coordinates_from_page_element(page_element) [page_element.element.wd.location.x, page_element.element.wd.location.y, page_element.element.wd.size.width, page_element.element.wd.size.height] end -def top_left_x_coordinates input_rectangles +def top_left_x_coordinates(input_rectangles) input_rectangles.collect do |rectangle| rectangle[0] end end -def top_left_y_coordinates input_rectangles +def top_left_y_coordinates(input_rectangles) input_rectangles.collect do |rectangle| rectangle[1] end end -def bottom_right_x_coordinates input_rectangles +def bottom_right_x_coordinates(input_rectangles) input_rectangles.collect do |rectangle| - rectangle[0]+rectangle[2] + rectangle[0] + rectangle[2] end end -def bottom_right_y_coordinates input_rectangles +def bottom_right_y_coordinates(input_rectangles) input_rectangles.collect do |rectangle| - rectangle[1]+rectangle[3] + rectangle[1] + rectangle[3] end end -def bottom_right_x_y input_rectangles +def bottom_right_x_y(input_rectangles) [bottom_right_x_coordinates(input_rectangles).max, bottom_right_y_coordinates(input_rectangles).max] end -def top_left_x_y input_rectangles +def top_left_x_y(input_rectangles) [top_left_x_coordinates(input_rectangles).min, top_left_y_coordinates(input_rectangles).min] end -def highlight element, color='#FF00FF' +def highlight(element, color = '#FF00FF') @current_page.execute_script("arguments[0].style.border = 'thick solid #{color}'", element) end diff --git a/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb b/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb index b3cec8c..11f099a 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/dummy_page.rb @@ -2,9 +2,8 @@ include PageObject include URL - page_url ("http://<%=params[:site]%>/wiki/asdfdgfghlkj?veaction=edit") + page_url ('http://<%=params[:site]%>/wiki/asdfdgfghlkj?veaction=edit') - div(:ve_editing_surface, :class => "ve-ui-surface ve-init-mw-viewPageTarget-surface") - div(:ve_editing_toolbar, :class => "oo-ui-toolbar-bar") - + div(:ve_editing_surface, class: 've-ui-surface ve-init-mw-viewPageTarget-surface') + div(:ve_editing_toolbar, class: 'oo-ui-toolbar-bar') end diff --git a/modules/ve-mw/tests/browser/features/support/pages/user_page.rb b/modules/ve-mw/tests/browser/features/support/pages/user_page.rb index 34b9cbc..a7c80be 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/user_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/user_page.rb @@ -2,8 +2,7 @@ include PageObject include URL - page_url URL.url("<%=params[:page_title]%>") + page_url URL.url('<%=params[:page_title]%>') - div(:ve_editing_surface, class: "ve-ui-surface ve-init-mw-viewPageTarget-surface") - + div(:ve_editing_surface, class: 've-ui-surface ve-init-mw-viewPageTarget-surface') end diff --git a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb index 7e57465..8a2f26a 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb @@ -3,106 +3,105 @@ include URL page_url URL.url("User:#{ENV['MEDIAWIKI_USER']}/#{ENV['BROWSER']}?vehidebetadialog=true&veaction=edit") - span(:bullet_number_selector, class: "oo-ui-iconElement-icon oo-ui-icon-bullet-list") - span(:cite_basic_reference, css: ".oo-ui-icon-reference") - span(:cite_button, text: "Cite") - div(:cite_select, css: "div.oo-ui-widget:nth-child(5) > div:nth-child(2)") - a(:cite_book, css: ".oo-ui-tool-name-cite-book > a:nth-child(1)") - a(:cite_journal, css: ".oo-ui-tool-name-cite-journal > a:nth-child(1)") - a(:cite_news, css: ".oo-ui-tool-name-cite-news > a:nth-child(1)") - span(:cite_website, css: ".oo-ui-icon-ref-cite-web") - div(:container_disabled, class: "oo-ui-widget oo-ui-widget-disabled oo-ui-flaggedElement-constructive oo-ui-.oo-ui-buttonElement-framed") - div(:content, class: "ve-ce-branchNode") - span(:decrease_indentation, class: "oo-ui-iconElement-icon oo-ui-icon-outdent-list") - span(:downarrow, class: "oo-ui-indicatorElement-indicator oo-ui-indicator-down") + span(:bullet_number_selector, class: 'oo-ui-iconElement-icon oo-ui-icon-bullet-list') + span(:cite_basic_reference, css: '.oo-ui-icon-reference') + span(:cite_button, text: 'Cite') + div(:cite_select, css: 'div.oo-ui-widget:nth-child(5) > div:nth-child(2)') + a(:cite_book, css: '.oo-ui-tool-name-cite-book > a:nth-child(1)') + a(:cite_journal, css: '.oo-ui-tool-name-cite-journal > a:nth-child(1)') + a(:cite_news, css: '.oo-ui-tool-name-cite-news > a:nth-child(1)') + span(:cite_website, css: '.oo-ui-icon-ref-cite-web') + div(:container_disabled, class: 'oo-ui-widget oo-ui-widget-disabled oo-ui-flaggedElement-constructive oo-ui-.oo-ui-buttonElement-framed') + div(:content, class: 've-ce-branchNode') + span(:decrease_indentation, class: 'oo-ui-iconElement-icon oo-ui-icon-outdent-list') + span(:downarrow, class: 'oo-ui-indicatorElement-indicator oo-ui-indicator-down') a(:edit_ve, title: /Edit this page with VisualEditor/) a(:edit_wikitext, title: /You can edit this page\./) a(:heading, text: /Heading/) - span(:hamburger_menu, css: "div.oo-ui-listToolGroup:nth-child(2) > span:nth-child(1) > span:nth-child(3)") - span(:increase_indentation, class: "oo-ui-iconElement-icon oo-ui-icon-indent-list") - span(:insert_menu, class: "oo-ui-popupToolGroup-handle", index: 4) - div(:insert_references, class: "oo-ui-processDialog-location") - div(:ip_warning, class: "ve-ui-mwNoticesPopupTool-item") - span(:looks_good, class: "oo-ui-labelElement-label", text: "Looks good to me") - div(:medium_dialog, class: "oo-ui-window oo-ui-dialog oo-ui-dialog-open oo-ui-dialog-medium") - span(:options_in_hamburger, class: "oo-ui-tool-title", text: "Options") - span(:option_advanced_settings, class: "oo-ui-tool-title", text: "Advanced settings") - span(:option_page_settings, class: "oo-ui-tool-title", text: "Page settings") - div(:page_text, id: "mw-content-text") + span(:hamburger_menu, css: 'div.oo-ui-listToolGroup:nth-child(2) > span:nth-child(1) > span:nth-child(3)') + span(:increase_indentation, class: 'oo-ui-iconElement-icon oo-ui-icon-indent-list') + span(:insert_menu, class: 'oo-ui-popupToolGroup-handle', index: 4) + div(:insert_references, class: 'oo-ui-processDialog-location') + div(:ip_warning, class: 've-ui-mwNoticesPopupTool-item') + span(:looks_good, class: 'oo-ui-labelElement-label', text: 'Looks good to me') + div(:medium_dialog, class: 'oo-ui-window oo-ui-dialog oo-ui-dialog-open oo-ui-dialog-medium') + span(:options_in_hamburger, class: 'oo-ui-tool-title', text: 'Options') + span(:option_advanced_settings, class: 'oo-ui-tool-title', text: 'Advanced settings') + span(:option_page_settings, class: 'oo-ui-tool-title', text: 'Page settings') + div(:page_text, id: 'mw-content-text') a(:page_title, text: /Page title/) a(:paragraph, text: /Paragraph/) a(:preformatted, text: /Preformatted/) - span(:refs_link, text: "Reference") - div(:save_disabled, class: "oo-ui-widget oo-ui-widget-disabled oo-ui-flaggedElement-constructive oo-ui-.oo-ui-buttonElement-framed") - a(:save_page, css: "div.ve-init-mw-viewPageTarget-toolbar-actions > div.oo-ui-flaggedElement-constructive > a") - div(:save_enabled, css: "div.ve-init-mw-viewPageTarget-toolbar-actions > div.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled") + span(:refs_link, text: 'Reference') + div(:save_disabled, class: 'oo-ui-widget oo-ui-widget-disabled oo-ui-flaggedElement-constructive oo-ui-.oo-ui-buttonElement-framed') + a(:save_page, css: 'div.ve-init-mw-viewPageTarget-toolbar-actions > div.oo-ui-flaggedElement-constructive > a') + div(:save_enabled, css: 'div.ve-init-mw-viewPageTarget-toolbar-actions > div.oo-ui-flaggedElement-constructive.oo-ui-widget-enabled') a(:subheading1, text: /Sub-heading 1/) a(:subheading2, text: /Sub-heading 2/) a(:subheading3, text: /Sub-heading 3/) a(:subheading4, text: /Sub-heading 4/) - span(:switch_to_source_editing, class: "oo-ui-iconElement-icon oo-ui-icon-source") - div(:heading_dropdown_menus, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable") - div(:formatting_option_menus, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 1) - span(:page_settings, class: "oo-ui-iconElement-icon oo-ui-icon-settings") - div(:indentation_pull_down, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 3) - div(:insert_pull_down, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 4) - div(:page_option_menu, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 6) - span(:special_character, class: "oo-ui-iconElement-icon oo-ui-icon-special-character") - div(:iframe, css: "div.oo-ui-window-setup > div.oo-ui-window-frame") + span(:switch_to_source_editing, class: 'oo-ui-iconElement-icon oo-ui-icon-source') + div(:heading_dropdown_menus, class: 'oo-ui-toolGroup-tools oo-ui-clippableElement-clippable') + div(:formatting_option_menus, class: 'oo-ui-toolGroup-tools oo-ui-clippableElement-clippable', index: 1) + span(:page_settings, class: 'oo-ui-iconElement-icon oo-ui-icon-settings') + div(:indentation_pull_down, class: 'oo-ui-toolGroup-tools oo-ui-clippableElement-clippable', index: 3) + div(:insert_pull_down, class: 'oo-ui-toolGroup-tools oo-ui-clippableElement-clippable', index: 4) + div(:page_option_menu, class: 'oo-ui-toolGroup-tools oo-ui-clippableElement-clippable', index: 6) + span(:special_character, class: 'oo-ui-iconElement-icon oo-ui-icon-special-character') + div(:iframe, css: 'div.oo-ui-window-setup > div.oo-ui-window-frame') figure(:media_image, index: 0) - unordered_list(:media_caption, class: "ve-ui-contextMenuWidget") - span(:cite_menu, class: "oo-ui-popupToolGroup-handle", index: 2) - div(:cite_pull_down, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 2) - div(:right_navigation, id: "p-views") - div(:left_navigation, id: "left-navigation") - div(:toolbar, class: "ve-init-mw-viewPageTarget-toolbar") - span(:category_link, class: "oo-ui-iconElement-icon oo-ui-icon-tag") - a(:formula_link, css: "span.oo-ui-tool-name-math > a.oo-ui-tool-link") - img(:formula_image, class: "mwe-math-fallback-png-inline") + unordered_list(:media_caption, class: 've-ui-contextMenuWidget') + span(:cite_menu, class: 'oo-ui-popupToolGroup-handle', index: 2) + div(:cite_pull_down, class: 'oo-ui-toolGroup-tools oo-ui-clippableElement-clippable', index: 2) + div(:right_navigation, id: 'p-views') + div(:left_navigation, id: 'left-navigation') + div(:toolbar, class: 've-init-mw-viewPageTarget-toolbar') + span(:category_link, class: 'oo-ui-iconElement-icon oo-ui-icon-tag') + a(:formula_link, css: 'span.oo-ui-tool-name-math > a.oo-ui-tool-link') + img(:formula_image, class: 'mwe-math-fallback-png-inline') - if ENV["BROWSER"] == "chrome" - div(:tools_menu, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-toolGroup oo-ui-iconElement oo-ui-popupToolGroup oo-ui-listToolGroup") + if ENV['BROWSER'] == 'chrome' + div(:tools_menu, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-toolGroup oo-ui-iconElement oo-ui-popupToolGroup oo-ui-listToolGroup') else - span(:tools_menu, class: "oo-ui-iconElement-icon oo-ui-icon-menu") + span(:tools_menu, class: 'oo-ui-iconElement-icon oo-ui-icon-menu') end - span(:ve_bold_text, class: "oo-ui-iconElement-icon oo-ui-icon-bold-b") - span(:ve_bullets, class: "oo-ui-iconElement-icon oo-ui-icon-bullet-list", index: 1) - span(:ve_computer_code, class: "oo-ui-iconElement-icon oo-ui-icon-code") - div(:ve_heading_menu, class: "oo-ui-iconElement-icon oo-ui-icon-down") - span(:ve_link_icon, class: "oo-ui-iconElement-icon oo-ui-icon-link") - span(:ve_more_markup_options, class: "oo-ui-tool-title-text", text: "More") - a(:ve_more_references_options, css: "span.oo-ui-tool-name-more-fewer:nth-child(9) > a:nth-child(1)") - span(:ve_italics, class: "oo-ui-iconElement-icon oo-ui-icon-italic-i") - span(:ve_media_menu, class: "oo-ui-iconElement-icon oo-ui-icon-picture") - span(:ve_references, class: "oo-ui-iconElement-icon oo-ui-icon-references") - span(:ve_numbering, class: "oo-ui-iconElement-icon oo-ui-icon-number-list") - span(:ve_strikethrough, class: "oo-ui-iconElement-icon oo-ui-icon-strikethrough-s") - span(:ve_subscript, class: "oo-ui-iconElement-icon oo-ui-icon-subscript") - span(:ve_superscript, class: "oo-ui-iconElement-icon oo-ui-icon-superscript") - span(:ve_text_style, class: "oo-ui-iconElement-icon oo-ui-icon-text-style") - span(:ve_underline, class: "oo-ui-iconElement-icon oo-ui-icon-underline-u") - div(:visual_editor_toolbar, class: "oo-ui-toolbar-tools") - a(:transclusion, css: "span.oo-ui-widget.oo-ui-iconElement.oo-ui-tool.oo-ui-tool-name-transclusion.oo-ui-widget-enabled > a") - text_area(:wikitext_editor, id: "wpTextbox1") - a(:first_reference, text: "[1]", index: 1) - a(:second_reference, text: "[1]", index: 2) + span(:ve_bold_text, class: 'oo-ui-iconElement-icon oo-ui-icon-bold-b') + span(:ve_bullets, class: 'oo-ui-iconElement-icon oo-ui-icon-bullet-list', index: 1) + span(:ve_computer_code, class: 'oo-ui-iconElement-icon oo-ui-icon-code') + div(:ve_heading_menu, class: 'oo-ui-iconElement-icon oo-ui-icon-down') + span(:ve_link_icon, class: 'oo-ui-iconElement-icon oo-ui-icon-link') + span(:ve_more_markup_options, class: 'oo-ui-tool-title-text', text: 'More') + a(:ve_more_references_options, css: 'span.oo-ui-tool-name-more-fewer:nth-child(9) > a:nth-child(1)') + span(:ve_italics, class: 'oo-ui-iconElement-icon oo-ui-icon-italic-i') + span(:ve_media_menu, class: 'oo-ui-iconElement-icon oo-ui-icon-picture') + span(:ve_references, class: 'oo-ui-iconElement-icon oo-ui-icon-references') + span(:ve_numbering, class: 'oo-ui-iconElement-icon oo-ui-icon-number-list') + span(:ve_strikethrough, class: 'oo-ui-iconElement-icon oo-ui-icon-strikethrough-s') + span(:ve_subscript, class: 'oo-ui-iconElement-icon oo-ui-icon-subscript') + span(:ve_superscript, class: 'oo-ui-iconElement-icon oo-ui-icon-superscript') + span(:ve_text_style, class: 'oo-ui-iconElement-icon oo-ui-icon-text-style') + span(:ve_underline, class: 'oo-ui-iconElement-icon oo-ui-icon-underline-u') + div(:visual_editor_toolbar, class: 'oo-ui-toolbar-tools') + a(:transclusion, css: 'span.oo-ui-widget.oo-ui-iconElement.oo-ui-tool.oo-ui-tool-name-transclusion.oo-ui-widget-enabled > a') + text_area(:wikitext_editor, id: 'wpTextbox1') + a(:first_reference, text: '[1]', index: 1) + a(:second_reference, text: '[1]', index: 2) unordered_list(:link_list, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-selectWidget oo-ui-selectWidget-depressed oo-ui-clippableElement-clippable oo-ui-menuWidget oo-ui-textInputMenuWidget oo-ui-lookupWidget-menu ve-ui-mwLinkTargetInputWidget-menu') - a(:new_link, class: "ve-ce-linkAnnotation ve-ce-mwInternalLinkAnnotation new") - a(:internal_link, class: "ve-ce-linkAnnotation ve-ce-mwInternalLinkAnnotation") - unordered_list(:popup_icon, class: "ve-ui-contextMenuWidget") - span(:basic_reference, class: "oo-ui-iconElement-icon oo-ui-icon-reference") - div(:toolbar_actions, class: "oo-ui-toolbar-actions") - span(:media_insert_menu, class: "oo-ui-tool-name-media") - span(:template_insert_menu, class: "oo-ui-tool-name-transclusion") - span(:ref_list_insert_menu, class: "oo-ui-tool-name-referencesList") - span(:formula_insert_menu,class: "oo-ui-tool-name-math") - div(:language_notification, class: "tipsy-inner") - span(:review_changes, class: "oo-ui-labelElement-label", text: "Review your changes") - span(:return_to_save, class: "oo-ui-labelElement-label", text: "Return to save form") - span(:second_save_page, css: ".oo-ui-flaggedElement-primary > a:nth-child(1) > span:nth-child(2)") - span(:confirm_switch_cancel, text: "Resume editing") - + a(:new_link, class: 've-ce-linkAnnotation ve-ce-mwInternalLinkAnnotation new') + a(:internal_link, class: 've-ce-linkAnnotation ve-ce-mwInternalLinkAnnotation') + unordered_list(:popup_icon, class: 've-ui-contextMenuWidget') + span(:basic_reference, class: 'oo-ui-iconElement-icon oo-ui-icon-reference') + div(:toolbar_actions, class: 'oo-ui-toolbar-actions') + span(:media_insert_menu, class: 'oo-ui-tool-name-media') + span(:template_insert_menu, class: 'oo-ui-tool-name-transclusion') + span(:ref_list_insert_menu, class: 'oo-ui-tool-name-referencesList') + span(:formula_insert_menu, class: 'oo-ui-tool-name-math') + div(:language_notification, class: 'tipsy-inner') + span(:review_changes, class: 'oo-ui-labelElement-label', text: 'Review your changes') + span(:return_to_save, class: 'oo-ui-labelElement-label', text: 'Return to save form') + span(:second_save_page, css: '.oo-ui-flaggedElement-primary > a:nth-child(1) > span:nth-child(2)') + span(:confirm_switch_cancel, text: 'Resume editing') text_area(:cite_first_textarea, index: 0) text_area(:cite_second_textarea, index: 1) @@ -112,77 +111,77 @@ text_area(:cite_sixth_textarea, index: 5) text_area(:cite_seventh_textarea, index: 6) text_area(:cite_eighth_textarea, index: 7) - div(:cite_ui, class: "oo-ui-window-body") + div(:cite_ui, class: 'oo-ui-window-body') - a(:cite_add_more_information_button, css: ".ve-ui-mwParameterPage-more a", index: 7) - a(:book_add_more_information_button, css: ".ve-ui-mwParameterPage-more a", index: 7) - div(:cite_visualeditor_user_interface, css: ".ve-ui-surfaceWidget") - div(:cite_basic_options_area, class: "oo-ui-layout oo-ui-iconElement oo-ui-labelElement oo-ui-fieldsetLayout") + a(:cite_add_more_information_button, css: '.ve-ui-mwParameterPage-more a', index: 7) + a(:book_add_more_information_button, css: '.ve-ui-mwParameterPage-more a', index: 7) + div(:cite_visualeditor_user_interface, css: '.ve-ui-surfaceWidget') + div(:cite_basic_options_area, class: 'oo-ui-layout oo-ui-iconElement oo-ui-labelElement oo-ui-fieldsetLayout') - #text_field(:cite_custom_field_name, css: ".oo-ui-textInputWidget-decorated > input:nth-child(1)", frame: frame) - text_field(:cite_custom_field_name, css: ".oo-ui-searchWidget-query > div:nth-child(1) > input:nth-child(1)") - div(:cite_group_name_textarea, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-indicatorElement oo-ui-textInputWidget") - text_area(:cite_new_website_field, css: "div.oo-ui-layout:nth-child(10) > div:nth-child(3) > div:nth-child(1) > textarea:nth-child(1)") - div(:cite_new_field_label, css: ".oo-ui-optionWidget") - div(:cite_show_more_fields, class: "ve-ui-mwMoreParametersResultWidget-label") - span(:insert_citation, css: ".oo-ui-flaggedElement-primary > a:nth-child(1) > span:nth-child(2)") + # text_field(:cite_custom_field_name, css: ".oo-ui-textInputWidget-decorated > input:nth-child(1)", frame: frame) + text_field(:cite_custom_field_name, css: '.oo-ui-searchWidget-query > div:nth-child(1) > input:nth-child(1)') + div(:cite_group_name_textarea, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-indicatorElement oo-ui-textInputWidget') + text_area(:cite_new_website_field, css: 'div.oo-ui-layout:nth-child(10) > div:nth-child(3) > div:nth-child(1) > textarea:nth-child(1)') + div(:cite_new_field_label, css: '.oo-ui-optionWidget') + div(:cite_show_more_fields, class: 've-ui-mwMoreParametersResultWidget-label') + span(:insert_citation, css: '.oo-ui-flaggedElement-primary > a:nth-child(1) > span:nth-child(2)') - text_field(:media_search, css: "div.oo-ui-textInputWidget > input") - span(:media_apply_changes, text: "Insert") - div(:media_select, class: "ve-ui-mwMediaResultWidget-overlay") - span(:media_exit, text: "Return to save form") + text_field(:media_search, css: 'div.oo-ui-textInputWidget > input') + span(:media_apply_changes, text: 'Insert') + div(:media_select, class: 've-ui-mwMediaResultWidget-overlay') + span(:media_exit, text: 'Return to save form') - div(:options_page_title, class: "oo-ui-processDialog-location", text: "Options") + div(:options_page_title, class: 'oo-ui-processDialog-location', text: 'Options') - div(:title, class: "oo-ui-processDialog-location") - span(:insert_references_list, text: "Insert") + div(:title, class: 'oo-ui-processDialog-location') + span(:insert_references_list, text: 'Insert') - span(:confirm_switch, text: "Keep changes") + span(:confirm_switch, text: 'Keep changes') - text_field(:transclusion_textfield, css: "div.oo-ui-widget-enabled:nth-child(4) > input:nth-child(1)") - text_field(:transclusion_description, css: ".oo-ui-inputWidget > input:nth-child(1)") - span(:add_template, text: "Add template") - span(:insert_template, text: "Insert") - div(:parameter_icon, text: "q") - a(:remove_parameter, css: ".ve-ui-mwParameterPage-removeButton > a:nth-child(1)") + text_field(:transclusion_textfield, css: 'div.oo-ui-widget-enabled:nth-child(4) > input:nth-child(1)') + text_field(:transclusion_description, css: '.oo-ui-inputWidget > input:nth-child(1)') + span(:add_template, text: 'Add template') + span(:insert_template, text: 'Insert') + div(:parameter_icon, text: 'q') + a(:remove_parameter, css: '.ve-ui-mwParameterPage-removeButton > a:nth-child(1)') - div(:review_failed, class: "oo-ui-window-head") + div(:review_failed, class: 'oo-ui-window-head') - span(:confirm_switch_cancel_on_switch, text: "Cancel") - span(:confirm_switch_discard, text: "Discard changes") + span(:confirm_switch_cancel_on_switch, text: 'Cancel') + span(:confirm_switch_discard, text: 'Discard changes') - div(:options_settings_content, class: "oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-scrollable oo-ui-panelLayout-expanded oo-ui-pageLayout oo-ui-pageLayout-active") + div(:options_settings_content, class: 'oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-scrollable oo-ui-panelLayout-expanded oo-ui-pageLayout oo-ui-pageLayout-active') - checkbox(:minor_edit, id: "wpMinoredit") - div(:diff_view, class: "ve-ui-mwSaveDialog-viewer") - span(:ex, text: "Return to save form") + checkbox(:minor_edit, id: 'wpMinoredit') + div(:diff_view, class: 've-ui-mwSaveDialog-viewer') + span(:ex, text: 'Return to save form') text_area(:describe_change, index: 0) - #USED IN LANGUAGE SCREENSHOT TEST: - span(:page_settings_icon, class: "oo-ui-iconElement-icon oo-ui-icon-settings", index: 2) - label(:prevent_redirect, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline oo-ui-fieldLayout-disabled") - label(:table_of_contents, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top", index: 1) - label(:page_settings_editlinks, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline", index: 4) - div(:settings_apply_button, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-buttonWidget oo-ui-actionWidget oo-ui-buttonElement-framed") + # USED IN LANGUAGE SCREENSHOT TEST: + span(:page_settings_icon, class: 'oo-ui-iconElement-icon oo-ui-icon-settings', index: 2) + label(:prevent_redirect, class: 'oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline oo-ui-fieldLayout-disabled') + label(:table_of_contents, class: 'oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top', index: 1) + label(:page_settings_editlinks, class: 'oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline', index: 4) + div(:settings_apply_button, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-buttonWidget oo-ui-actionWidget oo-ui-buttonElement-framed') in_iframe(index: 0) do |frame| - #ACTUALLY IS IN THE IFRAME: - div(:extension_reference, class: "ve-ui-mwReferenceResultWidget-shield", frame: frame) - span(:existing_reference, text: "Use an existing reference", frame: frame) - a(:remove_template, title: "Remove template", frame: frame) - div(:ve_link_ui, class: "oo-ui-window-head", frame: frame) - div(:suggestion_list, class: "ve-ui-mwTitleInputWidget-menu") - span(:another_save_page, class: "oo-ui-labelElement-label", text: "Save page", frame: frame) + # ACTUALLY IS IN THE IFRAME: + div(:extension_reference, class: 've-ui-mwReferenceResultWidget-shield', frame: frame) + span(:existing_reference, text: 'Use an existing reference', frame: frame) + a(:remove_template, title: 'Remove template', frame: frame) + div(:ve_link_ui, class: 'oo-ui-window-head', frame: frame) + div(:suggestion_list, class: 've-ui-mwTitleInputWidget-menu') + span(:another_save_page, class: 'oo-ui-labelElement-label', text: 'Save page', frame: frame) text_field(:link_textfield, index: 0, frame: frame) - span(:links_done, text: "Done", frame: frame) - div(:content_box, class: "ve-ce-documentNode ve-ce-branchNode", frame: frame) #ALSO USED IN LANGUAGE SCREENSHOT + span(:links_done, text: 'Done', frame: frame) + div(:content_box, class: 've-ce-documentNode ve-ce-branchNode', frame: frame) # ALSO USED IN LANGUAGE SCREENSHOT - #USED IN LANGUAGE SCREENSHOT TEST: - text_field(:media_alternative_text, css: "div.oo-ui-widget.oo-ui-widget-enabled.oo-ui-inputWidget.oo-ui-textInputWidget.ve-ui-mwMediaDialog-altText > input", frame: frame) - div(:media_alternative_block, class: "oo-ui-layout oo-ui-iconElement oo-ui-labelElement oo-ui-fieldsetLayout", index: 1, frame: frame) - list_item(:media_advanced_settings, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-optionWidget oo-ui-decoratedOptionWidget oo-ui-outlineItemWidget oo-ui-outlineItemWidget-level-0 oo-ui-iconElement oo-ui-labelElement", frame: frame) - a(:insert_media, css: "div.oo-ui-processDialog-actions-primary > div.oo-ui-buttonElement-frameless > a", frame: frame) - text_area(:formula_area, class: "oo-ui-ltr", frame: frame) + # USED IN LANGUAGE SCREENSHOT TEST: + text_field(:media_alternative_text, css: 'div.oo-ui-widget.oo-ui-widget-enabled.oo-ui-inputWidget.oo-ui-textInputWidget.ve-ui-mwMediaDialog-altText > input', frame: frame) + div(:media_alternative_block, class: 'oo-ui-layout oo-ui-iconElement oo-ui-labelElement oo-ui-fieldsetLayout', index: 1, frame: frame) + list_item(:media_advanced_settings, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-optionWidget oo-ui-decoratedOptionWidget oo-ui-outlineItemWidget oo-ui-outlineItemWidget-level-0 oo-ui-iconElement oo-ui-labelElement', frame: frame) + a(:insert_media, css: 'div.oo-ui-processDialog-actions-primary > div.oo-ui-buttonElement-frameless > a', frame: frame) + text_area(:formula_area, class: 'oo-ui-ltr', frame: frame) end end diff --git a/modules/ve-mw/tests/browser/features/support/pages/zarticlepage.rb b/modules/ve-mw/tests/browser/features/support/pages/zarticlepage.rb index cedd007..ed379ff 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/zarticlepage.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/zarticlepage.rb @@ -1,5 +1,5 @@ class ZtargetPage < VisualEditorPage include URL - page_url URL.url("<%=params[:article_name]%>?vehidebetadialog=true&veaction=edit") + page_url URL.url('<%=params[:article_name]%>?vehidebetadialog=true&veaction=edit') include PageObject end diff --git a/modules/ve-mw/tests/browser/spec/rectangle_spec.rb b/modules/ve-mw/tests/browser/spec/rectangle_spec.rb index 0639821..30d5f2e 100644 --- a/modules/ve-mw/tests/browser/spec/rectangle_spec.rb +++ b/modules/ve-mw/tests/browser/spec/rectangle_spec.rb @@ -1,215 +1,215 @@ require_relative '../features/support/language_screenshot' # Rectangle is defined as set of co-ordinates represented by top left x, top left y, width, height -describe "Rectangle" do - it "should return the co-ordinates of provided 1 rectangle" do - input_rectangle = [0,0,1,1] +describe 'Rectangle' do + it 'should return the co-ordinates of provided 1 rectangle' do + input_rectangle = [0, 0, 1, 1] input_rectangles = [input_rectangle] expect(rectangle(input_rectangles)).to eq(input_rectangle) end - it "should return the co-ordinates of the rectangle which is inside a iframe" do - input_rectangle = [50,50,10,10] - iframe_rectangle = [100,100,20,20] + it 'should return the co-ordinates of the rectangle which is inside a iframe' do + input_rectangle = [50, 50, 10, 10] + iframe_rectangle = [100, 100, 20, 20] input_rectangles = [input_rectangle] output_rectangle = [150, 150, 10, 10] expect(rectangle(input_rectangles, iframe_rectangle)).to eq(output_rectangle) end - it "if we provide 2 rectangles and if one contains the other then it should return co-ordinates of bigger rectangle" do - input_rectangle_1 = [0,0,1,1] - input_rectangle_2 = [0,0,2,2] + it 'if we provide 2 rectangles and if one contains the other then it should return co-ordinates of bigger rectangle' do + input_rectangle_1 = [0, 0, 1, 1] + input_rectangle_2 = [0, 0, 2, 2] input_rectangles = [input_rectangle_1, input_rectangle_2] expect(rectangle(input_rectangles)).to eq(input_rectangle_2) end - it "if we provide 2 rectangles it should return co-ordinates of third rectangle which contains both" do - input_rectangle_1 = [0,0,1,1] - input_rectangle_2 = [1,0,1,1] + it 'if we provide 2 rectangles it should return co-ordinates of third rectangle which contains both' do + input_rectangle_1 = [0, 0, 1, 1] + input_rectangle_2 = [1, 0, 1, 1] input_rectangles_1 = [input_rectangle_1, input_rectangle_2] - output_rectangle_1 = [0,0,2,1] + output_rectangle_1 = [0, 0, 2, 1] expect(rectangle(input_rectangles_1)).to eq(output_rectangle_1) - input_rectangle_3 = [1,1,1,1] - input_rectangle_4 = [3,3,1,1] + input_rectangle_3 = [1, 1, 1, 1] + input_rectangle_4 = [3, 3, 1, 1] input_rectangles_2 = [input_rectangle_3, input_rectangle_4] - output_rectangle_2 = [1,1,3,3] + output_rectangle_2 = [1, 1, 3, 3] expect(rectangle(input_rectangles_2)).to eq(output_rectangle_2) end - it "if we provide 3 rectangles it should return co-ordinates the rectangle which contains all the input rectangles" do - input_rectangle_1 = [1,1,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [3,3,1,1] + it 'if we provide 3 rectangles it should return co-ordinates the rectangle which contains all the input rectangles' do + input_rectangle_1 = [1, 1, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [3, 3, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_rectangle_1 = [1,1,3,3] + output_rectangle_1 = [1, 1, 3, 3] expect(rectangle(input_rectangles)).to eq(output_rectangle_1) end end -describe "Calculate topleft co-ordinates" do +describe 'Calculate topleft co-ordinates' do - it "if we provide 1 rectangle then it should return top left co-ordinates of the input rectangle" do - input_rectangle = [2,2,1,1] + it 'if we provide 1 rectangle then it should return top left co-ordinates of the input rectangle' do + input_rectangle = [2, 2, 1, 1] input_rectangles = [input_rectangle] - output_coordinates = [2,2] + output_coordinates = [2, 2] expect(top_left_x_y(input_rectangles)).to eq(output_coordinates) end - it "if we provide 2 rectangles then it should return top left co-ordinates of the biggest rectangle containing both rectangles" do - input_rectangle_1 = [1,0,1,1] - input_rectangle_2 = [0,0,1,1] + it 'if we provide 2 rectangles then it should return top left co-ordinates of the biggest rectangle containing both rectangles' do + input_rectangle_1 = [1, 0, 1, 1] + input_rectangle_2 = [0, 0, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2] - output_coordinates = [0,0] + output_coordinates = [0, 0] expect(top_left_x_y(input_rectangles)).to eq(output_coordinates) end - it "if we provide 3 rectangles then it should return top left co-ordinates of the biggest rectangle containing both rectangles" do - input_rectangle_1 = [3,3,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [1,1,1,1] + it 'if we provide 3 rectangles then it should return top left co-ordinates of the biggest rectangle containing both rectangles' do + input_rectangle_1 = [3, 3, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [1, 1, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_coordinates = [1,1] + output_coordinates = [1, 1] expect(top_left_x_y(input_rectangles)).to eq(output_coordinates) end end -describe "Topleft co-ordinates x" do +describe 'Topleft co-ordinates x' do - it "if we provide 1 rectangle then it should return array of top left x co-ordinate of the input rectangle" do - input_rectangle = [2,2,1,1] + it 'if we provide 1 rectangle then it should return array of top left x co-ordinate of the input rectangle' do + input_rectangle = [2, 2, 1, 1] input_rectangles = [input_rectangle] output_coordinates = [2] expect(top_left_x_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 2 rectangles then it should return array top left x co-ordinates" do - input_rectangle_1 = [0,0,1,1] - input_rectangle_2 = [1,0,1,1] + it 'if we provide 2 rectangles then it should return array top left x co-ordinates' do + input_rectangle_1 = [0, 0, 1, 1] + input_rectangle_2 = [1, 0, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2] - output_coordinates = [0,1] + output_coordinates = [0, 1] expect(top_left_x_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 3 rectangles then it should return array of top left x co-ordinates" do - input_rectangle_1 = [3,3,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [1,1,1,1] + it 'if we provide 3 rectangles then it should return array of top left x co-ordinates' do + input_rectangle_1 = [3, 3, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [1, 1, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_coordinates = [3,2,1] + output_coordinates = [3, 2, 1] expect(top_left_x_coordinates(input_rectangles)).to eq(output_coordinates) end end -describe "Topleft co-ordinates y" do +describe 'Topleft co-ordinates y' do - it "if we provide 1 rectangle then it should return array of top left y co-ordinate of the input rectangle" do - input_rectangle = [2,2,1,1] + it 'if we provide 1 rectangle then it should return array of top left y co-ordinate of the input rectangle' do + input_rectangle = [2, 2, 1, 1] input_rectangles = [input_rectangle] output_coordinates = [2] expect(top_left_y_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 2 rectangles then it should return array top left y co-ordinates" do - input_rectangle_1 = [0,0,1,1] - input_rectangle_2 = [1,0,1,1] + it 'if we provide 2 rectangles then it should return array top left y co-ordinates' do + input_rectangle_1 = [0, 0, 1, 1] + input_rectangle_2 = [1, 0, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2] - output_coordinates = [0,0] + output_coordinates = [0, 0] expect(top_left_y_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 3 rectangles then it should return array of top left y co-ordinates" do - input_rectangle_1 = [3,3,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [1,1,1,1] + it 'if we provide 3 rectangles then it should return array of top left y co-ordinates' do + input_rectangle_1 = [3, 3, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [1, 1, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_coordinates = [3,2,1] + output_coordinates = [3, 2, 1] expect(top_left_y_coordinates(input_rectangles)).to eq(output_coordinates) end end -describe "Calculate bottomright co-ordinates" do +describe 'Calculate bottomright co-ordinates' do - it "if we provide 1 rectangle then it should return bottom right co-ordinates of the input rectangle" do - input_rectangle = [2,2,1,1] + it 'if we provide 1 rectangle then it should return bottom right co-ordinates of the input rectangle' do + input_rectangle = [2, 2, 1, 1] input_rectangles = [input_rectangle] - output_coordinates = [3,3] + output_coordinates = [3, 3] expect(bottom_right_x_y(input_rectangles)).to eq(output_coordinates) end - it "if we provide 2 rectangles then it should return bottom right co-ordinates of the biggest rectangle containing both rectangles" do - input_rectangle_1 = [1,0,1,1] - input_rectangle_2 = [0,0,1,1] + it 'if we provide 2 rectangles then it should return bottom right co-ordinates of the biggest rectangle containing both rectangles' do + input_rectangle_1 = [1, 0, 1, 1] + input_rectangle_2 = [0, 0, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2] - output_coordinates = [2,1] + output_coordinates = [2, 1] expect(bottom_right_x_y(input_rectangles)).to eq(output_coordinates) end - it "if we provide 3 rectangles then it should return bottom right co-ordinates of the biggest rectangle containing both rectangles" do - input_rectangle_1 = [3,3,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [1,1,1,1] + it 'if we provide 3 rectangles then it should return bottom right co-ordinates of the biggest rectangle containing both rectangles' do + input_rectangle_1 = [3, 3, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [1, 1, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_coordinates = [4,4] + output_coordinates = [4, 4] expect(bottom_right_x_y(input_rectangles)).to eq(output_coordinates) end end -describe "Bottom right co-ordinates x" do +describe 'Bottom right co-ordinates x' do - it "if we provide 1 rectangle then it should return array of bottom right x co-ordinate of the input rectangle" do - input_rectangle = [2,2,1,1] + it 'if we provide 1 rectangle then it should return array of bottom right x co-ordinate of the input rectangle' do + input_rectangle = [2, 2, 1, 1] input_rectangles = [input_rectangle] output_coordinates = [3] expect(bottom_right_x_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 2 rectangles then it should return array bottom right x co-ordinates" do - input_rectangle_1 = [0,0,1,1] - input_rectangle_2 = [1,0,1,1] + it 'if we provide 2 rectangles then it should return array bottom right x co-ordinates' do + input_rectangle_1 = [0, 0, 1, 1] + input_rectangle_2 = [1, 0, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2] - output_coordinates = [1,2] + output_coordinates = [1, 2] expect(bottom_right_x_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 3 rectangles then it should return array of bottom right x co-ordinates" do - input_rectangle_1 = [3,3,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [1,1,1,1] + it 'if we provide 3 rectangles then it should return array of bottom right x co-ordinates' do + input_rectangle_1 = [3, 3, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [1, 1, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_coordinates = [4,3,2] + output_coordinates = [4, 3, 2] expect(bottom_right_x_coordinates(input_rectangles)).to eq(output_coordinates) end end -describe "Bottom right co-ordinates y" do +describe 'Bottom right co-ordinates y' do - it "if we provide 1 rectangle then it should return array of bottom right y co-ordinate of the input rectangle" do - input_rectangle = [2,2,1,1] + it 'if we provide 1 rectangle then it should return array of bottom right y co-ordinate of the input rectangle' do + input_rectangle = [2, 2, 1, 1] input_rectangles = [input_rectangle] output_coordinates = [3] expect(bottom_right_y_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 2 rectangles then it should return array bottom right y co-ordinates" do - input_rectangle_1 = [0,0,1,1] - input_rectangle_2 = [1,0,1,1] + it 'if we provide 2 rectangles then it should return array bottom right y co-ordinates' do + input_rectangle_1 = [0, 0, 1, 1] + input_rectangle_2 = [1, 0, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2] - output_coordinates = [1,1] + output_coordinates = [1, 1] expect(bottom_right_y_coordinates(input_rectangles)).to eq(output_coordinates) end - it "if we provide 3 rectangles then it should return array of bottom right y co-ordinates" do - input_rectangle_1 = [3,3,1,1] - input_rectangle_2 = [2,2,1,1] - input_rectangle_3 = [1,1,1,1] + it 'if we provide 3 rectangles then it should return array of bottom right y co-ordinates' do + input_rectangle_1 = [3, 3, 1, 1] + input_rectangle_2 = [2, 2, 1, 1] + input_rectangle_3 = [1, 1, 1, 1] input_rectangles = [input_rectangle_1, input_rectangle_2, input_rectangle_3] - output_coordinates = [4,3,2] + output_coordinates = [4, 3, 2] expect(bottom_right_y_coordinates(input_rectangles)).to eq(output_coordinates) end diff --git a/modules/ve-mw/tests/browser/upload.rb b/modules/ve-mw/tests/browser/upload.rb index e176aca..390bc10 100644 --- a/modules/ve-mw/tests/browser/upload.rb +++ b/modules/ve-mw/tests/browser/upload.rb @@ -1,5 +1,5 @@ def license(language_code, file_name) - require "date" + require 'date' date = Date.today.to_s "=={{int:filedesc}}== {{Information @@ -18,9 +18,9 @@ [[Category:VisualEditor automatic screenshots/#{language_code}]]" end -def upload_image file_path, client +def upload_image(file_path, client) language_code = ENV['LANGUAGE_SCREENSHOT_CODE'] - file_name = File.basename(file_path, "") + file_name = File.basename(file_path, '') file_license = license(language_code, file_name) client.upload_image(file_name, file_path, file_license, true) @@ -28,15 +28,15 @@ end def upload_images - screenshot_directory = ENV["LANGUAGE_SCREENSHOT_PATH"] || "./screenshots" + screenshot_directory = ENV['LANGUAGE_SCREENSHOT_PATH'] || './screenshots' require 'mediawiki_api' - client = MediawikiApi::Client.new ENV["MEDIAWIKI_API_UPLOAD_URL"] - client.log_in ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"] + client = MediawikiApi::Client.new ENV['MEDIAWIKI_API_UPLOAD_URL'] + client.log_in ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD'] Dir["#{screenshot_directory}/*.png"].each do |file_path| puts "Uploading #{file_path}" upload_image file_path, client end end -ENV["MEDIAWIKI_PASSWORD"] = ENV[ENV["MEDIAWIKI_PASSWORD_VARIABLE"]] if ENV["MEDIAWIKI_PASSWORD_VARIABLE"] +ENV['MEDIAWIKI_PASSWORD'] = ENV[ENV['MEDIAWIKI_PASSWORD_VARIABLE']] if ENV['MEDIAWIKI_PASSWORD_VARIABLE'] upload_images -- To view, visit https://gerrit.wikimedia.org/r/172245 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e00339ec9e0360e68fb40bb5b7095ce2445558e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Vikassy <vikasyaligar...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits