summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-10-09 14:25:38 +0200
committerRobert Speicher <rspeicher@gmail.com>2017-10-09 14:25:38 +0200
commit395820782fe44340a2a6cf4674104895c92976e0 (patch)
treeb620e7056791425615594b55f4cfdf2fcde0e87c
parent348c610592585ca8bb1aa3bf1287d2f0302e02e9 (diff)
downloadgitlab-ce-395820782fe44340a2a6cf4674104895c92976e0.tar.gz
Add QA::Scenario::Gitlab::Group::Create
-rw-r--r--qa/qa.rb4
-rw-r--r--qa/qa/page/dashboard/groups.rb48
-rw-r--r--qa/qa/page/group/new.rb21
-rw-r--r--qa/qa/page/group/show.rb14
-rw-r--r--qa/qa/scenario/gitlab/group/create.rb27
-rw-r--r--qa/qa/scenario/gitlab/project/create.rb17
-rw-r--r--qa/qa/scenario/gitlab/sandbox/prepare.rb15
7 files changed, 87 insertions, 59 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 752afc0e044..eb6f922d0d3 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -31,6 +31,10 @@ module QA
# GitLab instance scenarios.
#
module Gitlab
+ module Group
+ autoload :Create, 'qa/scenario/gitlab/group/create'
+ end
+
module Project
autoload :Create, 'qa/scenario/gitlab/project/create'
end
diff --git a/qa/qa/page/dashboard/groups.rb b/qa/qa/page/dashboard/groups.rb
index 1eadf605262..083d2e1ab16 100644
--- a/qa/qa/page/dashboard/groups.rb
+++ b/qa/qa/page/dashboard/groups.rb
@@ -3,53 +3,21 @@ module QA
module Dashboard
class Groups < Page::Base
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
+ fill_in 'Filter by name...', with: name
end
- def has_test_namespace?
- filter_by_name(namespace.name)
+ def has_group?(name)
+ filter_by_name(name)
- page.has_link?(namespace.name)
+ page.has_link?(name)
end
- def has_sandbox?
- filter_by_name(namespace.sandbox_name)
-
- page.has_link?(namespace.sandbox_name)
- end
-
- def go_to_test_namespace
- click_link namespace.name
- end
-
- def go_to_sandbox
- click_link namespace.sandbox_name
+ def go_to_group(name)
+ click_link name
end
- def create_group(group_name = nil, group_description = nil)
- Page::Group::New.act { create_group(group_name, group_description) }
- end
-
- def prepare_test_namespace
- if has_test_namespace?
- go_to_test_namespace
- else
- create_group
- end
- end
-
- private
-
- def namespace
- Runtime::Namespace
+ def go_to_new_group
+ click_on 'New group'
end
end
end
diff --git a/qa/qa/page/group/new.rb b/qa/qa/page/group/new.rb
index 50e317f0980..cb743a7bf11 100644
--- a/qa/qa/page/group/new.rb
+++ b/qa/qa/page/group/new.rb
@@ -2,20 +2,19 @@ module QA
module Page
module Group
class New < Page::Base
- def create_group(group_name = nil, group_description = nil)
- if page.has_content?('New Subgroup')
- click_on 'New Subgroup'
- else
- click_on 'New group'
- end
+ def set_path(path)
+ fill_in 'group_path', with: path
+ end
- group_name ||= Runtime::Namespace.name
- group_description ||= "QA test run at #{Runtime::Namespace.name}"
+ def set_description(description)
+ fill_in 'group_description', with: description
+ end
- fill_in 'group_path', with: group_name
- fill_in 'group_description', with: group_description
- choose 'Private'
+ def set_visibility(visibility)
+ choose visibility
+ end
+ def create
click_button 'Create group'
end
end
diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb
index 6fb058fc755..6987c1f8f85 100644
--- a/qa/qa/page/group/show.rb
+++ b/qa/qa/page/group/show.rb
@@ -6,8 +6,20 @@ module QA
click_link 'Subgroups'
end
+ def go_to_subgroup(name)
+ click_link name
+ end
+
+ def has_subgroup?(name)
+ page.has_link?(name)
+ end
+
+ def go_to_new_subgroup
+ click_on 'New Subgroup'
+ end
+
def go_to_new_project
- click_link 'New Project'
+ click_on 'New Project'
end
end
end
diff --git a/qa/qa/scenario/gitlab/group/create.rb b/qa/qa/scenario/gitlab/group/create.rb
new file mode 100644
index 00000000000..8e6c7c7ad80
--- /dev/null
+++ b/qa/qa/scenario/gitlab/group/create.rb
@@ -0,0 +1,27 @@
+require 'securerandom'
+
+module QA
+ module Scenario
+ module Gitlab
+ module Group
+ class Create < Scenario::Template
+ attr_writer :path, :description
+
+ def initialize
+ @path = Runtime::Namespace.name
+ @description = "QA test run at #{Runtime::Namespace.time}"
+ end
+
+ def perform
+ Page::Group::New.perform do |group|
+ group.set_path(@path)
+ group.set_description(@description)
+ group.set_visibility('Private')
+ group.create
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/scenario/gitlab/project/create.rb b/qa/qa/scenario/gitlab/project/create.rb
index 49aaf1b184f..7b614bfdd94 100644
--- a/qa/qa/scenario/gitlab/project/create.rb
+++ b/qa/qa/scenario/gitlab/project/create.rb
@@ -14,8 +14,21 @@ module QA
def perform
Scenario::Gitlab::Sandbox::Prepare.perform
- Page::Dashboard::Groups.act { prepare_test_namespace }
- Page::Group::Show.act { go_to_new_project }
+ Page::Group::Show.perform do |page|
+ page.go_to_subgroups
+
+ if page.has_subgroup?(Runtime::Namespace.name)
+ page.go_to_subgroup(Runtime::Namespace.name)
+ else
+ page.go_to_new_subgroup
+
+ Scenario::Gitlab::Group::Create.perform do |group|
+ group.path = Runtime::Namespace.name
+ end
+ end
+
+ page.go_to_new_project
+ end
Page::Project::New.perform do |page|
page.choose_test_namespace
diff --git a/qa/qa/scenario/gitlab/sandbox/prepare.rb b/qa/qa/scenario/gitlab/sandbox/prepare.rb
index 1875a943e4d..990de456e20 100644
--- a/qa/qa/scenario/gitlab/sandbox/prepare.rb
+++ b/qa/qa/scenario/gitlab/sandbox/prepare.rb
@@ -2,19 +2,24 @@ module QA
module Scenario
module Gitlab
module Sandbox
+ # Ensure we're in our sandbox namespace, either by navigating to it or
+ # by creating it if it doesn't yet exist
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
+ if page.has_group?(Runtime::Namespace.sandbox_name)
+ page.go_to_group(Runtime::Namespace.sandbox_name)
else
- page.create_group(Runtime::Namespace.sandbox_name, "QA sandbox")
+ page.go_to_new_group
+
+ Scenario::Gitlab::Group::Create.perform do |group|
+ group.path = Runtime::Namespace.sandbox_name
+ group.description = 'QA sandbox'
+ end
end
end
-
- Page::Group::Show.act { go_to_subgroups }
end
end
end