Ghost/apps/admin-x-settings/test/acceptance/layout.test.ts
Jono M a8083960d8
Added test examples to AdminX demo (#19116)
refs https://github.com/TryGhost/Product/issues/4182

Updated framework to include shared test config for easier app setup.
2023-11-23 12:59:48 +00:00

22 lines
741 B
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests} from '../utils/acceptance';
import {mockApi} from '@tryghost/admin-x-framework/test/acceptance';
test.describe('Layout', async () => {
test('Confirms when leaving if a section is dirty', async ({page}) => {
await mockApi({page, requests: globalDataRequests});
await page.goto('/');
const section = page.getByTestId('title-and-description');
await section.getByRole('button', {name: 'Edit'}).click();
await section.getByLabel('Site title').fill('New Site Title');
await page.getByTestId('exit-settings').click();
await expect(page.getByTestId('confirmation-modal')).toHaveText(/leave/i);
});
});