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 @@
- if current_user.can_create_project?
.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
.fade-left= sprite_icon('chevron-lg-left', size: 12)
......
......@@ -13,6 +13,10 @@ module QA
element :user_role_content
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)
within_element(:project_content, text: project_name) do
has_element?(:user_role_content, text: access_role)
......@@ -25,6 +29,10 @@ module QA
find_link(text: name).click
end
def click_new_project_button
click_element(:new_project_button, Page::Project::New)
end
def self.path
'/'
end
......
......@@ -20,7 +20,7 @@ module QA
:name,
:add_name_uuid,
:description,
:standalone,
:personal_namespace,
:runners_token,
:visibility,
:template_name,
......@@ -52,7 +52,7 @@ module QA
def initialize
@add_name_uuid = true
@standalone = false
@personal_namespace = false
@description = 'My awesome project'
@initialize_with_readme = false
@auto_devops_enabled = false
......@@ -70,7 +70,9 @@ module QA
def fabricate!
return if @import
unless @standalone
if @personal_namespace
Page::Dashboard::Projects.perform(&:click_new_project_button)
else
group.visit!
Page::Group::Show.perform(&:go_to_new_project)
end
......@@ -85,13 +87,15 @@ module QA
Page::Project::New.perform(&:click_blank_project_link)
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.add_description(@description)
new_page.set_visibility(@visibility)
new_page.disable_initialize_with_readme unless @initialize_with_readme
new_page.create_new_project
end
@id = Page::Project::Show.perform(&:project_id)
end
def fabricate_via_api!
......@@ -219,7 +223,7 @@ module QA
auto_devops_enabled: @auto_devops_enabled
}
unless @standalone
unless @personal_namespace
post_body[:namespace_id] = group.id
post_body[:path] = name
end
......
......@@ -47,7 +47,7 @@ module QA
def create_project(user, api_client, project_name)
project = Resource::Project.fabricate_via_api! do |project|
project.standalone = true
project.personal_namespace = true
project.add_name_uuid = false
project.name = project_name
project.path_with_namespace = "#{user.username}/#{project_name}"
......
......@@ -2,25 +2,53 @@
module QA
RSpec.describe 'Manage', :smoke do
describe 'Project creation' do
it 'user creates a new project',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1857' do
Flow::Login.sign_in
created_project = Resource::Project.fabricate_via_browser_ui! do |project|
project.name = 'awesome-project'
project.description = 'create awesome project test'
end
describe 'Project' do
shared_examples 'successful project creation' do
it 'creates a new project' do
Page::Project::Show.perform do |project|
expect(project).to have_content(created_project.name)
expect(project).to have_content(project_name)
expect(project).to have_content(
/Project \S?awesome-project\S+ was successfully created/
/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
project
end
context 'in group', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1857' do
let(:project_name) { "project-in-group-#{SecureRandom.hex(8)}" }
let(:project) do
Resource::Project.fabricate_via_browser_ui! do |project|
project.name = project_name
project.description = 'create awesome project test'
end
end
it_behaves_like 'successful project creation'
end
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)}" }
let(:project) do
Resource::Project.fabricate_via_browser_ui! do |project|
project.name = project_name
project.description = 'create awesome project test'
project.personal_namespace = true
end
end
it_behaves_like 'successful project creation'
end
after do
project.remove_via_api!
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