debian-mirror-gitlab/spec/features/contextual_sidebar_spec.rb

113 lines
3.7 KiB
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Contextual sidebar', :js, feature_category: :remote_development do
2021-12-11 22:18:48 +05:30
context 'when context is a project' do
let_it_be(:project) { create(:project) }
2021-09-04 01:27:46 +05:30
2022-04-04 11:22:00 +05:30
let(:user) { project.first_owner }
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
before do
sign_in(user)
end
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
context 'when analyzing the menu' do
before do
visit project_path(project)
end
it 'shows flyout navs when collapsed or expanded apart from on the active item when expanded', :aggregate_failures do
expect(page).not_to have_selector('.js-sidebar-collapsed')
find('.rspec-link-pipelines').hover
expect(page).to have_selector('.is-showing-fly-out')
find('.rspec-project-link').hover
expect(page).not_to have_selector('.is-showing-fly-out')
find('.rspec-toggle-sidebar').click
find('.rspec-link-pipelines').hover
expect(page).to have_selector('.is-showing-fly-out')
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
find('.rspec-project-link').hover
expect(page).to have_selector('.is-showing-fly-out')
end
end
context 'with invite_members_in_side_nav experiment', :experiment do
it 'allows opening of modal for the candidate experience' do
stub_experiments(invite_members_in_side_nav: :candidate)
expect(experiment(:invite_members_in_side_nav)).to track(:assignment)
.with_context(group: project.group)
.on_next_instance
visit project_path(project)
page.within '[data-test-id="side-nav-invite-members"' do
find('[data-test-id="invite-members-button"').click
end
expect(page).to have_content("You're inviting members to the")
end
it 'does not have invite members link in side nav for the control experience' do
stub_experiments(invite_members_in_side_nav: :control)
expect(experiment(:invite_members_in_side_nav)).to track(:assignment)
.with_context(group: project.group)
.on_next_instance
visit project_path(project)
expect(page).not_to have_css('[data-test-id="side-nav-invite-members"')
end
end
end
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
context 'when context is a group' do
let_it_be(:user) { create(:user) }
let_it_be(:group) do
create(:group).tap do |g|
g.add_owner(user)
end
end
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
before do
sign_in(user)
end
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
context 'with invite_members_in_side_nav experiment', :experiment do
it 'allows opening of modal for the candidate experience' do
stub_experiments(invite_members_in_side_nav: :candidate)
expect(experiment(:invite_members_in_side_nav)).to track(:assignment)
.with_context(group: group)
.on_next_instance
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
visit group_path(group)
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
page.within '[data-test-id="side-nav-invite-members"' do
find('[data-test-id="invite-members-button"').click
end
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
expect(page).to have_content("You're inviting members to the")
end
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
it 'does not have invite members link in side nav for the control experience' do
stub_experiments(invite_members_in_side_nav: :control)
expect(experiment(:invite_members_in_side_nav)).to track(:assignment)
.with_context(group: group)
.on_next_instance
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
visit group_path(group)
2019-09-04 21:01:54 +05:30
2021-12-11 22:18:48 +05:30
expect(page).not_to have_css('[data-test-id="side-nav-invite-members"')
end
end
2019-09-04 21:01:54 +05:30
end
end