Commit f21275c9 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'caalberts-test-fix-ff-save_issuable_health_status' into 'master'

Fix frontend feature flag save_issuable_health_status

Closes #220441

See merge request gitlab-org/gitlab!33921
parents 8b63ac79 5e3c5d67
......@@ -46,7 +46,6 @@ class Projects::IssuesController < Projects::ApplicationController
before_action do
push_frontend_feature_flag(:vue_issuable_sidebar, project.group)
push_frontend_feature_flag(:save_issuable_health_status, project.group, default_enabled: true)
end
before_action only: :show do
......
......@@ -11,6 +11,10 @@ module EE
before_action :check_service_desk_available!, only: [:service_desk]
before_action :whitelist_query_limiting_ee, only: [:update]
before_action do
push_frontend_feature_flag(:save_issuable_health_status, project.group, default_enabled: true)
end
end
override :issue_except_actions
......
......@@ -6,28 +6,6 @@ RSpec.describe 'Group value stream analytics' do
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
RSpec::Matchers.define :have_pushed_frontend_feature_flags do |expected|
def to_js(key, value)
"\"#{key}\":#{value}"
end
match do |actual|
expected.all? do |feature_flag_name, enabled|
page.html.include?(to_js(feature_flag_name, enabled))
end
end
failure_message do |actual|
missing = expected.select do |feature_flag_name, enabled|
!page.html.include?(to_js(feature_flag_name, enabled))
end
formatted_missing_flags = missing.map { |feature_flag_name, enabled| to_js(feature_flag_name, enabled) }.join("\n")
"The following feature flag(s) cannot be found in the frontend HTML source: #{formatted_missing_flags}"
end
end
before do
stub_licensed_features(cycle_analytics_for_groups: true)
......
......@@ -111,6 +111,21 @@ RSpec.describe 'Issue Sidebar' do
expect(page).not_to have_selector('.block.health-status')
end
end
it 'pushes frontend feature flag saveIssuableHealthStatus' do
visit_issue(project, issue)
expect(page).to have_pushed_frontend_feature_flags(saveIssuableHealthStatus: true)
end
context 'when save_issuable_health_status feature flag is disabled' do
it 'pushes disabled frontend feature flag saveIssuableHealthStatus' do
stub_feature_flags(save_issuable_health_status: false)
visit_issue(project, issue)
expect(page).to have_pushed_frontend_feature_flags(saveIssuableHealthStatus: false)
end
end
end
def visit_issue(project, issue)
......
# frozen_string_literal: true
RSpec::Matchers.define :have_pushed_frontend_feature_flags do |expected|
def to_js(key, value)
"\"#{key}\":#{value}"
end
match do |actual|
expected.all? do |feature_flag_name, enabled|
page.html.include?(to_js(feature_flag_name, enabled))
end
end
failure_message do |actual|
missing = expected.select do |feature_flag_name, enabled|
!page.html.include?(to_js(feature_flag_name, enabled))
end
formatted_missing_flags = missing.map { |feature_flag_name, enabled| to_js(feature_flag_name, enabled) }.join("\n")
"The following feature flag(s) cannot be found in the frontend HTML source: #{formatted_missing_flags}"
end
end
......@@ -13,7 +13,6 @@ describe 'Issue Sidebar' do
let!(:xss_label) { create(:label, project: project, title: '&lt;script&gt;alert("xss");&lt;&#x2F;script&gt;') }
before do
stub_feature_flags(save_issuable_health_status: false)
sign_in(user)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment