2023-10-03 12:20:40 +03:00
|
|
|
import {chooseOptionInSelect, globalDataRequests, mockApi, updatedSettingsResponse} from '../../utils/acceptance';
|
2023-06-06 06:50:07 +03:00
|
|
|
import {expect, test} from '@playwright/test';
|
|
|
|
|
|
|
|
test.describe('Time zone settings', async () => {
|
|
|
|
test('Supports editing the time zone', async ({page}) => {
|
2023-08-03 11:29:14 +03:00
|
|
|
const {lastApiRequests} = await mockApi({page, requests: {
|
|
|
|
...globalDataRequests,
|
|
|
|
editSettings: {method: 'PUT', path: '/settings/', response: updatedSettingsResponse([
|
2023-09-18 16:51:59 +03:00
|
|
|
{key: 'timezone', value: 'America/Anchorage'}
|
2023-08-03 11:29:14 +03:00
|
|
|
])}
|
2023-06-06 06:50:07 +03:00
|
|
|
}});
|
|
|
|
|
|
|
|
await page.goto('/');
|
|
|
|
|
|
|
|
const section = page.getByTestId('timezone');
|
|
|
|
|
2023-10-20 12:49:04 +03:00
|
|
|
await expect(section.getByText('(GMT) UTC')).toHaveCount(1);
|
2023-06-06 06:50:07 +03:00
|
|
|
|
|
|
|
await section.getByRole('button', {name: 'Edit'}).click();
|
|
|
|
|
2023-10-04 13:09:04 +03:00
|
|
|
await chooseOptionInSelect(section.getByTestId('timezone-select'), '(GMT -9:00) Alaska');
|
2023-06-06 06:50:07 +03:00
|
|
|
|
|
|
|
await section.getByRole('button', {name: 'Save'}).click();
|
|
|
|
|
2023-10-04 13:09:04 +03:00
|
|
|
await expect(section.getByTestId('timezone-select')).toHaveCount(0);
|
2023-06-06 06:50:07 +03:00
|
|
|
|
2023-10-20 12:49:04 +03:00
|
|
|
await expect(section.getByText('(GMT -9:00) Alaska')).toHaveCount(1);
|
2023-06-06 06:50:07 +03:00
|
|
|
|
2023-08-03 11:29:14 +03:00
|
|
|
expect(lastApiRequests.editSettings?.body).toEqual({
|
2023-06-06 06:50:07 +03:00
|
|
|
settings: [
|
2023-09-18 16:51:59 +03:00
|
|
|
{key: 'timezone', value: 'America/Anchorage'}
|
2023-06-06 06:50:07 +03:00
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|