Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions packages/playground/website/playwright/e2e/reprint-import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ test(

await website.goto('./?reprint');
const page = website.page;
await page.context().grantPermissions(['clipboard-write']);
await page.waitForFunction(() =>
Boolean((window as any).playgroundSites?.getClient())
);
Expand All @@ -52,6 +53,10 @@ test(
.fill(siteUrl!);
await pane.getByRole('button', { name: 'Check site' }).click();
// The key step opens only when Reprint Server answered the probe.
await pane
.locator('summary')
.filter({ hasText: 'Show key and connection details' })
.click();
const key = pane.getByRole('textbox', {
name: 'Migration key',
exact: true,
Expand All @@ -60,10 +65,14 @@ test(
const publicKey = await key.inputValue();
// Enroll through the actual plugin settings, just as a user would. No
// shared token or unauthenticated test endpoint stands in for signatures.
const sourceAdmin = await page.context().newPage();
await sourceAdmin.goto(
new URL('wp-admin/tools.php?page=reprint-server', siteUrl).href
);
await pane
.getByRole('button', { name: 'Copy migration key', exact: true })
.click();
const sourceAdminOpened = page.context().waitForEvent('page');
await pane
.getByRole('link', { name: 'Open Reprint settings ↗', exact: true })
.click();
const sourceAdmin = await sourceAdminOpened;
await sourceAdmin
.getByRole('textbox', { name: 'Username or Email Address' })
.fill('admin');
Expand All @@ -89,7 +98,9 @@ test(
sourceAdmin.getByText('Public key enrolled.')
).toBeVisible();
await sourceAdmin.close();
await pane.getByRole('button', { name: 'Clone site' }).click();
await pane
.getByRole('button', { name: 'I’ve authorized it — clone site' })
.click();

const openSite = page.getByRole('button', { name: 'Open site' });
// Stop waiting when the UI reports a failed stage, so the failure snapshot
Expand Down
35 changes: 34 additions & 1 deletion packages/playground/website/playwright/e2e/reprint-ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test(
);
await website.goto('./?reprint&name=pull-entry-original');
const page = website.page;
await page.context().grantPermissions(['clipboard-write']);
await page.waitForFunction(() =>
Boolean((window as any).playgroundSites?.getClient())
);
Expand Down Expand Up @@ -55,11 +56,43 @@ test(
.fill('http://127.0.0.1:1/');
await pane.getByRole('button', { name: 'Check site' }).click();
await pane.getByRole('button', { name: 'Connect manually' }).click();
await expect(
pane.getByRole('button', {
name: 'Copy migration key',
exact: true,
})
).toBeVisible();
await pane
.getByRole('button', { name: 'Copy migration key', exact: true })
.click();
await expect(
pane.getByRole('button', {
name: 'Copy migration key',
exact: true,
})
).toBeFocused();
const settingsOpened = page.context().waitForEvent('page');
await pane
.getByRole('link', { name: 'Open Reprint settings ↗', exact: true })
.click();
await (await settingsOpened).close();
await expect(
pane.getByRole('link', {
name: 'Open Reprint settings ↗',
exact: true,
})
).toBeFocused();
await pane
.locator('summary')
.filter({ hasText: 'Show key and connection details' })
.click();
await expect(
pane.getByRole('textbox', { name: 'Migration key', exact: true })
).toHaveValue(/^[A-Za-z0-9+/]+=*$/);
expect(await activeSlug()).toBe(originalSlug);
await pane.getByRole('button', { name: 'Clone site' }).click();
await pane
.getByRole('button', { name: 'I’ve authorized it — clone site' })
.click();

await page.waitForFunction(
(slug) =>
Expand Down
Loading
Loading