mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
dbe1c0fa2e
refs. https://github.com/TryGhost/Product/issues/3349 - some of the UI components' scrollbar was visible where it wasn't necessary - metadata preview was shown in view mode too - social accounts value was shown even if it was empty - user detail modal was missing field descriptions - it was not possible to reopen the Zapier modal after closing it the "Close" button - copy had to be updated for analytics export to make it clear what is going to be exported - invite modal had to be closed after successful invitation - toggle component was only active on the text itself, instead of the whole row
57 lines
2.4 KiB
TypeScript
57 lines
2.4 KiB
TypeScript
import {expect, test} from '@playwright/test';
|
|
import {globalDataRequests, mockApi, updatedSettingsResponse} from '../../utils/e2e';
|
|
|
|
test.describe('Analytics settings', async () => {
|
|
test('Supports toggling analytics settings', async ({page}) => {
|
|
const {lastApiRequests} = await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
editSettings: {method: 'PUT', path: '/settings/', response: updatedSettingsResponse([
|
|
{key: 'members_track_sources', value: false},
|
|
{key: 'email_track_opens', value: false},
|
|
{key: 'email_track_clicks', value: false},
|
|
{key: 'outbound_link_tagging', value: false}
|
|
])}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
const section = page.getByTestId('analytics');
|
|
|
|
await expect(section.getByLabel(/Newsletter opens/)).toBeChecked();
|
|
await expect(section.getByLabel(/Newsletter clicks/)).toBeChecked();
|
|
await expect(section.getByLabel(/Member sources/)).toBeChecked();
|
|
await expect(section.getByLabel(/Outbound link tagging/)).toBeChecked();
|
|
|
|
await section.getByLabel(/Newsletter opens/).uncheck();
|
|
await section.getByLabel(/Newsletter clicks/).uncheck();
|
|
await section.getByLabel(/Member sources/).uncheck();
|
|
await section.getByLabel(/Outbound link tagging/).uncheck();
|
|
|
|
await section.getByRole('button', {name: 'Save'}).click();
|
|
|
|
expect(lastApiRequests.editSettings?.body).toEqual({
|
|
settings: [
|
|
{key: 'members_track_sources', value: false},
|
|
{key: 'email_track_opens', value: false},
|
|
{key: 'email_track_clicks', value: false},
|
|
{key: 'outbound_link_tagging', value: false}
|
|
]
|
|
});
|
|
});
|
|
|
|
test('Supports downloading analytics csv export', async ({page}) => {
|
|
const {lastApiRequests} = await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
postsExport: {method: 'GET', path: '/posts/export/?limit=1000', response: 'csv data'}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
const section = page.getByTestId('analytics');
|
|
|
|
await section.getByRole('button', {name: 'Export post analytics'}).click();
|
|
|
|
const hasDownloadUrl = lastApiRequests.postsExport?.url?.includes('/posts/export/?limit=1000');
|
|
expect(hasDownloadUrl).toBe(true);
|
|
});
|
|
});
|