jenkins-bot has submitted this change and it was merged. Change subject: Refactor "Open language selector when logged in" ......................................................................
Refactor "Open language selector when logged in" Removed tags @uls-in-sidebar-only and @uls-in-personal-only. We will figure out a better solution. Alterted the test so that it catches if the language selector is not visible in the viewport to catch regressions like bug 56937. Bug: 56937 Change-Id: Ie8a37bf4f38e9c82e0c14736f2bc29e8ec1331ff --- M tests/browser/features/step_definitions/common_steps.rb M tests/browser/features/step_definitions/triggers_steps.rb M tests/browser/features/support/hooks.rb M tests/browser/features/support/pages/panel_page.rb M tests/browser/features/support/pages/random_page.rb M tests/browser/features/triggers.feature M tests/browser/tags.txt 7 files changed, 22 insertions(+), 34 deletions(-) Approvals: KartikMistry: Looks good to me, approved Zfilipin: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/tests/browser/features/step_definitions/common_steps.rb b/tests/browser/features/step_definitions/common_steps.rb index 5c1becf..27685d0 100644 --- a/tests/browser/features/step_definitions/common_steps.rb +++ b/tests/browser/features/step_definitions/common_steps.rb @@ -25,12 +25,3 @@ code = on(PanelPage).language_to_code(language) on(PanelPage).interface_element.attribute('lang').should == code end - -def uls_position() - if !defined?($uls_position) - visit(PanelPage) - $uls_position = @browser.execute_script( "return mw.config.get( 'wgULSPosition' )" ); - else - $uls_position - end -end diff --git a/tests/browser/features/step_definitions/triggers_steps.rb b/tests/browser/features/step_definitions/triggers_steps.rb index 2e8bd24..75a49ad 100644 --- a/tests/browser/features/step_definitions/triggers_steps.rb +++ b/tests/browser/features/step_definitions/triggers_steps.rb @@ -1,7 +1,10 @@ When(/^I click language selector trigger element$/) do - on(RandomPage).uls_trigger + on(PanelPage).trigger_personal end Then(/^I should see the language selector$/) do - on(PanelPage).uls_element.should be_visible + on(PanelPage) do |page| + page.uls_element.should be_visible + page.uls_onscreen?.should be_true + end end diff --git a/tests/browser/features/support/hooks.rb b/tests/browser/features/support/hooks.rb index 9731900..e806451 100644 --- a/tests/browser/features/support/hooks.rb +++ b/tests/browser/features/support/hooks.rb @@ -3,18 +3,6 @@ @scenario = scenario end -Before('@uls-in-personal-only') do |scenario| - if uls_position() != 'personal' - scenario.skip_invoke! - end -end - -Before('@uls-in-sidebar-only') do |scenario| - if uls_position() != 'interlanguage' - scenario.skip_invoke! - end -end - After('@reset-preferences-after') do |scenario| visit(ResetPreferencesPage).submit_element.click if @browser.exist? end diff --git a/tests/browser/features/support/pages/panel_page.rb b/tests/browser/features/support/pages/panel_page.rb index 3e275d8..212f9c8 100644 --- a/tests/browser/features/support/pages/panel_page.rb +++ b/tests/browser/features/support/pages/panel_page.rb @@ -53,6 +53,18 @@ 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 + + private def font(selector) @browser.execute_script( "return $( '#{selector}' ).css( 'font-family' );" ) diff --git a/tests/browser/features/support/pages/random_page.rb b/tests/browser/features/support/pages/random_page.rb index c6c1ace..d0d7ab3 100644 --- a/tests/browser/features/support/pages/random_page.rb +++ b/tests/browser/features/support/pages/random_page.rb @@ -13,5 +13,4 @@ a(:print_export, text: 'Print/export') a(:printable_version, text: 'Printable version') button(:search_button, id: 'searchButton') - a(:uls_trigger, class: 'uls-trigger') end diff --git a/tests/browser/features/triggers.feature b/tests/browser/features/triggers.feature index 5f25900..1e881a5 100644 --- a/tests/browser/features/triggers.feature +++ b/tests/browser/features/triggers.feature @@ -1,12 +1,12 @@ Feature: Trigger in personal toolbar - @login @uls-in-personal-only + @commons.wikimedia.beta.wmflabs.org @login 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 - @uls-in-personal-only @no-anon-language-selection + @no-anon-language-selection 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 @@ -17,7 +17,7 @@ When I click language selector trigger element Then I see the logged in language settings panel - @uls-in-personal-only @anon-language-selection + @anon-language-selection Scenario: Open language selector when logged out Given I am at random page @@ -25,7 +25,7 @@ Then I should see the language selector - @login @uls-in-sidebar-only + @login Scenario Outline: Opening language settings from sidebar Given I am <user status> And I am on <page type> @@ -39,7 +39,7 @@ | logged out | a talk page without interlanguage links | | logged out | a talk page with interlanguage links | - @login @uls-in-sidebar-only + @login Scenario Outline: Closing language settings without saving Given I am <user status> And I am on a page without interlanguage links diff --git a/tests/browser/tags.txt b/tests/browser/tags.txt index bee6854..b696446 100644 --- a/tests/browser/tags.txt +++ b/tests/browser/tags.txt @@ -20,11 +20,6 @@ could use your normal user account if you skip these tests, but I would not recommend doing that. -@uls-in-personal-only -@uls-in-sidebar-only - These tests will automatically be marked as skipped if ULS configuration is - not the one expected for the test. - @anon-language-selection @no-anon-language-selection Depending on the wiki configuration, you should filter out either one of -- To view, visit https://gerrit.wikimedia.org/r/95126 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie8a37bf4f38e9c82e0c14736f2bc29e8ec1331ff Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Cmcmahon <cmcma...@wikimedia.org> Gerrit-Reviewer: KartikMistry <kartik.mis...@gmail.com> Gerrit-Reviewer: Zfilipin <zfili...@wikimedia.org> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits