mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added Playwright test for Member Impersonation
ref https://github.com/TryGhost/Team/issues/2371 - tests whether an impersonation link gets generated as well as whether the link authenticates the user on a new page.
This commit is contained in:
parent
31855ba75a
commit
5bd82bc6d7
1 changed files with 18 additions and 0 deletions
|
@ -56,6 +56,24 @@ test.describe('Admin', () => {
|
|||
await expect(memberEmail).toHaveText(email);
|
||||
});
|
||||
|
||||
test('A member can be impersonated', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
await page.locator('.gh-nav a[href="#/members/"]').click();
|
||||
await page.locator('tbody > tr > a').nth(0).click();
|
||||
await page.waitForSelector('[data-test-button="member-actions"]');
|
||||
await page.locator('[data-test-button="member-actions"]').click();
|
||||
await page.getByRole('button', {name: 'Impersonate'}).click();
|
||||
await page.getByRole('button', {name: 'Copy link'}).click();
|
||||
await page.waitForSelector('button span:has-text("Link copied")');
|
||||
// get value from input because we don't have access to the clipboard during headless testing
|
||||
const elem = await page.$('input[name="member-signin-url"]');
|
||||
const link = await elem.inputValue();
|
||||
await page.goto(link);
|
||||
await page.frameLocator('#ghost-portal-root iframe[title="portal-trigger"]').locator('div').nth(1).click();
|
||||
const title = await page.frameLocator('#ghost-portal-root div iframe[title="portal-popup"]').locator('h2').innerText();
|
||||
await expect(title).toEqual('Your account'); // this is the title of the popup when member is logged in
|
||||
});
|
||||
|
||||
test('A member can be deleted', async ({page}) => {
|
||||
await page.goto('/ghost');
|
||||
await page.locator('.gh-nav a[href="#/members/"]').click();
|
||||
|
|
Loading…
Add table
Reference in a new issue