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