diff --git a/tests/browser/features/accept_language.feature b/tests/browser/features/accept_language.feature index 38d960d2..f8c982d8 100644 --- a/tests/browser/features/accept_language.feature +++ b/tests/browser/features/accept_language.feature @@ -3,7 +3,7 @@ Feature: Accept-Language Scenario Outline: Accept-Language Given that my browser's accept language is - When I visit a random page + When I am at the preferences page Then link to the main page has text Examples: diff --git a/tests/browser/features/autonym.feature b/tests/browser/features/autonym.feature index 177fad96..0c4b43d5 100644 --- a/tests/browser/features/autonym.feature +++ b/tests/browser/features/autonym.feature @@ -25,7 +25,7 @@ Feature: 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 random page + 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 diff --git a/tests/browser/features/ime.feature b/tests/browser/features/ime.feature index 2590fb95..319b4122 100644 --- a/tests/browser/features/ime.feature +++ b/tests/browser/features/ime.feature @@ -10,7 +10,7 @@ input method. The input method indicator is shown when input field gets a focus. - Given I am at random page + Given I am at the main page When I click on an input box Then I should see the input method indicator @@ -19,7 +19,7 @@ input method. Input method menu is shown when user clicks the input method indicator. - Given I am at random page + 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 @@ -41,13 +41,13 @@ input method. Chosen input method selection persists across page loads. - Given I am at random page + 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 go to another random page + 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 diff --git a/tests/browser/features/live_preview_of_display_language.feature b/tests/browser/features/live_preview_of_display_language.feature index 1df3e37d..1c5a57fe 100644 --- a/tests/browser/features/live_preview_of_display_language.feature +++ b/tests/browser/features/live_preview_of_display_language.feature @@ -4,7 +4,7 @@ Feature: Live preview of display language changes Background: Given I am logged in And I have reset my preferences - And I am at random page + And I am at the main page @needs-custom-setup @commons.wikimedia.beta.wmflabs.org Scenario: Display language change is previewed immediately diff --git a/tests/browser/features/persistent_settings.feature b/tests/browser/features/persistent_settings.feature index ce48ccc4..d987616b 100644 --- a/tests/browser/features/persistent_settings.feature +++ b/tests/browser/features/persistent_settings.feature @@ -15,12 +15,12 @@ Feature: Persistent settings Scenario: Interface font sticks to another page When I apply the changes - And I visit a random page + And I am at the main page Then the selected interface font must be OpenDyslexic Scenario: Discarding a live preview of a font keeps the previous font When I close the panel to discard the changes - And I visit a random page + 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 @@ -30,6 +30,6 @@ Feature: Persistent settings 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 visit a random page + 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 diff --git a/tests/browser/features/settings_panel.feature b/tests/browser/features/settings_panel.feature index c4ff3eb5..844f16f0 100644 --- a/tests/browser/features/settings_panel.feature +++ b/tests/browser/features/settings_panel.feature @@ -15,7 +15,7 @@ Feature: Settings panel | logged in | Scenario: How to use link appears in the Input settings panel - Given I am at random page + 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 @@ -24,7 +24,7 @@ Feature: Settings panel Then I should see the How to use link near the Malayalam transliteration item Scenario: More languages (input language selection) - Given I am at random page + 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 diff --git a/tests/browser/features/step_definitions/accept_language_steps.rb b/tests/browser/features/step_definitions/accept_language_steps.rb index 3ae88a21..4579f516 100644 --- a/tests/browser/features/step_definitions/accept_language_steps.rb +++ b/tests/browser/features/step_definitions/accept_language_steps.rb @@ -3,10 +3,10 @@ Given(/^that my browser's accept language is (.+)$/) do |language| $session_id = @browser.driver.instance_variable_get(:@bridge).session_id end -When(/^I visit a random page$/) do - visit RandomPage +When(/^I am at the preferences page$/) do + visit PreferencesPage end Then(/^link to the main page has text (.+)$/) do |text| - on(RandomPage).main_page_element.text.should == text + on(MainPage).main_page_element.text.should == text end diff --git a/tests/browser/features/step_definitions/common_steps.rb b/tests/browser/features/step_definitions/common_steps.rb index cb495ea1..775e98da 100644 --- a/tests/browser/features/step_definitions/common_steps.rb +++ b/tests/browser/features/step_definitions/common_steps.rb @@ -1,5 +1,5 @@ -Given(/^I am at random page$/) do - visit RandomPage +Given(/^I am at the main page$/) do + visit MainPage end Given(/^I am logged out$/) do diff --git a/tests/browser/features/step_definitions/ime_steps.rb b/tests/browser/features/step_definitions/ime_steps.rb index 5d0f7dd7..85d54b18 100644 --- a/tests/browser/features/step_definitions/ime_steps.rb +++ b/tests/browser/features/step_definitions/ime_steps.rb @@ -1,7 +1,7 @@ # encoding: utf-8 Given(/^I am on a wiki in Kotava language$/) do - visit RandomPage + step "I am at the main page" # Fake a Kotava Wiki @browser.execute_script( "mw.config.set( 'wgContentLanguage', 'avk' )" ) end @@ -54,10 +54,6 @@ When(/^I press Control-M$/) do on(IMEPage).search_input_element.send_keys [:control, "m"] end -When(/^I go to another random page$/) do - visit RandomPage -end - Then(/^in it there must be an element with Malayalam text$/) do # 'input_method_enabled' alone only returns [] on(IMEPage) do |page| diff --git a/tests/browser/features/step_definitions/live_preview_of_display_language_steps.rb b/tests/browser/features/step_definitions/live_preview_of_display_language_steps.rb index 36c1f777..9f9e3b15 100644 --- a/tests/browser/features/step_definitions/live_preview_of_display_language_steps.rb +++ b/tests/browser/features/step_definitions/live_preview_of_display_language_steps.rb @@ -15,7 +15,7 @@ Given(/^I select a language different than English for display language$/) do end When(/^I click on the link to select Malayalam$/) do - on(RandomPage).malayalam_element.click + on(MainPage).malayalam_element.click end Then(/^I should see the text in the language panel in (.+?)$/) do |language| diff --git a/tests/browser/features/support/pages/main_page.rb b/tests/browser/features/support/pages/main_page.rb index 6472bebb..9aaa0b14 100644 --- a/tests/browser/features/support/pages/main_page.rb +++ b/tests/browser/features/support/pages/main_page.rb @@ -4,7 +4,20 @@ class MainPage include URL page_url URL.url("Main_Page") - def non_interlanguage_links_use_autonym_font? + 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 diff --git a/tests/browser/features/support/pages/random_page.rb b/tests/browser/features/support/pages/random_page.rb deleted file mode 100644 index 587935f2..00000000 --- a/tests/browser/features/support/pages/random_page.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: utf-8 - -class RandomPage - include PageObject - - include URL - page_url URL.url("Special:Random") - - 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") -end diff --git a/tests/browser/features/triggers.feature b/tests/browser/features/triggers.feature index 76f2c105..a91ba0b0 100644 --- a/tests/browser/features/triggers.feature +++ b/tests/browser/features/triggers.feature @@ -15,13 +15,13 @@ Feature: Trigger in personal toolbar 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 random page + 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 random page + Given I am at the main page When I click language selector trigger element Then I should see the language selector