diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7516de263..5c3b984cf 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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 diff --git a/Gemfile b/Gemfile index e4060f0ed..977fd628c 100755 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ -#ruby=ruby-2.1.1 -#ruby-gemset=Echo +# ruby=ruby-2.1.1 +# ruby-gemset=Echo source "https://rubygems.org" diff --git a/tests/browser/features/step_definitions/common_steps.rb b/tests/browser/features/step_definitions/common_steps.rb index 4c48faf6d..e54203f3a 100644 --- a/tests/browser/features/step_definitions/common_steps.rb +++ b/tests/browser/features/step_definitions/common_steps.rb @@ -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 - - diff --git a/tests/browser/features/step_definitions/flyout_steps.rb b/tests/browser/features/step_definitions/flyout_steps.rb index 59e63e866..e57130567 100644 --- a/tests/browser/features/step_definitions/flyout_steps.rb +++ b/tests/browser/features/step_definitions/flyout_steps.rb @@ -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 \ No newline at end of file +end diff --git a/tests/browser/features/step_definitions/messages_steps.rb b/tests/browser/features/step_definitions/messages_steps.rb index 1464e3962..eaa8646e5 100644 --- a/tests/browser/features/step_definitions/messages_steps.rb +++ b/tests/browser/features/step_definitions/messages_steps.rb @@ -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 diff --git a/tests/browser/features/step_definitions/notifications_steps.rb b/tests/browser/features/step_definitions/notifications_steps.rb index 1b81386d0..34b2b4c02 100644 --- a/tests/browser/features/step_definitions/notifications_steps.rb +++ b/tests/browser/features/step_definitions/notifications_steps.rb @@ -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' diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb index b0ff58565..e68b5f388 100644 --- a/tests/browser/features/support/env.rb +++ b/tests/browser/features/support/env.rb @@ -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 diff --git a/tests/browser/features/support/pages/article_page.rb b/tests/browser/features/support/pages/article_page.rb index 5f24e7b7a..35675cea0 100644 --- a/tests/browser/features/support/pages/article_page.rb +++ b/tests/browser/features/support/pages/article_page.rb @@ -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")