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

54 lines
1.4 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'
2019-10-12 21:52:04 +05:30
describe 'Import multiple repositories by uploading a manifest file', :js do
2018-11-18 11:00:15 +05:30
include Select2Helper
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'
expect(page).to have_button('Import all repositories')
expect(page).to have_content('https://android-review.googlesource.com/platform/build/blueprint')
end
2019-12-26 22:10:19 +05:30
it 'imports successfully imports a project', :sidekiq_might_not_need_inline 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'
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
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
def first_row
page.all('table.import-jobs tbody tr')[0]
end
end