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
55
56
57
58
59
60
61
62
63
64
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'new navigation callout', :js, feature_category: :navigation do
let_it_be(:callout_title) { _('Welcome to a new navigation experience') }
let(:dot_com) { false }
before do
allow(Gitlab).to receive(:com?).and_return(dot_com)
sign_in(user)
visit root_path
end
context 'with new navigation toggled on' do
let_it_be(:user) { create(:user, created_at: Date.new(2023, 6, 1), use_new_navigation: true) }
it 'shows a callout about the new navigation' do
expect(page).to have_content callout_title
end
context 'when user dismisses callout' do
it 'hides callout' do
expect(page).to have_content callout_title
page.within(find('[data-feature-id="new_navigation_callout"]')) do
find('[data-testid="close-icon"]').click
end
wait_for_requests
visit root_path
expect(page).not_to have_content callout_title
end
end
end
context 'when user registered on or after June 2nd 2023' do
let_it_be(:user) { create(:user, created_at: Date.new(2023, 6, 2), use_new_navigation: true) }
context 'when on GitLab.com' do
let(:dot_com) { true }
it 'does not show the callout about the new navigation' do
expect(page).not_to have_content callout_title
end
end
context 'when on a self-managed instance' do
it 'shows the callout about the new navigation' do
expect(page).to have_content callout_title
end
end
end
context 'with new navigation toggled off' do
let_it_be(:user) { create(:user, created_at: Date.new(2023, 6, 1), use_new_navigation: false) }
it 'does not show the callout' do
expect(page).not_to have_content callout_title
end
end
end
|