Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix escalation policy importance going back to default #3282

Merged
merged 4 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Unify naming of Grafana Cloud / Cloud OnCall / Grafana Cloud OnCall
so that it's always Grafana Cloud OnCall ([#3279](https://github.com/grafana/oncall/pull/3279))

### Fixed

- Fix escalation policy importance going back to default by @vadimkerr ([#3282](https://github.com/grafana/oncall/pull/3282))

## v1.3.54 (2023-11-06)

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {expect, test} from "../fixtures";
import {generateRandomValue} from "../utils/forms";
import {createEscalationChain, EscalationStep, selectEscalationStepValue} from "../utils/escalationChain";

test('escalation policy does not go back to "Default" after adding users to notify', async ({ adminRolePage }) => {
const { page, userName } = adminRolePage;
const escalationChainName = generateRandomValue();

// create important escalation step
await createEscalationChain(page, escalationChainName, EscalationStep.NotifyUsers, null, true);
// add user to notify
await selectEscalationStepValue(page, EscalationStep.NotifyUsers, userName);

// reload and check if important is still selected
await page.reload();
await page.waitForLoadState('networkidle');

expect(await page.locator('text=Important').isVisible()).toBe(true);
});
37 changes: 26 additions & 11 deletions grafana-plugin/e2e-tests/utils/escalationChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export const createEscalationChain = async (
page: Page,
escalationChainName: string,
escalationStep?: EscalationStep,
escalationStepValue?: string
escalationStepValue?: string,
important?: boolean
): Promise<void> => {
// go to the escalation chains page
await goToOnCallPage(page, 'escalations');
Expand All @@ -40,18 +41,32 @@ export const createEscalationChain = async (
await clickButton({ page, buttonText: 'Create' });
await expect(page.getByTestId('escalation-chain-name')).toHaveText(escalationChainName);

if (!escalationStep || !escalationStepValue) {
return;
}
if (escalationStep) {
// add an escalation step
await selectDropdownValue({
page, selectType: 'grafanaSelect', placeholderText: 'Add escalation step...', value: escalationStep,
});

// add an escalation step
await selectDropdownValue({
page,
selectType: 'grafanaSelect',
placeholderText: 'Add escalation step...',
value: escalationStep,
});
// toggle important
if (important) {
await selectDropdownValue({
page,
selectType: 'grafanaSelect',
placeholderText: "Default",
value: "Important",
});
}

// select the escalation step value (e.g. user or schedule)
if (escalationStepValue) {await selectEscalationStepValue(page, escalationStep, escalationStepValue);}
}
};

export const selectEscalationStepValue = async (
page: Page,
escalationStep: EscalationStep,
escalationStepValue: string
): Promise<void> => {
await selectDropdownValue({
page,
selectType: 'grafanaSelect',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { pick } from 'lodash-es';
import { EscalationPolicy } from './escalation_policy.types';

export function prepareEscalationPolicy(value: EscalationPolicy) {
return pick(value, ['step']);
return pick(value, ['step', 'important']);
}
Loading