2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
2016-11-24 13:41:30 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
RSpec.describe 'New project', :js do
|
2018-03-17 18:26:18 +05:30
|
|
|
include Select2Helper
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
shared_examples 'combined_menu: feature flag examples' do
|
|
|
|
context 'as a user' do
|
|
|
|
let(:user) { create(:user) }
|
2016-11-24 13:41:30 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'new repo experiment', :experiment do
|
|
|
|
it 'when in control renders "project"' do
|
|
|
|
stub_experiments(new_repo: :control)
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
visit new_project_path
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('li.header-new.dropdown').click
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within('li.header-new.dropdown') do
|
|
|
|
expect(page).to have_selector('a', text: 'New project')
|
|
|
|
expect(page).to have_no_selector('a', text: 'New project/repository')
|
|
|
|
end
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_selector('h3', text: 'Create blank project')
|
|
|
|
expect(page).to have_no_selector('h3', text: 'Create blank project/repository')
|
|
|
|
end
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'when in candidate renders "project/repository"' do
|
|
|
|
stub_experiments(new_repo: :candidate)
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
visit new_project_path
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('li.header-new.dropdown').click
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within('li.header-new.dropdown') do
|
|
|
|
expect(page).to have_selector('a', text: 'New project/repository')
|
|
|
|
end
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_selector('h3', text: 'Create blank project/repository')
|
2021-04-29 21:17:54 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'when in control it renders "project" in the new projects dropdown' do
|
2021-06-08 01:23:25 +05:30
|
|
|
pending_on_combined_menu_flag
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
stub_experiments(new_repo: :control)
|
|
|
|
|
|
|
|
visit new_project_path
|
|
|
|
|
|
|
|
find('#nav-projects-dropdown').click
|
|
|
|
|
|
|
|
page.within('#nav-projects-dropdown') do
|
|
|
|
expect(page).to have_selector('a', text: 'Create blank project')
|
|
|
|
expect(page).to have_selector('a', text: 'Import project')
|
|
|
|
expect(page).to have_no_selector('a', text: 'Create blank project/repository')
|
|
|
|
expect(page).to have_no_selector('a', text: 'Import project/repository')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'when in candidate it renders "project/repository" in the new projects dropdown' do
|
2021-06-08 01:23:25 +05:30
|
|
|
pending_on_combined_menu_flag
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
stub_experiments(new_repo: :candidate)
|
|
|
|
|
|
|
|
visit new_project_path
|
|
|
|
|
|
|
|
find('#nav-projects-dropdown').click
|
|
|
|
|
|
|
|
page.within('#nav-projects-dropdown') do
|
|
|
|
expect(page).to have_selector('a', text: 'Create blank project/repository')
|
|
|
|
expect(page).to have_selector('a', text: 'Import project/repository')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'shows a message if multiple levels are restricted' do
|
|
|
|
Gitlab::CurrentSettings.update!(
|
|
|
|
restricted_visibility_levels: [Gitlab::VisibilityLevel::PRIVATE, Gitlab::VisibilityLevel::INTERNAL]
|
|
|
|
)
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_content 'Other visibility settings have been disabled by the administrator.'
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'shows a message if all levels are restricted' do
|
|
|
|
Gitlab::CurrentSettings.update!(
|
|
|
|
restricted_visibility_levels: Gitlab::VisibilityLevel.values
|
|
|
|
)
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_content 'Visibility settings have been disabled by the administrator.'
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'as an admin' do
|
|
|
|
let(:user) { create(:admin) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
before do
|
2021-06-08 01:23:25 +05:30
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows "New project" page', :js do
|
2019-09-30 21:07:59 +05:30
|
|
|
visit new_project_path
|
2021-06-08 01:23:25 +05:30
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_content('Project name')
|
|
|
|
expect(page).to have_content('Project URL')
|
|
|
|
expect(page).to have_content('Project slug')
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
click_link('New project')
|
|
|
|
find('[data-qa-selector="import_project_link"]').click
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_link('GitHub')
|
|
|
|
expect(page).to have_link('Bitbucket')
|
|
|
|
expect(page).to have_link('GitLab.com')
|
|
|
|
expect(page).to have_button('Repo by URL')
|
|
|
|
expect(page).to have_link('GitLab export')
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
describe 'manifest import option' do
|
|
|
|
before do
|
2019-09-30 21:07:59 +05:30
|
|
|
visit new_project_path
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('[data-qa-selector="import_project_link"]').click
|
|
|
|
end
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'has Manifest file' do
|
|
|
|
expect(page).to have_link('Manifest file')
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'Visibility level selector', :js do
|
|
|
|
Gitlab::VisibilityLevel.options.each do |key, level|
|
|
|
|
it "sets selector to #{key}" do
|
|
|
|
stub_application_setting(default_project_visibility: level)
|
2021-04-17 20:07:23 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(find_field("project_visibility_level_#{level}")).to be_checked
|
|
|
|
end
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it "saves visibility level #{level} on validation error" do
|
|
|
|
visit new_project_path
|
2021-04-17 20:07:23 +05:30
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
choose(key)
|
|
|
|
click_button('Create project')
|
2021-04-17 20:07:23 +05:30
|
|
|
page.within('#blank-project-pane') do
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(find_field("project_visibility_level_#{level}")).to be_checked
|
2021-04-17 20:07:23 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when group visibility is private but default is internal' do
|
|
|
|
let_it_be(:group) { create(:group, visibility_level: Gitlab::VisibilityLevel::PRIVATE) }
|
2021-04-17 20:07:23 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
stub_application_setting(default_project_visibility: Gitlab::VisibilityLevel::INTERNAL)
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when admin mode is enabled', :enable_admin_mode do
|
|
|
|
it 'has private selected' do
|
|
|
|
visit new_project_path(namespace_id: group.id)
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2021-04-17 20:07:23 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when admin mode is disabled' do
|
|
|
|
it 'is not allowed' do
|
|
|
|
visit new_project_path(namespace_id: group.id)
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_content('Not Found')
|
2021-04-17 20:07:23 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when group visibility is public but user requests private' do
|
|
|
|
let_it_be(:group) { create(:group, visibility_level: Gitlab::VisibilityLevel::PUBLIC) }
|
2021-04-17 20:07:23 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
stub_application_setting(default_project_visibility: Gitlab::VisibilityLevel::INTERNAL)
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when admin mode is enabled', :enable_admin_mode do
|
|
|
|
it 'has private selected' do
|
|
|
|
visit new_project_path(namespace_id: group.id, project: { visibility_level: Gitlab::VisibilityLevel::PRIVATE })
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2018-12-05 23:21:45 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(find_field("project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).to be_checked
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when admin mode is disabled' do
|
|
|
|
it 'is not allowed' do
|
|
|
|
visit new_project_path(namespace_id: group.id, project: { visibility_level: Gitlab::VisibilityLevel::PRIVATE })
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_content('Not Found')
|
|
|
|
end
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'Readme selector' do
|
|
|
|
it 'shows the initialize with Readme checkbox on "Blank project" tab' do
|
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_css('input#project_initialize_with_readme')
|
|
|
|
expect(page).to have_content('Initialize repository with a README')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'does not show the initialize with Readme checkbox on "Create from template" tab' do
|
2019-09-30 21:07:59 +05:30
|
|
|
visit new_project_path
|
2021-06-08 01:23:25 +05:30
|
|
|
find('[data-qa-selector="create_from_template_link"]').click
|
|
|
|
first('.choose-template').click
|
|
|
|
|
|
|
|
page.within '.project-fields-form' do
|
|
|
|
expect(page).not_to have_css('input#project_initialize_with_readme')
|
|
|
|
expect(page).not_to have_content('Initialize repository with a README')
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'does not show the initialize with Readme checkbox on "Import project" tab' do
|
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="import_project_link"]').click
|
|
|
|
first('.js-import-git-toggle-button').click
|
|
|
|
|
|
|
|
page.within '#import-project-pane' do
|
|
|
|
expect(page).not_to have_css('input#project_initialize_with_readme')
|
|
|
|
expect(page).not_to have_content('Initialize repository with a README')
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'Namespace selector' do
|
|
|
|
context 'with user namespace' do
|
|
|
|
before do
|
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'selects the user namespace' do
|
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(page).to have_select('project[namespace_id]', visible: false, selected: user.username)
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'with group namespace' do
|
|
|
|
let(:group) { create(:group, :private) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
group.add_owner(user)
|
|
|
|
visit new_project_path(namespace_id: group.id)
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'selects the group namespace' do
|
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(page).to have_select('project[namespace_id]', visible: false, selected: group.name)
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'with subgroup namespace' do
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:subgroup) { create(:group, parent: group) }
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
group.add_maintainer(user)
|
|
|
|
visit new_project_path(namespace_id: subgroup.id)
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'selects the group namespace' do
|
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(page).to have_select('project[namespace_id]', visible: false, selected: subgroup.full_path)
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'when changing namespaces dynamically', :js do
|
|
|
|
let(:public_group) { create(:group, :public) }
|
|
|
|
let(:internal_group) { create(:group, :internal) }
|
|
|
|
let(:private_group) { create(:group, :private) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
public_group.add_owner(user)
|
|
|
|
internal_group.add_owner(user)
|
|
|
|
private_group.add_owner(user)
|
|
|
|
visit new_project_path(namespace_id: public_group.id)
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'enables the correct visibility options' do
|
|
|
|
select2(user.namespace_id, from: '#project_namespace_id')
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).not_to be_disabled
|
|
|
|
|
|
|
|
select2(public_group.id, from: '#project_namespace_id')
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).not_to be_disabled
|
|
|
|
|
|
|
|
select2(internal_group.id, from: '#project_namespace_id')
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).to be_disabled
|
|
|
|
|
|
|
|
select2(private_group.id, from: '#project_namespace_id')
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PRIVATE}")).not_to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::INTERNAL}")).to be_disabled
|
|
|
|
expect(find("#project_visibility_level_#{Gitlab::VisibilityLevel::PUBLIC}")).to be_disabled
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'Import project options', :js do
|
2019-09-30 21:07:59 +05:30
|
|
|
before do
|
2021-06-08 01:23:25 +05:30
|
|
|
visit new_project_path
|
|
|
|
find('[data-qa-selector="import_project_link"]').click
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'from git repository url, "Repo by URL"' do
|
|
|
|
before do
|
|
|
|
first('.js-import-git-toggle-button').click
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'does not autocomplete sensitive git repo URL' do
|
|
|
|
autocomplete = find('#project_import_url')['autocomplete']
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(autocomplete).to eq('off')
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'shows import instructions' do
|
|
|
|
git_import_instructions = first('.js-toggle-content')
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(git_import_instructions).to be_visible
|
|
|
|
expect(git_import_instructions).to have_content 'Git repository URL'
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'reports error if repo URL does not end with .git' do
|
|
|
|
fill_in 'project_import_url', with: 'http://foo/bar'
|
|
|
|
fill_in 'project_name', with: 'import-project-without-git-suffix'
|
|
|
|
fill_in 'project_path', with: 'import-project-without-git-suffix'
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
click_button 'Create project'
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_text('Please provide a valid URL ending with .git')
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'keeps "Import project" tab open after form validation error' do
|
|
|
|
collision_project = create(:project, name: 'test-name-collision', namespace: user.namespace)
|
|
|
|
|
|
|
|
fill_in 'project_import_url', with: collision_project.http_url_to_repo
|
|
|
|
fill_in 'project_name', with: collision_project.name
|
|
|
|
|
|
|
|
click_on 'Create project'
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_css('#import-project-pane.active')
|
|
|
|
expect(page).not_to have_css('.toggle-import-form.hide')
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'from GitHub' do
|
|
|
|
before do
|
|
|
|
first('.js-import-github').click
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows import instructions' do
|
|
|
|
expect(page).to have_content('Authenticate with GitHub')
|
|
|
|
expect(current_path).to eq new_import_github_path
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'from manifest file' do
|
|
|
|
before do
|
|
|
|
first('.import_manifest').click
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows import instructions' do
|
|
|
|
expect(page).to have_content('Manifest file import')
|
|
|
|
expect(current_path).to eq new_import_manifest_path
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'Namespace selector' do
|
|
|
|
context 'with group with DEVELOPER_MAINTAINER_PROJECT_ACCESS project_creation_level' do
|
|
|
|
let(:group) { create(:group, project_creation_level: ::Gitlab::Access::DEVELOPER_MAINTAINER_PROJECT_ACCESS) }
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
group.add_developer(user)
|
|
|
|
visit new_project_path(namespace_id: group.id)
|
|
|
|
find('[data-qa-selector="blank_project_link"]').click
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'selects the group namespace' do
|
|
|
|
page.within('#blank-project-pane') do
|
|
|
|
expect(page).to have_select('project[namespace_id]', visible: false, selected: group.full_path)
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
context 'with combined_menu: feature flag on' do
|
|
|
|
let(:needs_rewrite_for_combined_menu_flag_on) { true }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_feature_flags(combined_menu: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'combined_menu: feature flag examples'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with combined_menu feature flag off' do
|
|
|
|
let(:needs_rewrite_for_combined_menu_flag_on) { false }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_feature_flags(combined_menu: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'combined_menu: feature flag examples'
|
|
|
|
end
|
|
|
|
|
|
|
|
def pending_on_combined_menu_flag
|
|
|
|
pending 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/56587' if needs_rewrite_for_combined_menu_flag_on
|
|
|
|
end
|
2016-11-24 13:41:30 +05:30
|
|
|
end
|