diff options
Diffstat (limited to 'spec/features/projects/new_project_spec.rb')
-rw-r--r-- | spec/features/projects/new_project_spec.rb | 91 |
1 files changed, 30 insertions, 61 deletions
diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index 926fea24e14..a3cbb86da2c 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -9,13 +9,37 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do stub_application_setting(import_sources: Gitlab::ImportSources.values) end + shared_examples 'shows correct navigation' do + context 'for a new top-level project' do + it 'shows the "Your work" navigation' do + visit new_project_path + expect(page).to have_selector(".super-sidebar", text: "Your work") + end + end + + context 'for a new group project' do + let_it_be(:parent_group) { create(:group) } + + before do + parent_group.add_owner(user) + end + + it 'shows the group sidebar of the parent group' do + visit new_project_path(namespace_id: parent_group.id) + expect(page).to have_selector(".super-sidebar", text: parent_group.name) + end + end + end + context 'as a user' do - let_it_be(:user) { create(:user, :no_super_sidebar) } + let_it_be(:user) { create(:user) } before do sign_in(user) end + it_behaves_like 'shows correct navigation' + it 'shows the project description field when it should' do description_label = 'Project description (optional)' @@ -76,7 +100,9 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do end context 'as an admin' do - let(:user) { create(:admin, :no_super_sidebar) } + let(:user) { create(:admin) } + + it_behaves_like 'shows correct navigation' shared_examples '"New project" page' do before do @@ -103,14 +129,6 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do include_examples '"New project" page' - context 'when the new navigation is enabled' do - before do - user.update!(use_new_navigation: true) - end - - include_examples '"New project" page' - end - shared_examples 'renders importer link' do |params| context 'with user namespace' do before do @@ -566,66 +584,17 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do let(:provider) { :bitbucket } context 'as a user' do - let(:user) { create(:user, :no_super_sidebar) } + let(:user) { create(:user) } let(:oauth_config_instructions) { 'To enable importing projects from Bitbucket, ask your GitLab administrator to configure OAuth integration' } it_behaves_like 'has instructions to enable OAuth' end context 'as an admin', :do_not_mock_admin_mode_setting do - let(:user) { create(:admin, :no_super_sidebar) } + let(:user) { create(:admin) } let(:oauth_config_instructions) { 'To enable importing projects from Bitbucket, as administrator you need to configure OAuth integration' } it_behaves_like 'has instructions to enable OAuth' end end - - describe 'sidebar' do - let_it_be(:user) { create(:user, :no_super_sidebar) } - let_it_be(:parent_group) { create(:group) } - - before do - parent_group.add_owner(user) - sign_in(user) - end - - context 'in the current navigation' do - before do - user.update!(use_new_navigation: false) - end - - context 'for a new top-level project' do - it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :new_project_path, :projects - end - - context 'for a new group project' do - it 'shows the group sidebar of the parent group' do - visit new_project_path(namespace_id: parent_group.id) - expect(page).to have_selector(".nav-sidebar[aria-label=\"Group navigation\"] .context-header[title=\"#{parent_group.name}\"]") - end - end - end - - context 'in the new navigation' do - before do - parent_group.add_owner(user) - user.update!(use_new_navigation: true) - sign_in(user) - end - - context 'for a new top-level project' do - it 'shows the "Your work" navigation' do - visit new_project_path - expect(page).to have_selector(".super-sidebar", text: "Your work") - end - end - - context 'for a new group project' do - it 'shows the group sidebar of the parent group' do - visit new_project_path(namespace_id: parent_group.id) - expect(page).to have_selector(".super-sidebar", text: parent_group.name) - end - end - end - end end |