diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-10-05 15:03:37 +0200 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-10-05 15:03:37 +0200 |
commit | 88194b818f53a96fcefb8d61ad2f32a609e2c7ca (patch) | |
tree | 9fcdb84c23cdb7d15f6f591a5ab7e3e95cb7e1c0 /qa/qa | |
parent | c2b17da46b4b6e3d5a19f1b1188db81f99b156af (diff) | |
download | gitlab-ce-88194b818f53a96fcefb8d61ad2f32a609e2c7ca.tar.gz |
Implement Scenario::Gitlab::Sandbox::Prepare
This better separates the concerns of preparing the sandbox namespace
from creating a (sub)group.
Diffstat (limited to 'qa/qa')
-rw-r--r-- | qa/qa/page/dashboard/groups.rb | 67 | ||||
-rw-r--r-- | qa/qa/page/group/show.rb | 4 | ||||
-rw-r--r-- | qa/qa/scenario/gitlab/project/create.rb | 9 | ||||
-rw-r--r-- | qa/qa/scenario/gitlab/sandbox/prepare.rb | 23 |
4 files changed, 69 insertions, 34 deletions
diff --git a/qa/qa/page/dashboard/groups.rb b/qa/qa/page/dashboard/groups.rb index 3d098ac60cc..e81b751082b 100644 --- a/qa/qa/page/dashboard/groups.rb +++ b/qa/qa/page/dashboard/groups.rb @@ -2,51 +2,60 @@ module QA module Page module Dashboard class Groups < Page::Base - def prepare_sandbox - sandbox_name = Runtime::Namespace.sandbox_name - - fill_in 'Filter by name...', with: sandbox_name + def filter_by_name(name) + # NOTE: The filter placeholder on the Subgroups page currently omits + # the ellipsis. + # + # See https://gitlab.com/gitlab-org/gitlab-ce/issues/38807 + if page.has_field?('Filter by name...') + fill_in 'Filter by name...', with: name + elsif page.has_field?('Filter by name') + fill_in 'Filter by name', with: name + end + end - if page.has_content?(sandbox_name) - return click_link(sandbox_name) - else - click_on 'New group' + def has_test_namespace? + filter_by_name(Runtime::Namespace.name) - populate_group_form(sandbox_name, "QA sandbox") - end + page.has_link?(Runtime::Namespace.name) end - def prepare_test_namespace - namespace_name = Runtime::Namespace.name + def has_sandbox? + filter_by_name(Runtime::Namespace.sandbox_name) - if page.has_content?('Subgroups') - click_link 'Subgroups' + page.has_link?(Runtime::Namespace.sandbox_name) + end - if page.has_content?(namespace_name) - return click_link(namespace_name) - end + def go_to_test_namespace + click_link Runtime::Namespace.name + end + + def go_to_sandbox + click_link Runtime::Namespace.sandbox_name + end - # NOTE: Inconsistent capitalization here in the UI + def create_group(group_name, group_description) + if page.has_content?('New Subgroup') click_on 'New Subgroup' else click_on 'New group' end - populate_group_form( - namespace_name, - "QA test run at #{Runtime::Namespace.time}" - ) - end - - private - - def populate_group_form(name, description) - fill_in 'group_path', with: name - fill_in 'group_description', with: description + fill_in 'group_path', with: group_name + fill_in 'group_description', with: group_description choose 'Private' click_button 'Create group' end + + def prepare_test_namespace + return click_link(Runtime::Namespace.name) if has_test_namespace? + + create_group( + Runtime::Namespace.name, + "QA test run at #{Runtime::Namespace.time}" + ) + end end end end diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index 296c311d7c6..6fb058fc755 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -2,6 +2,10 @@ module QA module Page module Group class Show < Page::Base + def go_to_subgroups + click_link 'Subgroups' + end + def go_to_new_project click_link 'New Project' end diff --git a/qa/qa/scenario/gitlab/project/create.rb b/qa/qa/scenario/gitlab/project/create.rb index 3b015c71da3..078de78de61 100644 --- a/qa/qa/scenario/gitlab/project/create.rb +++ b/qa/qa/scenario/gitlab/project/create.rb @@ -1,4 +1,5 @@ require 'securerandom' +require_relative '../sandbox/prepare' module QA module Scenario @@ -12,11 +13,9 @@ module QA end def perform - Page::Main::Menu.act { go_to_groups } - Page::Dashboard::Groups.act do - prepare_sandbox - prepare_test_namespace - end + Scenario::Gitlab::Sandbox::Prepare.perform + + Page::Dashboard::Groups.act { prepare_test_namespace } Page::Group::Show.act { go_to_new_project } Page::Project::New.perform do |page| diff --git a/qa/qa/scenario/gitlab/sandbox/prepare.rb b/qa/qa/scenario/gitlab/sandbox/prepare.rb new file mode 100644 index 00000000000..1875a943e4d --- /dev/null +++ b/qa/qa/scenario/gitlab/sandbox/prepare.rb @@ -0,0 +1,23 @@ +module QA + module Scenario + module Gitlab + module Sandbox + class Prepare < Scenario::Template + def perform + Page::Main::Menu.act { go_to_groups } + + Page::Dashboard::Groups.perform do |page| + if page.has_sandbox? + page.go_to_sandbox + else + page.create_group(Runtime::Namespace.sandbox_name, "QA sandbox") + end + end + + Page::Group::Show.act { go_to_subgroups } + end + end + end + end + end +end |