Alerting: Fix RuleEditorCloudRules test flakiness in CI (#114695)
Tests: Fix RuleEditorCloudRules test flakiness in CI Mock the labels plugin as not installed to ensure consistent test behavior across OSS and Enterprise environments. The labels plugin detection was causing different API calls to be made in CI vs local, leading to snapshot mismatches. This test is focused on cloud rule creation, not label plugin functionality, so explicitly disabling the plugin ensures the test remains stable.
This commit is contained in:
@@ -3,6 +3,7 @@ import { clickSelectOption } from 'test/helpers/selectOptionInTest';
|
||||
import { screen } from 'test/test-utils';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import * as pluginSettings from 'app/features/plugins/pluginSettings';
|
||||
import { AccessControlAction } from 'app/types/accessControl';
|
||||
|
||||
import { ExpressionEditorProps } from '../components/rule-editor/ExpressionEditor';
|
||||
@@ -33,6 +34,10 @@ setupPluginsExtensionsHook();
|
||||
|
||||
describe('RuleEditor cloud', () => {
|
||||
beforeEach(() => {
|
||||
// Mock getPluginSettings to ensure labels plugin is not detected
|
||||
// This ensures consistent test behavior across OSS and Enterprise environments
|
||||
jest.spyOn(pluginSettings, 'getPluginSettings').mockRejectedValue(new Error('Plugin not found'));
|
||||
|
||||
grantUserPermissions([
|
||||
AccessControlAction.AlertingRuleRead,
|
||||
AccessControlAction.AlertingRuleUpdate,
|
||||
|
||||
Reference in New Issue
Block a user