debian-mirror-gitlab/spec/features/merge_request/user_manages_subscription_spec.rb

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

62 lines
1.6 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'User manages subscription', :js, feature_category: :code_review do
2018-03-17 18:26:18 +05:30
let(:project) { create(:project, :public, :repository) }
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
let(:user) { create(:user) }
2022-07-16 23:28:13 +05:30
let(:moved_mr_sidebar_enabled) { false }
2018-03-17 18:26:18 +05:30
before do
2022-07-16 23:28:13 +05:30
stub_feature_flags(moved_mr_sidebar: moved_mr_sidebar_enabled)
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2018-03-17 18:26:18 +05:30
sign_in(user)
visit(merge_request_path(merge_request))
end
2022-07-16 23:28:13 +05:30
context 'moved sidebar flag disabled' do
it 'toggles subscription' do
page.within('[data-testid="subscription-toggle"]') do
wait_for_requests
expect(page).to have_css 'button:not(.is-checked)'
find('button:not(.is-checked)').click
wait_for_requests
expect(page).to have_css 'button.is-checked'
find('button.is-checked').click
wait_for_requests
expect(page).to have_css 'button:not(.is-checked)'
end
end
end
context 'moved sidebar flag enabled' do
let(:moved_mr_sidebar_enabled) { true }
it 'toggles subscription' do
2020-04-08 14:13:33 +05:30
wait_for_requests
2022-11-25 23:54:43 +05:30
find('[data-testid="merge-request-actions"]').click
2022-07-16 23:28:13 +05:30
2022-10-11 01:57:18 +05:30
expect(page).to have_selector('.gl-toggle:not(.is-checked)')
find('[data-testid="notifications-toggle"] .gl-toggle').click
2018-03-17 18:26:18 +05:30
wait_for_requests
2022-10-11 01:57:18 +05:30
expect(page).to have_selector('.gl-toggle.is-checked')
find('[data-testid="notifications-toggle"] .gl-toggle').click
2018-03-17 18:26:18 +05:30
wait_for_requests
2022-10-11 01:57:18 +05:30
expect(page).to have_selector('.gl-toggle:not(.is-checked)')
2018-03-17 18:26:18 +05:30
end
end
end