debian-mirror-gitlab/spec/features/import/manifest_import_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.8 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-11-18 11:00:15 +05:30
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Import multiple repositories by uploading a manifest file', :js, feature_category: :importers do
2018-11-18 11:00:15 +05:30
let(:user) { create(:admin) }
let(:group) { create(:group) }
before do
sign_in(user)
group.add_owner(user)
end
it 'parses manifest file and list repositories' do
visit new_import_manifest_path
attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml'))
click_on 'List available repositories'
2020-11-24 15:15:51 +05:30
expect(page).to have_button('Import 660 repositories')
2018-11-18 11:00:15 +05:30
expect(page).to have_content('https://android-review.googlesource.com/platform/build/blueprint')
end
2020-10-24 23:57:45 +05:30
it 'imports a project successfully', :sidekiq_inline, :js do
2018-11-18 11:00:15 +05:30
visit new_import_manifest_path
attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml'))
click_on 'List available repositories'
2020-03-13 15:44:24 +05:30
page.within(second_row) do
2018-11-18 11:00:15 +05:30
click_on 'Import'
2020-10-24 23:57:45 +05:30
end
wait_for_requests
2018-11-18 11:00:15 +05:30
2020-10-24 23:57:45 +05:30
page.within(second_row) do
2021-04-29 21:17:54 +05:30
expect(page).to have_content 'Complete'
2020-03-13 15:44:24 +05:30
expect(page).to have_content("#{group.full_path}/build/blueprint")
2018-11-18 11:00:15 +05:30
end
end
2021-04-29 21:17:54 +05:30
it 'renders an error if the remote url scheme starts with javascript' do
visit new_import_manifest_path
attach_file('manifest', Rails.root.join('spec/fixtures/unsafe_javascript.xml'))
click_on 'List available repositories'
expect(page).to have_content 'Make sure the url does not start with javascript'
end
2018-11-18 11:00:15 +05:30
it 'renders an error if invalid file was provided' do
visit new_import_manifest_path
attach_file('manifest', Rails.root.join('spec/fixtures/banana_sample.gif'))
click_on 'List available repositories'
expect(page).to have_content 'The uploaded file is not a valid XML file.'
end
2020-03-13 15:44:24 +05:30
def second_row
2021-03-11 19:13:27 +05:30
page.all('table tbody tr')[1]
2018-11-18 11:00:15 +05:30
end
end