mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-27 17:40:06 +00:00
Fixed Style/StringLiterals RuboCop offense
See: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals Bug: T117984 Change-Id: I5388aa3f7c47b9667a03d905f6562dfe6939a70e
This commit is contained in:
parent
810506a063
commit
c8237daa5b
|
@ -16,9 +16,3 @@ Metrics/LineLength:
|
|||
Style/GlobalVars:
|
||||
Exclude:
|
||||
- 'tests/browser/features/step_definitions/mmv_performance_steps.rb'
|
||||
|
||||
# Offense count: 79
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/StringLiterals:
|
||||
Enabled: false
|
||||
|
|
6
Gemfile
6
Gemfile
|
@ -1,4 +1,4 @@
|
|||
source "https://rubygems.org"
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem "mediawiki_selenium", "~> 1.6.2"
|
||||
gem "rubocop", "~> 0.35.1", require: false
|
||||
gem 'mediawiki_selenium', '~> 1.6.2'
|
||||
gem 'rubocop', '~> 0.35.1', require: false
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# encoding: utf-8
|
||||
|
||||
When /^I open the download dropdown$/ do
|
||||
step "I click the download icon"
|
||||
step "I click the download down arrow icon"
|
||||
step 'I click the download icon'
|
||||
step 'I click the download down arrow icon'
|
||||
end
|
||||
|
||||
When /^I click the download icon$/ do
|
||||
|
@ -25,11 +25,11 @@ end
|
|||
When /^I click the (.*) download size$/ do |size_option|
|
||||
on(E2ETestPage) do |page|
|
||||
case size_option
|
||||
when "small"
|
||||
when 'small'
|
||||
@index = 1
|
||||
when "medium"
|
||||
when 'medium'
|
||||
@index = 2
|
||||
when "large"
|
||||
when 'large'
|
||||
@index = 3
|
||||
else
|
||||
@index = 0
|
||||
|
|
|
@ -10,7 +10,7 @@ end
|
|||
|
||||
When /^I press the browser back button$/ do
|
||||
# $browser.back doesn't work for Safari. This is a workaround for https://code.google.com/p/selenium/issues/detail?id=3771
|
||||
on(E2ETestPage).execute_script("window.history.back();")
|
||||
on(E2ETestPage).execute_script('window.history.back();')
|
||||
end
|
||||
|
||||
Then /^the image and metadata of the next image should appear$/ do
|
||||
|
@ -31,7 +31,7 @@ end
|
|||
|
||||
Then /^the wiki article should be scrolled to the same position as before opening MMV$/ do
|
||||
on(E2ETestPage) do |page|
|
||||
scroll_difference = page.execute_script("return $(window).scrollTop();") - @article_scroll_top
|
||||
scroll_difference = page.execute_script('return $(window).scrollTop();') - @article_scroll_top
|
||||
expect(scroll_difference.abs).to be < 2
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,24 +33,24 @@ When /^I click the disable X icon$/ do
|
|||
end
|
||||
|
||||
When /^I disable MMV$/ do
|
||||
step "I click the options icon"
|
||||
step "I click the disable button"
|
||||
step 'I click the options icon'
|
||||
step 'I click the disable button'
|
||||
end
|
||||
|
||||
When /^I reenable MMV$/ do
|
||||
step "I disable MMV"
|
||||
step "I click the options icon"
|
||||
step "I click the enable button"
|
||||
step 'I disable MMV'
|
||||
step 'I click the options icon'
|
||||
step 'I click the enable button'
|
||||
end
|
||||
|
||||
When /^I click the options icon with MMV disabled$/ do
|
||||
step "I disable MMV"
|
||||
step "I click the options icon"
|
||||
step 'I disable MMV'
|
||||
step 'I click the options icon'
|
||||
end
|
||||
|
||||
When /^I disable and close MMV$/ do
|
||||
step "I disable MMV"
|
||||
step "I close MMV"
|
||||
step 'I disable MMV'
|
||||
step 'I close MMV'
|
||||
end
|
||||
|
||||
Then /^the disable confirmation should appear$/ do
|
||||
|
|
|
@ -4,11 +4,11 @@ end
|
|||
|
||||
Given /^I visit the Commons page$/ do
|
||||
@commons_open_time = Time.now.getutc
|
||||
browser.goto "https://commons.wikimedia.org/wiki/File:Sunrise_over_fishing_boats_in_Kerala.jpg"
|
||||
browser.goto 'https://commons.wikimedia.org/wiki/File:Sunrise_over_fishing_boats_in_Kerala.jpg'
|
||||
end
|
||||
|
||||
Given /^I visit an unrelated Commons page to warm up the browser cache$/ do
|
||||
browser.goto "https://commons.wikimedia.org/wiki/File:Wikimedia_Foundation_2013_All_Hands_Offsite_-_Day_2_-_Photo_16.jpg"
|
||||
browser.goto 'https://commons.wikimedia.org/wiki/File:Wikimedia_Foundation_2013_All_Hands_Offsite_-_Day_2_-_Photo_16.jpg'
|
||||
end
|
||||
|
||||
Given /^I have a small browser window$/ do
|
||||
|
@ -29,18 +29,18 @@ end
|
|||
|
||||
Then /^the File: page image is loaded$/ do
|
||||
on(CommonsPage) do |page|
|
||||
page.wait_for_image_load ".fullImageLink img"
|
||||
page.wait_for_image_load '.fullImageLink img'
|
||||
# Has to be a global variable, otherwise it doesn't survive between scenarios
|
||||
$commons_time = Time.now.getutc - @commons_open_time
|
||||
page.log_performance type: "file-page", duration: $commons_time * 1000
|
||||
page.log_performance type: 'file-page', duration: $commons_time * 1000
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the MMV image is loaded in (\d+) percent of the time with a (.*) cache and an? (.*) browser window$/ do |percentage, cache, window_size|
|
||||
on(E2ETestPage) do |page|
|
||||
page.wait_for_image_load ".mw-mmv-image img"
|
||||
page.wait_for_image_load '.mw-mmv-image img'
|
||||
mmv_time = Time.now.getutc - @image_click_time
|
||||
page.log_performance type: "mmv", duration: mmv_time * 1000, cache: cache, windowSize: window_size
|
||||
page.log_performance type: 'mmv', duration: mmv_time * 1000, cache: cache, windowSize: window_size
|
||||
|
||||
expected_time = $commons_time * (percentage.to_f / 100.0)
|
||||
expect(mmv_time).to be < expected_time
|
||||
|
|
|
@ -6,9 +6,9 @@ Given /^I am at a wiki article with at least two embedded pictures$/ do
|
|||
end
|
||||
|
||||
Given /^I am viewing an image using MMV$/ do
|
||||
step "I am at a wiki article with at least two embedded pictures"
|
||||
step "I click on the second image in the article"
|
||||
step "the image metadata and the image itself should be there"
|
||||
step 'I am at a wiki article with at least two embedded pictures'
|
||||
step 'I click on the second image in the article'
|
||||
step 'the image metadata and the image itself should be there'
|
||||
end
|
||||
|
||||
When /^I click on the first image in the article$/ do
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require "json"
|
||||
require 'json'
|
||||
|
||||
class CommonsPage
|
||||
include PageObject
|
||||
|
||||
page_url "File:Sunrise_over_fishing_boats_in_Kerala.jpg"
|
||||
page_url 'File:Sunrise_over_fishing_boats_in_Kerala.jpg'
|
||||
|
||||
img(:commons_image, src: /Kerala\.jpg$/)
|
||||
div(:mmv_image_loaded_cucumber, class: "mw-mmv-image-loaded-cucumber")
|
||||
div(:mmv_image_loaded_cucumber, class: 'mw-mmv-image-loaded-cucumber')
|
||||
|
||||
def wait_for_image_load(selector)
|
||||
browser.execute_script <<-end_script
|
||||
|
|
|
@ -1,87 +1,87 @@
|
|||
class E2ETestPage < CommonsPage
|
||||
include PageObject
|
||||
|
||||
page_url "MediaViewerE2ETest"
|
||||
page_url 'MediaViewerE2ETest'
|
||||
|
||||
# Tag page elements that we will need.
|
||||
|
||||
# First image in lightbox demo page
|
||||
a(:image1_in_article, class: "image", href: /Kerala\.jpg$/)
|
||||
a(:image2_in_article, class: "image", href: /Wikimedia_Foundation_2013_All_Hands_Offsite_-_Day_2_-_Photo_24\.jpg$/)
|
||||
a(:image1_in_article, class: 'image', href: /Kerala\.jpg$/)
|
||||
a(:image2_in_article, class: 'image', href: /Wikimedia_Foundation_2013_All_Hands_Offsite_-_Day_2_-_Photo_24\.jpg$/)
|
||||
|
||||
a(:other_image_in_article, href: /Academy_of_Sciences\.jpg$/)
|
||||
|
||||
# Black overlay
|
||||
div(:mmv_overlay, class: "mw-mmv-overlay")
|
||||
div(:mmv_overlay, class: 'mw-mmv-overlay')
|
||||
|
||||
# Wrapper div for all mmv elements
|
||||
div(:mmv_wrapper, class: "mw-mmv-wrapper")
|
||||
div(:mmv_wrapper, class: 'mw-mmv-wrapper')
|
||||
|
||||
# Wrapper div for image
|
||||
div(:mmv_image_div, class: "mw-mmv-image")
|
||||
div(:mmv_image_div, class: 'mw-mmv-image')
|
||||
|
||||
# Actual image
|
||||
image(:mmv_final_image, class: "mw-mmv-final-image")
|
||||
image(:mmv_final_image, class: 'mw-mmv-final-image')
|
||||
|
||||
# Metadata elements
|
||||
span(:mmv_metadata_title, class: "mw-mmv-title")
|
||||
a(:mmv_metadata_license, class: "mw-mmv-license")
|
||||
p(:mmv_metadata_credit, class: "mw-mmv-credit")
|
||||
span(:mmv_metadata_source, class: "mw-mmv-source")
|
||||
span(:mmv_metadata_title, class: 'mw-mmv-title')
|
||||
a(:mmv_metadata_license, class: 'mw-mmv-license')
|
||||
p(:mmv_metadata_credit, class: 'mw-mmv-credit')
|
||||
span(:mmv_metadata_source, class: 'mw-mmv-source')
|
||||
|
||||
div(:mmv_image_metadata_wrapper, class: "mw-mmv-image-metadata")
|
||||
p(:mmv_image_metadata_desc, class: "mw-mmv-image-desc")
|
||||
div(:mmv_image_metadata_wrapper, class: 'mw-mmv-image-metadata')
|
||||
p(:mmv_image_metadata_desc, class: 'mw-mmv-image-desc')
|
||||
|
||||
ul(:mmv_image_metadata_links_wrapper, class: "mw-mmv-image-links")
|
||||
a(:mmv_details_page_link, class: "mw-mmv-description-page-button")
|
||||
ul(:mmv_image_metadata_links_wrapper, class: 'mw-mmv-image-links')
|
||||
a(:mmv_details_page_link, class: 'mw-mmv-description-page-button')
|
||||
|
||||
# Controls
|
||||
div(:mmv_next_button, class: "mw-mmv-next-image")
|
||||
div(:mmv_previous_button, class: "mw-mmv-prev-image")
|
||||
div(:mmv_close_button, class: "mw-mmv-close")
|
||||
div(:mmv_image_loaded_cucumber, class: "mw-mmv-image-loaded-cucumber")
|
||||
div(:mmv_next_button, class: 'mw-mmv-next-image')
|
||||
div(:mmv_previous_button, class: 'mw-mmv-prev-image')
|
||||
div(:mmv_close_button, class: 'mw-mmv-close')
|
||||
div(:mmv_image_loaded_cucumber, class: 'mw-mmv-image-loaded-cucumber')
|
||||
|
||||
# Download
|
||||
div(:mmv_download_icon, class: "mw-mmv-download-button")
|
||||
div(:mmv_download_menu, class: "mw-mmv-download-dialog")
|
||||
span(:mmv_download_size_label, class: "mw-mmv-download-image-size")
|
||||
span(:mmv_download_down_arrow_icon, class: "mw-mmv-download-select-menu")
|
||||
div(:mmv_download_size_menu_container, class: "mw-mmv-download-size")
|
||||
div(:mmv_download_icon, class: 'mw-mmv-download-button')
|
||||
div(:mmv_download_menu, class: 'mw-mmv-download-dialog')
|
||||
span(:mmv_download_size_label, class: 'mw-mmv-download-image-size')
|
||||
span(:mmv_download_down_arrow_icon, class: 'mw-mmv-download-select-menu')
|
||||
div(:mmv_download_size_menu_container, class: 'mw-mmv-download-size')
|
||||
div(:mmv_download_size_menu) do |page|
|
||||
page.mmv_download_size_menu_container_element.div_element(class: "oo-ui-selectWidget")
|
||||
page.mmv_download_size_menu_container_element.div_element(class: 'oo-ui-selectWidget')
|
||||
end
|
||||
divs(:mmv_download_size_options, class: "oo-ui-menuOptionWidget")
|
||||
a(:mmv_download_link, class: "mw-mmv-download-go-button")
|
||||
a(:mmv_download_preview_link, class: "mw-mmv-download-preview-link")
|
||||
div(:mmv_download_attribution_area, class: "mw-mmv-download-attribution")
|
||||
p(:mmv_download_attribution_area_close_icon, class: "mw-mmv-download-attribution-close-button")
|
||||
div(:mmv_download_attribution_area_input_container, class: "mw-mmv-download-attr-input")
|
||||
divs(:mmv_download_size_options, class: 'oo-ui-menuOptionWidget')
|
||||
a(:mmv_download_link, class: 'mw-mmv-download-go-button')
|
||||
a(:mmv_download_preview_link, class: 'mw-mmv-download-preview-link')
|
||||
div(:mmv_download_attribution_area, class: 'mw-mmv-download-attribution')
|
||||
p(:mmv_download_attribution_area_close_icon, class: 'mw-mmv-download-attribution-close-button')
|
||||
div(:mmv_download_attribution_area_input_container, class: 'mw-mmv-download-attr-input')
|
||||
text_field(:mmv_download_attribution_area_input) do |page|
|
||||
page.mmv_download_attribution_area_input_container_element.text_field_element
|
||||
end
|
||||
|
||||
# Options
|
||||
div(:mmv_options_icon, class: "mw-mmv-options-button")
|
||||
div(:mmv_options_menu_disable, class: "mw-mmv-options-disable")
|
||||
div(:mmv_options_menu_enable, class: "mw-mmv-options-enable")
|
||||
div(:mmv_options_icon, class: 'mw-mmv-options-button')
|
||||
div(:mmv_options_menu_disable, class: 'mw-mmv-options-disable')
|
||||
div(:mmv_options_menu_enable, class: 'mw-mmv-options-enable')
|
||||
button(:mmv_options_enable_button) do |page|
|
||||
page.mmv_options_menu_enable_element.div_element(class: "mw-mmv-options-submit").button_element(class: "mw-mmv-options-submit-button")
|
||||
page.mmv_options_menu_enable_element.div_element(class: 'mw-mmv-options-submit').button_element(class: 'mw-mmv-options-submit-button')
|
||||
end
|
||||
button(:mmv_options_disable_button) do |page|
|
||||
page.mmv_options_menu_disable_element.div_element(class: "mw-mmv-options-submit").button_element(class: "mw-mmv-options-submit-button")
|
||||
page.mmv_options_menu_disable_element.div_element(class: 'mw-mmv-options-submit').button_element(class: 'mw-mmv-options-submit-button')
|
||||
end
|
||||
button(:mmv_options_enable_cancel_button) do |page|
|
||||
page.mmv_options_menu_enable_element.div_element(class: "mw-mmv-options-submit").button_element(class: "mw-mmv-options-cancel-button")
|
||||
page.mmv_options_menu_enable_element.div_element(class: 'mw-mmv-options-submit').button_element(class: 'mw-mmv-options-cancel-button')
|
||||
end
|
||||
button(:mmv_options_disable_cancel_button) do |page|
|
||||
page.mmv_options_menu_disable_element.div_element(class: "mw-mmv-options-submit").button_element(class: "mw-mmv-options-cancel-button")
|
||||
page.mmv_options_menu_disable_element.div_element(class: 'mw-mmv-options-submit').button_element(class: 'mw-mmv-options-cancel-button')
|
||||
end
|
||||
div(:mmv_options_disable_confirmation, class: "mw-mmv-disable-confirmation")
|
||||
div(:mmv_options_disable_confirmation, class: 'mw-mmv-disable-confirmation')
|
||||
div(:mmv_options_disable_x_icon) do |page|
|
||||
page.mmv_options_disable_confirmation_element.div_element(class: "mw-mmv-confirmation-close")
|
||||
page.mmv_options_disable_confirmation_element.div_element(class: 'mw-mmv-confirmation-close')
|
||||
end
|
||||
div(:mmv_options_enable_confirmation, class: "mw-mmv-enable-confirmation")
|
||||
div(:mmv_options_enable_confirmation, class: 'mw-mmv-enable-confirmation')
|
||||
div(:mmv_options_enable_x_icon) do |page|
|
||||
page.mmv_options_enable_confirmation_element.div_element(class: "mw-mmv-confirmation-close")
|
||||
page.mmv_options_enable_confirmation_element.div_element(class: 'mw-mmv-confirmation-close')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue