0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/apps/admin-x-settings/test/acceptance/advanced/history.test.ts
Ronald Langeveld a596b3aaca
Renamed e2e tests to acceptance tests in Admin X (#18439)
ref https://www.notion.so/AdminX-testing-plan-99b2dab27e794fc893767ccd01c84a63?d=26612fc2b9d84e65bbb269fa3bc5079e&pvs=4#f0089cd4d9f24e93bd7f8e2868987bf6

This pull request renames the end-to-end tests to acceptance tests in
the `apps/admin-x-settings` folder. It updates the `ci.yml` file, the
`package.json` file, the `playwright.config.ts` file, and the test files
to reflect the new naming convention. This change aims to better reflect
the purpose and scope of the tests.
2023-10-03 16:20:40 +07:00

45 lines
2.1 KiB
TypeScript

import {expect, test} from '@playwright/test';
import {globalDataRequests, mockApi, responseFixtures} from '../../utils/acceptance';
test.describe('History', async () => {
test('Browsing history', async ({page}) => {
const {lastApiRequests} = await mockApi({page, requests: {
...globalDataRequests,
browseActionsFiltered: {
method: 'GET',
path: /\/actions\/.+post/,
response: {
...responseFixtures.actions,
actions: responseFixtures.actions.actions.filter(action => action.resource_type !== 'post')
}
},
browseActionsAll: {method: 'GET', path: /\/actions\//, response: responseFixtures.actions}
}});
await page.goto('/');
const historySection = page.getByTestId('history');
await historySection.getByRole('button', {name: 'View history'}).click();
const historyModal = page.getByTestId('history-modal');
await expect(historyModal).toHaveText(/Settings edited: Site \(navigation\) 2 times/);
await expect(historyModal).toHaveText(/Page edited: The Clunkers Hall of Shame 2 times/);
expect(lastApiRequests.browseActionsAll?.url).toEqual('http://localhost:5173/ghost/api/admin/actions/?include=actor%2Cresource&limit=200&filter=resource_type%3A-%5Blabel%5D');
await historyModal.getByRole('button', {name: 'Filter'}).click();
await page.getByTestId('popover-content').getByLabel('Posts').uncheck();
await expect(historyModal).not.toHaveText(/Page edited/);
await expect(historyModal).toHaveText(/Settings edited/);
expect(lastApiRequests.browseActionsFiltered?.url).toEqual('http://localhost:5173/ghost/api/admin/actions/?include=actor%2Cresource&limit=200&filter=resource_type%3A-%5Blabel%2Cpost%5D');
await page.getByTestId('popover-content').getByLabel('Deleted').uncheck();
expect(lastApiRequests.browseActionsFiltered?.url).toEqual('http://localhost:5173/ghost/api/admin/actions/?include=actor%2Cresource&limit=200&filter=event%3A-%5Bdeleted%5D%2Bresource_type%3A-%5Blabel%2Cpost%5D');
});
});