Commit cf02ace2 authored by Sanad Liaquat's avatar Sanad Liaquat

Merge branch 'qa-remove-projects-under-sandbox-after-tests' into 'master'

Remove projects created directly under the sandbox group after tests

See merge request gitlab-org/gitlab!48005
parents 721d1aec e80ede56
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
= render_if_exists 'compliance_management/compliance_framework/compliance_framework_badge', project: @project = render_if_exists 'compliance_management/compliance_framework/compliance_framework_badge', project: @project
.home-panel-metadata.d-flex.flex-wrap.text-secondary.gl-font-base.gl-font-weight-normal.gl-line-height-normal .home-panel-metadata.d-flex.flex-wrap.text-secondary.gl-font-base.gl-font-weight-normal.gl-line-height-normal
- if can?(current_user, :read_project, @project) - if can?(current_user, :read_project, @project)
%span.text-secondary{ itemprop: 'identifier' } %span.text-secondary{ itemprop: 'identifier', data: { qa_selector: 'project_id_content' } }
= s_('ProjectPage|Project ID: %{project_id}') % { project_id: @project.id } = s_('ProjectPage|Project ID: %{project_id}') % { project_id: @project.id }
- if current_user - if current_user
%span.access-request-links.gl-ml-3 %span.access-request-links.gl-ml-3
......
...@@ -34,6 +34,7 @@ module QA ...@@ -34,6 +34,7 @@ module QA
view 'app/views/projects/_home_panel.html.haml' do view 'app/views/projects/_home_panel.html.haml' do
element :forked_from_link element :forked_from_link
element :project_name_content element :project_name_content
element :project_id_content
end end
view 'app/views/projects/_files.html.haml' do view 'app/views/projects/_files.html.haml' do
...@@ -157,6 +158,10 @@ module QA ...@@ -157,6 +158,10 @@ module QA
find_element(:project_name_content).text find_element(:project_name_content).text
end end
def project_id
find_element(:project_id_content).text.delete('Project ID: ')
end
def switch_to_branch(branch_name) def switch_to_branch(branch_name)
find_element(:branches_select).click find_element(:branches_select).click
......
...@@ -200,6 +200,10 @@ module QA ...@@ -200,6 +200,10 @@ module QA
post_body post_body
end end
def api_delete_path
"/projects/#{id}"
end
def change_repository_storage(new_storage) def change_repository_storage(new_storage)
put_body = { repository_storage: new_storage } put_body = { repository_storage: new_storage }
response = put Runtime::API::Request.new(api_client, api_put_path).url, put_body response = put Runtime::API::Request.new(api_client, api_put_path).url, put_body
......
...@@ -4,6 +4,8 @@ require 'securerandom' ...@@ -4,6 +4,8 @@ require 'securerandom'
module QA module QA
RSpec.describe 'Manage' do RSpec.describe 'Manage' do
describe 'Project templates' do describe 'Project templates' do
include Support::Api
before(:all) do before(:all) do
@files = [ @files = [
{ {
...@@ -163,12 +165,18 @@ module QA ...@@ -163,12 +165,18 @@ module QA
Page::Project::Show.perform do |project| Page::Project::Show.perform do |project|
project.wait_for_import_success project.wait_for_import_success
@project_id = project.project_id
@files.each do |file| @files.each do |file|
expect(project).to have_file(file[:name]) expect(project).to have_file(file[:name])
end end
end end
end end
after do
api_client = Runtime::API::Client.new(:gitlab)
delete Runtime::API::Request.new(api_client, "/projects/#{@project_id}").url
end
end end
def create_project_using_template(project_name:, namespace:, template_name:) def create_project_using_template(project_name:, namespace:, template_name:)
......
...@@ -30,6 +30,7 @@ module QA ...@@ -30,6 +30,7 @@ module QA
after do after do
group_or_project.remove_member(approver) group_or_project.remove_member(approver)
approver.remove_via_api! approver.remove_via_api!
project.remove_via_api!
end end
context 'and the code owner is the root group' do context 'and the code owner is the root group' do
......
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