summaryrefslogtreecommitdiff
path: root/qa/qa/page/dashboard
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-10-05 15:03:37 +0200
committerRobert Speicher <rspeicher@gmail.com>2017-10-05 15:03:37 +0200
commit88194b818f53a96fcefb8d61ad2f32a609e2c7ca (patch)
tree9fcdb84c23cdb7d15f6f591a5ab7e3e95cb7e1c0 /qa/qa/page/dashboard
parentc2b17da46b4b6e3d5a19f1b1188db81f99b156af (diff)
downloadgitlab-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/page/dashboard')
-rw-r--r--qa/qa/page/dashboard/groups.rb67
1 files changed, 38 insertions, 29 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