Merge "QA: rubocop updates"

This commit is contained in:
jenkins-bot 2014-11-10 17:51:17 +00:00 committed by Gerrit Code Review
commit 704049f360
8 changed files with 36 additions and 115 deletions

View file

@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config` # This configuration was generated by `rubocop --auto-gen-config`
# on 2014-11-07 14:18:36 -0700 using RuboCop version 0.27.0. # on 2014-11-07 14:36:31 -0700 using RuboCop version 0.27.0.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
@ -8,24 +8,12 @@
# Offense count: 11 # Offense count: 11
# Configuration parameters: AllowURI, URISchemes. # Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength: Metrics/LineLength:
Max: 124 Max: 128
# Offense count: 3 # Offense count: 3
Style/AccessorMethodName: Style/AccessorMethodName:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AlignParameters:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
Enabled: false
# Offense count: 1 # Offense count: 1
Style/Documentation: Style/Documentation:
Enabled: false Enabled: false
@ -35,60 +23,6 @@ Style/Documentation:
Style/GlobalVars: Style/GlobalVars:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/HashSyntax:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Width.
Style/IndentationWidth:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/LeadingCommentSpace:
Enabled: false
# Offense count: 13
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/MultilineIfThen:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowSafeAssignment.
Style/ParenthesesAroundCondition:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterColon:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAroundOperators:
Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
# Offense count: 29
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false
# Offense count: 46 # Offense count: 46
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
@ -100,14 +34,3 @@ Style/StringLiterals:
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiteralsInInterpolation: Style/StringLiteralsInInterpolation:
Enabled: false Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
Style/Tab:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false

View file

@ -1,5 +1,5 @@
#ruby=ruby-2.1.1 # ruby=ruby-2.1.1
#ruby-gemset=Echo # ruby-gemset=Echo
source "https://rubygems.org" source "https://rubygems.org"

View file

@ -11,33 +11,33 @@ def get_session_username_b
end end
Given(/^I am logged in as the user "(.*?)"$/) do |username| Given(/^I am logged in as the user "(.*?)"$/) do |username|
step 'the user "' + username +'" exists' step 'the user "' + username + '" exists'
visit(LoginPage).login_with(username, ENV["MEDIAWIKI_PASSWORD"]) visit(LoginPage).login_with(username, ENV["MEDIAWIKI_PASSWORD"])
end end
# Note Echo redefines this so that the user is unique to the current browser # Note Echo redefines this so that the user is unique to the current browser
Given(/^I am logged in my non-shared account$/) do Given(/^I am logged in my non-shared account$/) do
username = get_session_username() username = get_session_username
step 'I am logged in as the user "' + username + '"' step 'I am logged in as the user "' + username + '"'
end end
Given(/^I am on the "(.+)" page$/) do |title| Given(/^I am on the "(.+)" page$/) do |title|
on(APIPage).create title, "Test is used by Selenium web driver" on(APIPage).create title, "Test is used by Selenium web driver"
visit(ArticlePage, :using_params => {:article_name => title}) visit(ArticlePage, using_params: { article_name: title })
end end
Given(/^I am using user agent "(.+)"$/) do |user_agent| Given(/^I am using user agent "(.+)"$/) do |user_agent|
@user_agent = user_agent @user_agent = user_agent
@browser = browser(test_name(@scenario), {user_agent: user_agent}) @browser = browser(test_name(@scenario), user_agent: user_agent)
$session_id = @browser.driver.instance_variable_get(:@bridge).session_id $session_id = @browser.driver.instance_variable_get(:@bridge).session_id
end end
Given(/^my user rights get changed$/) do Given(/^my user rights get changed$/) do
@username = get_new_username() @username = get_new_username
client = on(APIPage).client client = on(APIPage).client
client.log_in(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"]) client.log_in(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
resp = client.query(action: "query", list: "users", ususers: @username, ustoken: 'userrights') resp = client.query(action: "query", list: "users", ususers: @username, ustoken: 'userrights')
data = resp.data() data = resp.data
@token = data["users"][0]["userrightstoken"] @token = data["users"][0]["userrightstoken"]
client.action('userrights', token_type: false, token: @token, add: "bot", user: @username) client.action('userrights', token_type: false, token: @token, add: "bot", user: @username)
end end
@ -59,5 +59,3 @@ end
Then(/^I see the first heading on the page says Notifications$/) do Then(/^I see the first heading on the page says Notifications$/) do
expect(on(ArticlePage).first_heading_span).to match "Notifications" expect(on(ArticlePage).first_heading_span).to match "Notifications"
end end

View file

@ -12,4 +12,4 @@ end
Then(/^I see the notification flyout button$/) do Then(/^I see the notification flyout button$/) do
expect(on(ArticlePage).flyout_link_container_element.when_present).to be_visible expect(on(ArticlePage).flyout_link_container_element.when_present).to be_visible
end end

View file

@ -4,11 +4,11 @@ end
Given(/^I have a Flow message that triggers an alert notification$/) do Given(/^I have a Flow message that triggers an alert notification$/) do
client = on(APIPage).client client = on(APIPage).client
username = get_session_username_b() username = get_session_username_b
step 'the user "' + username + '" exists' step 'the user "' + username + '" exists'
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"]) client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
client.action( 'flow', token_type: 'edit', submodule: 'new-topic', page: 'Talk:Flow QA', client.action('flow', token_type: 'edit', submodule: 'new-topic', page: 'Talk:Flow QA',
nttopic:'Mention #1', ntcontent: '[[User:' + get_session_username() + ']] I wanted to say hello.' ) nttopic: 'Mention #1', ntcontent: '[[User:' + get_session_username + ']] I wanted to say hello.')
end end
When(/^I click the mark all as read button$/) do When(/^I click the mark all as read button$/) do

View file

@ -1,24 +1,24 @@
def make_page_with_user( title, text, username ) def make_page_with_user(title, text, username)
client = on(APIPage).client client = on(APIPage).client
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"]) client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
client.create_page(title, text) client.create_page(title, text)
end end
def clear_notifications( username ) def clear_notifications(username)
client = on(APIPage).client client = on(APIPage).client
step 'the user "' + username + '" exists' step 'the user "' + username + '" exists'
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"]) client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
client.action( 'echomarkread', token_type: 'edit', all: '1' ) client.action('echomarkread', token_type: 'edit', all: '1')
end end
def make_page_with_user_b( title, text ) def make_page_with_user_b(title, text)
username = get_session_username_b() username = get_session_username_b
step 'the user "' + username + '" exists' step 'the user "' + username + '" exists'
make_page_with_user( title, text, username ) make_page_with_user(title, text, username)
end end
def make_page_with_user_a( title, text ) def make_page_with_user_a(title, text)
make_page_with_user( title, text, get_session_username() ) make_page_with_user(title, text, get_session_username)
end end
def poll_for_new_notifications(number_of_polls) def poll_for_new_notifications(number_of_polls)
@ -36,12 +36,12 @@ Given(/^another user has linked to a page I created from another page$/) do
end end
Given(/^another user writes on my talk page$/) do Given(/^another user writes on my talk page$/) do
make_page_with_user_b("User talk:" + get_session_username(), make_page_with_user_b("User talk:" + get_session_username,
"== Barnstar ==\nHello Selenium, here is a barnstar for all your testing! " + @random_string + "~~~~\n") "== Barnstar ==\nHello Selenium, here is a barnstar for all your testing! " + @random_string + "~~~~\n")
end end
Given(/^another user @s me on "(.*?)"$/) do |title| Given(/^another user @s me on "(.*?)"$/) do |title|
username = get_session_username().sub( '_', ' ' ) username = get_session_username.sub('_', ' ')
text = "@" + username + " Cho cho cho. ~~~~" text = "@" + username + " Cho cho cho. ~~~~"
make_page_with_user_b(title, text) make_page_with_user_b(title, text)
end end
@ -52,29 +52,29 @@ end
Given(/^another user mentions me on the wiki$/) do Given(/^another user mentions me on the wiki$/) do
title = 'Selenium Echo mention test ' + @random_string title = 'Selenium Echo mention test ' + @random_string
username = get_session_username().sub( '_', ' ' ) username = get_session_username.sub('_', ' ')
text = "== The walrus ==\n[[User:" + username + "]]: Cho cho cho. ~~~~\n" text = "== The walrus ==\n[[User:" + username + "]]: Cho cho cho. ~~~~\n"
make_page_with_user_b(title, text) make_page_with_user_b(title, text)
end end
Given(/^I am logged in as a new user$/) do Given(/^I am logged in as a new user$/) do
@username = get_new_username() @username = get_new_username
step 'I am logged in as the user "' + @username + '"' step 'I am logged in as the user "' + @username + '"'
end end
Given(/^I am logged in as a new user with no notifications$/) do Given(/^I am logged in as a new user with no notifications$/) do
@username = get_new_username() @username = get_new_username
clear_notifications( @username ) clear_notifications(@username)
step 'I am logged in as the user "' + @username + '"' step 'I am logged in as the user "' + @username + '"'
end end
Given(/^I am logged in with no notifications$/) do Given(/^I am logged in with no notifications$/) do
# Mark all messages as read # Mark all messages as read
client = on(APIPage).client client = on(APIPage).client
username = get_session_username() username = get_session_username
step 'the user "' + username + '" exists' step 'the user "' + username + '" exists'
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"]) client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
client.action( 'echomarkread', token_type: 'edit', all: '1' ) client.action('echomarkread', token_type: 'edit', all: '1')
step 'I am logged in my non-shared account' step 'I am logged in my non-shared account'
step 'I have no new notifications' step 'I have no new notifications'

View file

@ -3,10 +3,10 @@ require "bundler/setup"
Bundler.require Bundler.require
if ( ENV['PAGE_WAIT_TIMEOUT'] ) then if ENV['PAGE_WAIT_TIMEOUT']
PageObject.default_page_wait = ENV['PAGE_WAIT_TIMEOUT'].to_i PageObject.default_page_wait = ENV['PAGE_WAIT_TIMEOUT'].to_i
end end
if ( ENV['ELEMENT_WAIT_TIMEOUT'] ) then if ENV['ELEMENT_WAIT_TIMEOUT']
PageObject.default_element_wait = ENV['ELEMENT_WAIT_TIMEOUT'].to_i PageObject.default_element_wait = ENV['ELEMENT_WAIT_TIMEOUT'].to_i
end end

View file

@ -3,7 +3,7 @@ class ArticlePage
include URL include URL
page_url URL.url("<%=params[:article_name]%><%=params[:hash]%>") page_url URL.url("<%=params[:article_name]%><%=params[:hash]%>")
span(:first_heading_span, css: "#firstHeading > span:nth-child(1)" ) span(:first_heading_span, css: "#firstHeading > span:nth-child(1)")
li(:flyout_link_container, css: "#pt-notifications") li(:flyout_link_container, css: "#pt-notifications")
a(:flyout_link, css: "#pt-notifications a") a(:flyout_link, css: "#pt-notifications a")
div(:flyout, css: ".mw-echo-overlay") div(:flyout, css: ".mw-echo-overlay")