Welcome to mirror list, hosted at ThFree Co, Russian Federation.

new_group_page_spec.rb « groups « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e1034f2bb9d5d3d23f6a911f05faa14f8f6537ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'New group page', :js, feature_category: :groups_and_projects do
  let_it_be(:user)  { create(:user) }
  let_it_be(:parent_group) { create(:group) }

  before do
    parent_group.add_owner(user)
    sign_in(user)
  end

  describe 'sidebar' do
    context 'in the current navigation' do
      before do
        user.update!(use_new_navigation: false)
      end

      context 'for a new top-level group' do
        it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :new_group_path, :groups
      end

      context 'for a new subgroup' do
        it 'shows the group sidebar of the parent group' do
          visit new_group_path(parent_id: parent_group.id, anchor: 'create-group-pane')
          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
        user.update!(use_new_navigation: true)
      end

      context 'for a new top-level group' do
        it 'shows the "Your work" navigation' do
          visit new_group_path
          expect(page).to have_selector(".super-sidebar", text: "Your work")
        end
      end

      context 'for a new subgroup' do
        it 'shows the group navigation of the parent group' do
          visit new_group_path(parent_id: parent_group.id, anchor: 'create-group-pane')
          expect(page).to have_selector(".super-sidebar", text: parent_group.name)
        end
      end
    end
  end
end