[Browser tests] Prefer double-quoted strings in Ruby code

Bug: 57597
Change-Id: I4ddc3f20d03bf3e66b04234be529c3eaa29be9e0
This commit is contained in:
mayankmadan 2013-11-27 01:44:30 +05:30
parent 0a091193f9
commit 2af79b6108
15 changed files with 60 additions and 60 deletions

View file

@ -22,4 +22,4 @@ Feature: VisualEditor
| Editing with ÄËÏÖÜ | Editing with ÄËÏÖÜ |
| Editing with ÂÊÎÔÛ | Editing with ÂÊÎÔÛ |
| Editing with áéíóú | Editing with áéíóú |
| Editing with Déjà vu <tag & "OK" 'end' | Editing with Déjà vu <tag & "OK" 'end' |
| Editing with Déjà vu <tag & "OK" "end" | Editing with Déjà vu <tag & "OK" "end" |

View file

@ -11,11 +11,11 @@ Feature: VisualEditor Headings
And I can click the X on the save box
Examples:
| headings_interface_name | headings_string |
| Paragraph | '^Editing' |
| Heading | '^==Editing' |
| Subheading1 | '^===Editing' |
| Subheading2 | '^====Editing' |
| Subheading3 | '^=====Editing' |
| Subheading4 | '^======Editing' |
| Preformatted | ' Editing' |
| Page title | '^=Editing' |
| Paragraph | "^Editing" |
| Heading | "^==Editing" |
| Subheading1 | "^===Editing" |
| Subheading2 | "^====Editing" |
| Subheading3 | "^=====Editing" |
| Subheading4 | "^======Editing" |
| Preformatted | " Editing" |
| Page title | "^=Editing" |

View file

@ -24,7 +24,7 @@ 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.diff_view.include? '# This '
page.diff_view.include? "# This "
end
page.diff_view.should match Regexp.new(/^\# This is a new line/)
end
@ -37,7 +37,7 @@ 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.diff_view.include? '* This '
page.diff_view.include? "* This "
end
page.diff_view.should match Regexp.new(/^\* This is a new line/)
end
@ -50,7 +50,7 @@ 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.diff_view.include? '## This '
page.diff_view.include? "## This "
end
page.diff_view.should match Regexp.new(/^\#\# This is a new line/)
end
@ -59,7 +59,7 @@ 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.diff_view.include? '** This '
page.diff_view.include? "** This "
end
page.diff_view.should match Regexp.new(/^\*\* This is a new line/)
end
@ -73,7 +73,7 @@ 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.diff_view.include? 'This '
page.diff_view.include? "This "
end
page.diff_view.should match Regexp.new(/^This is a new line/)
end

View file

@ -1,3 +1,3 @@
Given(/^I am logged in$/) do
visit(LoginPage).login_with(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD'])
visit(LoginPage).login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
end

View file

@ -4,10 +4,10 @@ end
When(/^I send right arrow times (\d+)$/) do |number|
on(VisualEditorPage) do |page|
page.content_element.when_present.fire_event('onfocus')
page.content_element.when_present.fire_event("onfocus")
number.to_i.times do
page.content_element.send_keys :arrow_right
page.content_element.fire_event('onblur') #gerrit 86800/86801
page.content_element.fire_event("onblur") #gerrit 86800/86801
end
end
end

View file

@ -11,7 +11,7 @@ Then(/^(.+) should appear in the diff view$/) do |headings_string|
# 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"
end

View file

@ -3,7 +3,7 @@ When(/^I click the Link button$/) do
end
Given(/^I can see the Link User Inteface$/) do
on(VisualEditorPage).ve_link_ui.should match Regexp.escape('Hyperlink')
on(VisualEditorPage).ve_link_ui.should match Regexp.escape("Hyperlink")
end
When(/^I click the blue text$/) do
@ -17,9 +17,9 @@ end
Then(/^an external link appears in the diff view$/) do
on(VisualEditorPage) do |page|
page.wait_until(10) do
page.links_diff_view.include? 'example.com'
page.links_diff_view.include? "example.com"
end
page.links_diff_view.should match Regexp.escape('[http://www.example.com Editing] ')
page.links_diff_view.should match Regexp.escape("[http://www.example.com Editing] ")
end
end
@ -30,9 +30,9 @@ end
Then(/^an internal link appears in the diff view$/) do
on(VisualEditorPage) do |page|
page.wait_until(10) do
page.links_diff_view.include? 'Main Page'
page.links_diff_view.include? "Main Page"
end
page.links_diff_view.should match Regexp.escape('[[Main Page|Editing]]')
page.links_diff_view.should match Regexp.escape("[[Main Page|Editing]]")
end
end
@ -43,9 +43,9 @@ end
Then(/^a non\-existing link appears in the diff view$/) do
on(VisualEditorPage) do |page|
page.wait_until(10) do
page.links_diff_view.include? 'DoesNotExist'
page.links_diff_view.include? "DoesNotExist"
end
page.links_diff_view.should match Regexp.escape('[[DoesNotExist|Editing]]')
page.links_diff_view.should match Regexp.escape("[[DoesNotExist|Editing]]")
end
end

View file

@ -1,5 +1,5 @@
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 reference$/) do
@ -14,7 +14,7 @@ When(/^I click Edit for VisualEditor$/) do
page.beta_warning_element.when_present.click
rescue
end
page.content_element.fire_event('onfocus')
page.content_element.fire_event("onfocus")
end
end

View file

@ -43,7 +43,7 @@ When(/^I edit the page with (.+)$/) do |input_string|
page.beta_warning_element.when_present.click
rescue
end
page.content_element.fire_event('onfocus')
page.content_element.fire_event("onfocus")
page.content_element.when_present.send_keys(input_string + " #{@random_string} ")
end
end

View file

@ -1,9 +1,9 @@
Given(/^I can see the Transclusion User Interface$/) do
on(VisualEditorPage) do |page|
page.wait_until(10) do
page.title.include? 'Transclusion'
page.title.include? "Transclusion"
end
page.title.should match 'Transclusion'
page.title.should match "Transclusion"
end
end

View file

@ -1,2 +1,2 @@
require_relative 'hooks'
require 'mediawiki/selenium'
require_relative "hooks"
require "mediawiki/selenium"

View file

@ -1,25 +1,25 @@
at_exit do
$browser.close unless ENV['KEEP_BROWSER_OPEN'] == 'true'
$browser.close unless ENV["KEEP_BROWSER_OPEN"] == "true"
end
#This is for the Headings test
Before('@edit_user_page') do
if (!$edit_user_page or !(ENV['REUSE_BROWSER'] == 'true')) and @browser
step 'I am logged in'
step 'I am at my user page'
step 'I edit the page with Editing with'
Before("@edit_user_page") do
if (!$edit_user_page or !(ENV["REUSE_BROWSER"] == "true")) and @browser
step "I am logged in"
step "I am at my user page"
step "I edit the page with Editing with"
$edit_user_page=true
end
end
#This is for the bullets, indent-outdent, and the General Markup tests
Before('@make_selectable_line') do
if (!$make_selectable_line or !(ENV['REUSE_BROWSER'] == 'true')) and @browser
step 'I am logged in'
step 'I am at my user page'
step 'I click Edit for VisualEditor'
step 'I type in an input string'
step 'select the string'
Before("@make_selectable_line") do
if (!$make_selectable_line or !(ENV["REUSE_BROWSER"] == "true")) and @browser
step "I am logged in"
step "I am at my user page"
step "I click Edit for VisualEditor"
step "I type in an input string"
step "select the string"
$make_selectable_line=true
end
end

View file

@ -1,9 +1,9 @@
module URL
def self.url(name)
if ENV['MEDIAWIKI_URL']
mediawiki_url = ENV['MEDIAWIKI_URL']
if ENV["MEDIAWIKI_URL"]
mediawiki_url = ENV["MEDIAWIKI_URL"]
else
mediawiki_url = 'http://en.wikipedia.beta.wmflabs.org/wiki/'
mediawiki_url = "http://en.wikipedia.beta.wmflabs.org/wiki/"
end
"#{mediawiki_url}#{name}"
end

View file

@ -2,12 +2,12 @@ class CursorTestPage
include PageObject
include URL
page_url URL.url('User:Selenium_user/cursor_test_page')
page_url URL.url("User:Selenium_user/cursor_test_page")
# contents of this page must contain EXACTLY the wikitext string:
# Reference one <ref> this is ref1 </ref>invisible transclusion here{{Template sandbox notice}} and visible transclusion here{{User:Selenium_user/cursor}}[http://www.google.com This is link to google]{{reflist}}
span(:references_hover, class: 'oo-ui-iconedElement-icon oo-ui-icon-reference', index: 1)
span(:transclusion_hover, class: 'oo-ui-iconedElement-icon oo-ui-icon-template', index: 1)
span(:link_hover, class: 'oo-ui-iconedElement-icon oo-ui-icon-link', index: 1)
span(:references_hover, class: "oo-ui-iconedElement-icon oo-ui-icon-reference", index: 1)
span(:transclusion_hover, class: "oo-ui-iconedElement-icon oo-ui-icon-template", index: 1)
span(:link_hover, class: "oo-ui-iconedElement-icon oo-ui-icon-link", index: 1)
end

View file

@ -2,18 +2,18 @@ class LoginPage
include PageObject
include URL
page_url URL.url('Special:UserLogin')
page_url URL.url("Special:UserLogin")
div(:feedback, class: 'errorbox')
button(:login, id: 'wpLoginAttempt')
text_field(:password, id: 'wpPassword1')
a(:password_strength, text: 'password strength')
a(:phishing, text: 'phishing')
text_field(:username, id: 'wpName1')
div(:feedback, class: "errorbox")
button(:login, id: "wpLoginAttempt")
text_field(:password, id: "wpPassword1")
a(:password_strength, text: "password strength")
a(:phishing, text: "phishing")
text_field(:username, id: "wpName1")
a(:username_displayed, title: /Your user page/)
def logged_in_as_element
@browser.div(id: 'mw-content-text').p.b
@browser.div(id: "mw-content-text").p.b
end
def login_with(username, password)
self.username = username