From 5865bb576fdd092eb9fa683bab8b3974f29eb3af Mon Sep 17 00:00:00 2001 From: Sam Lord Date: Tue, 26 Nov 2024 12:04:53 +0000 Subject: [PATCH] Fixed invite test Invited staff members no longer need to do a 2fa verification code on the first sign-in --- .../core/test/e2e-browser/portal/invites.spec.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ghost/core/test/e2e-browser/portal/invites.spec.js b/ghost/core/test/e2e-browser/portal/invites.spec.js index 5302113368..8375044d1f 100644 --- a/ghost/core/test/e2e-browser/portal/invites.spec.js +++ b/ghost/core/test/e2e-browser/portal/invites.spec.js @@ -19,7 +19,7 @@ test.describe('Portal', () => { // Set up response listener just before clicking send const responsePromise = sharedPage.waitForResponse( - response => response.url().includes('/api/admin/invites/') && + response => response.url().includes('/api/admin/invites/') && response.request().method() === 'POST' ); @@ -73,15 +73,15 @@ test.describe('Portal', () => { // Enable 2FA await sharedPage.goto('/ghost'); await sharedPage.locator('[data-test-nav="settings"]').click(); - + const section = sharedPage.getByTestId('labs'); await section.getByRole('button', {name: 'Open'}).click(); - + await section.getByRole('tab', {name: 'Alpha features'}).click(); await section.getByLabel('Staff 2FA').click(); }); - test('New staff member can signup using an invite link with 2FA enabled', async ({sharedPage, verificationToken}) => { + test('New staff member can signup using an invite link with 2FA enabled', async ({sharedPage}) => { // Navigate to settings await sharedPage.goto('/ghost'); await sharedPage.locator('[data-test-nav="settings"]').click(); @@ -95,7 +95,7 @@ test.describe('Portal', () => { // Set up response listener just before clicking send const responsePromise = sharedPage.waitForResponse( - response => response.url().includes('/api/admin/invites/') && + response => response.url().includes('/api/admin/invites/') && response.request().method() === 'POST' ); @@ -140,12 +140,7 @@ test.describe('Portal', () => { await sharedPage.getByPlaceholder('At least 10 characters').fill('test123456'); await sharedPage.getByRole('button', {name: 'Create Account →'}).click(); await sharedPage.waitForLoadState('networkidle'); - const verificationCode = await verificationToken.getToken(); - //Enter verification code for 2FA - await sharedPage.locator('[data-test-input="token"]').fill(verificationCode); - await sharedPage.locator('[data-test-button="verify"]').click(); - await sharedPage.waitForLoadState('networkidle'); await expect(sharedPage).toHaveURL(/\/ghost\/#\/.*/); await sharedPage.locator('[data-test-nav="arrow-down"]').click();