Cmcmahon has uploaded a new change for review. https://gerrit.wikimedia.org/r/90380
Change subject: restore working ULS tests ...................................................................... restore working ULS tests Change-Id: Iddddc6a5b4ac7435c7e6b257ab6407f5178a607d --- A features/step_definitions/uls_cog_sidebar_user_steps.rb A features/step_definitions/uls_ime_steps.rb A features/step_definitions/uls_steps.rb M features/support/modules/interlanguage_module.rb A features/uls.feature A features/uls_cog_sidebar_anon_user.feature A features/uls_cog_sidebar_logged_user.feature A features/uls_ime.feature 8 files changed, 444 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/qa/browsertests refs/changes/80/90380/1 diff --git a/features/step_definitions/uls_cog_sidebar_user_steps.rb b/features/step_definitions/uls_cog_sidebar_user_steps.rb new file mode 100644 index 0000000..f32041d --- /dev/null +++ b/features/step_definitions/uls_cog_sidebar_user_steps.rb @@ -0,0 +1,161 @@ +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://bugzilla.wikimedia.org/show_bug.cgi?id=49139 +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 anonymous 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' +end + +When(/^I click Apply Settings$/) do + on(InterlanguagePage).apply_settings_element.click +end + +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 the button with the ellipsis$/) do + on(InterlanguagePage).ellipsis_button_element.click +end + +When(/^I click the cog icon by Languages in the sidebar$/) do + on(NoInterlanguagePage).cog_element.when_present.click +end + +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 + +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 + 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 + +When(/^in the language filter I type (.+)$/) do |search_term| + on(InterlanguagePage).language_search=search_term +end + +When(/^I click on the link to select Malayalam$/) do + on(InterlanguagePage).malayam_link_element.when_present.click +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 + 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 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 + 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 + 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(/^the cog icon brings up anonymous Language Settings again$/) do + step 'I click the cog icon by Languages in the sidebar' + step 'I see the anonymous 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(/^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 diff --git a/features/step_definitions/uls_ime_steps.rb b/features/step_definitions/uls_ime_steps.rb new file mode 100644 index 0000000..9455e7b --- /dev/null +++ b/features/step_definitions/uls_ime_steps.rb @@ -0,0 +1,69 @@ +# encoding: utf-8 + +Given(/^I am on a wiki in Kotava language$/) do + visit(RandomPage) + # Fake a Kotava Wiki + @browser.execute_script( "mw.config.set( 'wgContentLanguage', 'avk' )" ) +end + +When(/^I click on an input box$/) do + on(RandomPage) do |page| + page.search_input_element.click + # For some reason click alone doesn't seem to trigger the ime indicator + # when running tests + page.search_input_element.send_keys ' ' + end +end + +When(/^I click on the input method indicator$/) do + on(RandomPage).input_method_element.click +end + +When(/^I open the input method menu$/) do + on(RandomPage) do |page| + page.search_input_element.click + page.search_input_element.send_keys ' ' + page.input_method_element.when_present.click + end +end + +Then(/^I should see the input method indicator$/) do + on(RandomPage).input_method_element.should be_visible +end + +Then(/^I should see input methods for (.+)/) do |language| + on(RandomPage).input_method_ime_list_title.should == language +end + +Then(/^I should see a list of available input methods$/) do + on(RandomPage).input_method_selector_menu_element.should be_visible +end + +Then(/^I should see a list of suggested languages$/) do + on(RandomPage).input_method_language_list_element.should be_visible +end + +When(/^I choose (.+?) as the input language$/) do |language| + on(RandomPage) do |page| + page.more_languages + page.language_filter = language + page.language_filter_element.send_keys :return + end +end + +When(/^I click on the Malayalam InScript 2 menu item$/) do + on(RandomPage).uls_malayalam_inscript2_item_element.click +end + +When(/^I press Control\-M$/) do + on(RandomPage).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(RandomPage).input_method_enabled_element.text.should == 'ഇൻസ്ക്രിപ്റ്റ് 2' +end diff --git a/features/step_definitions/uls_steps.rb b/features/step_definitions/uls_steps.rb new file mode 100644 index 0000000..cb3372a --- /dev/null +++ b/features/step_definitions/uls_steps.rb @@ -0,0 +1,11 @@ +When(/^I click language selector trigger element$/) do + on(RandomPage).uls_trigger +end + +Then(/^I should see the Language selector$/) do + on(RandomPage).language_settings_dialog_element.should be_visible +end + +Then(/^I should see a cog icon near the 'Languages' header$/) do + on(RandomPage).cog_element.should exist +end diff --git a/features/support/modules/interlanguage_module.rb b/features/support/modules/interlanguage_module.rb index 5999332..30980cb 100644 --- a/features/support/modules/interlanguage_module.rb +++ b/features/support/modules/interlanguage_module.rb @@ -7,7 +7,7 @@ span(:apply_settings, class: 'uls-settings-trigger') a(:back_to_display, text: 'Back to display settings') a(:back_to_input, text: 'Back to input settings') - button(:cancel, class: 'button uls-display-settings-cancel') + button(:cancel, class: 'button uls-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') @@ -21,6 +21,7 @@ button(:language_button, id: 'uls-display-settings-language-tab') div(:language_list, class: 'row uls-language-list lcd') text_field(:language_search, id: 'languagefilter') + a(:malayam_link, title: 'Malayalam') button(:non_default_language, class: 'button uls-language-button', index: 1) button(:other_language_button, class: 'button uls-language-button') a(:talk, text: 'Discussion') diff --git a/features/uls.feature b/features/uls.feature new file mode 100644 index 0000000..7eb3166 --- /dev/null +++ b/features/uls.feature @@ -0,0 +1,8 @@ [email protected] +Feature: Universal Language Selector User language selector + + + Scenario: Open Language selector + Given I visit a random page + When I click language selector trigger element + Then I should see the Language selector \ No newline at end of file diff --git a/features/uls_cog_sidebar_anon_user.feature b/features/uls_cog_sidebar_anon_user.feature new file mode 100644 index 0000000..aac0011 --- /dev/null +++ b/features/uls_cog_sidebar_anon_user.feature @@ -0,0 +1,74 @@ [email protected] @ie6-bug @ie7-bug +Feature: ULS cog behaviour on the side-bar for logged in users + + 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 anonymous 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 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 + Then I do not see the Language Settings panel + And the cog icon brings up anonymous Language Settings again + + 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 + + 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 + Then I can enable input methods + And I can disable input methods + + 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 + 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 + Then I see Worldwide + And I see Language Search + And I can navigate back to Input Settings diff --git a/features/uls_cog_sidebar_logged_user.feature b/features/uls_cog_sidebar_logged_user.feature new file mode 100644 index 0000000..9ce7ed4 --- /dev/null +++ b/features/uls_cog_sidebar_logged_user.feature @@ -0,0 +1,68 @@ [email protected] @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 diff --git a/features/uls_ime.feature b/features/uls_ime.feature new file mode 100644 index 0000000..31f8c48 --- /dev/null +++ b/features/uls_ime.feature @@ -0,0 +1,51 @@ [email protected] +Feature: Universal Language Selector 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. + + Scenario: Input method indicator is shown + + The input method indicator is shown when input field gets a focus. + + Given I am at random page + When I click on an input box + Then I should see the input method indicator + + Scenario: Input method menu + + Input method menu is shown when user clicks the input method indicator. + + Given I am at random 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 + + 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 + + Scenario: Sticky input methods + + Chosen input method selection persists across page loads. + + Given I am at random 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 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 -- To view, visit https://gerrit.wikimedia.org/r/90380 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iddddc6a5b4ac7435c7e6b257ab6407f5178a607d Gerrit-PatchSet: 1 Gerrit-Project: qa/browsertests Gerrit-Branch: master Gerrit-Owner: Cmcmahon <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
