2019-06-12 17:26:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Contextual sidebar', :js do
|
2021-11-17 01:12:07 -05:00
|
|
|
context 'when context is a project' do
|
|
|
|
let_it_be(:project) { create(:project) }
|
2021-05-26 08:10:41 -04:00
|
|
|
|
2022-01-24 19:11:49 -05:00
|
|
|
let(:user) { project.first_owner }
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
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-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
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-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
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-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
before do
|
|
|
|
sign_in(user)
|
|
|
|
end
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
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-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
visit group_path(group)
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
page.within '[data-test-id="side-nav-invite-members"' do
|
|
|
|
find('[data-test-id="invite-members-button"').click
|
|
|
|
end
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
expect(page).to have_content("You're inviting members to the")
|
|
|
|
end
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
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-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
visit group_path(group)
|
2019-06-12 17:26:48 -04:00
|
|
|
|
2021-11-17 01:12:07 -05:00
|
|
|
expect(page).not_to have_css('[data-test-id="side-nav-invite-members"')
|
|
|
|
end
|
|
|
|
end
|
2019-06-12 17:26:48 -04:00
|
|
|
end
|
|
|
|
end
|