Deleted all Ruby code

The only Ruby code were broken Selenium tests.

Bug: T164479
Depends-On: Ic14b86a5006da360d022af875b4aa8c119a3678a
Change-Id: I15f641cd08ec3ba483c11764a89c9ed493a570a8
This commit is contained in:
Željko Filipin
2017-09-29 19:38:34 +02:00
parent cc53254b2c
commit 4251150afe
41 changed files with 0 additions and 1442 deletions

1
.gitignore vendored
View File

@@ -3,7 +3,6 @@
*.kate-swp
.*.swp
.idea
.bundle/
node_modules/
composer.lock
vendor/

View File

@@ -1,23 +0,0 @@
inherit_from: .rubocop_todo.yml
AllCops:
StyleGuideCopsOnly: true
# Uncomment when the repository is cleaned up
# Metrics/LineLength:
# Max: 100
Metrics/MethodLength:
Enabled: false
Style/Alias:
Enabled: false
Style/SignalException:
Enabled: false
Style/StringLiterals:
EnforcedStyle: single_quotes
Style/TrivialAccessors:
ExactNameMatch: true

View File

@@ -1,18 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2015-11-18 11:57:22 +0100 using RuboCop version 0.35.1.
# 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
# versions of RuboCop, may require this file to be generated again.
# Offense count: 18
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 168
# Offense count: 1
# Configuration parameters: AllowedVariables.
Style/GlobalVars:
Exclude:
- 'tests/browser/features/step_definitions/accept_language_steps.rb'

View File

@@ -1,4 +0,0 @@
source 'https://rubygems.org'
gem 'mediawiki_selenium', '~> 1.7', '>= 1.7.1'
gem 'rubocop', '~> 0.35.1', require: false

View File

@@ -1,102 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.1.0)
astrolabe (1.3.1)
parser (~> 2.2)
builder (3.2.2)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.20)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
data_magic (0.22)
faker (>= 1.1.2)
yml_reader (>= 0.6)
diff-lcs (1.2.5)
domain_name (0.5.20160310)
unf (>= 0.0.5, < 1.0.0)
faker (1.6.3)
i18n (~> 0.5)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
http-cookie (~> 1.0.0)
ffi (1.9.10)
gherkin (2.12.2)
multi_json (~> 1.3)
headless (2.2.3)
http-cookie (1.0.2)
domain_name (~> 0.5)
i18n (0.7.0)
json (1.8.3)
mediawiki_api (0.6.0)
faraday (~> 0.9, >= 0.9.0)
faraday-cookie_jar (~> 0.0, >= 0.0.6)
mediawiki_selenium (1.7.1)
cucumber (~> 1.3, >= 1.3.20)
headless (~> 2.0, >= 2.1.0)
json (~> 1.8, >= 1.8.1)
mediawiki_api (~> 0.6, >= 0.6.0)
page-object (~> 1.0)
rest-client (~> 1.6, >= 1.6.7)
rspec-core (~> 2.14, >= 2.14.4)
rspec-expectations (~> 2.14, >= 2.14.4)
syntax (~> 1.2, >= 1.2.0)
thor (~> 0.19, >= 0.19.1)
mime-types (2.99.2)
multi_json (1.12.1)
multi_test (0.1.2)
multipart-post (2.0.0)
netrc (0.11.0)
page-object (1.1.1)
page_navigation (>= 0.9)
selenium-webdriver (>= 2.44.0)
watir-webdriver (>= 0.6.11)
page_navigation (0.9)
data_magic (>= 0.14)
parser (2.2.3.0)
ast (>= 1.1, < 3.0)
powerpack (0.1.1)
rainbow (2.0.0)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rubocop (0.35.1)
astrolabe (~> 1.3)
parser (>= 2.2.3.0, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
tins (<= 1.6.0)
ruby-progressbar (1.7.5)
rubyzip (1.2.0)
selenium-webdriver (2.53.0)
childprocess (~> 0.5)
rubyzip (~> 1.0)
websocket (~> 1.0)
syntax (1.2.0)
thor (0.19.1)
tins (1.6.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
watir-webdriver (0.9.1)
selenium-webdriver (>= 2.46.2)
websocket (1.2.3)
yml_reader (0.7)
PLATFORMS
ruby
DEPENDENCIES
mediawiki_selenium (~> 1.7, >= 1.7.1)
rubocop (~> 0.35.1)

View File

@@ -1,14 +0,0 @@
require 'bundler/setup'
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop) do |task|
# if you use mediawiki-vagrant, rubocop will by default use it's .rubocop.yml
# the next line makes it explicit that you want .rubocop.yml from the directory
# where `bundle exec rake` is executed
task.options = ['-c', '.rubocop.yml']
end
task default: [:test]
desc 'Run all build/tests commands (CI entry point)'
task test: [:rubocop]

View File

@@ -1 +0,0 @@
Please see https://github.com/wikimedia/mediawiki-selenium for instructions on how to run tests.

View File

@@ -1,39 +0,0 @@
# Customize this configuration as necessary to provide defaults for various
# test environments.
#
# The set of defaults to use is determined by the MEDIAWIKI_ENVIRONMENT
# environment variable.
#
# export MEDIAWIKI_ENVIRONMENT=mw-vagrant-host
# bundle exec cucumber
#
# Additional variables set by the environment will override the corresponding
# defaults defined here.
#
# export MEDIAWIKI_ENVIRONMENT=mw-vagrant-host
# export MEDIAWIKI_USER=Selenium_user2
# bundle exec cucumber
#
mw-vagrant-host: &default
user_factory: true
mediawiki_url: http://127.0.0.1:8080/wiki/
mw-vagrant-guest:
user_factory: true
mediawiki_url: http://127.0.0.1/wiki/
beta:
mediawiki_url: http://en.wikipedia.beta.wmflabs.org/wiki/
mediawiki_user: Selenium_user
# mediawiki_password: SET THIS IN THE ENVIRONMENT!
test2:
mediawiki_url: http://test2.wikipedia.org/wiki/
mediawiki_user: Selenium_user
# mediawiki_password: SET THIS IN THE ENVIRONMENT!
integration:
user_factory: true
# mediawiki_url: THIS WILL BE SET BY JENKINS
default: *default

View File

@@ -1,14 +0,0 @@
@custom-browser @firefox @internet_explorer_10 @phantomjs @sandbox.translatewiki.net
Feature: Accept-Language
Scenario Outline: Accept-Language
Given that my browser's accept language is <language>
When I am at the preferences page
Then link to the main page has text <text>
Examples:
| language | text |
| de | Hauptseite |
| sr | Главна страна |
| sr-ec | Главна страна |
| sr-el | Glavna strana |

View File

@@ -1,37 +0,0 @@
@firefox @internet_explorer_10 @phantomjs
Feature: Autonym font
* With tofu detection in ULS, system fonts will be given preference over webfonts.
* Reference: https://upload.wikimedia.org/wikipedia/commons/7/7d/ULS-WebFonts-Workflow-Diagram.png
Scenario: Autonym font is used in the ULS language search dialog for display language selection by logged-in users
Given I am logged in
And I open the Universal Language Selector
And I open Display panel of language settings
When I click the button with the ellipsis
Then the language list of ULS should use Autonym font
Scenario: Autonym font is used in the ULS language search dialog for input language selection by logged-in users
Given I am logged in
And I open the Universal Language Selector
And I switch to Input panel of language settings
When I click the button with the ellipsis
Then the language list of ULS should use Autonym font
Scenario: Autonym font should be used in the Interlanguage area of a page only with Interlanguage links
When I am on the main page
Then the Interlanguage links should use Autonym font
And elements that are not Interlanguage links should not use Autonym font
Scenario: Autonym font is used in the ULS language search dialog for input language selection by anonymous users
Given I am at the main page
And I open the Universal Language Selector
And I open Input side panel of language settings
When I click the button with the ellipsis
Then the language list of ULS should use Autonym font
#Autonym is blacklisted in Interlanguage area at moment, and may whitelist in future.
Scenario: Autonym font should be used in the Interlanguage area of a page only with Interlanguage links
When I am on the main page
Then the Interlanguage links should use Autonym font
And elements that are not Interlanguage links should not use Autonym font

View File

@@ -1,98 +0,0 @@
@firefox @internet_explorer_10 @phantomjs
Feature: Font selection default disabled
In order to have better using experience,
As a reader and writer,
I want to change or disable the fonts for interface and content.
In addition the user is provided live preview feature: changes are applied
immediately when selection is made. Changes can either be applied or discarded
for easy testing.
This feature is similar to font_selection_default_enabled,
but it is targeted at wikis where automatic font downloading
is disabled by default ($wgULSWebfontsEnabled = false).
Background:
Given I am logged in
And I have reset my preferences
And I set "German" as the interface language
And I open ULS
And I open Display panel of language settings
When I open Fonts panel of language settings
Scenario: Font selector pane appears
Then a font selector for interface language doesn't appear
And a font selector for content language doesn't appear
And the checkbox to enable fonts downloading appears
And the checkbox to enable fonts downloading is not checked
And webfonts are not applied to body
Scenario: Enabling fonts downloading with live preview
When I click the checkbox to enable fonts downloading
Then a font selector for interface language appears
And a font selector for content language appears
And the checkbox to enable fonts downloading appears
And the checkbox to enable fonts downloading is checked
And the selected content font must be system
And webfonts are applied to body
@commons.wikimedia.beta.wmflabs.org
Scenario: Enabling fonts downloading without saving the preferences
When I click the checkbox to enable fonts downloading
And I select OpenDyslexic font for the content language for the live preview
And I close the panel to discard the changes
And I open Display panel of language settings
Then a font selector for interface language doesn't appear
And a font selector for content language doesn't appear
And the active interface font must be the same as font prior to the preview
And the active content font must be the same as font prior to the preview
@commons.wikimedia.beta.wmflabs.org
Scenario: Enabling fonts downloading and saving the preferences
When I click the checkbox to enable fonts downloading
And I select OpenDyslexic font for the interface language for the live preview
And I apply the changes
Then webfonts are applied to body
And the interface font is OpenDyslexic
@commons.wikimedia.beta.wmflabs.org
Scenario: Enabling fonts downloading and going to another page
When I click the checkbox to enable fonts downloading
And I select OpenDyslexic font for the content language for the live preview
And I apply the changes
And I am on the main page
Then webfonts are applied to body
And the content font is OpenDyslexic
@commons.wikimedia.beta.wmflabs.org
Scenario: Enabling fonts downloading and then disabling them
When I click the checkbox to enable fonts downloading
And I select OpenDyslexic font for the interface language for the live preview
And I apply the changes
And I am on the main page
And I open ULS
And I open Display panel of language settings
And I open Fonts panel of language settings
And I click the checkbox to disable fonts downloading
Then a font selector for interface language doesn't appear
And a font selector for content language doesn't appear
@commons.wikimedia.beta.wmflabs.org
Scenario: Enabling fonts downloading and then disabling them and saving the preferences
When I click the checkbox to enable fonts downloading
And I select OpenDyslexic font for the interface language for the live preview
And I apply the changes
And I am on the main page
And I open ULS
And I open Display panel of language settings
And I open Fonts panel of language settings
And I click the checkbox to disable fonts downloading
And I apply the changes
And I am on the main page
And I open ULS
And I open Display panel of language settings
Then a font selector for interface language doesn't appear
And a font selector for content language doesn't appear
And the checkbox to enable fonts downloading is not checked
And webfonts are not applied to body

View File

@@ -1,78 +0,0 @@
@firefox @internet_explorer_10 @language-browsertests.wmflabs.org @phantomjs
Feature: Font selection default enabled
In order to have better using experience,
As a reader and writer,
I want to change or disable the fonts for interface and content.
In addition the user is provided live preview feature: changes are applied
immediately when selection is made. Changes can either be applied or discarded
for easy testing.
This feature is similar to font_selection_default_disabled,
but it is targeted at wikis where automatic font downloading
is enabled by default ($wgULSWebfontsEnabled = true).
Background:
Given I am logged in
And I have reset my preferences
And I set "German" as the interface language
And I open ULS
And I open Display panel of language settings
When I open Fonts panel of language settings
Scenario: Font selector pane appears
Then a font selector for interface language appears
And a font selector for content language appears
And the checkbox to enable fonts downloading appears
And the checkbox to enable fonts downloading is checked
And webfonts are applied to body
Scenario: Discarding live preview of content font
When I select OpenDyslexic font for the content language for the live preview
And I close the panel to discard the changes
And I open Display panel of language settings
Then the selected content font must be system
And the active content font must be the same as font prior to the preview
Scenario: Discarding live preview of interface font
When I select OpenDyslexic font for the interface language for the live preview
And I close the panel to discard the changes
Then the active interface font must be the same as font prior to the preview
And the selected interface font must be Systemschriftart
Scenario: Applying the live preview of interface font
When I select OpenDyslexic font for the interface language for the live preview
And I apply the changes
Then the interface font is OpenDyslexic
Scenario: Disabling fonts if they are enabled by default
When I click the checkbox to enable fonts downloading
Then a font selector for interface language doesn't appear
And a font selector for content language doesn't appear
And the checkbox to enable fonts downloading is not checked
Scenario: Disabling fonts when they are enabled by default and going to another page
When I click the checkbox to disable fonts downloading
And I apply the changes
And I am on the main page
And I open ULS
And I open Display panel of language settings
Then a font selector for interface language doesn't appear
And a font selector for content language doesn't appear
And the checkbox to enable fonts downloading is not checked
And webfonts are not applied to body
Scenario: Disabling fonts, going to another page, and re-enabling fonts
When I click the checkbox to disable fonts downloading
And I apply the changes
And I am on the main page
And I open ULS
And I open Display panel of language settings
And I open Fonts panel of language settings
And I click the checkbox to enable fonts downloading
Then a font selector for interface language appears
And a font selector for content language appears
And the checkbox to enable fonts downloading appears
And the checkbox to enable fonts downloading is checked
And webfonts are applied to body

View File

@@ -1,68 +0,0 @@
@firefox @phantomjs
Feature: Input method engine
User is able to select among different input methods via a menu which is
activated by the input method indicator. User can type with selected input
method in different input fields and temporarily activate and deactivate the
input method.
@commons.wikimedia.beta.wmflabs.org @internet_explorer_10
Scenario: Input method indicator is shown
The input method indicator is shown when input field gets a focus.
Given I am at the main page
When I click on an input box
Then I should see the input method indicator
@commons.wikimedia.beta.wmflabs.org @internet_explorer_10
Scenario: Input method menu
Input method menu is shown when user clicks the input method indicator.
Given I am at the main page
When I click on an input box
And I click on the input method indicator
Then I should see input methods for English
And I should see a list of available input methods
And I should see a list of suggested languages
@internet_explorer_10
Scenario: Unsupported input language
User visits a wiki with content language that does not have have an input
method.
Given I am on a wiki in Kotava language
When I open the input method menu
Then I should see input methods for Kotava
@commons.wikimedia.beta.wmflabs.org
Scenario: Sticky input methods
Chosen input method selection persists across page loads.
Given I am at the main page
When I open the input method menu
And I choose ml as the input language
And I open the input method menu
And I click on the Malayalam InScript 2 menu item
And I press Control-M
And I reload the page
And I click on an input box
And I press Control-M
Then I should see the input method indicator
And in it there must be an element with Malayalam text
@commons.wikimedia.beta.wmflabs.org @internet_explorer_10
Scenario Outline: Input method menu is completely visible
Given I visit a random page with <skin> skin and <language> as the interface language
When I open the input method menu
Then I should see the input method menu is not offscreen
Examples:
| skin | language |
| Vector | English |
| Vector | Hebrew |
| Monobook | English |
#| Monobook | Hebrew |

View File

@@ -1,42 +0,0 @@
@firefox @internet_explorer_10 @phantomjs
Feature: Live preview of display language changes
Background:
Given I am logged in
And I have reset my preferences
And I am at the main page
Scenario: Display language change is previewed immediately
Given I open the Universal Language Selector
And I open Display panel of language settings
And I click the button with the ellipsis
And in the language filter I type malayalam
And I click on the link to select Malayalam
Then I should see the text in the language panel in Malayalam
Scenario: Live preview of display language changes can be reverted on cancel
Given I open the Universal Language Selector
And I open Display panel of language settings
And I select a language different than English for display language
When I click Cancel
And I open Display panel of language settings
Then I should see the text in the language panel in English
Scenario: Live preview of display language changes can be reverted on closing the dialog with the X button
Given I open the Universal Language Selector
And I open Display panel of language settings
And I select a language different than English for display language
When I click X
And I open Display panel of language settings
Then I should see the text in the language panel in English
# https://phabricator.wikimedia.org/T59967
# @commons.wikimedia.beta.wmflabs.org
Scenario: Live preview of display language changes can be reverted on closing the dialog on cancel from a different panel
Given I open the Universal Language Selector
And I open Display panel of language settings
And I select a language different than English for display language
And I switch to Input panel of language settings
When I click Cancel
And I open Display panel of language settings
Then I should see the text in the language panel in English

View File

@@ -1,37 +0,0 @@
# First scenario seems to fail whenever OpenDyslexic is missing
@firefox @internet_explorer_10 @phantomjs
Feature: Persistent settings
This assumes wiki content language is English.
Background:
Given I am logged in
And I have reset my preferences
And I set "German" as the interface language
And I open the Universal Language Selector
And I open Display panel of language settings
And I open Fonts panel of language settings
And I select OpenDyslexic font for the interface language for the live preview
@language-browsertests.wmflabs.org
Scenario: Interface font sticks to another page
When I apply the changes
And I am at the main page
Then the selected interface font must be OpenDyslexic
@language-browsertests.wmflabs.org
Scenario: Discarding a live preview of a font keeps the previous font
When I close the panel to discard the changes
And I am at the main page
Then the selected interface font must be Systemschriftart
Scenario: Changing both a font and an input method is saved
When I open Input side panel of language settings
And I click the button with the ellipsis
And in the language filter I type ml
And I click on the link to select Malayalam
And I select the ml-inscript2 input method in the panel
And I apply the changes
And I am at the main page
Then the selected interface font must be OpenDyslexic
And the selected input method for Malayalam is ml-inscript2

View File

@@ -1,88 +0,0 @@
@firefox @internet_explorer_10 @phantomjs
Feature: Settings panel
@ime-default-on
Scenario Outline: Input settings display
Given I am <user status>
And I am on a page without interlanguage links
When I open ULS
And I switch to Input panel of language settings
Then I can disable input methods
And I can enable input methods
Examples:
| user status |
| logged out |
| logged in |
Scenario: How to use link appears in the Input settings panel
Given I am at the main page
When I open ULS
And I switch to Input panel of language settings
And I click the button with the ellipsis
And in the language filter I type ml
And I click on the link to select Malayalam
Then I should see the How to use link near the Malayalam transliteration item
Scenario: More languages (input language selection)
Given I am at the main page
When I open ULS
And I switch to Input panel of language settings
And I click the button with the ellipsis
Then I see Worldwide
And I see Language Search
And I can navigate back to Input Settings
Scenario: More languages (interface language selection)
Given I am logged in
When I open Language panel of language settings
And I click the button with the ellipsis
Then I see Common Languages
And I see Worldwide
And I see Language Search
And I can navigate back to Language Settings
Scenario: Temporary live preview for menu language
Given I am logged in
When I open Language panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I switch to Input panel of language settings
And I click X
And I open Language panel of language settings
Then the panel is in English
Scenario: The name of site content language is correct when translation language is different
This feature is a bit hard to test. In most cases content language matches
the language of translation. In addition this only applies to anonymous
users in wikis where language changing for anonymous users is disabled. So
to test this we create a somewhat artificial test case by setting the wiki
interface language to a non-default value.
Given I temporarily use "Finnish" as the interface language
When I open Language panel of language settings
Then I see "English (sama kuin sisällön)" as the name of the content language
Scenario: Selecting language via [...] button
Given I am logged in
And I have reset my preferences
When I open Language panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I apply the changes
Then my interface language is "German"
Scenario: Regression test for bug T58913
Given I am logged in
And I have reset my preferences
When I open the Universal Language Selector
And I switch to Input panel of language settings
And I click the button with the ellipsis
And I use the panel to change my input language to "Finnish"
And I close the panel to discard the changes
And I switch to Input panel of language settings
Then I should see English as the selected input language

View File

@@ -1,12 +0,0 @@
Given(/^that my browser's accept language is (.+)$/) do |language|
browser = browser(test_name(@scenario), { language: language })
$session_id = browser.driver.instance_variable_get(:@bridge).session_id
end
When(/^I am at the preferences page$/) do
visit PreferencesPage
end
Then(/^link to the main page has text (.+)$/) do |text|
on(MainPage).main_page_element.text.should == text
end

View File

@@ -1,15 +0,0 @@
When(/^I am on the main page$/) do
visit MainPage
end
Then(/^I open Input side panel of language settings$/) do
on(PanelPage).panel_side_input_element.when_visible.click
end
Then(/^the Interlanguage links should use Autonym font$/) do
on(InterlanguagePage).interlang_link_element.style('font-family').should == "'Autonym',sans-serif"
end
Then(/^elements that are not Interlanguage links should not use Autonym font$/) do
on(MainPage).non_interlanguage_links_use_autonym_font?.should == false
end

View File

@@ -1,106 +0,0 @@
Given(/^I am on a page with interlanguage links$/) do
visit InterlanguagePage
end
Given(/^I am on a page without interlanguage links$/) do
visit NoInterlanguagePage # .add_links_element.when_visible.should be_visible
# cannot do this because of https://phabricator.wikimedia.org/T51139
end
Given(/^I am on a talk page with interlanguage links$/) do
visit(InterlanguagePage).talk_element.click
end
Given(/^I am on a talk page without interlanguage links$/) do
visit(NoInterlanguagePage).talk_element.click
end
Given(/^I navigate to the anonymous Language Settings panel$/) do
step 'I am on a page with interlanguage links'
step 'I click the cog icon by Languages in the sidebar'
step 'I see the logged out language settings panel'
end
Given(/^I navigate to the Language Settings panel$/) do
step 'I am on a page with interlanguage links'
step 'I click the cog icon by Languages in the sidebar'
step 'I see the logged in language settings panel'
end
When(/^I click the cog icon by Languages in the sidebar$/) do
on(NoInterlanguagePage).cog_element.when_present.click
# Wait for the panel to open
on(PanelPage).panel_display_element.when_visible
end
Then(/^I can navigate back to Input Settings$/) do
on(InterlanguagePage) do |page|
page.back_to_input
page.x_element.should be_visible
end
end
Then(/^I can navigate back to Language Settings$/) do
on(InterlanguagePage) do |page|
page.back_to_display
page.x_element.should be_visible
end
end
When(/^I choose a different language for writing$/) do
on(InterlanguagePage).non_default_language_element.when_visible.click
end
Then(/^I do not see the Language Settings panel$/) do
on(PanelPage) do |page|
page.panel_language_element.should_not be_visible
page.panel_fonts_element.should_not be_visible
page.default_language_button_element.should_not be_visible
page.other_language_button_element.should_not be_visible
end
end
Then(/^I see Common Languages$/) do
on(InterlanguagePage).language_list.should match Regexp.escape('Common languages')
end
Then(/^I see Language Search$/) do
on(InterlanguagePage).language_search_element.should be_visible
end
Then(/^I see the logged out language settings panel$/) do
on(PanelPage) do |page|
page.panel_language_element.should be_visible
page.panel_fonts_element.should be_visible
end
end
Then(/^I see the logged in language settings panel$/) do
on(PanelPage) do |page|
page.panel_language_element.should be_visible
page.panel_fonts_element.should be_visible
page.default_language_button_element.should be_visible
page.other_language_button_element.should be_visible
end
end
Then(/^I see Worldwide$/) do
on(InterlanguagePage) do |page|
page.language_list.should match Regexp.escape('Worldwide')
page.english_link_element.should be_visible
end
end
Then(/^I click the cog icon to open language settings again$/) do
step 'I click the cog icon by Languages in the sidebar'
step 'I see the logged out language settings panel'
end
Then(/^the cog icon brings up Language Settings again$/) do
step 'I click the cog icon by Languages in the sidebar'
step 'I see the Language Settings panel'
end
Then(/^I should see the How to use link near the Malayalam transliteration item$/) do
on(InterlanguagePage).how_to_use_ml_transliteration_element.should be_visible
end

View File

@@ -1,39 +0,0 @@
Given(/^I am at the main page$/) do
visit MainPage
end
Given(/^I am logged out$/) do
end
Given(/^I set "(.*?)" as the interface language$/) do |language|
code = on(PanelPage).language_to_code(language)
visit(PanelPage, using_params: { extra: "setlang=#{code}" })
@original_content_font = on(PanelPage).content_font
@original_interface_font = on(PanelPage).interface_font
end
Given(/^I temporarily use "(.*?)" as the interface language$/) do |language|
code = on(PanelPage).language_to_code(language)
visit(PanelPage, using_params: { extra: "uselang=#{code}" })
end
Then(/^my interface language is "(.*?)"$/) do |language|
code = on(PanelPage).language_to_code(language)
on(PanelPage).interface_element.attribute('lang').should == code
end
When(/^I click the button with the ellipsis$/) do
on(InterlanguagePage).ellipsis_button_element.click
end
When(/^in the language filter I type (.+)$/) do |language_abbreviation|
on(IMEPage).language_filter = language_abbreviation
end
When(/^I click Cancel$/) do
on(PanelPage).panel_button_cancel_element.click
end
When(/^I click X$/) do
on(InterlanguagePage).x_element.click
end

View File

@@ -1,47 +0,0 @@
When(/^I click the checkbox to (?:enable|disable) fonts downloading$/) do
on(PanelPage).webfonts_enable_checkbox_element.click
end
Then(/^the checkbox to enable fonts downloading appears$/) do
on(PanelPage).webfonts_enable_checkbox_element.should be_visible
end
Then(/^the checkbox to enable fonts downloading is checked$/) do
on(PanelPage).webfonts_enable_checkbox_element.should be_checked
end
Then(/^the checkbox to enable fonts downloading is not checked$/) do
on(PanelPage).webfonts_enable_checkbox_element.should_not be_checked
end
Given(/^I open ULS$/) do
on(PanelPage).trigger_personal_element.when_visible.click
end
Then(/^the active content font must be the same as font prior to the preview$/) do
on(PanelPage).content_font.should == @original_content_font
end
Then(/^the active interface font must be the same as font prior to the preview$/) do
on(PanelPage).interface_font.should == @original_interface_font
end
Then(/^the selected content font must be (.*?)$/) do |font|
on(PanelPage).selected_content_font_element.when_visible.value.should == font
end
Then(/^the interface font is (.*?)$/) do |font|
on(PanelPage).interface_font.should match("^#{font}")
end
Then(/^the content font is (.*?)$/) do |font|
on(PanelPage).content_font.should match("^#{font}")
end
Then(/^webfonts are applied to body$/) do
on(PanelPage).webfonts_library_loaded.should be_true
end
Then(/^webfonts are not applied to body$/) do
on(PanelPage).webfonts_library_loaded.should be_false
end

View File

@@ -1,77 +0,0 @@
# encoding: utf-8
Given(/^I am on a wiki in Kotava language$/) do
step 'I am at the main page'
# Fake a Kotava Wiki
browser.execute_script("mw.config.set( 'wgContentLanguage', 'avk' )")
end
When(/^I click on an input box$/) do
on(IMEPage).search_input_element.click
end
When(/^I click on the input method indicator$/) do
on(IMEPage).input_method_element.when_present.click
end
When(/^I open the input method menu$/) do
step 'I click on an input box'
on(IMEPage).input_method_element.when_present.click
end
Then(/^I should see the input method indicator$/) do
on(IMEPage).input_method_element.when_present.should be_visible
end
Then(/^I should see input methods for (.+)/) do |language|
on(IMEPage).input_method_ime_list_title.should == language
end
Then(/^I should see a list of available input methods$/) do
on(IMEPage).input_method_selector_menu_element.should be_visible
end
Then(/^I should see a list of suggested languages$/) do
on(IMEPage).input_method_language_list_element.should be_visible
end
When(/^I choose (.+?) as the input language$/) do |language|
on(IMEPage) do |page|
page.more_languages
page.language_filter = language
# firefox only works with :return
# phantomjs only works with :enter
# This seems to work on both
page.language_filter_element.send_keys "\n"
end
end
When(/^I click on the Malayalam InScript 2 menu item$/) do
on(IMEPage).malayalam_inscript2_element.click
end
When(/^I press Control-M$/) do
on(IMEPage).search_input_element.send_keys [:control, 'm']
end
When(/^I reload the page$/) do
browser.refresh
end
Then(/^in it there must be an element with Malayalam text$/) do
# 'input_method_enabled' alone only returns []
on(IMEPage) do |page|
page.wait_until do
page.input_method_enabled_element.text != ''
end
page.input_method_enabled_element.text.should == 'ഇൻസ്ക്രിപ്റ്റ് 2'
end
end
Given(/^I visit a random page with (.+) skin and (.+) as the interface language$/) do |skin, language|
visit(IMEPage, using_params: { extra: "useskin=#{skin.downcase}&uselang=#{on(IMEPage).language_to_code(language)}" })
end
Then(/^I should see the input method menu is not offscreen$/) do
on(IMEPage).ime_input_method_menu_onscreen?.should == true
end

View File

@@ -1,24 +0,0 @@
When(/^I set English font to System$/) do
on(PanelPage).select_font_for_content = 'System font'
end
When(/^I set English font to OpenDyslexic$/) do
on(PanelPage).select_font_for_content = 'OpenDyslexic'
end
Then(/^the selected content font must be OpenDyslexic$/) do
on(PanelPage).select_font_for_content.should == 'OpenDyslexic'
end
Given(/^I select a language different than English for display language$/) do
on(PanelPage).other_language_button_element.click
end
When(/^I click on the link to select Malayalam$/) do
on(MainPage).malayalam_element.click
end
Then(/^I should see the text in the language panel in (.+?)$/) do |language|
code = on(PanelPage).language_to_code(language)
on(PanelPage).uls_display_settings_element.attribute('lang').should == code
end

View File

@@ -1,89 +0,0 @@
Then(/^I see "(.*?)" as the name of the content language$/) do |text|
browser.span(text: "#{text}").should be_visible
end
When(/^I open the Universal Language Selector$/) do
on(PanelPage) do |page|
page.trigger_personal_element.when_visible.click unless page.uls_element.visible?
end
end
When(/^I open Display panel of language settings$/) do
on(PanelPage).panel_display_element.when_visible.click
end
When(/^I open Language panel of language settings$/) do
on(PanelPage).panel_language_element.click
end
When(/^I open Fonts panel of language settings$/) do
on(PanelPage).panel_fonts_element.click
end
When(/^I select (.*?) font for the interface language for the live preview$/) do |font|
on(PanelPage).selected_interface_font = font
end
When(/^I select (.*?) font for the content language for the live preview$/) do |font|
on(PanelPage).font_for_content = font
end
When(/^I close the panel to discard the changes$/) do
on(PanelPage).panel_button_close_element.click
end
When(/^I apply the changes$/) do
on(PanelPage) do |page|
page.panel_button_apply_element.click
page.language_settings_dialog_element.when_not_present(10)
end
end
Then(/^I can disable input methods$/) do
on(PanelPage).panel_disable_input_methods_element.click
end
Then(/^I can enable input methods$/) do
on(PanelPage).panel_enable_input_methods_element.click
end
Then(/^a font selector for interface language appears$/) do
on(PanelPage).panel_interface_font_selector_element.should be_visible
end
Then(/^a font selector for interface language doesn't appear$/) do
on(PanelPage).panel_interface_font_selector_element.should_not be_visible
end
Then(/^a font selector for content language appears$/) do
on(PanelPage).panel_content_font_selector_element.should be_visible
end
Then(/^a font selector for content language doesn't appear$/) do
on(PanelPage).panel_content_font_selector_element.should_not be_visible
end
When(/^I use the panel to change my (?:interface|input) language to "(.*?)"$/) do |language|
code = on(PanelPage).language_to_code(language)
on(IMEPage) do |page|
page.language_filter = code
# Because one browser wants :enter and other :return -- sigh
page.language_filter_element.send_keys [:enter, "\n"]
end
end
Then(/^the panel is in English/) do
on(PanelPage).panel_language_element.text.should == 'Language'
end
When(/^I switch to Input panel of language settings$/) do
on(PanelPage).panel_side_input_element.click
end
Then(/^the language list of ULS should use Autonym font$/) do
on(PanelPage).uls_language_name_item('en').style('font-family').should match /Autonym'?, ?sans-serif/
end
Then(/^I should see (.*) as the selected input language$/) do |language|
on(PanelPage).default_language_button_element.text.should == language
end

View File

@@ -1,16 +0,0 @@
Then(/^the selected interface font must be (.*?)$/) do |font|
step 'I open the Universal Language Selector'
step 'I open Display panel of language settings'
step 'I open Fonts panel of language settings'
on(PanelPage).selected_interface_font.should == font
end
Then(/^the selected input method for Malayalam is ml-inscript2$/) do
step 'I click on an input box'
step 'I should see the input method indicator'
step 'in it there must be an element with Malayalam text'
end
When(/^I select the ml-inscript2 input method in the panel$/) do
on(PanelPage).ml_inscript2_radio_element.click
end

View File

@@ -1,23 +0,0 @@
When(/^I set the editing fonts to "(.*?)"$/) do |editing_font|
visit(PreferencesPage) do |page|
page.editing_tab_element.click
page.editing_font_element.select_value editing_font
page.save_element.click
end
end
When(/^I start editing a page$/) do
visit(NoInterlanguagePage).edit_link_element.click
end
When(/^I select (.*?) font for the content language$/) do |font|
step 'I open the Universal Language Selector'
step 'I open Display panel of language settings'
step 'I open Fonts panel of language settings'
step "I select #{font} font for the content language for the live preview"
step 'I apply the changes'
end
Then(/^I should see the edit area text being displayed using "(.*?)" font$/) do |font|
on(EditPage).editarea_element.style('font-family').should match(/^#{font}/)
end

View File

@@ -1,10 +0,0 @@
When(/^I click language selector trigger element$/) do
on(PanelPage).trigger_personal
end
Then(/^I should see the language selector$/) do
on(PanelPage) do |page|
page.uls_element.should be_visible
page.uls_onscreen?.should be_true
end
end

View File

@@ -1,3 +0,0 @@
require 'mediawiki_selenium/cucumber'
require 'mediawiki_selenium/pages'
require 'mediawiki_selenium/step_definitions'

View File

@@ -1,3 +0,0 @@
After do
step 'I have reset my preferences'
end

View File

@@ -1,23 +0,0 @@
# encoding: utf-8
require 'page-object'
module InterlanguagePageModule
include PageObject
a(:add_links, id: 'wbc-linkToItem-link')
a(:back_to_display, text: 'Back to display settings')
a(:back_to_input, text: 'Back to input settings')
span(:cog, class: 'uls-settings-trigger')
button(:ellipsis_button, class: 'uls-more-languages button')
a(:english_link, text: 'English')
a(:hindi_link, title: 'Hindi')
div(:input_settings, id: 'input-settings-block')
div(:language_list, class: 'row uls-language-list lcd')
text_field(:language_search, id: 'uls-languagefilter')
button(:non_default_language, class: 'button uls-language-button', index: 1)
a(:talk, text: 'Discussion')
span(:x, id: 'languagesettings-close')
a(:how_to_use_ml_transliteration, href: 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/ml-transliteration')
a(:edit_link, css: '#ca-edit a')
a(:interlang_link, css: '#p-lang li.interlanguage-link')
end

View File

@@ -1,22 +0,0 @@
module LanguageModule
include PageObject
def language_to_code(language)
case language
when 'German'
'de'
when 'English'
'en'
when 'Finnish'
'fi'
when 'Hebrew'
'he'
when 'Hindi'
'hi'
when 'Malayalam'
'ml'
else
p "Unknown language #{language}"
end
end
end

View File

@@ -1,5 +0,0 @@
class EditPage
include PageObject
textarea(:editarea, id: 'wpTextbox1')
end

View File

@@ -1,25 +0,0 @@
class IMEPage
include PageObject
include LanguageModule
page_url '?<%=params[:extra]%>'
div(:input_method, class: 'imeselector imeselector-toggle')
a(:input_method_enabled, class: 'ime-name imeselector-toggle')
h3(:input_method_ime_list_title, class: 'ime-list-title')
ul(:input_method_language_list, class: 'ime-language-list')
div(:input_method_selector_menu, class: 'imeselector-menu')
text_field(:language_filter, id: 'uls-languagefilter')
li(:malayalam_inscript2, data_ime_inputmethod: 'ml-inscript2')
a(:more_languages, class: 'ime-selector-more-languages')
text_field(:search_input, id: 'searchInput')
def ime_input_method_menu_onscreen?
browser.execute_script("
var $selectorMenu = $( '.imeselector-menu' ),
menuLeft = $selectorMenu.offset().left,
menuRight = menuLeft + $selectorMenu.width();
return ( menuLeft >= 0 && menuRight <= $( window ).width() );")
end
end

View File

@@ -1,6 +0,0 @@
class InterlanguagePage
include PageObject
include InterlanguagePageModule
page_url 'Boleyn_family'
end

View File

@@ -1,24 +0,0 @@
class MainPage
include PageObject
page_url 'Main_Page'
span(:cog, title: 'Language settings')
a(:create_a_book, text: 'Create a book')
a(:download_as_pdf, text: 'Download as PDF')
a(:download_the_file, text: 'Download the file')
li(:main_page, id: 'n-mainpage-description')
div(:asia, id: 'AS')
a(:malayalam) do |page|
page.asia_element.element.li(lang: 'ml')
end
a(:print_export, text: 'Print/export')
a(:printable_version, text: 'Printable version')
button(:search_button, id: 'searchButton')
def non_interlanguage_links_use_autonym_font?
browser.elements(css: '#p-lang li:not(.interlanguage-link)').collect do |element|
element.style('font-family')
end.to_s.match(/Autonym/) != nil
end
end

View File

@@ -1,7 +0,0 @@
class NoInterlanguagePage
include PageObject
page_url 'Think_Like_a_Cat'
include InterlanguagePageModule
end

View File

@@ -1,80 +0,0 @@
class PanelPage
include PageObject
include LanguageModule
page_url '?<%=params[:extra]%>'
div(:uls, class: 'uls-menu')
span(:uls_button_close, id: 'uls-close')
div(:language_settings_dialog, id: 'language-settings-dialog')
div(:panel_display, id: 'display-settings-block')
button(:panel_fonts, id: 'uls-display-settings-fonts-tab')
button(:panel_language, id: 'uls-display-settings-language-tab')
div(:panel_side_display, id: 'display-panel-trigger')
div(:panel_side_input, id: 'input-panel-trigger')
span(:panel_button_close, id: 'languagesettings-close')
button(:panel_button_apply, class: 'uls-settings-apply')
button(:panel_button_cancel, class: 'uls-settings-cancel')
button(:panel_disable_input_methods, class: 'uls-input-toggle-button')
button(:panel_enable_input_methods, class: 'uls-input-toggle-button')
checkbox(:webfonts_enable_checkbox, id: 'webfonts-enable-checkbox')
select_list(:panel_content_font_selector, id: 'content-font-selector')
select_list(:panel_interface_font_selector, id: 'ui-font-selector')
button(:other_language_button, class: 'button uls-language-button', index: 1)
button(:default_language_button, css: '.uls-language-button.down')
# Triggers
span(:trigger_cog, class: 'uls-settings-trigger')
a(:trigger_personal, class: 'uls-trigger')
select(:selected_content_font, id: 'content-font-selector')
select(:selected_interface_font, id: 'ui-font-selector')
select(:font_for_content, id: 'content-font-selector')
div(:uls_display_settings, class: 'uls-display-settings')
radio_button(:ml_inscript2_radio, id: 'ml-inscript2')
# Is there way to access the html element?
div(:interface, id: 'footer')
def uls_language_name_item(language)
browser.element(css: ".uls-language-block li[lang=#{language}] a")
end
def content_font
font('#mw-content-text')
end
def interface_font
font('body')
end
def uls_onscreen?
browser.execute_script("
var $menu = $( '.uls-menu' ),
$window = $( window ),
top = $menu.offset().top,
viewportTop = $window.scrollTop(),
viewportBottom = $window.scrollTop() + $window.height();
return ( top < viewportBottom && top >= viewportTop )")
end
def webfonts_library_loaded
browser.execute_script("return ( $( 'body' ).data( 'webfonts' ) !== undefined )")
end
private
def font(selector)
browser.execute_script("return $( '#{selector}' ).css( 'font-family' );")
end
end

View File

@@ -1,11 +0,0 @@
class PreferencesPage
include PageObject
page_url 'Special:Preferences'
select(:set_interface_language, id: 'mw-input-wplanguage')
button(:save, id: 'prefcontrol')
a(:editing_tab, id: 'preftab-editing')
select(:editing_font, id: 'mw-input-wpeditfont')
end

View File

@@ -1,46 +0,0 @@
@firefox @internet_explorer_10 @phantomjs
Feature: Font preferences respected in different languages
If a user has an edit font preferences respect that preference.
If a user has no edit font preference, but the UI language has a monospace defined,
the edit area has monospace font, given there is no ULS webfont preference for the user.
If a user has no edit font preference, but the UI language has no monospace defined,
the edit area has the font according to the ULS webfont preferences.
Background:
Given I am logged in
And I have reset my preferences
Scenario: Edit area fonts should not change on UI language change if the user preferences for edit area font are set
When I set the editing fonts to "monospace"
And I set "Hindi" as the interface language
And I start editing a page
Then I should see the edit area text being displayed using "monospace" font
# Needs OpenDyslexic font to have been configured on the target wiki
Scenario: Edit area should use the fonts selected by the user from ULS for a language
When I select OpenDyslexic font for the content language
And I start editing a page
Then I should see the edit area text being displayed using "OpenDyslexic" font
Scenario: Edit area should use the ULS selected fonts when content language has a ULS font selection
When I open Language panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I open Fonts panel of language settings
And I select "OpenDyslexic" font for the content language for the live preview
And I apply the changes
And I start editing a page
Then I should see the edit area text being displayed using "OpenDyslexic" font
Scenario: Edit area should use the system default fonts when content language does not have any ULS font selection
When I open Language panel of language settings
And I click the button with the ellipsis
And I use the panel to change my interface language to "German"
And I apply the changes
And I start editing a page
Then I should see the edit area text being displayed using "monospace" font
Scenario: Edit area should use browser's default Monospace font for languages that have a default monospace font (Latin, Cyrillic, Hebrew etc.)
When I start editing a page
Then I should see the edit area text being displayed using "monospace" font

View File

@@ -1,53 +0,0 @@
@firefox @internet_explorer_10 @phantomjs
Feature: Trigger in personal toolbar
@commons.wikimedia.beta.wmflabs.org
Scenario: Open language selector when logged in
Given I am logged in
When I click language selector trigger element
Then I should see the language selector
And I see Common Languages
And I see Worldwide
Scenario: Open language settings when logged out and language change not allowed
If the user is logged out, the user will either see the language selector
or the settings panel, depending on whether language selection for
anonymous users is disabled. This and next test cover both cases.
Given I am at the main page
When I click language selector trigger element
Then I see the logged in language settings panel
Scenario: Open language selector when logged out
Given I am at the main page
When I click language selector trigger element
Then I should see the language selector
Scenario Outline: Opening language settings from sidebar
Given I am <user status>
And I am on <page type>
When I click the cog icon by Languages in the sidebar
Then I see the <user status> language settings panel
Examples:
| user status | page type |
| logged out | a page without interlanguage links |
| logged in | a page with interlanguage links |
| logged out | a talk page without interlanguage links |
| logged out | a talk page with interlanguage links |
Scenario Outline: Closing language settings without saving
Given I am <user status>
And I am on a page without interlanguage links
When I click the cog icon by Languages in the sidebar
And <close method>
Then I do not see the Language Settings panel
And I click the cog icon by Languages in the sidebar
And I see the <user status> language settings panel
Examples:
| user status | close method |
| logged in | I click X |
| logged out | I click Cancel |

View File

@@ -1,12 +0,0 @@
This file contains the descriptions of the tags we use.
@en.wikipedia.beta.wmflabs.org
@commons.wikimedia.beta.wmflabs.org
Test is run on this domain unless further excluded by other tags.
@custom-browser
This tests needs support from Accept-Language header setting from the
webdriver.
@ime-default-on
These tests expect input methods to be enabled by default.