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`
# 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
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@ -8,24 +8,12 @@
# Offense count: 11
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 124
Max: 128
# Offense count: 3
Style/AccessorMethodName:
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
Style/Documentation:
Enabled: false
@ -35,60 +23,6 @@ Style/Documentation:
Style/GlobalVars:
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
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
@ -100,14 +34,3 @@ Style/StringLiterals:
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiteralsInInterpolation:
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-gemset=Echo
# ruby=ruby-2.1.1
# ruby-gemset=Echo
source "https://rubygems.org"

View file

@ -11,33 +11,33 @@ def get_session_username_b
end
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"])
end
# Note Echo redefines this so that the user is unique to the current browser
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 + '"'
end
Given(/^I am on the "(.+)" page$/) do |title|
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
Given(/^I am using user agent "(.+)"$/) do |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
end
Given(/^my user rights get changed$/) do
@username = get_new_username()
@username = get_new_username
client = on(APIPage).client
client.log_in(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
resp = client.query(action: "query", list: "users", ususers: @username, ustoken: 'userrights')
data = resp.data()
data = resp.data
@token = data["users"][0]["userrightstoken"]
client.action('userrights', token_type: false, token: @token, add: "bot", user: @username)
end
@ -59,5 +59,3 @@ end
Then(/^I see the first heading on the page says Notifications$/) do
expect(on(ArticlePage).first_heading_span).to match "Notifications"
end

View file

@ -12,4 +12,4 @@ end
Then(/^I see the notification flyout button$/) do
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
client = on(APIPage).client
username = get_session_username_b()
username = get_session_username_b
step 'the user "' + username + '" exists'
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
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.' )
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.')
end
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.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
client.create_page(title, text)
end
def clear_notifications( username )
def clear_notifications(username)
client = on(APIPage).client
step 'the user "' + username + '" exists'
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
client.action( 'echomarkread', token_type: 'edit', all: '1' )
client.action('echomarkread', token_type: 'edit', all: '1')
end
def make_page_with_user_b( title, text )
username = get_session_username_b()
def make_page_with_user_b(title, text)
username = get_session_username_b
step 'the user "' + username + '" exists'
make_page_with_user( title, text, username )
make_page_with_user(title, text, username)
end
def make_page_with_user_a( title, text )
make_page_with_user( title, text, get_session_username() )
def make_page_with_user_a(title, text)
make_page_with_user(title, text, get_session_username)
end
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
Given(/^another user writes on my talk page$/) do
make_page_with_user_b("User talk:" + get_session_username(),
"== Barnstar ==\nHello Selenium, here is a barnstar for all your testing! " + @random_string + "~~~~\n")
make_page_with_user_b("User talk:" + get_session_username,
"== Barnstar ==\nHello Selenium, here is a barnstar for all your testing! " + @random_string + "~~~~\n")
end
Given(/^another user @s me on "(.*?)"$/) do |title|
username = get_session_username().sub( '_', ' ' )
username = get_session_username.sub('_', ' ')
text = "@" + username + " Cho cho cho. ~~~~"
make_page_with_user_b(title, text)
end
@ -52,29 +52,29 @@ end
Given(/^another user mentions me on the wiki$/) do
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"
make_page_with_user_b(title, text)
end
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 + '"'
end
Given(/^I am logged in as a new user with no notifications$/) do
@username = get_new_username()
clear_notifications( @username )
@username = get_new_username
clear_notifications(@username)
step 'I am logged in as the user "' + @username + '"'
end
Given(/^I am logged in with no notifications$/) do
# Mark all messages as read
client = on(APIPage).client
username = get_session_username()
username = get_session_username
step 'the user "' + username + '" exists'
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 have no new notifications'

View file

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

View file

@ -3,7 +3,7 @@ class ArticlePage
include URL
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")
a(:flyout_link, css: "#pt-notifications a")
div(:flyout, css: ".mw-echo-overlay")