-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweaks to overrides (added draggable bounds, take timezone into consi…
- Loading branch information
Showing
21 changed files
with
326 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { test, expect, Locator } from '../fixtures'; | ||
import { MOSCOW_TIMEZONE } from '../utils/constants'; | ||
import { clickButton, generateRandomValue } from '../utils/forms'; | ||
import { setTimezoneInProfile } from '../utils/grafanaProfile'; | ||
import { createOnCallSchedule } from '../utils/schedule'; | ||
|
||
test('Fills in Rotation time and reacts to timezone change', async ({ adminRolePage }) => { | ||
const { page, userName } = adminRolePage; | ||
|
||
await setTimezoneInProfile(page, MOSCOW_TIMEZONE); // UTC+3 | ||
|
||
const onCallScheduleName = generateRandomValue(); | ||
await createOnCallSchedule(page, onCallScheduleName, userName, false); | ||
|
||
await clickButton({ page, buttonText: 'Add rotation' }); | ||
// enable Rotation End | ||
await page.getByTestId('rotation-end').getByLabel('Toggle switch').click(); | ||
|
||
const startEl = page.getByTestId('rotation-start'); | ||
await changeDatePickerTime(startEl, '02'); | ||
await expect(startEl.getByTestId('date-time-picker').getByRole('textbox')).toHaveValue('02:00'); | ||
|
||
const endEl = page.getByTestId('rotation-end'); | ||
await changeDatePickerTime(endEl, '12'); | ||
await expect(endEl.getByTestId('date-time-picker').getByRole('textbox')).toHaveValue('12:00'); | ||
|
||
await page.getByRole('dialog').click(); // clear focus | ||
|
||
await page.getByTestId('timezone-select').locator('svg').click(); | ||
await page.getByText('GMT', { exact: true }).click(); | ||
|
||
// expect times to go back by -3 | ||
await expect(startEl.getByTestId('date-time-picker').getByRole('textbox')).toHaveValue('23:00'); | ||
await expect(endEl.getByTestId('date-time-picker').getByRole('textbox')).toHaveValue('09:00'); | ||
|
||
async function changeDatePickerTime(element: Locator, value: string) { | ||
await element.getByRole('img').click(); | ||
// set minutes to {value} | ||
await page.locator('.rc-time-picker-panel').getByRole('button', { name: value }).first().click(); | ||
// set seconds to 00 | ||
await page.getByRole('button', { name: '00' }).nth(1).click(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { Page } from '@playwright/test'; | ||
import { Page, expect } from '@playwright/test'; | ||
|
||
import { goToGrafanaPage } from './navigation'; | ||
|
||
export const setTimezoneInProfile = async (page: Page, timezone: string) => { | ||
await goToGrafanaPage(page, '/profile'); | ||
await expect(page.getByLabel('Time zone picker')).toBeVisible(); | ||
|
||
await page.getByLabel('Time zone picker').click(); | ||
await page.getByLabel('Select options menu').getByText(timezone).click(); | ||
await page.getByTestId('data-testid-shared-prefs-save').click(); | ||
await page.waitForLoadState('networkidle'); | ||
await page.waitForTimeout(3000); // wait for reload | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.