58d9b8e382
refs.
7b40393d77
We're improving the usability and possibilities for publishers to
migrate from other platforms such as Substack, Medium or Mailchimp. This
PR applies changes to Ghost Settings to support the new flows, more
specifically:
- moves import and export functions out of Labs to its own setting,
directly available from search and the menu
- adds direct access to various platform migrations
- moves "Delete all content" to a dedicated setting group at the bottom
of all setting
---------
Co-authored-by: Jono Mingard <reason.koan@gmail.com>
70 lines
2.8 KiB
TypeScript
70 lines
2.8 KiB
TypeScript
import {expect, test} from '@playwright/test';
|
|
import {globalDataRequests} from '../../utils/acceptance';
|
|
import {mockApi} from '@tryghost/admin-x-framework/test/acceptance';
|
|
|
|
test.describe('Labs', async () => {
|
|
test('Uploading/downloading redirects', async ({page}) => {
|
|
const {lastApiRequests} = await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
uploadRedirects: {method: 'POST', path: '/redirects/upload/', response: {}},
|
|
downloadRedirects: {method: 'GET', path: '/redirects/download/', response: 'redirects'}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
const labsSection = page.getByTestId('labs');
|
|
|
|
await labsSection.getByRole('button', {name: 'Open'}).click();
|
|
await labsSection.getByRole('tab', {name: 'Beta features'}).click();
|
|
|
|
const fileChooserPromise = page.waitForEvent('filechooser');
|
|
|
|
await labsSection.getByText('Upload redirects file').click();
|
|
|
|
const fileChooser = await fileChooserPromise;
|
|
await fileChooser.setFiles(`${__dirname}/../../utils/files/redirects.yml`);
|
|
|
|
await expect(page.getByTestId('toast-success')).toContainText('Redirects uploaded successfully');
|
|
|
|
expect(lastApiRequests.uploadRedirects).toBeTruthy();
|
|
|
|
await labsSection.getByRole('button', {name: 'Download current redirects'}).click();
|
|
|
|
await expect(page.locator('iframe#iframeDownload')).toHaveAttribute('src', /\/redirects\/download\//);
|
|
|
|
expect(lastApiRequests.downloadRedirects).toBeTruthy();
|
|
});
|
|
|
|
test('Uploading/downloading routes', async ({page}) => {
|
|
const {lastApiRequests} = await mockApi({page, requests: {
|
|
...globalDataRequests,
|
|
uploadRoutes: {method: 'POST', path: '/settings/routes/yaml/', response: {}},
|
|
downloadRoutes: {method: 'GET', path: '/settings/routes/yaml/', response: 'routes'}
|
|
}});
|
|
|
|
await page.goto('/');
|
|
|
|
const labsSection = page.getByTestId('labs');
|
|
|
|
await labsSection.getByRole('button', {name: 'Open'}).click();
|
|
await labsSection.getByRole('tab', {name: 'Beta features'}).click();
|
|
|
|
const fileChooserPromise = page.waitForEvent('filechooser');
|
|
|
|
await labsSection.getByText('Upload routes file').click();
|
|
|
|
const fileChooser = await fileChooserPromise;
|
|
await fileChooser.setFiles(`${__dirname}/../../utils/files/routes.yml`);
|
|
|
|
await expect(page.getByTestId('toast-success')).toContainText('Routes uploaded successfully');
|
|
|
|
expect(lastApiRequests.uploadRoutes).toBeTruthy();
|
|
|
|
await labsSection.getByRole('button', {name: 'Download current routes'}).click();
|
|
|
|
await expect(page.locator('iframe#iframeDownload')).toHaveAttribute('src', /\/settings\/routes\/yaml\//);
|
|
|
|
expect(lastApiRequests.downloadRoutes).toBeTruthy();
|
|
});
|
|
});
|