diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/features/projects/import_export/import_file_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/features/projects/import_export/import_file_spec.rb')
-rw-r--r-- | spec/features/projects/import_export/import_file_spec.rb | 77 |
1 files changed, 22 insertions, 55 deletions
diff --git a/spec/features/projects/import_export/import_file_spec.rb b/spec/features/projects/import_export/import_file_spec.rb index 83ceffa621c..af228764c17 100644 --- a/spec/features/projects/import_export/import_file_spec.rb +++ b/spec/features/projects/import_export/import_file_spec.rb @@ -28,73 +28,40 @@ RSpec.describe 'Import/Export - project import integration test', :js do let(:project_name) { 'Test Project Name' + randomHex } let(:project_path) { 'test-project-name' + randomHex } - context 'prefilled the path' do - it 'user imports an exported project successfully', :sidekiq_might_not_need_inline do - visit new_project_path + it 'user imports an exported project successfully', :sidekiq_might_not_need_inline do + visit new_project_path + click_import_project_tab + click_link 'GitLab export' - fill_in :project_name, with: project_name, visible: true - click_import_project_tab - click_link 'GitLab export' + fill_in :name, with: 'Test Project Name', visible: true + fill_in :path, with: 'test-project-path', visible: true + attach_file('file', file) - expect(page).to have_content('Import an exported GitLab project') - expect(URI.parse(current_url).query).to eq("namespace_id=#{namespace.id}&name=#{ERB::Util.url_encode(project_name)}&path=#{project_path}") + expect { click_on 'Import project' }.to change { Project.count }.by(1) - attach_file('file', file) - click_on 'Import project' - - expect(Project.count).to eq(1) - - project = Project.last - expect(project).not_to be_nil - expect(project.description).to eq("Foo Bar") - expect(project.issues).not_to be_empty - expect(project.merge_requests).not_to be_empty - expect(wiki_exists?(project)).to be true - expect(project.import_state.status).to eq('finished') - end + project = Project.last + expect(project).not_to be_nil + expect(page).to have_content("Project 'test-project-path' is being imported") end - context 'path is not prefilled' do - it 'user imports an exported project successfully', :sidekiq_might_not_need_inline do - visit new_project_path - click_import_project_tab - click_link 'GitLab export' + it 'invalid project' do + project = create(:project, namespace: user.namespace) - fill_in :name, with: 'Test Project Name', visible: true - fill_in :path, with: 'test-project-path', visible: true - attach_file('file', file) + visit new_project_path - expect { click_on 'Import project' }.to change { Project.count }.by(1) + click_import_project_tab + click_link 'GitLab export' + fill_in :name, with: project.name, visible: true + attach_file('file', file) + click_on 'Import project' - project = Project.last - expect(project).not_to be_nil - expect(page).to have_content("Project 'test-project-path' is being imported") + page.within('.flash-container') do + expect(page).to have_content('Project could not be imported') end end end - it 'invalid project' do - project = create(:project, namespace: user.namespace) - - visit new_project_path - - fill_in :project_name, with: project.name, visible: true - click_import_project_tab - click_link 'GitLab export' - attach_file('file', file) - click_on 'Import project' - - page.within('.flash-container') do - expect(page).to have_content('Project could not be imported') - end - end - - def wiki_exists?(project) - wiki = ProjectWiki.new(project) - wiki.repository.exists? && !wiki.repository.empty? - end - def click_import_project_tab - find('#import-project-tab').click + find('[data-qa-selector="import_project_link"]').click end end |