2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-06 06:59:48 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2019-07-24 05:20:54 -04:00
|
|
|
describe 'Import multiple repositories by uploading a manifest file', :js do
|
2018-07-06 06:59:48 -04:00
|
|
|
include Select2Helper
|
|
|
|
|
|
|
|
let(:user) { create(:admin) }
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
group.add_owner(user)
|
|
|
|
end
|
|
|
|
|
2018-07-06 08:06:44 -04:00
|
|
|
it 'parses manifest file and list repositories' do
|
2018-07-06 06:59:48 -04:00
|
|
|
visit new_import_manifest_path
|
|
|
|
|
|
|
|
attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml'))
|
2018-07-09 03:55:10 -04:00
|
|
|
click_on 'List available repositories'
|
2018-07-06 06:59:48 -04:00
|
|
|
|
|
|
|
expect(page).to have_button('Import all repositories')
|
|
|
|
expect(page).to have_content('https://android-review.googlesource.com/platform/build/blueprint')
|
|
|
|
end
|
2018-07-06 08:06:44 -04:00
|
|
|
|
2018-10-30 06:53:01 -04:00
|
|
|
it 'imports successfully imports a project' do
|
2018-07-06 08:06:44 -04:00
|
|
|
visit new_import_manifest_path
|
|
|
|
|
|
|
|
attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml'))
|
2018-07-09 03:55:10 -04:00
|
|
|
click_on 'List available repositories'
|
2018-07-06 08:06:44 -04:00
|
|
|
|
|
|
|
page.within(first_row) do
|
|
|
|
click_on 'Import'
|
|
|
|
|
|
|
|
expect(page).to have_content 'Done'
|
|
|
|
expect(page).to have_content("#{group.full_path}/build/make")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-09 07:59:07 -04:00
|
|
|
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
|
|
|
|
|
2018-07-06 08:06:44 -04:00
|
|
|
def first_row
|
|
|
|
page.all('table.import-jobs tbody tr')[0]
|
|
|
|
end
|
2018-07-06 06:59:48 -04:00
|
|
|
end
|