Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-26 18:09:27 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-26 18:09:27 +0300
commit5169b4a63b1e592e159b5451f81bc3c11602275f (patch)
tree2cfb5e8f0a4c2343579a2f56c8a60233bb6059b1 /qa
parent0594381ba711725d7d676db202902dfcbe9ec4a0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/flow/login.rb7
-rw-r--r--qa/qa/mobile/page/main/menu.rb60
-rw-r--r--qa/qa/mobile/page/profile/menu.rb26
-rw-r--r--qa/qa/mobile/page/project/issue/show.rb37
-rw-r--r--qa/qa/mobile/page/project/show.rb31
-rw-r--r--qa/qa/mobile/page/sub_menus/common.rb28
-rw-r--r--qa/qa/page/main/login.rb6
-rw-r--r--qa/qa/page/main/menu.rb18
-rw-r--r--qa/qa/page/profile/menu.rb4
-rw-r--r--qa/qa/page/project/issue/show.rb5
-rw-r--r--qa/qa/page/project/show.rb3
-rw-r--r--qa/qa/page/project/sub_menus/common.rb4
-rw-r--r--qa/qa/page/sub_menus/common.rb4
-rw-r--r--qa/qa/runtime/browser.rb3
-rw-r--r--qa/qa/runtime/env.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb6
17 files changed, 237 insertions, 13 deletions
diff --git a/qa/qa/flow/login.rb b/qa/qa/flow/login.rb
index 05a509588f1..5f7e0227ac5 100644
--- a/qa/qa/flow/login.rb
+++ b/qa/qa/flow/login.rb
@@ -23,8 +23,11 @@ module QA
end
def sign_in(as: nil, address: :gitlab, skip_page_validation: false, admin: false)
- Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?)
- Runtime::Browser.visit(address, Page::Main::Login)
+ unless Page::Main::Login.perform(&:on_login_page?)
+ Page::Main::Menu.perform(&:sign_out) if Page::Main::Menu.perform(&:signed_in?)
+ Runtime::Browser.visit(address, Page::Main::Login)
+ end
+
Page::Main::Login.perform do |login|
if admin
login.sign_in_using_admin_credentials
diff --git a/qa/qa/mobile/page/main/menu.rb b/qa/qa/mobile/page/main/menu.rb
new file mode 100644
index 00000000000..40bb421b383
--- /dev/null
+++ b/qa/qa/mobile/page/main/menu.rb
@@ -0,0 +1,60 @@
+# frozen_string_literal: true
+
+module QA
+ module Mobile
+ module Page
+ module Main
+ module Menu
+ extend QA::Page::PageConcern
+
+ def self.prepended(base)
+ super
+
+ base.class_eval do
+ view 'app/views/layouts/header/_default.html.haml' do
+ element :mobile_navbar_button, required: true
+ end
+
+ view 'app/assets/javascripts/nav/components/responsive_home.vue' do
+ element :mobile_new_dropdown
+ end
+ end
+ end
+
+ def open_mobile_menu
+ if has_no_element?(:user_avatar)
+ Support::Retrier.retry_until do
+ click_element(:mobile_navbar_button)
+ has_element?(:user_avatar)
+ end
+ end
+ end
+
+ def open_mobile_new_dropdown
+ open_mobile_menu
+
+ Support::Retrier.retry_until do
+ find('[data-qa-selector="mobile_new_dropdown"] > button').click
+ has_css?('.dropdown-menu-right.show')
+ end
+ end
+
+ def has_personal_area?(wait: Capybara.default_max_wait_time)
+ open_mobile_menu
+ super
+ end
+
+ def has_no_personal_area?(wait: Capybara.default_max_wait_time)
+ open_mobile_menu
+ super
+ end
+
+ def within_user_menu
+ open_mobile_menu
+ super
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/mobile/page/profile/menu.rb b/qa/qa/mobile/page/profile/menu.rb
new file mode 100644
index 00000000000..34c53a95e03
--- /dev/null
+++ b/qa/qa/mobile/page/profile/menu.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+module QA
+ module Mobile
+ module Page
+ module Profile
+ module Menu
+ extend QA::Page::PageConcern
+
+ def self.prepended(base)
+ super
+
+ base.class_eval do
+ prepend QA::Mobile::Page::Main::Menu
+ end
+ end
+
+ def within_sidebar
+ open_mobile_nav_sidebar
+ super
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/mobile/page/project/issue/show.rb b/qa/qa/mobile/page/project/issue/show.rb
new file mode 100644
index 00000000000..017ecebcb69
--- /dev/null
+++ b/qa/qa/mobile/page/project/issue/show.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+module QA
+ module Mobile
+ module Page
+ module Project
+ module Issue
+ module Show
+ extend QA::Page::PageConcern
+
+ def self.prepended(base)
+ super
+
+ base.class_eval do
+ view 'app/assets/javascripts/issue_show/components/header_actions.vue' do
+ element :issue_actions_dropdown
+ element :mobile_close_issue_button
+ element :mobile_reopen_issue_button
+ end
+ end
+ end
+
+ def click_close_issue_button
+ find('[data-qa-selector="issue_actions_dropdown"] > button').click
+ find_element(:mobile_close_issue_button, visible: false).click
+ end
+
+ def has_reopen_issue_button?
+ find('[data-qa-selector="issue_actions_dropdown"] > button').click
+ has_element?(:mobile_reopen_issue_button)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/mobile/page/project/show.rb b/qa/qa/mobile/page/project/show.rb
new file mode 100644
index 00000000000..8a0a222c852
--- /dev/null
+++ b/qa/qa/mobile/page/project/show.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+module QA
+ module Mobile
+ module Page
+ module Project
+ module Show
+ extend QA::Page::PageConcern
+
+ def self.prepended(base)
+ super
+
+ base.class_eval do
+ prepend QA::Mobile::Page::Main::Menu
+
+ view 'app/assets/javascripts/nav/components/top_nav_new_dropdown.vue' do
+ element :new_issue_mobile_button
+ end
+ end
+ end
+
+ def go_to_new_issue
+ open_mobile_new_dropdown
+
+ click_element(:new_issue_mobile_button)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/mobile/page/sub_menus/common.rb b/qa/qa/mobile/page/sub_menus/common.rb
new file mode 100644
index 00000000000..6a0477a3f31
--- /dev/null
+++ b/qa/qa/mobile/page/sub_menus/common.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module QA
+ module Mobile
+ module Page
+ module SubMenus
+ module Common
+ def open_mobile_nav_sidebar
+ if has_element?(:project_sidebar, visible: false)
+ Support::Retrier.retry_until do
+ click_element(:toggle_mobile_nav_button)
+ has_element?(:project_sidebar, visible: true)
+ end
+ end
+ end
+
+ def within_sidebar
+ wait_for_requests
+
+ open_mobile_nav_sidebar
+
+ super
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb
index c3170478733..5cba9d4bce4 100644
--- a/qa/qa/page/main/login.rb
+++ b/qa/qa/page/main/login.rb
@@ -45,6 +45,10 @@ module QA
has_element?(:sign_in_button)
end
+ def on_login_page?
+ has_element?(:login_page, wait: 0)
+ end
+
def sign_in_using_credentials(user: nil, skip_page_validation: false)
# Don't try to log-in if we're already logged-in
return if Page::Main::Menu.perform(&:signed_in?)
@@ -164,6 +168,8 @@ module QA
fill_element :password_field, user.password
click_element :sign_in_button
+ Support::WaitForRequests.wait_for_requests
+
Page::Main::Terms.perform do |terms|
terms.accept_terms if terms.visible?
end
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index ad5cd971afc..e3bb585955b 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -4,6 +4,8 @@ module QA
module Page
module Main
class Menu < Page::Base
+ prepend Mobile::Page::Main::Menu if Runtime::Env.mobile_layout?
+
view 'app/views/layouts/header/_current_user_dropdown.html.haml' do
element :sign_out_link
element :edit_profile_link
@@ -12,12 +14,12 @@ module QA
view 'app/views/layouts/header/_default.html.haml' do
element :navbar, required: true
element :canary_badge_link
- element :user_avatar, required: true
- element :user_menu, required: true
+ element :user_avatar, required: !QA::Runtime::Env.mobile_layout?
+ element :user_menu, required: !QA::Runtime::Env.mobile_layout?
element :stop_impersonation_link
- element :issues_shortcut_button, required: true
- element :merge_requests_shortcut_button, required: true
- element :todos_shortcut_button, required: true
+ 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
view 'app/assets/javascripts/nav/components/top_nav_app.vue' do
@@ -98,10 +100,14 @@ module QA
end
def signed_in?
+ return false if Page::Main::Login.perform(&:on_login_page?)
+
has_personal_area?(wait: 0)
end
def not_signed_in?
+ return true if Page::Main::Login.perform(&:on_login_page?)
+
has_no_personal_area?
end
@@ -115,7 +121,7 @@ module QA
click_element :sign_out_link
end
- has_no_element?(:user_avatar)
+ not_signed_in?
end
end
diff --git a/qa/qa/page/profile/menu.rb b/qa/qa/page/profile/menu.rb
index a12db2918dc..d638a378610 100644
--- a/qa/qa/page/profile/menu.rb
+++ b/qa/qa/page/profile/menu.rb
@@ -4,6 +4,10 @@ module QA
module Page
module Profile
class Menu < Page::Base
+ # We need to check remote_mobile_device_name instead of mobile_layout? here
+ # since tablets have the regular top navigation bar but still close the left nav
+ prepend QA::Mobile::Page::Profile::Menu if QA::Runtime::Env.remote_mobile_device_name
+
view 'app/views/layouts/nav/sidebar/_profile.html.haml' do
element :access_token_link, 'link_to profile_personal_access_tokens_path' # rubocop:disable QA/ElementWithPattern
element :access_token_title, 'Access Tokens' # rubocop:disable QA/ElementWithPattern
diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb
index 7a5a153db86..3b033830420 100644
--- a/qa/qa/page/project/issue/show.rb
+++ b/qa/qa/page/project/issue/show.rb
@@ -9,6 +9,7 @@ module QA
include Page::Component::Note
include Page::Component::DesignManagement
include Page::Component::Issuable::Sidebar
+ prepend Mobile::Page::Project::Issue::Show if Runtime::Env.mobile_layout?
view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do
element :remove_related_issue_button
@@ -64,6 +65,10 @@ module QA
def has_metrics_unfurled?
has_element?(:prometheus_graph_widgets, wait: 30)
end
+
+ def has_reopen_issue_button?
+ has_element?(:reopen_issue_button)
+ end
end
end
end
diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb
index 6e5097c3812..18a29f518dd 100644
--- a/qa/qa/page/project/show.rb
+++ b/qa/qa/page/project/show.rb
@@ -9,6 +9,7 @@ module QA
include Page::Component::Breadcrumbs
include Page::Project::SubMenus::Settings
include Page::File::Shared::CommitMessage
+ prepend Mobile::Page::Project::Show if Runtime::Env.mobile_layout?
view 'app/assets/javascripts/repository/components/preview/index.vue' do
element :blob_viewer_content
@@ -117,7 +118,7 @@ module QA
end
def go_to_new_issue
- click_element :new_menu_toggle
+ click_element(:new_menu_toggle)
click_element(:new_issue_link)
end
diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb
index c20710bc393..112f49a90ee 100644
--- a/qa/qa/page/project/sub_menus/common.rb
+++ b/qa/qa/page/project/sub_menus/common.rb
@@ -19,6 +19,10 @@ module QA
view 'app/views/shared/nav/_sidebar_menu.html.haml' do
element :sidebar_menu_link
end
+
+ view 'app/views/layouts/nav/_breadcrumbs.html.haml' do
+ element :toggle_mobile_nav_button
+ end
end
end
diff --git a/qa/qa/page/sub_menus/common.rb b/qa/qa/page/sub_menus/common.rb
index 2efeeb062e8..518b3b4e84e 100644
--- a/qa/qa/page/sub_menus/common.rb
+++ b/qa/qa/page/sub_menus/common.rb
@@ -4,6 +4,10 @@ module QA
module Page
module SubMenus
module Common
+ # We need to check remote_mobile_device_name instead of mobile_layout? here
+ # since tablets have the regular top navigation bar but still close the left nav
+ prepend Mobile::Page::SubMenus::Common if QA::Runtime::Env.remote_mobile_device_name
+
def hover_element(element)
within_sidebar do
find_element(element).hover
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
index 0566bc237bb..44153eb4104 100644
--- a/qa/qa/runtime/browser.rb
+++ b/qa/qa/runtime/browser.rb
@@ -205,6 +205,9 @@ module QA
simulate_slow_connection if Runtime::Env.simulate_slow_connection?
+ # Wait until the new page is ready for us to interact with it
+ Support::WaitForRequests.wait_for_requests
+
page_class.validate_elements_present! if page_class.respond_to?(:validate_elements_present!)
if QA::Runtime::Env.qa_cookies
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index cdfa95457c7..be641cc283a 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -153,6 +153,12 @@ module QA
ENV['QA_REMOTE_MOBILE_DEVICE_NAME']
end
+ def mobile_layout?
+ return false if ENV['QA_REMOTE_MOBILE_DEVICE_NAME'].blank?
+
+ !(ENV['QA_REMOTE_MOBILE_DEVICE_NAME'].downcase.include?('ipad') || ENV['QA_REMOTE_MOBILE_DEVICE_NAME'].downcase.include?('tablet'))
+ end
+
def user_username
ENV['GITLAB_USERNAME']
end
diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
index ca95d567316..9625771164c 100644
--- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
+++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
module QA
- RSpec.describe 'Manage', :smoke do
+ RSpec.describe 'Manage', :smoke, :mobile do
describe 'basic user login' do
it 'user logs in using basic credentials and logs out', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1578' do
Flow::Login.sign_in
diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
index 7519f4daae2..81ae8b82ef6 100644
--- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
+++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb
@@ -9,7 +9,7 @@ module QA
Flow::Login.sign_in
end
- it 'creates an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1185' do
+ it 'creates an issue', :mobile, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1185' do
issue = Resource::Issue.fabricate_via_browser_ui!
Page::Project::Menu.perform(&:click_issues)
@@ -19,13 +19,13 @@ module QA
end
end
- it 'closes an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1222' do
+ it 'closes an issue', :mobile, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1222' do
closed_issue.visit!
Page::Project::Issue::Show.perform do |issue_page|
issue_page.click_close_issue_button
- expect(issue_page).to have_element(:reopen_issue_button)
+ expect(issue_page).to have_reopen_issue_button
end
Page::Project::Menu.perform(&:click_issues)