From 7377b97c5faf375d659c8e338982760d0d6bbb25 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 22 Dec 2017 03:04:25 +0800 Subject: QA: Add a scenario for adding a deploy key --- qa/qa/page/project/settings/deploy_key.rb | 33 +++++++++++++++++++++++++++++++ qa/qa/page/project/settings/repository.rb | 19 ++++++++++++++++++ qa/qa/page/project/show.rb | 20 +++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 qa/qa/page/project/settings/deploy_key.rb create mode 100644 qa/qa/page/project/settings/repository.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_key.rb b/qa/qa/page/project/settings/deploy_key.rb new file mode 100644 index 00000000000..27a6c26efd5 --- /dev/null +++ b/qa/qa/page/project/settings/deploy_key.rb @@ -0,0 +1,33 @@ +module QA + module Page + module Project + module Settings + class DeployKey < Repository + def initialize + super + + expand('Deploy Keys') + end + + def fill_new_deploy_key_title(title) + fill_in 'deploy_key_title', with: title + end + + def fill_new_deploy_key_key(key) + fill_in 'deploy_key_key', with: key + end + + def add_key + click_on 'Add key' + end + + def has_key_title?(title) + page.within('.deploy-keys') do + page.find('.title', text: title) + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb new file mode 100644 index 00000000000..740fb91d62e --- /dev/null +++ b/qa/qa/page/project/settings/repository.rb @@ -0,0 +1,19 @@ +module QA + module Page + module Project + module Settings + class Repository < Page::Base + def expand(title) + page.within('#content-body') do + find( + :xpath, + "//button[contains(text(), 'Expand')]" + + "[../h4[contains(text(), '#{title}')]]" + ).click + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 3b2bac84f3f..239fe8efdfd 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -10,6 +10,12 @@ module QA end end + def click_repository_setting + hover_setting do + click_link('Repository') + end + end + def repository_location find('#project_clone').value end @@ -18,6 +24,20 @@ module QA find('.project-title').text end + def hover_setting + within_sidebar do + find('.nav-item-name', text: 'Settings').hover + + yield + end + end + + def within_sidebar + page.within('.sidebar-top-level-items') do + yield + end + end + def wait_for_push sleep 5 end -- cgit v1.2.1 From 2078cb4e84bcc65774fc523d82a3f682248aae6f Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 28 Dec 2017 20:50:22 +0800 Subject: Rename DeployKey to DeployKeys --- qa/qa/page/project/settings/deploy_key.rb | 33 ------------------------------ qa/qa/page/project/settings/deploy_keys.rb | 33 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 qa/qa/page/project/settings/deploy_key.rb create mode 100644 qa/qa/page/project/settings/deploy_keys.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_key.rb b/qa/qa/page/project/settings/deploy_key.rb deleted file mode 100644 index 27a6c26efd5..00000000000 --- a/qa/qa/page/project/settings/deploy_key.rb +++ /dev/null @@ -1,33 +0,0 @@ -module QA - module Page - module Project - module Settings - class DeployKey < Repository - def initialize - super - - expand('Deploy Keys') - end - - def fill_new_deploy_key_title(title) - fill_in 'deploy_key_title', with: title - end - - def fill_new_deploy_key_key(key) - fill_in 'deploy_key_key', with: key - end - - def add_key - click_on 'Add key' - end - - def has_key_title?(title) - page.within('.deploy-keys') do - page.find('.title', text: title) - end - 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 new file mode 100644 index 00000000000..a8aa571f1f2 --- /dev/null +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -0,0 +1,33 @@ +module QA + module Page + module Project + module Settings + class DeployKeys < Repository + def initialize + super + + expand('Deploy Keys') + end + + def fill_new_deploy_key_title(title) + fill_in 'deploy_key_title', with: title + end + + def fill_new_deploy_key_key(key) + fill_in 'deploy_key_key', with: key + end + + def add_key + click_on 'Add key' + end + + def has_key_title?(title) + page.within('.deploy-keys') do + page.find('.title', text: title) + end + end + end + end + end + end +end -- cgit v1.2.1 From c91718366d0af94de6d67afe1f2fe35076e20f26 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 28 Dec 2017 21:22:21 +0800 Subject: Just add a new class to locate the expand button --- qa/qa/page/project/settings/repository.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 740fb91d62e..5d73911c697 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -5,11 +5,7 @@ module QA class Repository < Page::Base def expand(title) page.within('#content-body') do - find( - :xpath, - "//button[contains(text(), 'Expand')]" + - "[../h4[contains(text(), '#{title}')]]" - ).click + find('.qa-expand-deploy-keys').click end end end -- cgit v1.2.1 From bc5552b3594142b6f54a7ac2bc80ee80066c2064 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 29 Dec 2017 15:19:58 +0800 Subject: Introduce Menu::Side --- qa/qa/page/project/show.rb | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 239fe8efdfd..3b2bac84f3f 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -10,12 +10,6 @@ module QA end end - def click_repository_setting - hover_setting do - click_link('Repository') - end - end - def repository_location find('#project_clone').value end @@ -24,20 +18,6 @@ module QA find('.project-title').text end - def hover_setting - within_sidebar do - find('.nav-item-name', text: 'Settings').hover - - yield - end - end - - def within_sidebar - page.within('.sidebar-top-level-items') do - yield - end - end - def wait_for_push sleep 5 end -- cgit v1.2.1 From f851f13f1bba5503f8219e975fd326573c6a40d5 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 29 Dec 2017 15:40:46 +0800 Subject: Introduce expand_deploy_keys --- qa/qa/page/project/settings/deploy_keys.rb | 12 +++--------- qa/qa/page/project/settings/repository.rb | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index a8aa571f1f2..4028b8cccc5 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -2,18 +2,12 @@ module QA module Page module Project module Settings - class DeployKeys < Repository - def initialize - super - - expand('Deploy Keys') - end - - def fill_new_deploy_key_title(title) + class DeployKeys < Page::Base + def fill_key_title(title) fill_in 'deploy_key_title', with: title end - def fill_new_deploy_key_key(key) + def fill_key_value(key) fill_in 'deploy_key_key', with: key end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 5d73911c697..941fde2f04f 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -3,9 +3,19 @@ module QA module Project module Settings class Repository < Page::Base - def expand(title) + def expand_deploy_keys(&block) + expand('.qa-expand-deploy-keys') do + DeployKeys.perform(&block) + end + end + + private + + def expand(selector) page.within('#content-body') do - find('.qa-expand-deploy-keys').click + find(selector).click + + yield end end end -- cgit v1.2.1 From 7945878d45775e74046196bfd40291a1a7747724 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 29 Dec 2017 22:40:47 +0800 Subject: Introduce common project settings and just put everything in the scenario without a before block. --- qa/qa/page/project/settings/common.rb | 17 +++++++++++++++++ qa/qa/page/project/settings/repository.rb | 12 ++---------- 2 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 qa/qa/page/project/settings/common.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb new file mode 100644 index 00000000000..5d1d5120929 --- /dev/null +++ b/qa/qa/page/project/settings/common.rb @@ -0,0 +1,17 @@ +module QA + module Page + module Project + module Settings + module Common + def expand(selector) + page.within('#content-body') do + find(selector).click + + yield + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 941fde2f04f..034b0d09c1c 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -3,21 +3,13 @@ module QA module Project module Settings class Repository < Page::Base + include Common + def expand_deploy_keys(&block) expand('.qa-expand-deploy-keys') do DeployKeys.perform(&block) end end - - private - - def expand(selector) - page.within('#content-body') do - find(selector).click - - yield - end - end end end end -- cgit v1.2.1 From b1c388706c14fa2edb6eaa2f9daa522297f288e3 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 10 Jan 2018 11:13:30 +0100 Subject: Add temporary views coupling to all QA page objects --- qa/qa/page/project/new.rb | 7 +++++++ qa/qa/page/project/settings/deploy_keys.rb | 7 +++++++ qa/qa/page/project/settings/repository.rb | 7 +++++++ qa/qa/page/project/show.rb | 7 +++++++ 4 files changed, 28 insertions(+) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index b31bec27b59..a87313b2cb9 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -2,6 +2,13 @@ module QA module Page module Project class New < Page::Base + ## + # TODO, define all selectors required by this page object + # + # See gitlab-org/gitlab-qa#154 + # + view 'app/views/projects/new.html.haml' + def choose_test_namespace find('#s2id_project_namespace_id').click find('.select2-result-label', text: Runtime::Namespace.name).click diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index 4028b8cccc5..a8d6f09777c 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -3,6 +3,13 @@ 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' + def fill_key_title(title) fill_in 'deploy_key_title', with: title end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 034b0d09c1c..524d87c6be9 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -5,6 +5,13 @@ 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' + def expand_deploy_keys(&block) expand('.qa-expand-deploy-keys') do DeployKeys.perform(&block) diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 3b2bac84f3f..90967e6cc15 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -2,6 +2,13 @@ module QA module Page module Project class Show < Page::Base + ## + # TODO, define all selectors required by this page object + # + # See gitlab-org/gitlab-qa#154 + # + view 'app/views/projects/show.html.haml' + def choose_repository_clone_http find('#clone-dropdown').click -- cgit v1.2.1 From 9d766d2ecfa368d6d4dcfc298794e5706d4814b0 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 11 Jan 2018 13:54:33 +0100 Subject: Define QA project pages views / selectors --- qa/qa/page/project/new.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index a87313b2cb9..1f23de29642 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -2,16 +2,18 @@ module QA module Page module Project class New < Page::Base - ## - # TODO, define all selectors required by this page object - # - # See gitlab-org/gitlab-qa#154 - # - view 'app/views/projects/new.html.haml' + view 'projects/_new_project_fields.html.haml' do + element :project_namespace_select + element :project_namespace_field, 'select :namespace_id' + element :project_path, 'text_field :path' + element :project_description, 'text_area :description' + element :project_create_button, "submit 'Create project'" + end def choose_test_namespace - find('#s2id_project_namespace_id').click - find('.select2-result-label', text: Runtime::Namespace.name).click + click_element :project_namespace_select + + first('li', text: Runtime::Namespace.name).click end def choose_name(name) -- cgit v1.2.1 From 3e6e09c458ea67f156e43d2829bdce3138c5cf03 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 11 Jan 2018 14:14:16 +0100 Subject: Use full QA sandbox group path when creating a project --- qa/qa/page/project/new.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 1f23de29642..19428ede79e 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -13,7 +13,7 @@ module QA def choose_test_namespace click_element :project_namespace_select - first('li', text: Runtime::Namespace.name).click + first('li', text: Runtime::Namespace.path).click end def choose_name(name) -- cgit v1.2.1 From 0619c537ac1ae57233f493f95b3e6c8a119fdb8d Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 11 Jan 2018 14:17:51 +0100 Subject: Fix path to QA new project page object view --- qa/qa/page/project/new.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 19428ede79e..9b1438f76d5 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -2,7 +2,7 @@ module QA module Page module Project class New < Page::Base - view 'projects/_new_project_fields.html.haml' do + view 'app/views/projects/_new_project_fields.html.haml' do element :project_namespace_select element :project_namespace_field, 'select :namespace_id' element :project_path, 'text_field :path' -- cgit v1.2.1 From bf05a7e77ddecace7e231abbde18cbd1e42d528a Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 11 Jan 2018 14:27:11 +0100 Subject: Add selectors coupling for QA project show page object --- qa/qa/page/project/show.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 90967e6cc15..c8af5ba6280 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -2,15 +2,21 @@ module QA module Page module Project class Show < Page::Base - ## - # TODO, define all selectors required by this page object - # - # See gitlab-org/gitlab-qa#154 - # - view 'app/views/projects/show.html.haml' + view 'app/views/shared/_clone_panel.html.haml' do + element :clone_dropdown + element :clone_options_dropdown, '.clone-options-dropdown' + end + + view 'app/views/shared/_clone_panel.html.haml' do + element :project_repository_location, 'text_field_tag :project_clone' + end + + view 'app/views/projects/_home_panel.html.haml' do + element :project_name + end def choose_repository_clone_http - find('#clone-dropdown').click + click_element :clone_dropdown page.within('.clone-options-dropdown') do click_link('HTTP') @@ -22,7 +28,7 @@ module QA end def project_name - find('.project-title').text + find('.qa-project-name').text end def wait_for_push -- cgit v1.2.1 From d0a4ab21f0927fa602e1bab972f545e29d8cf206 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Fri, 12 Jan 2018 16:45:00 +0000 Subject: improvements after CR --- qa/qa/page/project/activity.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 qa/qa/page/project/activity.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/activity.rb b/qa/qa/page/project/activity.rb new file mode 100644 index 00000000000..c343266f01d --- /dev/null +++ b/qa/qa/page/project/activity.rb @@ -0,0 +1,19 @@ +module QA + module Page + module Project + class Activity < Page::Base + view 'app/views/shared/_event_filter.html.haml' do + element :push_events_button, 'Push events' + end + + def go_to_push_events + click_link :push_events_button + end + + def self.path + '/activity' + end + end + end + end +end -- cgit v1.2.1 From a1a5d142981379087ca7183d402300a3a3b6ad52 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Fri, 12 Jan 2018 17:43:13 +0000 Subject: improvement after CR - test reaches Activity page - the actual git push seems to be failing - had problems with defining selectors --- qa/qa/page/project/activity.rb | 15 +++++++-------- qa/qa/page/project/sidebar.rb | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 qa/qa/page/project/sidebar.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/activity.rb b/qa/qa/page/project/activity.rb index c343266f01d..47bfca087fb 100644 --- a/qa/qa/page/project/activity.rb +++ b/qa/qa/page/project/activity.rb @@ -2,16 +2,15 @@ module QA module Page module Project class Activity < Page::Base - view 'app/views/shared/_event_filter.html.haml' do - element :push_events_button, 'Push events' - end + ## + # TODO, define all selectors required by this page object + # + # See gitlab-org/gitlab-qa#155 + # + view 'app/views/shared/_event_filter.html.haml' def go_to_push_events - click_link :push_events_button - end - - def self.path - '/activity' + click_on 'Push events' end end end diff --git a/qa/qa/page/project/sidebar.rb b/qa/qa/page/project/sidebar.rb new file mode 100644 index 00000000000..3e4f783f105 --- /dev/null +++ b/qa/qa/page/project/sidebar.rb @@ -0,0 +1,18 @@ +module QA + module Page + module Project + class Sidebar < Page::Base + ## + # TODO, define all selectors required by this page object + # + # See gitlab-org/gitlab-qa#155 + # + view 'app/views/layouts/nav/sidebar/_project.html.haml' + + def go_to_activity + click_on class: 'shortcuts-project-activity' + end + end + end + end +end -- cgit v1.2.1 From e268575b08ccaf30a844fdb37898d680d0cbb98d Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 15 Jan 2018 22:38:15 +0800 Subject: Add view elements to deploy keys pages --- qa/qa/page/project/settings/common.rb | 4 ++-- qa/qa/page/project/settings/deploy_keys.rb | 18 ++++++++++++------ qa/qa/page/project/settings/repository.rb | 11 ++++------- 3 files changed, 18 insertions(+), 15 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index 5d1d5120929..b4ef07e1540 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -3,9 +3,9 @@ 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 diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index a8d6f09777c..c6a07b59493 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -3,12 +3,18 @@ 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, 'deploy-keys' + end + + view 'app/assets/javascripts/deploy_keys/components/key.vue' do + element :key_title, 'class="title"' + end def fill_key_title(title) fill_in 'deploy_key_title', with: title 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 -- cgit v1.2.1 From d56f059cd2ae4b89c4f5955b3892f8227e5eef11 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 16 Jan 2018 22:29:45 +0800 Subject: Try to match more aggressively --- qa/qa/page/project/settings/deploy_keys.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index c6a07b59493..bf42767c707 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -9,11 +9,12 @@ module QA end view 'app/assets/javascripts/deploy_keys/components/app.vue' do - element :deploy_keys_section, 'deploy-keys' + element :deploy_keys_section, /class=".*deploy\-keys.*"/ end view 'app/assets/javascripts/deploy_keys/components/key.vue' do - element :key_title, 'class="title"' + element :key_title, /class=".*title.*"/ + element :key_title_field, '{{ deployKey.title }}' end def fill_key_title(title) -- cgit v1.2.1 From d7caa2f8ccf554cdd0763db0cca1dc1c39ba30df Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Tue, 16 Jan 2018 20:20:57 +0000 Subject: improvements after CR + move activity click to side.rb + add element check on activity.rb + minor fixes --- qa/qa/page/project/activity.rb | 13 +++++++------ qa/qa/page/project/sidebar.rb | 18 ------------------ 2 files changed, 7 insertions(+), 24 deletions(-) delete mode 100644 qa/qa/page/project/sidebar.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/activity.rb b/qa/qa/page/project/activity.rb index 47bfca087fb..d766dbfb8f6 100644 --- a/qa/qa/page/project/activity.rb +++ b/qa/qa/page/project/activity.rb @@ -2,12 +2,13 @@ module QA module Page module Project class Activity < Page::Base - ## - # TODO, define all selectors required by this page object - # - # See gitlab-org/gitlab-qa#155 - # - view 'app/views/shared/_event_filter.html.haml' + view 'app/views/shared/_event_filter.html.haml' do + ## + # TODO, This needs improvement, _event_filter.html.haml + # doesn't have proper elements defined + # + element :push_events, '.event-filter' + end def go_to_push_events click_on 'Push events' diff --git a/qa/qa/page/project/sidebar.rb b/qa/qa/page/project/sidebar.rb deleted file mode 100644 index 3e4f783f105..00000000000 --- a/qa/qa/page/project/sidebar.rb +++ /dev/null @@ -1,18 +0,0 @@ -module QA - module Page - module Project - class Sidebar < Page::Base - ## - # TODO, define all selectors required by this page object - # - # See gitlab-org/gitlab-qa#155 - # - view 'app/views/layouts/nav/sidebar/_project.html.haml' - - def go_to_activity - click_on class: 'shortcuts-project-activity' - end - end - end - end -end -- cgit v1.2.1 From 350dbca41c2be6717d4c9f5800ef6dd60b06d932 Mon Sep 17 00:00:00 2001 From: Filipe Freire Date: Thu, 18 Jan 2018 18:52:03 +0000 Subject: improve push events selector in activity.rb --- qa/qa/page/project/activity.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/activity.rb b/qa/qa/page/project/activity.rb index d766dbfb8f6..0196922c889 100644 --- a/qa/qa/page/project/activity.rb +++ b/qa/qa/page/project/activity.rb @@ -3,11 +3,7 @@ module QA module Project class Activity < Page::Base view 'app/views/shared/_event_filter.html.haml' do - ## - # TODO, This needs improvement, _event_filter.html.haml - # doesn't have proper elements defined - # - element :push_events, '.event-filter' + element :push_events, "event_filter_link EventFilter.push, _('Push events')" end def go_to_push_events -- cgit v1.2.1 From 39a659a1350553900c0efe500da752665dd4a376 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 18 Jan 2018 22:23:35 +0800 Subject: Scrap the deploy key title and match it in test --- qa/qa/page/project/settings/deploy_keys.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index bf42767c707..211699599e1 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -29,9 +29,11 @@ module QA click_on 'Add key' end - def has_key_title?(title) + def key_title page.within('.deploy-keys') do - page.find('.title', text: title) + # The instance might have public keys available, here we want + # the one from the project + page.first('.title').text end end end -- cgit v1.2.1 From 09e9a50272c516997e41afff81d98d05a8b6c728 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 19 Jan 2018 22:34:21 +0800 Subject: Add .qa-project-deploy-keys to locate it Without this, it's very hard to locate it. --- qa/qa/page/project/settings/deploy_keys.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index 211699599e1..f9e40bf4252 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -10,6 +10,7 @@ module QA 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 @@ -30,10 +31,8 @@ module QA end def key_title - page.within('.deploy-keys') do - # The instance might have public keys available, here we want - # the one from the project - page.first('.title').text + page.within('.qa-project-deploy-keys') do + page.find('.title').text end end end -- cgit v1.2.1 From 4b1da8502f4625116447014b18adc7e1986e038e Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 22 Jan 2018 16:25:14 +0800 Subject: Also test if the fingerprint is correct --- qa/qa/page/project/settings/deploy_keys.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index f9e40bf4252..332e84724c7 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -14,8 +14,8 @@ module QA end view 'app/assets/javascripts/deploy_keys/components/key.vue' do - element :key_title, /class=".*title.*"/ - element :key_title_field, '{{ deployKey.title }}' + element :key_title, /class=".*qa-key-title.*"/ + element :key_fingerprint, /class=".*qa-key-fingerprint.*"/ end def fill_key_title(title) @@ -31,8 +31,22 @@ module QA end def key_title - page.within('.qa-project-deploy-keys') do - page.find('.title').text + 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 -- cgit v1.2.1 From ca7e1058e8d91a01157ac7d9170423e16a732850 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 22 Jan 2018 18:22:44 +0800 Subject: Add a scenario for adding secret variables --- qa/qa/page/project/settings/cicd.rb | 21 +++++++++ qa/qa/page/project/settings/secret_variables.rb | 60 +++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 qa/qa/page/project/settings/cicd.rb create mode 100644 qa/qa/page/project/settings/secret_variables.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/cicd.rb b/qa/qa/page/project/settings/cicd.rb new file mode 100644 index 00000000000..045a0826522 --- /dev/null +++ b/qa/qa/page/project/settings/cicd.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 :expand_secret_variables + end + + def expand_secret_variables(&block) + expand(:expand_secret_variables) do + SecretVariables.perform(&block) + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/secret_variables.rb b/qa/qa/page/project/settings/secret_variables.rb new file mode 100644 index 00000000000..880ef58ab54 --- /dev/null +++ b/qa/qa/page/project/settings/secret_variables.rb @@ -0,0 +1,60 @@ +module QA + module Page + module Project + module Settings + class SecretVariables < Page::Base + view 'app/views/ci/variables/_table.html.haml' do + element :variable_key, '.variable-key' + element :variable_value, '.variable-value' + end + + view 'app/views/projects/settings/ci_cd/show.html.haml' do + element :secret_variable + end + + def fill_variable_key(key) + fill_in 'variable_key', with: key + end + + def fill_variable_value(value) + fill_in 'variable_value', with: value + end + + def add_variable + click_on 'Add new variable' + end + + def variable_key + page.find('.variable-key').text + end + + def variable_value + reveal_value do + page.find('.variable-value').text + end + end + + private + + def within_section + page.within('.qa-secret-variables') do + yield + end + end + + def reveal_value + within_section do + click_button('Reveal value') + end + + yield.tap do + within_section do + click_button('Hide value') + end + end + end + end + end + end + end +end -- cgit v1.2.1 From 50a82f64e53d396ca91f52c4d25af60beb52a424 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 22 Jan 2018 14:03:03 +0100 Subject: Add end-to-end test for registering GitLab Runner --- qa/qa/page/project/settings/ci_cd.rb | 21 +++++++++++++++++++++ qa/qa/page/project/settings/common.rb | 10 ++++++++++ qa/qa/page/project/settings/runners.rb | 19 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 qa/qa/page/project/settings/ci_cd.rb create mode 100644 qa/qa/page/project/settings/runners.rb (limited to 'qa/qa/page/project') 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 b4ef07e1540..1357bf031d5 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -10,6 +10,16 @@ module QA 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/runners.rb b/qa/qa/page/project/settings/runners.rb new file mode 100644 index 00000000000..ba3dc632c59 --- /dev/null +++ b/qa/qa/page/project/settings/runners.rb @@ -0,0 +1,19 @@ +module QA + module Page + module Project + module Settings + class Runners < Page::Base + def registration_token + find('code#registration_token').text + end + + def coordinator_address + # TODO, this needs a specific ID or QA class + # + all('code').first.text + end + end + end + end + end +end -- cgit v1.2.1 From ca4db9d25f797a07bed3750ca9d8f0833487f55c Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 22 Jan 2018 14:12:36 +0100 Subject: Wait for Runner to register in QA and DRY page objects --- qa/qa/page/project/settings/runners.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index ba3dc632c59..ac93c3efddd 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -12,6 +12,10 @@ module QA # all('code').first.text end + + def has_online_runner? + page.has_css?('.runner-status-online') + end end end end -- cgit v1.2.1 From 738bad8ee83932ffd1b7b4de9113b0152b37172a Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 22 Jan 2018 15:31:41 +0100 Subject: Fix CI/CD end-to-end tests by waiting for changes --- qa/qa/page/project/show.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'qa/qa/page/project') 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 -- cgit v1.2.1 From ededa488f2c94d1d132d974476f38e668c44e4ee Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 23 Jan 2018 12:55:44 +0100 Subject: Assert on pipeline jobs statuses in CI/CD QA tests --- qa/qa/page/project/pipeline/index.rb | 13 +++++++++++++ qa/qa/page/project/pipeline/show.rb | 23 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 qa/qa/page/project/pipeline/index.rb create mode 100644 qa/qa/page/project/pipeline/show.rb (limited to 'qa/qa/page/project') 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..309d9e75ea2 --- /dev/null +++ b/qa/qa/page/project/pipeline/show.rb @@ -0,0 +1,23 @@ +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 + + 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 -- cgit v1.2.1 From d327277c39df1537b41073912d9b4e9f765d8da5 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 23 Jan 2018 13:02:35 +0100 Subject: Add views / selectors for pipeline show page object --- qa/qa/page/project/pipeline/show.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 309d9e75ea2..0835173f1cd 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -5,6 +5,18 @@ module QA::Page 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') -- cgit v1.2.1 From 915b554773244a883790308fd9608f5f301edde0 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 23 Jan 2018 13:09:12 +0100 Subject: Add specific views / selectors for QA runners page --- qa/qa/page/project/settings/runners.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index ac93c3efddd..ff763402d98 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -3,14 +3,24 @@ module QA 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 from Ruby helpers. + # + view 'app/helpers/runners_helper.rb' do + element :runner_status, 'runner-status-#{status}' + end + def registration_token find('code#registration_token').text end def coordinator_address - # TODO, this needs a specific ID or QA class - # - all('code').first.text + find('code#coordinator_address').text end def has_online_runner? -- cgit v1.2.1 From 5bead3e29965ec26ccf3320d65a5757d673d9958 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 23 Jan 2018 14:31:32 +0100 Subject: Fix offense in runners settings QA page object class --- qa/qa/page/project/settings/runners.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index ff763402d98..b41668c94cd 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -9,10 +9,12 @@ module QA end ## - # TODO, phase-out CSS classes from Ruby helpers. + # 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 -- cgit v1.2.1 From 8586391e073901ef7dcd70e20f3ccc00774006d2 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 25 Jan 2018 21:11:44 +0800 Subject: Respect the latest changes from master Basically using the new expand_section --- qa/qa/page/project/settings/ci_cd.rb | 7 +++++++ qa/qa/page/project/settings/cicd.rb | 21 --------------------- qa/qa/page/project/settings/common.rb | 11 +++++++++-- qa/qa/page/project/settings/secret_variables.rb | 20 ++++---------------- 4 files changed, 20 insertions(+), 39 deletions(-) delete mode 100644 qa/qa/page/project/settings/cicd.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/ci_cd.rb b/qa/qa/page/project/settings/ci_cd.rb index 5270dde7411..99be21bbe89 100644 --- a/qa/qa/page/project/settings/ci_cd.rb +++ b/qa/qa/page/project/settings/ci_cd.rb @@ -7,6 +7,7 @@ module QA view 'app/views/projects/settings/ci_cd/show.html.haml' do element :runners_settings, 'Runners settings' + element :secret_variables, 'Secret variables' end def expand_runners_settings(&block) @@ -14,6 +15,12 @@ module QA Settings::Runners.perform(&block) end end + + def expand_secret_variables(&block) + expand_section('Secret variables') do + Settings::SecretVariables.perform(&block) + end + end end end end diff --git a/qa/qa/page/project/settings/cicd.rb b/qa/qa/page/project/settings/cicd.rb deleted file mode 100644 index 045a0826522..00000000000 --- a/qa/qa/page/project/settings/cicd.rb +++ /dev/null @@ -1,21 +0,0 @@ -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 :expand_secret_variables - end - - def expand_secret_variables(&block) - expand(:expand_secret_variables) do - SecretVariables.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 1357bf031d5..7fa04b62fde 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -12,10 +12,17 @@ module QA end def expand_section(name) + within_section(name) do + # Don't expand if it's already expanded + click_button 'Expand' unless first('button', text: 'Collapse') + + yield + end + end + + def within_section(name) page.within('#content-body') do page.within('section', text: name) do - click_button 'Expand' - yield end end diff --git a/qa/qa/page/project/settings/secret_variables.rb b/qa/qa/page/project/settings/secret_variables.rb index 880ef58ab54..846fd893f94 100644 --- a/qa/qa/page/project/settings/secret_variables.rb +++ b/qa/qa/page/project/settings/secret_variables.rb @@ -3,15 +3,13 @@ module QA module Project module Settings class SecretVariables < Page::Base + include Common + view 'app/views/ci/variables/_table.html.haml' do element :variable_key, '.variable-key' element :variable_value, '.variable-value' end - view 'app/views/projects/settings/ci_cd/show.html.haml' do - element :secret_variable - end - def fill_variable_key(key) fill_in 'variable_key', with: key end @@ -36,21 +34,11 @@ module QA private - def within_section - page.within('.qa-secret-variables') do - yield - end - end - def reveal_value - within_section do - click_button('Reveal value') - end + click_button('Reveal value') yield.tap do - within_section do - click_button('Hide value') - end + click_button('Hide value') end end end -- cgit v1.2.1 From 73e3215b1b6dd2ed154622bbd4c3d16789ff3fa4 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 25 Jan 2018 21:33:30 +0800 Subject: Add more views check --- qa/qa/page/project/settings/secret_variables.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/secret_variables.rb b/qa/qa/page/project/settings/secret_variables.rb index 846fd893f94..e3bfbfcf080 100644 --- a/qa/qa/page/project/settings/secret_variables.rb +++ b/qa/qa/page/project/settings/secret_variables.rb @@ -10,6 +10,15 @@ module QA element :variable_value, '.variable-value' end + view 'app/views/ci/variables/_index.html.haml' do + element :add_new_variable, 'btn_text: "Add new variable"' + end + + view 'app/assets/javascripts/behaviors/secret_values.js' do + element :reveal_value, 'Reveal value' + element :hide_value, 'Hide value' + end + def fill_variable_key(key) fill_in 'variable_key', with: key end -- cgit v1.2.1 From f5efeeb807e6c88c380a76bdfb2258ff8b0303cd Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Thu, 25 Jan 2018 21:33:48 +0800 Subject: Try to restore page's state --- qa/qa/page/project/settings/common.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index 7fa04b62fde..b61f64d446c 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -12,18 +12,13 @@ module QA end def expand_section(name) - within_section(name) do - # Don't expand if it's already expanded - click_button 'Expand' unless first('button', text: 'Collapse') - - yield - end - end - - def within_section(name) page.within('#content-body') do page.within('section', text: name) do - yield + click_button 'Expand' + + yield.tap do + click_button 'Collapse' if first('button', text: 'Collapse') + end end end end -- cgit v1.2.1 From a33f7050be76c158dfd749dcf4e5856bad7acf46 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 26 Jan 2018 00:00:51 +0100 Subject: Backport QA changes from EE --- qa/qa/page/project/settings/advanced.rb | 33 +++++++++++++++++++++++++++++++ qa/qa/page/project/settings/common.rb | 7 +++++-- qa/qa/page/project/settings/main.rb | 21 ++++++++++++++++++++ qa/qa/page/project/settings/repository.rb | 4 ++-- 4 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 qa/qa/page/project/settings/advanced.rb create mode 100644 qa/qa/page/project/settings/main.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb new file mode 100644 index 00000000000..5ef00504fdf --- /dev/null +++ b/qa/qa/page/project/settings/advanced.rb @@ -0,0 +1,33 @@ +module QA + module Page + module Project + module Settings + class Advanced < Page::Base + view 'app/views/projects/edit.html.haml' do + element :project_path_field, 'f.text_field :path' + element :project_name_field, 'f.text_field :name' + element :rename_project_button, "f.submit 'Rename project'" + end + + def rename_to(path) + fill_project_name(path) + fill_project_path(path) + rename_project! + end + + def fill_project_path(path) + fill_in :project_path, with: path + end + + def fill_project_name(name) + fill_in :project_name, with: name + end + + def rename_project! + click_on 'Rename project' + 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 1357bf031d5..1d5c919ba4a 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -11,12 +11,15 @@ module QA end end + # Click the Expand button present in the specified section + # + # @param [String] name present in the container in the DOM def expand_section(name) page.within('#content-body') do page.within('section', text: name) do - click_button 'Expand' + click_button('Expand') - yield + yield if block_given? end end end diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb new file mode 100644 index 00000000000..5d743f4c9c8 --- /dev/null +++ b/qa/qa/page/project/settings/main.rb @@ -0,0 +1,21 @@ +module QA + module Page + module Project + module Settings + class Main < Page::Base + include Common + + view 'app/views/projects/edit.html.haml' do + element :advanced_settings_section, 'Advanced settings' + end + + def expand_advanced_settings(&block) + expand_section('Advanced settings') do + Advanced.perform(&block) + end + end + end + end + end + end +end diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index 6cc68358c8c..22362164a1a 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -6,11 +6,11 @@ module QA include Common view 'app/views/projects/deploy_keys/_index.html.haml' do - element :expand_deploy_keys + element :deploy_keys_section, 'Deploy Keys' end def expand_deploy_keys(&block) - expand(:expand_deploy_keys) do + expand_section('Deploy Keys') do DeployKeys.perform(&block) end end -- cgit v1.2.1 From 253c2a365fba7e3abbbb01e0d50565cafc696506 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 26 Jan 2018 16:15:52 +0800 Subject: Just don't expand if it's already expanded --- qa/qa/page/project/settings/common.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index b61f64d446c..0a2a3488b9a 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -14,11 +14,9 @@ module QA def expand_section(name) page.within('#content-body') do page.within('section', text: name) do - click_button 'Expand' + click_button 'Expand' unless first('button', text: 'Collapse') - yield.tap do - click_button 'Collapse' if first('button', text: 'Collapse') - end + yield end end end -- cgit v1.2.1 From e35be13ea4faceae3499d6779b3c193887d0de5b Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 26 Jan 2018 17:38:55 +0800 Subject: Pick the EE version for this file --- qa/qa/page/project/settings/common.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index 5bed873b5df..c7955124ef3 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -3,11 +3,11 @@ module QA module Project module Settings module Common - def expand(element_name) - page.within('#content-body') do - click_element(element_name) - - yield + def self.included(base) + base.class_eval do + view 'app/views/projects/edit.html.haml' do + element :advanced_settings_expand, "= expanded ? 'Collapse' : 'Expand'" + end end end -- cgit v1.2.1 From 3a1e06d6a2494af5449abfee9fb49d56a0f3fe00 Mon Sep 17 00:00:00 2001 From: Felipe Artur Date: Fri, 15 Dec 2017 14:59:35 -0200 Subject: Create merge request spec --- qa/qa/page/project/show.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 5e66e40a0b5..24eb29ceb4c 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -11,6 +11,10 @@ module QA element :project_repository_location, 'text_field_tag :project_clone' end + view 'app/views/projects/_last_push.html.haml' do + element :create_merge_request + end + view 'app/views/projects/_home_panel.html.haml' do element :project_name end @@ -31,6 +35,10 @@ module QA find('.qa-project-name').text end + def new_merge_request + click_element :create_merge_request + end + def wait_for_push sleep 5 refresh -- cgit v1.2.1 From 428db24a033ff9c145405286481d682701698a49 Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Thu, 25 Jan 2018 22:35:06 -0800 Subject: Fix click on incorrect namespace in certain conditions. And `first` was causing it to succeed even though the criteria were ambiguous. --- qa/qa/page/project/new.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 9b1438f76d5..186a4724326 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -4,7 +4,7 @@ module QA class New < Page::Base view 'app/views/projects/_new_project_fields.html.haml' do element :project_namespace_select - element :project_namespace_field, 'select :namespace_id' + element :project_namespace_field, /select :namespace_id.*class: 'select2/ element :project_path, 'text_field :path' element :project_description, 'text_area :description' element :project_create_button, "submit 'Create project'" @@ -13,7 +13,7 @@ module QA def choose_test_namespace click_element :project_namespace_select - first('li', text: Runtime::Namespace.path).click + find('ul.select2-result-sub > li', text: Runtime::Namespace.path).click end def choose_name(name) -- cgit v1.2.1 From 09a7a1f0767285d59855bc3722ed838672c78c7f Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Thu, 25 Jan 2018 23:03:14 -0800 Subject: Fix intermittent click error --- qa/qa/page/project/settings/common.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index c7955124ef3..319cb1045b6 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -17,7 +17,12 @@ module QA def expand_section(name) page.within('#content-body') do page.within('section', text: name) do - click_button 'Expand' unless first('button', text: 'Collapse') + # Because it is possible to click the button before the JS toggle code is bound + wait(reload: false) do + click_button 'Expand' unless first('button', text: 'Collapse') + + page.has_content?('Collapse') + end yield if block_given? end -- cgit v1.2.1 From 25cd25fc40b3178530f62755158ecd047d8a0b49 Mon Sep 17 00:00:00 2001 From: Michael Kozono Date: Fri, 26 Jan 2018 09:41:19 -0800 Subject: Fix intermittent clone over SSH failure We always clone over HTTP, so if the QA spec attempts to clone over SSH, we know it gathered the wrong repo URI. --- qa/qa/page/project/show.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 5e66e40a0b5..5762c50cde7 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -3,11 +3,9 @@ module QA module Project class Show < Page::Base view 'app/views/shared/_clone_panel.html.haml' do + element :clone_holder, '.git-clone-holder' element :clone_dropdown element :clone_options_dropdown, '.clone-options-dropdown' - end - - view 'app/views/shared/_clone_panel.html.haml' do element :project_repository_location, 'text_field_tag :project_clone' end @@ -16,10 +14,15 @@ module QA end def choose_repository_clone_http - click_element :clone_dropdown + wait(reload: false) do + click_element :clone_dropdown + + page.within('.clone-options-dropdown') do + click_link('HTTP') + end - page.within('.clone-options-dropdown') do - click_link('HTTP') + # Ensure git clone textbox was updated to http URI + page.has_css?('.git-clone-holder input#project_clone[value*="http"]') end end -- cgit v1.2.1 From 38f300081714c03bca88d7d7a4633fbf5ff1f154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 30 Jan 2018 14:06:13 +0100 Subject: Port changes from gitlab-org/gitlab-ee!4064 to CE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- qa/qa/page/project/issue/index.rb | 17 +++++++++++++++++ qa/qa/page/project/issue/new.rb | 33 +++++++++++++++++++++++++++++++++ qa/qa/page/project/issue/show.rb | 37 +++++++++++++++++++++++++++++++++++++ qa/qa/page/project/show.rb | 11 +++++++++++ 4 files changed, 98 insertions(+) create mode 100644 qa/qa/page/project/issue/index.rb create mode 100644 qa/qa/page/project/issue/new.rb create mode 100644 qa/qa/page/project/issue/show.rb (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/issue/index.rb b/qa/qa/page/project/issue/index.rb new file mode 100644 index 00000000000..b5903f536a4 --- /dev/null +++ b/qa/qa/page/project/issue/index.rb @@ -0,0 +1,17 @@ +module QA + module Page + module Project + module Issue + class Index < Page::Base + view 'app/views/projects/issues/_issue.html.haml' do + element :issue_link, 'link_to issue.title' + end + + def go_to_issue(title) + click_link(title) + end + end + end + end + end +end diff --git a/qa/qa/page/project/issue/new.rb b/qa/qa/page/project/issue/new.rb new file mode 100644 index 00000000000..7fc581da1ed --- /dev/null +++ b/qa/qa/page/project/issue/new.rb @@ -0,0 +1,33 @@ +module QA + module Page + module Project + module Issue + class New < Page::Base + view 'app/views/shared/issuable/_form.html.haml' do + element :submit_issue_button, 'form.submit "Submit' + end + + view 'app/views/shared/issuable/form/_title.html.haml' do + element :issue_title_textbox, 'form.text_field :title' + end + + view 'app/views/shared/form_elements/_description.html.haml' do + element :issue_description_textarea, "render 'projects/zen', f: form, attr: :description" + end + + def add_title(title) + fill_in 'issue_title', with: title + end + + def add_description(description) + fill_in 'issue_description', with: description + end + + def create_new_issue + click_on 'Submit issue' + end + end + end + end + end +end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb new file mode 100644 index 00000000000..10644c0fecc --- /dev/null +++ b/qa/qa/page/project/issue/show.rb @@ -0,0 +1,37 @@ +module QA + module Page + module Project + module Issue + class Show < Page::Base + view 'app/views/projects/issues/show.html.haml' do + element :issue_details, '.issue-details' + element :title, '.title' + end + + view 'app/views/shared/notes/_form.html.haml' do + element :new_note_form, 'new-note' + element :new_note_form, 'attr: :note' + end + + view 'app/views/shared/notes/_comment_button.html.haml' do + element :comment_button, '%strong Comment' + end + + def issue_title + find('.issue-details .title').text + end + + # Adds a comment to an issue + # attachment option should be an absolute path + def comment(text, attachment:) + fill_in(with: text, name: 'note[note]') + + attach_file_to_dropzone(attachment, '.new-note') if attachment + + click_on 'Comment' + end + end + end + end + end +end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 75308ae8a3c..553d35f9579 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -17,6 +17,11 @@ module QA element :project_name end + view 'app/views/layouts/header/_new_dropdown.haml' do + element :new_menu_toggle + element :new_issue_link, "link_to 'New issue', new_project_issue_path(@project)" + end + def choose_repository_clone_http wait(reload: false) do click_element :clone_dropdown @@ -46,6 +51,12 @@ module QA sleep 5 refresh end + + def go_to_new_issue + click_element :new_menu_toggle + + click_link 'New issue' + end end end end -- cgit v1.2.1 From 2f4d088fb4f3d17622655951dcc16255646d0f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 30 Jan 2018 18:18:48 +0100 Subject: Introduce a new QA::Gitlab::Page::Component::Dropzone class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- qa/qa/page/project/issue/show.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 10644c0fecc..364a2c61665 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -23,10 +23,13 @@ module QA # Adds a comment to an issue # attachment option should be an absolute path - def comment(text, attachment:) + def comment(text, attachment: nil) fill_in(with: text, name: 'note[note]') - attach_file_to_dropzone(attachment, '.new-note') if attachment + unless attachment.nil? + QA::Page::Component::Dropzone.new(page, '.new-note') + .attach_file(attachment) + end click_on 'Comment' end -- cgit v1.2.1 From 922154ce44e0e9a86b3c1d28e4e0c35e03f0bb08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 1 Feb 2018 15:11:33 +0100 Subject: QA::Page::Component::Dropzone#initialize needs a QA::Page::Base object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- qa/qa/page/project/issue/show.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qa/qa/page/project') diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 364a2c61665..5bc0598a524 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -27,7 +27,7 @@ module QA fill_in(with: text, name: 'note[note]') unless attachment.nil? - QA::Page::Component::Dropzone.new(page, '.new-note') + QA::Page::Component::Dropzone.new(self, '.new-note') .attach_file(attachment) end -- cgit v1.2.1