diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-23 06:06:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-23 06:06:19 +0000 |
commit | 89861e72b7375353654513aa2bc0a3b60a5e4377 (patch) | |
tree | 60e5424a064977a346eaf5f06720dc74af54d720 /qa/qa/page | |
parent | 98dbb0a488d7b0093f352938210d9578b0f7a8a6 (diff) | |
download | gitlab-ce-89861e72b7375353654513aa2bc0a3b60a5e4377.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/admin/menu.rb | 46 | ||||
-rw-r--r-- | qa/qa/page/admin/overview/users/index.rb | 35 | ||||
-rw-r--r-- | qa/qa/page/admin/overview/users/show.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 16 | ||||
-rw-r--r-- | qa/qa/page/main/menu.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/profile/emails.rb | 29 | ||||
-rw-r--r-- | qa/qa/page/profile/menu.rb | 14 | ||||
-rw-r--r-- | qa/qa/page/profile/password.rb | 23 |
8 files changed, 163 insertions, 26 deletions
diff --git a/qa/qa/page/admin/menu.rb b/qa/qa/page/admin/menu.rb index 5a18ebd7af8..2d1af78046d 100644 --- a/qa/qa/page/admin/menu.rb +++ b/qa/qa/page/admin/menu.rb @@ -6,12 +6,16 @@ module QA class Menu < Page::Base view 'app/views/layouts/nav/sidebar/_admin.html.haml' do element :admin_sidebar - element :admin_sidebar_submenu + element :admin_sidebar_settings_submenu element :admin_settings_item element :admin_settings_repository_item element :admin_settings_general_item element :admin_settings_metrics_and_profiling_item element :admin_settings_preferences_link + element :admin_monitoring_link + element :admin_sidebar_monitoring_submenu_content + element :admin_sidebar_overview_submenu_content + element :users_overview_link end view 'app/views/layouts/nav/sidebar/_admin.html.haml' do @@ -19,59 +23,65 @@ module QA end def go_to_preferences_settings - hover_settings do - within_submenu do + hover_element(:admin_settings_item) do + within_submenu(:admin_sidebar_settings_submenu) do click_element :admin_settings_preferences_link end end end def go_to_repository_settings - hover_settings do - within_submenu do + hover_element(:admin_settings_item) do + within_submenu(:admin_sidebar_settings_submenu) do click_element :admin_settings_repository_item end end end def go_to_integration_settings - hover_settings do - within_submenu do + hover_element(:admin_settings_item) do + within_submenu(:admin_sidebar_settings_submenu) do click_element :integration_settings_link end end end def go_to_general_settings - hover_settings do - within_submenu do + hover_element(:admin_settings_item) do + within_submenu(:admin_sidebar_settings_submenu) do click_element :admin_settings_general_item end end end def go_to_metrics_and_profiling_settings - hover_settings do - within_submenu do + hover_element(:admin_settings_item) do + within_submenu(:admin_sidebar_settings_submenu) do click_element :admin_settings_metrics_and_profiling_item end end end def go_to_network_settings - hover_settings do - within_submenu do + hover_element(:admin_settings_item) do + within_submenu(:admin_sidebar_settings_submenu) do click_element :admin_settings_network_item end end end + def go_to_users_overview + within_submenu(:admin_sidebar_overview_submenu_content) do + click_element :users_overview_link + end + end + private - def hover_settings + def hover_element(element) within_sidebar do - scroll_to_element(:admin_settings_item) - find_element(:admin_settings_item).hover + scroll_to_element(element) + find_element(element).hover yield end @@ -83,8 +93,8 @@ module QA end end - def within_submenu - within_element(:admin_sidebar_submenu) do + def within_submenu(element) + within_element(element) do yield end end diff --git a/qa/qa/page/admin/overview/users/index.rb b/qa/qa/page/admin/overview/users/index.rb new file mode 100644 index 00000000000..e374c1bf281 --- /dev/null +++ b/qa/qa/page/admin/overview/users/index.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Overview + module Users + class Index < QA::Page::Base + view 'app/views/admin/users/index.html.haml' do + element :user_search_field + end + + view 'app/views/admin/users/_user.html.haml' do + element :user_row_content + end + + view 'app/views/admin/users/_user_detail.html.haml' do + element :username_link + end + + def search_user(username) + find_element(:user_search_field).set(username).send_keys(:return) + end + + def click_user(username) + within_element(:user_row_content, text: username) do + click_element(:username_link) + end + end + end + end + end + end + end +end diff --git a/qa/qa/page/admin/overview/users/show.rb b/qa/qa/page/admin/overview/users/show.rb new file mode 100644 index 00000000000..11ea7bcabc8 --- /dev/null +++ b/qa/qa/page/admin/overview/users/show.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Overview + module Users + class Show < QA::Page::Base + view 'app/views/admin/users/_head.html.haml' do + element :impersonate_user_link + end + + def click_impersonate_user + click_element(:impersonate_user_link) + end + end + end + end + end + end +end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index ca93663dba2..c373ec6d4fd 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -42,7 +42,7 @@ module QA element :login_page, required: true end - def sign_in_using_credentials(user = nil) + 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?) @@ -52,9 +52,9 @@ module QA raise NotImplementedError if Runtime::User.ldap_user? && user&.credentials_given? if Runtime::User.ldap_user? - sign_in_using_ldap_credentials(user || Runtime::User) + sign_in_using_ldap_credentials(user: user || Runtime::User) else - sign_in_using_gitlab_credentials(user || Runtime::User) + sign_in_using_gitlab_credentials(user: user || Runtime::User, skip_page_validation: skip_page_validation) end end end @@ -68,13 +68,13 @@ module QA using_wait_time 0 do set_initial_password_if_present - sign_in_using_gitlab_credentials(admin) + sign_in_using_gitlab_credentials(user: admin) end Page::Main::Menu.perform(&:has_personal_area?) end - def sign_in_using_ldap_credentials(user) + def sign_in_using_ldap_credentials(user:) Page::Main::Menu.perform(&:sign_out_if_signed_in) using_wait_time 0 do @@ -148,18 +148,18 @@ module QA def sign_out_and_sign_in_as(user:) Menu.perform(&:sign_out_if_signed_in) has_sign_in_tab? - sign_in_using_credentials(user) + sign_in_using_credentials(user: user) end private - def sign_in_using_gitlab_credentials(user) + def sign_in_using_gitlab_credentials(user:, skip_page_validation: false) switch_to_sign_in_tab if has_sign_in_tab? switch_to_standard_tab if has_standard_tab? fill_element :login_field, user.username fill_element :password_field, user.password - click_element :sign_in_button, Page::Main::Menu + click_element :sign_in_button, !skip_page_validation && Page::Main::Menu end def set_initial_password_if_present diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 751b67d7695..3391ef454ee 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -13,6 +13,7 @@ module QA element :navbar, required: true element :user_avatar, required: true element :user_menu, required: true + element :stop_impersonation_link end view 'app/views/layouts/nav/_dashboard.html.haml' do @@ -95,6 +96,10 @@ module QA has_element?(:admin_area_link, wait: wait) end + def click_stop_impersonation_link + click_element(:stop_impersonation_link) + end + private def within_top_menu diff --git a/qa/qa/page/profile/emails.rb b/qa/qa/page/profile/emails.rb new file mode 100644 index 00000000000..c20bc6a5c57 --- /dev/null +++ b/qa/qa/page/profile/emails.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module QA + module Page + module Profile + class Emails < Page::Base + view 'app/views/profiles/emails/index.html.haml' do + element :email_address_field + element :add_email_address_button + element :email_row_content + element :delete_email_link + end + + def add_email_address(email_address) + find_element(:email_address_field).set email_address + click_element(:add_email_address_button) + end + + def delete_email_address(email_address) + page.accept_alert do + within_element(:email_row_content, text: email_address) do + click_element(:delete_email_link) + end + end + end + end + end + end +end diff --git a/qa/qa/page/profile/menu.rb b/qa/qa/page/profile/menu.rb index 99a795a23ef..e7baaf3d40a 100644 --- a/qa/qa/page/profile/menu.rb +++ b/qa/qa/page/profile/menu.rb @@ -9,6 +9,8 @@ module QA element :access_token_title, 'Access Tokens' # rubocop:disable QA/ElementWithPattern element :top_level_items, '.sidebar-top-level-items' # rubocop:disable QA/ElementWithPattern element :ssh_keys, 'SSH Keys' # rubocop:disable QA/ElementWithPattern + element :profile_emails_link + element :profile_password_link end def click_access_tokens @@ -23,6 +25,18 @@ module QA end end + def click_emails + within_sidebar do + click_element(:profile_emails_link) + end + end + + def click_password + within_sidebar do + click_element(:profile_password_link) + end + end + private def within_sidebar diff --git a/qa/qa/page/profile/password.rb b/qa/qa/page/profile/password.rb new file mode 100644 index 00000000000..ce062f39edb --- /dev/null +++ b/qa/qa/page/profile/password.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module QA + module Page + module Profile + class Password < Page::Base + view 'app/views/profiles/passwords/edit.html.haml' do + element :current_password_field + element :new_password_field + element :confirm_password_field + element :save_password_button + end + + def update_password(new_password, current_password) + find_element(:current_password_field).set current_password + find_element(:new_password_field).set new_password + find_element(:confirm_password_field).set new_password + click_element(:save_password_button) + end + end + end + end +end |