diff --git a/ghost/core/test/e2e-browser/admin/portal-settings.spec.js b/ghost/core/test/e2e-browser/admin/portal-settings.spec.js index 75d69c6fec77..461af941996c 100644 --- a/ghost/core/test/e2e-browser/admin/portal-settings.spec.js +++ b/ghost/core/test/e2e-browser/admin/portal-settings.spec.js @@ -19,68 +19,68 @@ test.describe('Portal Settings', () => { test('can open portal on default page', async ({sharedPage}) => { const modal = await openPortalLinks(sharedPage); + // fetch portal default url from input const portalUrl = await modal.getByLabel('Default:').inputValue(); await sharedPage.goto(portalUrl); const portalFrame = sharedPage.locator('[data-testid="portal-popup-frame"]'); - // Wait for frame to be attached and visible + // check portal popup is opened await expect(portalFrame).toBeVisible(); }); test('can open portal on signin page', async ({sharedPage}) => { const modal = await openPortalLinks(sharedPage); + // fetch portal signin url from input const portalUrl = await modal.getByLabel('Sign in').inputValue(); await sharedPage.goto(portalUrl); const portalFrame = sharedPage.locator('[data-testid="portal-popup-frame"]'); - - // Wait for frame to be attached and visible first - await expect(portalFrame).toBeVisible(); - const portalFrameLocator = sharedPage.frameLocator('[data-testid="portal-popup-frame"]'); - - // Wait for the frame content to be loaded - await expect(portalFrameLocator.locator('.gh-portal-signin')).toBeVisible({timeout: 15000}); - await expect(portalFrameLocator.getByRole('heading', {name: 'Sign in'})).toBeVisible({timeout: 15000}); + + // check portal popup is opened + await expect(portalFrame).toBeVisible(); + // check signin page is opened in portal + await expect(portalFrameLocator.getByRole('heading', {name: 'Sign in'})).toBeVisible(); }); test('can open portal on signup page', async ({sharedPage}) => { const modal = await openPortalLinks(sharedPage); + // fetch portal signup url from input const portalUrl = await modal.getByLabel('Sign up').inputValue(); await sharedPage.goto(portalUrl); const portalFrame = sharedPage.locator('[data-testid="portal-popup-frame"]'); - - // Wait for frame to be attached and visible first - await expect(portalFrame).toBeVisible(); - const portalFrameLocator = sharedPage.frameLocator('[data-testid="portal-popup-frame"]'); - - // Wait for the frame content to be loaded - await expect(portalFrameLocator.locator('.gh-portal-signup')).toBeVisible({timeout: 15000}); + + // check portal popup is opened + await expect(portalFrame).toBeVisible(); + // check signup page is opened in portal + await expect(portalFrameLocator.locator('.gh-portal-signup')).toBeVisible(); }); test('can open portal directly on monthly signup', async ({sharedPage}) => { const modal = await openPortalLinks(sharedPage); + // fetch and go to portal directly monthly signup url const portalUrl = await modal.getByLabel('Signup / Monthly').inputValue(); await sharedPage.goto(portalUrl); - // Wait longer for Stripe checkout to load - await sharedPage.waitForURL(/^https:\/\/checkout.stripe.com/, {timeout: 15000}); + // expect stripe checkout to have opeened + await sharedPage.waitForURL(/^https:\/\/checkout.stripe.com/); }); test('can open portal directly on yearly signup', async ({sharedPage}) => { const modal = await openPortalLinks(sharedPage); + // fetch and go to portal directly yearly signup url const portalUrl = await modal.getByLabel('Signup / Yearly').inputValue(); await sharedPage.goto(portalUrl); - // Wait longer for Stripe checkout to load - await sharedPage.waitForURL(/^https:\/\/checkout.stripe.com/, {timeout: 15000}); + // expect stripe checkout to have opeened + await sharedPage.waitForURL(/^https:\/\/checkout.stripe.com/); }); }); });