summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-02-21 06:07:54 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-02-21 06:07:54 +0000
commit6c3db3c7e44f428675da5e85ef1244a35125940e (patch)
treeedcd626bbcf4ecb2676f990458ecaadbf9455b1e /qa
parentbfb5557b15d66fc1c22aeec5c345241946b103a3 (diff)
downloadgitlab-ce-6c3db3c7e44f428675da5e85ef1244a35125940e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/flow/login.rb4
-rw-r--r--qa/qa/page/main/login.rb1
-rw-r--r--qa/qa/page/main/menu.rb38
-rw-r--r--qa/qa/runtime/env.rb4
4 files changed, 36 insertions, 11 deletions
diff --git a/qa/qa/flow/login.rb b/qa/qa/flow/login.rb
index 564a51ee483..2702b52f2ef 100644
--- a/qa/qa/flow/login.rb
+++ b/qa/qa/flow/login.rb
@@ -21,8 +21,8 @@ module QA
def sign_in(as: nil, address: :gitlab, skip_page_validation: false, admin: false)
Page::Main::Login.perform { |p| p.redirect_to_login_page(address) }
- unless Page::Main::Login.perform(&:on_login_page?)
- Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?)
+ if !Page::Main::Login.perform(&:on_login_page?) && Page::Main::Menu.perform(&:signed_in?)
+ Page::Main::Menu.perform(&:sign_out)
end
Page::Main::Login.perform do |login|
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index f4f8820bc04..7532154f0cc 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -233,6 +233,7 @@ module QA
terms.accept_terms if terms.visible?
end
+ Page::Main::Menu.perform(&:enable_new_navigation) if Runtime::Env.super_sidebar_enabled?
Page::Main::Menu.validate_elements_present! unless skip_page_validation
end
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index 1e050d79e23..0b258c9ee34 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -12,15 +12,24 @@ module QA
element :user_profile_link
end
- view 'app/views/layouts/header/_default.html.haml' do
- element :navbar, required: true
- element :canary_badge_link
- element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout?
- element :user_menu, required: !QA::Runtime::Env.mobile_layout?
- element :stop_impersonation_link
- element :issues_shortcut_button, required: !QA::Runtime::Env.mobile_layout?
- element :merge_requests_shortcut_button, required: !QA::Runtime::Env.mobile_layout?
- element :todos_shortcut_button, required: !QA::Runtime::Env.mobile_layout?
+ if QA::Runtime::Env.super_sidebar_enabled?
+ # Define alternative navbar (super sidebar) which does not yet implement all the same elements
+ view 'app/assets/javascripts/super_sidebar/components/super_sidebar.vue' do
+ element :navbar, required: true # TODO: rename to sidebar once it's default implementation
+ element :user_menu, required: !QA::Runtime::Env.mobile_layout?
+ element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout?
+ end
+ else
+ view 'app/views/layouts/header/_default.html.haml' do
+ element :navbar, required: true
+ element :canary_badge_link
+ element :user_avatar_content, required: !QA::Runtime::Env.mobile_layout?
+ element :user_menu, required: !QA::Runtime::Env.mobile_layout?
+ element :stop_impersonation_link
+ element :issues_shortcut_button, required: !QA::Runtime::Env.mobile_layout?
+ element :merge_requests_shortcut_button, required: !QA::Runtime::Env.mobile_layout?
+ element :todos_shortcut_button, required: !QA::Runtime::Env.mobile_layout?
+ end
end
view 'app/assets/javascripts/nav/components/top_nav_app.vue' do
@@ -64,6 +73,10 @@ module QA
element :global_new_project_link
end
+ view 'app/assets/javascripts/nav/components/new_nav_toggle.vue' do
+ element :new_navigation_toggle
+ end
+
def go_to_groups
within_groups_menu do
click_element(:menu_item_link, title: 'View all groups')
@@ -211,6 +224,13 @@ module QA
has_element?(:canary_badge_link)
end
+ def enable_new_navigation
+ Runtime::Logger.info("Enabling super sidebar!")
+ 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
+
private
def within_top_menu(&block)
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index b53c2320537..3153c644b88 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -514,6 +514,10 @@ module QA
ENV['DEFAULT_CHROME_DOWNLOAD_PATH'] || Dir.tmpdir
end
+ def super_sidebar_enabled?
+ enabled?(ENV['QA_SUPER_SIDEBAR_ENABLED'], default: false)
+ end
+
def require_slack_env!
missing_env = %i[slack_workspace slack_email slack_password].select do |method|
::QA::Runtime::Env.public_send(method).nil?