Refactor ULS tests to reduce duplication and repetition
Change-Id: I96f1594f1b4d1960da9a8bc21e2a5c4727497b10
This commit is contained in:
@@ -15,6 +15,11 @@ Background:
|
||||
And the content language is "English"
|
||||
And I inspect current fonts
|
||||
|
||||
Scenario: Font selector appears
|
||||
When I open "Fonts" panel of language settings
|
||||
Then a font selector for interface language appears
|
||||
Then a font selector for content language appears
|
||||
|
||||
Scenario: Discarding live preview of content font
|
||||
When I open "Fonts" panel of language settings
|
||||
And I select "OpenDyslexic" font for the content language for the live preview
|
||||
|
||||
@@ -2,6 +2,9 @@ Given(/^I am at random page$/) do
|
||||
visit RandomPage
|
||||
end
|
||||
|
||||
Given(/^I am logged out$/) do
|
||||
end
|
||||
|
||||
Given(/^I am logged in$/) do
|
||||
visit(LoginPage).login_with(@mediawiki_username, @mediawiki_password)
|
||||
end
|
||||
@@ -33,3 +36,13 @@ After('@reset-preferences-after') do |scenario|
|
||||
visit(ResetPreferencesPage)
|
||||
on(ResetPreferencesPage).submit_element.click
|
||||
end
|
||||
|
||||
Before('@uls-in-sidebar-only') do |scenario|
|
||||
if !defined?($uls_position)
|
||||
visit(ULSPage)
|
||||
$uls_position = @browser.execute_script( "return mw.config.get( 'wgULSPosition' )" );
|
||||
end
|
||||
if $uls_position != 'interlanguage'
|
||||
scenario.skip_invoke!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -92,6 +92,18 @@ Then(/^the (.*) font must be changed to the "(.*?)" font$/) do |type, font|
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the selected font displayed as the interface font must be the same as before the intermediate selection$/) do
|
||||
pending # express the regexp above with the code you wish you had
|
||||
Then(/^I can disable input methods$/) do
|
||||
on(ULSPage).panel_disable_input_methods_element.click
|
||||
end
|
||||
|
||||
Then(/^I can enable input methods$/) do
|
||||
on(ULSPage).panel_enable_input_methods_element.click
|
||||
end
|
||||
|
||||
Then(/^a font selector for interface language appears$/) do
|
||||
on(ULSPage).panel_interface_font_selector_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^a font selector for content language appears$/) do
|
||||
on(ULSPage).panel_content_font_selector_element.should be_visible
|
||||
end
|
||||
|
||||
@@ -18,13 +18,13 @@ 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 anonymous Language Settings panel'
|
||||
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 Language Settings panel'
|
||||
step 'I see the logged in language settings panel'
|
||||
end
|
||||
|
||||
When(/^I click Apply Settings$/) do
|
||||
@@ -35,18 +35,6 @@ When(/^I click Cancel$/) do
|
||||
on(InterlanguagePage).cancel_element.click
|
||||
end
|
||||
|
||||
Then(/^I click Enable input$/) do
|
||||
on(InterlanguagePage).enable_input_element.when_visible.click
|
||||
end
|
||||
|
||||
When(/^I click Fonts$/) do
|
||||
on(InterlanguagePage).fonts_settings
|
||||
end
|
||||
|
||||
When(/^I click Input$/) do
|
||||
on(InterlanguagePage).input_settings_element.click
|
||||
end
|
||||
|
||||
When(/^I click on the link to select Malayalam$/) do
|
||||
on(RandomPage).malayalam_link
|
||||
end
|
||||
@@ -63,26 +51,10 @@ When(/^I click X$/) do
|
||||
on(InterlanguagePage).x_element.click
|
||||
end
|
||||
|
||||
When(/^I navigate to the talk page$/) do
|
||||
on(InterlanguagePage).talk_element.click
|
||||
end
|
||||
|
||||
When(/^in the language filter I type (.+)$/) do |language_abbreviation|
|
||||
on(RandomPage).language_filter=language_abbreviation
|
||||
end
|
||||
|
||||
Then(/^a font selectbox appears$/) do
|
||||
on(InterlanguagePage).content_font_selectbox_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I can disable input methods$/) do
|
||||
on(InterlanguagePage).disable_input_methods_element.when_visible.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I can enable input methods$/) do
|
||||
on(InterlanguagePage).enable_input_element.when_visible.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I can navigate back to Input Settings$/) do
|
||||
on(InterlanguagePage) do |page|
|
||||
page.back_to_input
|
||||
@@ -102,9 +74,9 @@ When(/^I choose a different language for writing$/) do
|
||||
end
|
||||
|
||||
Then(/^I do not see the Language Settings panel$/) do
|
||||
on(InterlanguagePage) do |page|
|
||||
page.language_button_element.should_not be_visible
|
||||
page.fonts_button_element.should_not be_visible
|
||||
on(ULSPage) 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
|
||||
@@ -118,17 +90,17 @@ Then(/^I see Language Search$/) do
|
||||
on(InterlanguagePage).language_search_element.should be_visible
|
||||
end
|
||||
|
||||
Then(/^I see the anonymous Language Settings panel$/) do
|
||||
on(NoInterlanguagePage) do |page|
|
||||
page.language_button_element.when_present.should be_visible
|
||||
page.fonts_button_element.should be_visible
|
||||
Then(/^I see the logged out language settings panel$/) do
|
||||
on(ULSPage) do |page|
|
||||
page.panel_language_element.should be_visible
|
||||
page.panel_fonts_element.should be_visible
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I see the Language Settings panel$/) do
|
||||
on(NoInterlanguagePage) do |page|
|
||||
page.language_button_element.when_present.should be_visible
|
||||
page.fonts_button_element.should be_visible
|
||||
Then(/^I see the logged in language settings panel$/) do
|
||||
on(ULSPage) 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
|
||||
@@ -141,9 +113,9 @@ Then(/^I see Worldwide$/) do
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^the cog icon brings up anonymous Language Settings again$/) do
|
||||
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 anonymous Language Settings panel'
|
||||
step 'I see the logged out language settings panel'
|
||||
end
|
||||
|
||||
Then(/^the cog icon brings up Language Settings again$/) do
|
||||
@@ -151,10 +123,6 @@ Then(/^the cog icon brings up Language Settings again$/) do
|
||||
step 'I see the Language Settings panel'
|
||||
end
|
||||
|
||||
Then(/^a font selectbox appears for content$/) do
|
||||
on(InterlanguagePage).content_font_selectbox_element.should be_visible
|
||||
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
|
||||
|
||||
@@ -9,22 +9,13 @@ module InterlanguagePageModule
|
||||
a(:back_to_input, text: 'Back to input settings')
|
||||
button(:cancel, class: 'button uls-display-settings-cancel')
|
||||
span(:cog, class: 'uls-settings-trigger')
|
||||
select_list(:content_font_selectbox, id: 'content-font-selector')
|
||||
button(:default_language_button, class: 'button uls-language-button down')
|
||||
button(:disable_input_methods, class: 'active green button uls-input-toggle-button')
|
||||
button(:ellipsis_button, class: 'uls-more-languages button')
|
||||
button(:enable_input, class: 'active green button uls-input-toggle-button')
|
||||
a(:english_link, text: 'English')
|
||||
button(:fonts_button, id: 'uls-display-settings-fonts-tab')
|
||||
button(:fonts_settings, id: 'uls-display-settings-fonts-tab')
|
||||
div(:input_settings, id: 'input-settings-block')
|
||||
button(:language_button, id: 'uls-display-settings-language-tab')
|
||||
div(:language_list, class: 'row uls-language-list lcd')
|
||||
text_field(:language_search, id: 'languagefilter')
|
||||
button(:non_default_language, class: 'button uls-language-button', index: 1)
|
||||
button(:other_language_button, class: 'button uls-language-button')
|
||||
a(:talk, text: 'Discussion')
|
||||
select_list(:ui_font_selectbox, id: 'ui-font-selector')
|
||||
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')
|
||||
end
|
||||
|
||||
@@ -5,10 +5,20 @@ class ULSPage
|
||||
page_url URL.url('?setlang=<%=params[:setlang]%>')
|
||||
|
||||
div(:panel_display, id: 'display-settings-block')
|
||||
div(:panel_input, id: 'display-settings-block')
|
||||
div(:panel_input, id: 'input-settings-block')
|
||||
button(:panel_fonts, id: 'uls-display-settings-fonts-tab')
|
||||
button(:panel_language, id: 'uls-display-settings-language-tab')
|
||||
|
||||
span(:panel_button_close, id: 'languagesettings-close')
|
||||
button(:panel_button_display_apply, id: 'uls-displaysettings-apply')
|
||||
|
||||
button(:panel_disable_input_methods, class: 'uls-input-toggle-button')
|
||||
button(:panel_enable_input_methods, class: 'uls-input-toggle-button')
|
||||
|
||||
select_list(:panel_content_font_selector, id: 'content-font-selector')
|
||||
select_list(:panel_interface_font_selector, id: 'ui-font-selector')
|
||||
|
||||
# TODO: Rename to match convention
|
||||
button(:other_language_button, class: 'button uls-language-button')
|
||||
button(:default_language_button, class: 'button uls-language-button down')
|
||||
end
|
||||
|
||||
@@ -1,74 +1,73 @@
|
||||
@en.wikipedia.beta.wmflabs.org @ie6-bug @ie7-bug
|
||||
Feature: ULS cog behaviour on the side-bar for logged in users
|
||||
Feature: ULS cog in the sidebar allows access to language settings
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector
|
||||
Given I am on a page without interlanguage links
|
||||
@login @uls-in-sidebar-only
|
||||
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 anonymous Language Settings panel
|
||||
Then I see the <user status> language settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector
|
||||
Given I am on a page with interlanguage links
|
||||
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 |
|
||||
|
||||
@login @uls-in-sidebar-only
|
||||
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
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the anonymous Language Settings panel
|
||||
|
||||
Scenario: Language Settings closes and opens with X button
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click X
|
||||
And <close method>
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up anonymous Language Settings again
|
||||
And I click the cog icon by Languages in the sidebar
|
||||
And I see the <user status> language settings panel
|
||||
|
||||
Scenario: Language Settings closes and opens with Apply Settings buttons
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Apply Settings
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up anonymous Language Settings again
|
||||
Examples:
|
||||
| user status | close method |
|
||||
| logged in | I click X |
|
||||
| logged out | I click Cancel |
|
||||
# It is weird that this works, since the button is disabled until changes
|
||||
# have been made
|
||||
| logged out | I click Apply Settings |
|
||||
|
||||
Scenario: Language Settings closes and opens with Cancel buttons
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Cancel
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up anonymous Language Settings again
|
||||
|
||||
Scenario: Input settings display
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Input
|
||||
@login
|
||||
Scenario Outline: Input settings display
|
||||
Givan I am <user status>
|
||||
And I am on a page without interlanguage links
|
||||
When I open "Input" panel of language settings
|
||||
Then I can enable input methods
|
||||
And I can disable input methods
|
||||
|
||||
Examples:
|
||||
| user status |
|
||||
| logged out |
|
||||
| logged in |
|
||||
|
||||
Scenario: How to use link appears in the Input settings panel
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Input
|
||||
And I click Enable input
|
||||
Given I am at random page
|
||||
When I open "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: Fonts default settings and display
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Fonts
|
||||
Then a font selectbox appears
|
||||
|
||||
Scenario: Fonts not default settings and display
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
When I click Fonts
|
||||
Then a font selectbox appears for content
|
||||
|
||||
Scenario: More languages
|
||||
Given I navigate to the anonymous Language Settings panel
|
||||
And I click Input
|
||||
And I click Enable input
|
||||
When I click the button with the ellipsis
|
||||
Scenario: More languages (input language selection)
|
||||
Given I am at random page
|
||||
When I open "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
|
||||
|
||||
@login
|
||||
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
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
@en.wikipedia.beta.wmflabs.org @login @ie6-bug @ie7-bug
|
||||
Feature: ULS cog behaviour on the side-bar for logged in users
|
||||
|
||||
Background:
|
||||
Given I am logged in
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector
|
||||
Given I am on a page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector
|
||||
Given I am on a page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Page without interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page without interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Page with interlanguage links has cog icon and language selector on Talk page
|
||||
Given I am on a talk page with interlanguage links
|
||||
When I click the cog icon by Languages in the sidebar
|
||||
Then I see the Language Settings panel
|
||||
|
||||
Scenario: Language Settings closes and opens with X button
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click X
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up Language Settings again
|
||||
|
||||
Scenario: Language Settings closes and opens with Apply Settings buttons
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Apply Settings
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up Language Settings again
|
||||
|
||||
Scenario: Language Settings closes and opens with Cancel buttons
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Cancel
|
||||
Then I do not see the Language Settings panel
|
||||
And the cog icon brings up Language Settings again
|
||||
|
||||
Scenario: Input settings display
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Input
|
||||
Then I can enable input methods
|
||||
And I can disable input methods
|
||||
|
||||
Scenario: Fonts default settings and display
|
||||
Given I navigate to the Language Settings panel
|
||||
When I click Fonts
|
||||
Then a font selectbox appears
|
||||
|
||||
Scenario: Fonts not default settings and display
|
||||
Given I navigate to the Language Settings panel
|
||||
When I choose a different language for writing
|
||||
And I click Fonts
|
||||
Then a font selectbox appears for content
|
||||
|
||||
Scenario: More languages
|
||||
Given I navigate to the Language Settings panel
|
||||
When 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
|
||||
Reference in New Issue
Block a user