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

user_visits_notifications_tab_spec.rb « profiles « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d212982f4e31830c0a8422856dd1b92e58ac81b8 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'User visits the notifications tab', :js, feature_category: :users do
  let(:project) { create(:project) }
  let(:user) { create(:user) }

  before do
    project.add_maintainer(user)
    sign_in(user)
    visit(profile_notifications_path)
  end

  it 'turns on the receive product marketing emails setting' do
    expect(page).to have_content('Notifications')

    expect do
      check 'Receive product marketing emails'
    end.to change { user.reload.email_opted_in }.to(true)
  end

  it 'changes the project notifications setting' do
    expect(page).to have_content('Notifications')

    first('[data-testid="notification-dropdown"]').click
    click_button('On mention')

    expect(page).to have_selector('[data-testid="notification-dropdown"]', text: 'On mention')
  end

  context 'when project emails are disabled' do
    let(:project) { create(:project, emails_disabled: true) }

    it 'notification button is disabled' do
      expect(page).to have_selector('[data-testid="notification-dropdown"] .disabled')
    end
  end
end