debian-mirror-gitlab/spec/features/groups/new_group_page_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.2 KiB
Ruby
Raw Normal View History

2022-11-25 23:54:43 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'New group page', :js, feature_category: :subgroups do
2023-05-27 22:25:52 +05:30
let_it_be(:user) { create(:user) }
let_it_be(:parent_group) { create(:group) }
2022-11-25 23:54:43 +05:30
before do
2023-05-27 22:25:52 +05:30
parent_group.add_owner(user)
2022-11-25 23:54:43 +05:30
sign_in(user)
end
describe 'new top level group alert' do
context 'when a user visits the new group page' do
it 'shows the new top level group alert' do
visit new_group_path(anchor: 'create-group-pane')
expect(page).to have_selector('[data-testid="new-top-level-alert"]')
end
end
context 'when a user visits the new sub group page' do
it 'does not show the new top level group alert' do
visit new_group_path(parent_id: parent_group.id, anchor: 'create-group-pane')
expect(page).not_to have_selector('[data-testid="new-top-level-alert"]')
end
end
end
2023-05-27 22:25:52 +05:30
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
2023-06-20 00:43:36 +05:30
it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :new_group_path, :groups
2023-05-27 22:25:52 +05:30
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 .context-switcher-toggle", 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 .context-switcher-toggle", text: parent_group.name)
end
end
end
end
2022-11-25 23:54:43 +05:30
end