Commit ed050950 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/352761/fixWidgetExtensionFlag' into 'master'

Hide old MR widgets when the extension flag is enabled

See merge request gitlab-org/gitlab!81295
parents 951a7b42 48c2fc42
...@@ -574,7 +574,7 @@ export default { ...@@ -574,7 +574,7 @@ export default {
/> />
<grouped-accessibility-reports-app <grouped-accessibility-reports-app
v-if="shouldShowAccessibilityReport" v-if="shouldShowAccessibilityReport && !shouldShowExtension"
:endpoint="mr.accessibilityReportPath" :endpoint="mr.accessibilityReportPath"
/> />
......
...@@ -83,7 +83,11 @@ export default { ...@@ -83,7 +83,11 @@ export default {
return threshold + totalScoreDelta <= 0; return threshold + totalScoreDelta <= 0;
}, },
shouldRenderBrowserPerformance() { shouldRenderBrowserPerformance() {
return this.hasBrowserPerformancePaths && this.hasBrowserPerformanceDegradation; return (
this.hasBrowserPerformancePaths &&
this.hasBrowserPerformanceDegradation &&
!this.shouldShowExtension
);
}, },
hasLoadPerformanceMetrics() { hasLoadPerformanceMetrics() {
return ( return (
...@@ -352,7 +356,7 @@ export default { ...@@ -352,7 +356,7 @@ export default {
:has-issues="hasBrowserPerformanceMetrics" :has-issues="hasBrowserPerformanceMetrics"
/> />
<grouped-load-performance-reports-app <grouped-load-performance-reports-app
v-if="hasLoadPerformancePaths" v-if="hasLoadPerformancePaths && !shouldShowExtension"
:status="loadPerformanceStatus" :status="loadPerformanceStatus"
:loading-text="translateText('load-performance').loading" :loading-text="translateText('load-performance').loading"
:error-text="translateText('load-performance').error" :error-text="translateText('load-performance').error"
...@@ -472,12 +476,12 @@ export default { ...@@ -472,12 +476,12 @@ export default {
/> />
<grouped-accessibility-reports-app <grouped-accessibility-reports-app
v-if="shouldShowAccessibilityReport" v-if="shouldShowAccessibilityReport && !shouldShowExtension"
:endpoint="mr.accessibilityReportPath" :endpoint="mr.accessibilityReportPath"
/> />
<status-checks-reports-app <status-checks-reports-app
v-if="shouldRenderStatusReport" v-if="shouldRenderStatusReport && !shouldShowExtension"
:endpoint="mr.apiStatusChecksPath" :endpoint="mr.apiStatusChecksPath"
/> />
......
...@@ -23,6 +23,9 @@ RSpec.describe 'Merge request > User sees status checks widget', :js do ...@@ -23,6 +23,9 @@ RSpec.describe 'Merge request > User sees status checks widget', :js do
context 'user is authorized' do context 'user is authorized' do
before do before do
stub_feature_flags(refactor_mr_widgets_extensions: false)
stub_feature_flags(refactor_mr_widgets_extensions_user: false)
project.add_maintainer(user) project.add_maintainer(user)
sign_in(user) sign_in(user)
...@@ -48,6 +51,31 @@ RSpec.describe 'Merge request > User sees status checks widget', :js do ...@@ -48,6 +51,31 @@ RSpec.describe 'Merge request > User sees status checks widget', :js do
end end
end end
context 'widget extension flag is enabled' do
before do
project.add_maintainer(user)
sign_in(user)
visit project_merge_request_path(project, merge_request)
end
it 'shows the widget' do
expect(page).to have_content('Status checks 1 pending')
end
it 'shows the status check issues', :aggregate_failures do
within '[data-testid="widget-extension"]' do
find('[data-testid="toggle-button"]').click
end
[check1, check2].each do |rule|
icon_type = rule.approved?(merge_request, merge_request.source_branch_sha) ? 'success' : 'neutral'
expect(page).to have_css("[data-testid='status-#{icon_type}-icon']")
expect(page).to have_content("#{rule.name}: #{rule.external_url}")
end
end
end
context 'user is not logged in' do context 'user is not logged in' do
before do before do
visit project_merge_request_path(project, merge_request) visit project_merge_request_path(project, merge_request)
......
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