Commit d1e9426b authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'qa-shl-e2e-test-project-in-personal-namespace' into 'master'

Add e2e smoke test for create project under personal namespace

See merge request gitlab-org/gitlab!68259
parents 55b4480a 9c0db2b8
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
- if current_user.can_create_project? - if current_user.can_create_project?
.page-title-controls .page-title-controls
= link_to _("New project"), new_project_path, class: "gl-button btn btn-confirm" = link_to _("New project"), new_project_path, class: "gl-button btn btn-confirm", data: { qa_selector: 'new_project_button' }
.top-area.scrolling-tabs-container.inner-page-scroll-tabs .top-area.scrolling-tabs-container.inner-page-scroll-tabs
.fade-left= sprite_icon('chevron-lg-left', size: 12) .fade-left= sprite_icon('chevron-lg-left', size: 12)
......
...@@ -13,6 +13,10 @@ module QA ...@@ -13,6 +13,10 @@ module QA
element :user_role_content element :user_role_content
end end
view 'app/views/dashboard/_projects_head.html.haml' do
element :new_project_button
end
def has_project_with_access_role?(project_name, access_role) def has_project_with_access_role?(project_name, access_role)
within_element(:project_content, text: project_name) do within_element(:project_content, text: project_name) do
has_element?(:user_role_content, text: access_role) has_element?(:user_role_content, text: access_role)
...@@ -25,6 +29,10 @@ module QA ...@@ -25,6 +29,10 @@ module QA
find_link(text: name).click find_link(text: name).click
end end
def click_new_project_button
click_element(:new_project_button, Page::Project::New)
end
def self.path def self.path
'/' '/'
end end
......
...@@ -20,7 +20,7 @@ module QA ...@@ -20,7 +20,7 @@ module QA
:name, :name,
:add_name_uuid, :add_name_uuid,
:description, :description,
:standalone, :personal_namespace,
:runners_token, :runners_token,
:visibility, :visibility,
:template_name, :template_name,
...@@ -52,7 +52,7 @@ module QA ...@@ -52,7 +52,7 @@ module QA
def initialize def initialize
@add_name_uuid = true @add_name_uuid = true
@standalone = false @personal_namespace = false
@description = 'My awesome project' @description = 'My awesome project'
@initialize_with_readme = false @initialize_with_readme = false
@auto_devops_enabled = false @auto_devops_enabled = false
...@@ -70,7 +70,9 @@ module QA ...@@ -70,7 +70,9 @@ module QA
def fabricate! def fabricate!
return if @import return if @import
unless @standalone if @personal_namespace
Page::Dashboard::Projects.perform(&:click_new_project_button)
else
group.visit! group.visit!
Page::Group::Show.perform(&:go_to_new_project) Page::Group::Show.perform(&:go_to_new_project)
end end
...@@ -85,13 +87,15 @@ module QA ...@@ -85,13 +87,15 @@ module QA
Page::Project::New.perform(&:click_blank_project_link) Page::Project::New.perform(&:click_blank_project_link)
Page::Project::New.perform do |new_page| Page::Project::New.perform do |new_page|
new_page.choose_test_namespace new_page.choose_test_namespace unless @personal_namespace
new_page.choose_name(@name) new_page.choose_name(@name)
new_page.add_description(@description) new_page.add_description(@description)
new_page.set_visibility(@visibility) new_page.set_visibility(@visibility)
new_page.disable_initialize_with_readme unless @initialize_with_readme new_page.disable_initialize_with_readme unless @initialize_with_readme
new_page.create_new_project new_page.create_new_project
end end
@id = Page::Project::Show.perform(&:project_id)
end end
def fabricate_via_api! def fabricate_via_api!
...@@ -219,7 +223,7 @@ module QA ...@@ -219,7 +223,7 @@ module QA
auto_devops_enabled: @auto_devops_enabled auto_devops_enabled: @auto_devops_enabled
} }
unless @standalone unless @personal_namespace
post_body[:namespace_id] = group.id post_body[:namespace_id] = group.id
post_body[:path] = name post_body[:path] = name
end end
......
...@@ -47,7 +47,7 @@ module QA ...@@ -47,7 +47,7 @@ module QA
def create_project(user, api_client, project_name) def create_project(user, api_client, project_name)
project = Resource::Project.fabricate_via_api! do |project| project = Resource::Project.fabricate_via_api! do |project|
project.standalone = true project.personal_namespace = true
project.add_name_uuid = false project.add_name_uuid = false
project.name = project_name project.name = project_name
project.path_with_namespace = "#{user.username}/#{project_name}" project.path_with_namespace = "#{user.username}/#{project_name}"
......
...@@ -2,24 +2,52 @@ ...@@ -2,24 +2,52 @@
module QA module QA
RSpec.describe 'Manage', :smoke do RSpec.describe 'Manage', :smoke do
describe 'Project creation' do describe 'Project' do
it 'user creates a new project', shared_examples 'successful project creation' do
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1857' do it 'creates a new project' do
Page::Project::Show.perform do |project|
expect(project).to have_content(project_name)
expect(project).to have_content(
/Project \S?#{project_name}\S+ was successfully created/
)
expect(project).to have_content('create awesome project test')
expect(project).to have_content('The repository for this project is empty')
end
end
end
before do
Flow::Login.sign_in Flow::Login.sign_in
project
end
created_project = Resource::Project.fabricate_via_browser_ui! do |project| context 'in group', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1857' do
project.name = 'awesome-project' let(:project_name) { "project-in-group-#{SecureRandom.hex(8)}" }
project.description = 'create awesome project test' let(:project) do
Resource::Project.fabricate_via_browser_ui! do |project|
project.name = project_name
project.description = 'create awesome project test'
end
end end
Page::Project::Show.perform do |project| it_behaves_like 'successful project creation'
expect(project).to have_content(created_project.name) end
expect(project).to have_content(
/Project \S?awesome-project\S+ was successfully created/ context 'in personal namespace', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1888' do
) let(:project_name) { "project-in-personal-namespace-#{SecureRandom.hex(8)}" }
expect(project).to have_content('create awesome project test') let(:project) do
expect(project).to have_content('The repository for this project is empty') Resource::Project.fabricate_via_browser_ui! do |project|
project.name = project_name
project.description = 'create awesome project test'
project.personal_namespace = true
end
end end
it_behaves_like 'successful project creation'
end
after do
project.remove_via_api!
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment