require 'spec_helper'

feature 'Import multiple repositories by uploading a manifest file', :js do
  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 'Continue to the next step'

    expect(page).to have_button('Import all repositories')
    expect(page).to have_content('https://android-review.googlesource.com/platform/build/blueprint')
  end

  it 'imports succesfully imports a project' do
    visit new_import_manifest_path

    attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml'))
    click_on 'Continue to the next step'

    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

  def first_row
    page.all('table.import-jobs tbody tr')[0]
  end
end

require 'spec_helper'

feature 'Import multiple repositories by uploading a manifest file', :js, :postgresql do
  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 'Continue to the next step'

    expect(page).to have_button('Import all repositories')
    expect(page).to have_content('https://android-review.googlesource.com/platform/build/blueprint')
  end

  it 'imports succesfully imports a project' do
    visit new_import_manifest_path

    attach_file('manifest', Rails.root.join('spec/fixtures/aosp_manifest.xml'))
    click_on 'Continue to the next step'

    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

  def first_row
    page.all('table.import-jobs tbody tr')[0]
  end
end

Make the manifest import feature spec a postgres only
Make the manifest import feature spec a postgres only

Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
