mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-27 17:20:40 +00:00
QA update for single quote preference
Change-Id: I35d22c47abd78a588f622b9b7cd07444c345db5a
This commit is contained in:
parent
6468f8e575
commit
bf9773e6ed
|
@ -23,9 +23,3 @@ Style/Documentation:
|
|||
Style/GlobalVars:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 46
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/StringLiterals:
|
||||
Enabled: false
|
||||
|
||||
|
|
12
Gemfile
12
Gemfile
|
@ -1,10 +1,10 @@
|
|||
# ruby=ruby-2.1.1
|
||||
# ruby-gemset=Echo
|
||||
|
||||
source "https://rubygems.org"
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem "chunky_png"
|
||||
gem "csscss"
|
||||
gem "mediawiki_api"
|
||||
gem "mediawiki_selenium"
|
||||
gem "rubocop", require: false
|
||||
gem 'chunky_png'
|
||||
gem 'csscss'
|
||||
gem 'mediawiki_api'
|
||||
gem 'mediawiki_selenium'
|
||||
gem 'rubocop', require: false
|
||||
|
|
|
@ -7,12 +7,12 @@ def get_session_username
|
|||
end
|
||||
|
||||
def get_session_username_b
|
||||
"EchoUser"
|
||||
'EchoUser'
|
||||
end
|
||||
|
||||
Given(/^I am logged in as the user "(.*?)"$/) do |username|
|
||||
step 'the user "' + username + '" exists'
|
||||
visit(LoginPage).login_with(username, ENV["MEDIAWIKI_PASSWORD"])
|
||||
visit(LoginPage).login_with(username, ENV['MEDIAWIKI_PASSWORD'])
|
||||
end
|
||||
|
||||
# Note Echo redefines this so that the user is unique to the current browser
|
||||
|
@ -22,7 +22,7 @@ Given(/^I am logged in my non-shared account$/) do
|
|||
end
|
||||
|
||||
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 })
|
||||
end
|
||||
|
||||
|
@ -35,27 +35,27 @@ end
|
|||
Given(/^my user rights get changed$/) do
|
||||
@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')
|
||||
client.log_in(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD'])
|
||||
resp = client.query(action: 'query', list: 'users', ususers: @username, ustoken: 'userrights')
|
||||
data = resp.data
|
||||
@token = data["users"][0]["userrightstoken"]
|
||||
client.action('userrights', token_type: false, token: @token, add: "bot", user: @username)
|
||||
@token = data['users'][0]['userrightstoken']
|
||||
client.action('userrights', token_type: false, token: @token, add: 'bot', user: @username)
|
||||
end
|
||||
|
||||
Given(/^the user "(.*?)" exists$/) do |username|
|
||||
on(APIPage).client.log_in(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
|
||||
on(APIPage).client.log_in(ENV['MEDIAWIKI_USER'], ENV['MEDIAWIKI_PASSWORD'])
|
||||
begin
|
||||
on(APIPage).client.create_account(username, ENV["MEDIAWIKI_PASSWORD"])
|
||||
puts "Successfully created user " + username
|
||||
on(APIPage).client.create_account(username, ENV['MEDIAWIKI_PASSWORD'])
|
||||
puts 'Successfully created user ' + username
|
||||
rescue MediawikiApi::ApiError
|
||||
puts 'Assuming in step that user ' + username + ' already exists since was unable to create.'
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I am on the Special Notifications page$/) do
|
||||
expect(@browser.url).to match "Special:Notifications"
|
||||
expect(@browser.url).to match 'Special:Notifications'
|
||||
end
|
||||
|
||||
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
|
||||
|
|
|
@ -6,7 +6,7 @@ Given(/^I have a Flow message that triggers an alert notification$/) do
|
|||
client = on(APIPage).client
|
||||
username = get_session_username_b
|
||||
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',
|
||||
nttopic: 'Mention #1', ntcontent: '[[User:' + get_session_username + ']] I wanted to say hello.')
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
def make_page_with_user(title, text, username)
|
||||
client = on(APIPage).client
|
||||
client.log_in(username, ENV["MEDIAWIKI_PASSWORD"])
|
||||
client.log_in(username, ENV['MEDIAWIKI_PASSWORD'])
|
||||
client.create_page(title, text)
|
||||
end
|
||||
|
||||
def clear_notifications(username)
|
||||
client = on(APIPage).client
|
||||
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')
|
||||
end
|
||||
|
||||
|
@ -30,19 +30,19 @@ end
|
|||
|
||||
Given(/^another user has linked to a page I created from another page$/) do
|
||||
title = 'Selenium Echo link test ' + @random_string
|
||||
make_page_with_user_a(title, "Selenium test page. Feel free to delete me.")
|
||||
make_page_with_user_a(title, 'Selenium test page. Feel free to delete me.')
|
||||
title2 = title + ' ' + @random_string
|
||||
make_page_with_user_b(title2, "I am linking to [[" + title + "]].")
|
||||
make_page_with_user_b(title2, 'I am linking to [[' + title + ']].')
|
||||
end
|
||||
|
||||
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")
|
||||
end
|
||||
|
||||
Given(/^another user @s me on "(.*?)"$/) do |title|
|
||||
username = get_session_username.sub('_', ' ')
|
||||
text = "@" + username + " Cho cho cho. ~~~~"
|
||||
text = '@' + username + ' Cho cho cho. ~~~~'
|
||||
make_page_with_user_b(title, text)
|
||||
end
|
||||
|
||||
|
@ -73,7 +73,7 @@ Given(/^I am logged in with no notifications$/) do
|
|||
client = on(APIPage).client
|
||||
username = get_session_username
|
||||
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')
|
||||
|
||||
step 'I am logged in my non-shared account'
|
||||
|
@ -81,9 +81,9 @@ Given(/^I am logged in with no notifications$/) do
|
|||
end
|
||||
|
||||
Then(/^I have no new notifications$/) do
|
||||
expect(on(ArticlePage).flyout_link_element.when_present.class_name).not_to match "mw-echo-unread-notifications"
|
||||
expect(on(ArticlePage).flyout_link_element.when_present.class_name).not_to match 'mw-echo-unread-notifications'
|
||||
end
|
||||
|
||||
Then(/^I have new notifications$/) do
|
||||
expect(on(ArticlePage).flyout_link_element.when_present.class_name).to match "mw-echo-unread-notifications"
|
||||
expect(on(ArticlePage).flyout_link_element.when_present.class_name).to match 'mw-echo-unread-notifications'
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
require 'rubygems'
|
||||
require 'bundler/setup'
|
||||
|
||||
Bundler.require
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# Allow running of bundle exec cucumber --dry-run -f stepdefs
|
||||
require "mediawiki_selenium"
|
||||
require 'mediawiki_selenium'
|
||||
require 'page-object'
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
class ArticlePage
|
||||
include PageObject
|
||||
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)")
|
||||
li(:flyout_link_container, css: "#pt-notifications")
|
||||
a(:flyout_link, css: "#pt-notifications a")
|
||||
div(:flyout, css: ".mw-echo-overlay")
|
||||
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')
|
||||
|
||||
# Overlay header
|
||||
a(:alert_tab_link, css: ".mw-echo-overlay-title ul li a", index: 1)
|
||||
button(:mark_as_read, css: ".mw-echo-notifications > button")
|
||||
a(:messages_view_link, css: ".mw-ui-active")
|
||||
a(:alert_tab_link, css: '.mw-echo-overlay-title ul li a', index: 1)
|
||||
button(:mark_as_read, css: '.mw-echo-notifications > button')
|
||||
a(:messages_view_link, css: '.mw-ui-active')
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue