diff options
Diffstat (limited to 'qa/qa/page')
-rw-r--r-- | qa/qa/page/README.md | 12 | ||||
-rw-r--r-- | qa/qa/page/base.rb | 16 | ||||
-rw-r--r-- | qa/qa/page/main/login.rb | 16 | ||||
-rw-r--r-- | qa/qa/page/menu/main.rb | 9 | ||||
-rw-r--r-- | qa/qa/page/menu/profile.rb | 27 | ||||
-rw-r--r-- | qa/qa/page/menu/side.rb | 31 | ||||
-rw-r--r-- | qa/qa/page/profile/personal_access_tokens.rb | 33 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/index.rb | 13 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/show.rb | 35 | ||||
-rw-r--r-- | qa/qa/page/project/settings/ci_cd.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/project/settings/common.rb | 14 | ||||
-rw-r--r-- | qa/qa/page/project/settings/deploy_keys.rb | 40 | ||||
-rw-r--r-- | qa/qa/page/project/settings/repository.rb | 11 | ||||
-rw-r--r-- | qa/qa/page/project/settings/runners.rb | 35 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 1 |
15 files changed, 282 insertions, 32 deletions
diff --git a/qa/qa/page/README.md b/qa/qa/page/README.md index f72fbfeafca..83710606d7c 100644 --- a/qa/qa/page/README.md +++ b/qa/qa/page/README.md @@ -77,7 +77,7 @@ module Page view 'app/views/devise/sessions/_new_base.html.haml' do element :login_field, 'text_field :login' - element :passowrd_field, 'password_field :password' + element :password_field, 'password_field :password' element :sign_in_button, 'submit "Sign in"' end @@ -103,6 +103,16 @@ view 'app/views/my/view.html.haml' do end ``` +## Running the test locally + +During development, you can run the `qa:selectors` test by running + +```shell +bin/qa Test::Sanity::Selectors +``` + +from within the `qa` directory. + ## Where to ask for help? If you need more information, ask for help on `#qa` channel on Slack (GitLab diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index ea4c920c82c..81ba80cdbaf 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -41,7 +41,21 @@ module QA end def click_element(name) - find(Page::Element.new(name).selector_css).click + find_element(name).click + end + + def find_element(name) + find(element_selector_css(name)) + end + + def within_element(name) + page.within(element_selector_css(name)) do + yield + end + end + + def element_selector_css(name) + Page::Element.new(name).selector_css end def self.path diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index 7b4c1603017..9cff2c5c317 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -19,15 +19,17 @@ module QA end def sign_in_using_credentials - if page.has_content?('Change your password') + using_wait_time 0 do + if page.has_content?('Change your password') + fill_in :user_password, with: Runtime::User.password + fill_in :user_password_confirmation, with: Runtime::User.password + click_button 'Change your password' + end + + fill_in :user_login, with: Runtime::User.name fill_in :user_password, with: Runtime::User.password - fill_in :user_password_confirmation, with: Runtime::User.password - click_button 'Change your password' + click_button 'Sign in' end - - fill_in :user_login, with: Runtime::User.name - fill_in :user_password, with: Runtime::User.password - click_button 'Sign in' end def self.path diff --git a/qa/qa/page/menu/main.rb b/qa/qa/page/menu/main.rb index f8978b8a5f7..df93a5fa2d2 100644 --- a/qa/qa/page/menu/main.rb +++ b/qa/qa/page/menu/main.rb @@ -7,6 +7,7 @@ module QA element :user_avatar element :user_menu, '.dropdown-menu-nav' element :user_sign_out_link, 'link_to "Sign out"' + element :settings_link, 'link_to "Settings"' end view 'app/views/layouts/nav/_dashboard.html.haml' do @@ -40,7 +41,13 @@ module QA def sign_out within_user_menu do - click_link('Sign out') + click_link 'Sign out' + end + end + + def go_to_profile_settings + within_user_menu do + click_link 'Settings' end end diff --git a/qa/qa/page/menu/profile.rb b/qa/qa/page/menu/profile.rb new file mode 100644 index 00000000000..95e88d863e4 --- /dev/null +++ b/qa/qa/page/menu/profile.rb @@ -0,0 +1,27 @@ +module QA + module Page + module Menu + class Profile < Page::Base + view 'app/views/layouts/nav/sidebar/_profile.html.haml' do + element :access_token_link, 'link_to profile_personal_access_tokens_path' + element :access_token_title, 'Access Tokens' + element :top_level_items, '.sidebar-top-level-items' + end + + def click_access_tokens + within_sidebar do + click_link('Access Tokens') + end + end + + private + + def within_sidebar + page.within('.sidebar-top-level-items') do + yield + end + end + end + end + end +end diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb index 00b7eba62b0..26f1eccd45c 100644 --- a/qa/qa/page/menu/side.rb +++ b/qa/qa/page/menu/side.rb @@ -5,19 +5,36 @@ module QA view 'app/views/layouts/nav/sidebar/_project.html.haml' do element :settings_item element :repository_link, "title: 'Repository'" + element :pipelines_settings_link, "title: 'CI / CD'" element :top_level_items, '.sidebar-top-level-items' element :activity_link, "title: 'Activity'" end - def click_repository_setting - hover_setting do - click_link('Repository') + def click_repository_settings + hover_settings do + within_submenu do + click_link('Repository') + end + end + end + + def click_ci_cd_settings + hover_settings do + within_submenu do + click_link('CI / CD') + end + end + end + + def click_ci_cd_pipelines + within_sidebar do + click_link('CI / CD') end end private - def hover_setting + def hover_settings within_sidebar do find('.qa-settings-item').hover @@ -36,6 +53,12 @@ module QA click_on 'Activity' end end + + def within_submenu + page.within('.fly-out-list') do + yield + end + end end end end diff --git a/qa/qa/page/profile/personal_access_tokens.rb b/qa/qa/page/profile/personal_access_tokens.rb new file mode 100644 index 00000000000..f5ae47dadd0 --- /dev/null +++ b/qa/qa/page/profile/personal_access_tokens.rb @@ -0,0 +1,33 @@ +module QA + module Page + module Profile + class PersonalAccessTokens < Page::Base + view 'app/views/shared/_personal_access_tokens_form.html.haml' do + element :personal_access_token_name_field, 'text_field :name' + element :create_token_button, 'submit "Create #{type} token"' # rubocop:disable Lint/InterpolationCheck + element :scopes_api_radios, "label :scopes" + end + + view 'app/views/profiles/personal_access_tokens/index.html.haml' do + element :create_token_field, "text_field_tag 'created-personal-access-token'" + end + + def fill_token_name(name) + fill_in 'personal_access_token_name', with: name + end + + def check_api + check 'personal_access_token_scopes_api' + end + + def create_token + click_on 'Create personal access token' + end + + def created_access_token + page.find('#created-personal-access-token').value + end + end + end + end +end diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb new file mode 100644 index 00000000000..32c108393b9 --- /dev/null +++ b/qa/qa/page/project/pipeline/index.rb @@ -0,0 +1,13 @@ +module QA::Page + module Project::Pipeline + class Index < QA::Page::Base + view 'app/assets/javascripts/pipelines/components/pipeline_url.vue' do + element :pipeline_link, 'class="js-pipeline-url-link"' + end + + def go_to_latest_pipeline + first('.js-pipeline-url-link').click + end + end + end +end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb new file mode 100644 index 00000000000..0835173f1cd --- /dev/null +++ b/qa/qa/page/project/pipeline/show.rb @@ -0,0 +1,35 @@ +module QA::Page + module Project::Pipeline + class Show < QA::Page::Base + view 'app/assets/javascripts/vue_shared/components/header_ci_component.vue' do + element :pipeline_header, /header class.*ci-header-container.*/ + end + + view 'app/assets/javascripts/pipelines/components/graph/graph_component.vue' do + element :pipeline_graph, /class.*pipeline-graph.*/ + end + + view 'app/assets/javascripts/pipelines/components/graph/job_component.vue' do + element :job_component, /class.*ci-job-component.*/ + end + + view 'app/assets/javascripts/vue_shared/components/ci_icon.vue' do + element :status_icon, 'ci-status-icon-${status}' + end + + def running? + within('.ci-header-container') do + return page.has_content?('running') + end + end + + def has_build?(name, status: :success) + within('.pipeline-graph') do + within('.ci-job-component', text: name) do + return has_selector?(".ci-status-icon-#{status}") + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/ci_cd.rb b/qa/qa/page/project/settings/ci_cd.rb new file mode 100644 index 00000000000..5270dde7411 --- /dev/null +++ b/qa/qa/page/project/settings/ci_cd.rb @@ -0,0 +1,21 @@ +module QA + module Page + module Project + module Settings + class CICD < Page::Base + include Common + + view 'app/views/projects/settings/ci_cd/show.html.haml' do + element :runners_settings, 'Runners settings' + end + + def expand_runners_settings(&block) + expand_section('Runners settings') do + Settings::Runners.perform(&block) + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index 5d1d5120929..1357bf031d5 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -3,13 +3,23 @@ module QA module Project module Settings module Common - def expand(selector) + def expand(element_name) page.within('#content-body') do - find(selector).click + click_element(element_name) yield end end + + def expand_section(name) + page.within('#content-body') do + page.within('section', text: name) do + click_button 'Expand' + + yield + end + end + end end end end diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index a8d6f09777c..332e84724c7 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -3,12 +3,20 @@ module QA module Project module Settings class DeployKeys < Page::Base - ## - # TODO, define all selectors required by this page object - # - # See gitlab-org/gitlab-qa#154 - # - view 'app/views/projects/deploy_keys/edit.html.haml' + view 'app/views/projects/deploy_keys/_form.html.haml' do + element :deploy_key_title, 'text_field :title' + element :deploy_key_key, 'text_area :key' + end + + view 'app/assets/javascripts/deploy_keys/components/app.vue' do + element :deploy_keys_section, /class=".*deploy\-keys.*"/ + element :project_deploy_keys, 'class="qa-project-deploy-keys"' + end + + view 'app/assets/javascripts/deploy_keys/components/key.vue' do + element :key_title, /class=".*qa-key-title.*"/ + element :key_fingerprint, /class=".*qa-key-fingerprint.*"/ + end def fill_key_title(title) fill_in 'deploy_key_title', with: title @@ -22,9 +30,23 @@ module QA click_on 'Add key' end - def has_key_title?(title) - page.within('.deploy-keys') do - page.find('.title', text: title) + def key_title + within_project_deploy_keys do + find_element(:key_title).text + end + end + + def key_fingerprint + within_project_deploy_keys do + find_element(:key_fingerprint).text + end + end + + private + + def within_project_deploy_keys + within_element(:project_deploy_keys) do + yield end end end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 524d87c6be9..6cc68358c8c 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -5,15 +5,12 @@ module QA class Repository < Page::Base include Common - ## - # TODO, define all selectors required by this page object - # - # See gitlab-org/gitlab-qa#154 - # - view 'app/views/projects/settings/repository/show.html.haml' + view 'app/views/projects/deploy_keys/_index.html.haml' do + element :expand_deploy_keys + end def expand_deploy_keys(&block) - expand('.qa-expand-deploy-keys') do + expand(:expand_deploy_keys) do DeployKeys.perform(&block) end end diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb new file mode 100644 index 00000000000..b41668c94cd --- /dev/null +++ b/qa/qa/page/project/settings/runners.rb @@ -0,0 +1,35 @@ +module QA + module Page + module Project + module Settings + class Runners < Page::Base + view 'app/views/ci/runner/_how_to_setup_runner.html.haml' do + element :registration_token, '%code#registration_token' + element :coordinator_address, '%code#coordinator_address' + end + + ## + # TODO, phase-out CSS classes added in Ruby helpers. + # + view 'app/helpers/runners_helper.rb' do + # rubocop:disable Lint/InterpolationCheck + element :runner_status, 'runner-status-#{status}' + # rubocop:enable Lint/InterpolationCheck + end + + def registration_token + find('code#registration_token').text + end + + def coordinator_address + find('code#coordinator_address').text + end + + def has_online_runner? + page.has_css?('.runner-status-online') + end + end + end + end + end +end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index c8af5ba6280..5e66e40a0b5 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -33,6 +33,7 @@ module QA def wait_for_push sleep 5 + refresh end end end |