diff --git a/app/assets/javascripts/nav/components/new_nav_toggle.vue b/app/assets/javascripts/nav/components/new_nav_toggle.vue index 82302ec46024e36949bb835c6c2bc69d5d23634e..c36c56d7e43e38482613d6892a8b4f1010f6b9be 100644 --- a/app/assets/javascripts/nav/components/new_nav_toggle.vue +++ b/app/assets/javascripts/nav/components/new_nav_toggle.vue @@ -71,7 +71,12 @@ export default { class="gl-new-dropdown-item-text-wrapper gl-display-flex! gl-justify-content-space-between gl-align-items-center gl-py-2!" > {{ $options.i18n.toggleMenuItemLabel }} - <gl-toggle :value="isEnabled" :label="$options.i18n.toggleLabel" label-position="hidden" /> + <gl-toggle + :value="isEnabled" + :label="$options.i18n.toggleLabel" + label-position="hidden" + data-testid="new-navigation-toggle" + /> </div> </div> </gl-disclosure-dropdown-item> diff --git a/app/assets/javascripts/super_sidebar/components/user_bar.vue b/app/assets/javascripts/super_sidebar/components/user_bar.vue index 0e156445f586bd1e706c2462224db9c64a9d41d3..a882df057fa669dd78cd03eadaf65b9c7d5cb4d9 100644 --- a/app/assets/javascripts/super_sidebar/components/user_bar.vue +++ b/app/assets/javascripts/super_sidebar/components/user_bar.vue @@ -159,6 +159,7 @@ export default { :count="userCounts.assigned_issues" :href="sidebarData.issues_dashboard_path" :label="$options.i18n.issues" + data-testid="issues-shortcut-button" data-track-action="click_link" data-track-label="issues_link" data-track-property="nav_core_menu" @@ -175,6 +176,7 @@ export default { icon="merge-request-open" :count="mergeRequestTotalCount" :label="$options.i18n.mergeRequests" + data-testid="merge-requests-shortcut-button" data-track-action="click_dropdown" data-track-label="merge_requests_menu" data-track-property="nav_core_menu" @@ -187,7 +189,7 @@ export default { :count="userCounts.todos" :href="sidebarData.todos_dashboard_path" :label="$options.i18n.todoList" - data-testid="todos_shortcut_button" + data-testid="todos-shortcut-button" data-track-action="click_link" data-track-label="todos_link" data-track-property="nav_core_menu" diff --git a/app/helpers/nav/top_nav_helper.rb b/app/helpers/nav/top_nav_helper.rb index 9d138c1debb448c045741b08d6d3f7cc6b827b5c..d74efac76aad9b39faad2f87387d7a0af348c07f 100644 --- a/app/helpers/nav/top_nav_helper.rb +++ b/app/helpers/nav/top_nav_helper.rb @@ -195,7 +195,7 @@ def build_view_model(builder:, project:, group:) active: active_nav_link?(controller: 'admin/dashboard'), icon: 'admin', href: admin_root_path, - data: { testid: 'admin_area_link', **menu_data_tracking_attrs(title) } + data: { qa_selector: 'admin_area_link', **menu_data_tracking_attrs(title) } ) end diff --git a/qa/qa/ee/page/project/sub_menus/analytics.rb b/qa/qa/ee/page/project/sub_menus/analytics.rb index 76f396b9978622b78e6bcafffdec1105fb8a7b7b..61e5f34812f856daf119e336e7d4c8ededc5dbfd 100644 --- a/qa/qa/ee/page/project/sub_menus/analytics.rb +++ b/qa/qa/ee/page/project/sub_menus/analytics.rb @@ -23,6 +23,22 @@ def hover_analytics yield end end + + def go_to_value_stream_analytics + hover_analytics do + within_submenu do + click_element(:sidebar_menu_item_link, menu_item: 'Value stream') + end + end + end + + def go_to_merge_request_analytics + hover_analytics do + within_submenu do + click_element(:sidebar_menu_item_link, menu_item: 'Merge request') + end + end + end end end end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index d25b4efe85c7d2418744cde3be36dfaf04e946cf..8812c79255454b075941499fb732430c908db0f7 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -103,6 +103,12 @@ def sign_in_using_ldap_credentials(user:) click_element :sign_in_button end + if Runtime::Env.super_sidebar_enabled? + Page::Main::Menu.perform(&:enable_new_navigation) + else + Page::Main::Menu.perform(&:disable_new_navigation) + end + Page::Main::Menu.perform(&:signed_in?) end @@ -263,7 +269,11 @@ def sign_in_using_gitlab_credentials(user:, skip_page_validation: false) wait_for_gitlab_to_respond - Page::Main::Menu.perform(&:enable_new_navigation) if Runtime::Env.super_sidebar_enabled? + if Runtime::Env.super_sidebar_enabled? + Page::Main::Menu.perform(&:enable_new_navigation) + else + Page::Main::Menu.perform(&:disable_new_navigation) + end wait_for_gitlab_to_respond diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index bd2948ed39ad24316e7bd8cafe770da75870cb53..29c4360f81425f204bf91496ca13e2e8847eff0d 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -33,6 +33,9 @@ class Menu < Page::Base view 'app/assets/javascripts/super_sidebar/components/user_bar.vue' do element :super_sidebar_search_button element :stop_impersonation_btn + element :issues_shortcut_button, required: !Runtime::Env.phone_layout? + element :merge_requests_shortcut_button, required: !Runtime::Env.phone_layout? + element :todos_shortcut_button, required: !Runtime::Env.phone_layout? end view 'app/assets/javascripts/super_sidebar/components/global_search/components/global_search.vue' do @@ -278,11 +281,23 @@ def canary? def enable_new_navigation Runtime::Logger.info("Enabling super sidebar!") return Runtime::Logger.info("User is not signed in, skipping") unless has_element?(:navbar, wait: 2) + return Runtime::Logger.info("Super sidebar is already enabled") if has_css?('[data-testid="super-sidebar"]') within_user_menu { click_element(:new_navigation_toggle) } end + def disable_new_navigation + Runtime::Logger.info("Disabling super sidebar!") + return Runtime::Logger.info("User is not signed in, skipping") unless has_element?(:navbar, wait: 2) + + unless has_css?('[data-testid="super-sidebar"]') + return Runtime::Logger.info("Super sidebar is already disabled") + end + + within_user_menu { click_element(:new_navigation_toggle) } + end + private def within_top_menu(&block) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb index cf9282c1149a8d13c62a2b29e029b6c1f1d227a3..84664cb8b944bcab76de8f04a254b036f3de90e9 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb @@ -43,7 +43,12 @@ module QA it( 'allows enforcing 2FA via UI and logging in with 2FA', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931', + quarantine: { + type: :bug, + only: { condition: -> { !QA::Runtime::Env.super_sidebar_enabled? } }, + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/409336' + } ) do enforce_two_factor_authentication_on_group(group) diff --git a/qa/qa/vendor/saml_idp/page/login.rb b/qa/qa/vendor/saml_idp/page/login.rb index dda9cd3758fbc98ae240fdd73c19c78ac01c8cdb..9b4fbe15366c65a09b0a7adb6138695bdc7d2848 100644 --- a/qa/qa/vendor/saml_idp/page/login.rb +++ b/qa/qa/vendor/saml_idp/page/login.rb @@ -11,6 +11,12 @@ def login(username, password) fill_in 'username', with: username fill_in 'password', with: password click_on 'Login' + + if Runtime::Env.super_sidebar_enabled? + QA::Page::Main::Menu.perform(&:enable_new_navigation) + else + QA::Page::Main::Menu.perform(&:disable_new_navigation) + end end def login_if_required(username, password) diff --git a/spec/frontend/super_sidebar/components/user_bar_spec.js b/spec/frontend/super_sidebar/components/user_bar_spec.js index ae48c0f2a758b9b504aac85488116ce697bb08e9..272e0237219bfcce0ca97955a22b4a558d5120ee 100644 --- a/spec/frontend/super_sidebar/components/user_bar_spec.js +++ b/spec/frontend/super_sidebar/components/user_bar_spec.js @@ -7,7 +7,6 @@ import CreateMenu from '~/super_sidebar/components/create_menu.vue'; import SearchModal from '~/super_sidebar/components/global_search/components/global_search.vue'; import BrandLogo from 'jh_else_ce/super_sidebar/components/brand_logo.vue'; import MergeRequestMenu from '~/super_sidebar/components/merge_request_menu.vue'; -import Counter from '~/super_sidebar/components/counter.vue'; import UserBar from '~/super_sidebar/components/user_bar.vue'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import waitForPromises from 'helpers/wait_for_promises'; @@ -19,10 +18,9 @@ describe('UserBar component', () => { let wrapper; const findCreateMenu = () => wrapper.findComponent(CreateMenu); - const findCounter = (at) => wrapper.findAllComponents(Counter).at(at); - const findIssuesCounter = () => findCounter(0); - const findMRsCounter = () => findCounter(1); - const findTodosCounter = () => findCounter(2); + const findIssuesCounter = () => wrapper.findByTestId('issues-shortcut-button'); + const findMRsCounter = () => wrapper.findByTestId('merge-requests-shortcut-button'); + const findTodosCounter = () => wrapper.findByTestId('todos-shortcut-button'); const findMergeRequestMenu = () => wrapper.findComponent(MergeRequestMenu); const findBrandLogo = () => wrapper.findComponent(BrandLogo); const findCollapseButton = () => wrapper.findByTestId('super-sidebar-collapse-button'); diff --git a/spec/helpers/nav/top_nav_helper_spec.rb b/spec/helpers/nav/top_nav_helper_spec.rb index e2a0c11e7cb93c5b819ece1dd17f10ef3641d98d..6ffc2cbf6944489664996ca2e51b8b6e4be83a5b 100644 --- a/spec/helpers/nav/top_nav_helper_spec.rb +++ b/spec/helpers/nav/top_nav_helper_spec.rb @@ -375,7 +375,7 @@ it 'has admin as first :secondary item' do expected_admin_item = ::Gitlab::Nav::TopNavMenuItem.build( data: { - testid: 'admin_area_link', + qa_selector: 'admin_area_link', **menu_data_tracking_attrs('admin') }, id: 'admin',