From 4bb9d5e385f94c781965830ecc26ccd9a0f34dab Mon Sep 17 00:00:00 2001 From: Austin Turner Date: Fri, 22 Nov 2024 18:14:35 -0700 Subject: [PATCH] Add tests for frontdoor login Ensure that frontdoor login works --- apps/jetstream-e2e/playwright.config.ts | 2 +- .../src/pageObjectModels/OrganizationsPage.ts | 5 ++--- apps/jetstream-e2e/src/tests/orgs/orgs.spec.ts | 9 +++++++++ libs/shared/ui-core/src/orgs/OrgInfoPopover.tsx | 1 + libs/ui/src/lib/popover/Popover.tsx | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/jetstream-e2e/playwright.config.ts b/apps/jetstream-e2e/playwright.config.ts index 7b21ef2f..8cdb3a74 100644 --- a/apps/jetstream-e2e/playwright.config.ts +++ b/apps/jetstream-e2e/playwright.config.ts @@ -61,7 +61,7 @@ export default defineConfig({ }, testMatch: /.*\.spec\.ts/, dependencies: ['setup'], - teardown: 'teardown', + // teardown: 'teardown', }, // { diff --git a/apps/jetstream-e2e/src/pageObjectModels/OrganizationsPage.ts b/apps/jetstream-e2e/src/pageObjectModels/OrganizationsPage.ts index d8d2b8a8..fbe31dbc 100644 --- a/apps/jetstream-e2e/src/pageObjectModels/OrganizationsPage.ts +++ b/apps/jetstream-e2e/src/pageObjectModels/OrganizationsPage.ts @@ -77,12 +77,11 @@ export class OrganizationsPage { try { const allowLocator = salesforcePage.getByRole('button', { name: 'Allow' }); - await expect(allowLocator).toBeVisible({ timeout: 1000 }); + await allowLocator.waitFor({ state: 'visible', timeout: 20000 }); await allowLocator.click(); } catch { - // ignore error - this is expected if the org is already authorized + // ignore error - this is expected if the org has already consented } - await pageClosePromise; } diff --git a/apps/jetstream-e2e/src/tests/orgs/orgs.spec.ts b/apps/jetstream-e2e/src/tests/orgs/orgs.spec.ts index e2039332..6c2f51cd 100644 --- a/apps/jetstream-e2e/src/tests/orgs/orgs.spec.ts +++ b/apps/jetstream-e2e/src/tests/orgs/orgs.spec.ts @@ -27,6 +27,15 @@ test.describe('Salesforce Orgs + Jetstream Orgs', () => { await expect(organizationsPage.orgDropdown).toHaveValue(environment.TEST_ORG_2); }); + await test.step('Ensure frontdoor login works', async () => { + await page.getByPlaceholder('Select an Org').click(); + await page.getByTestId('header').getByTestId('org-info-popover-button').click(); + await page.getByRole('link', { name: 'Setup Menu' }).click(); + const salesforcePage = await page.waitForEvent('popup'); + await salesforcePage.getByRole('tab', { name: 'Object Manager' }).click(); + await salesforcePage.close(); + }); + await test.step('Add an org with a custom domain', async () => { await organizationsPage.addSalesforceOrg(environment.TEST_ORG_3, environment.E2E_LOGIN_PASSWORD, { type: 'custom', diff --git a/libs/shared/ui-core/src/orgs/OrgInfoPopover.tsx b/libs/shared/ui-core/src/orgs/OrgInfoPopover.tsx index c67c3556..80efc5a9 100644 --- a/libs/shared/ui-core/src/orgs/OrgInfoPopover.tsx +++ b/libs/shared/ui-core/src/orgs/OrgInfoPopover.tsx @@ -353,6 +353,7 @@ export const OrgInfoPopover: FunctionComponent = ({ } buttonProps={{ className: iconButtonClassName || 'slds-button slds-button_icon', + 'data-testid': 'org-info-popover-button', }} > diff --git a/libs/ui/src/lib/popover/Popover.tsx b/libs/ui/src/lib/popover/Popover.tsx index 183b4807..efa12ed8 100644 --- a/libs/ui/src/lib/popover/Popover.tsx +++ b/libs/ui/src/lib/popover/Popover.tsx @@ -37,7 +37,7 @@ export interface PopoverProps { header?: JSX.Element; footer?: JSX.Element; panelStyle?: CSSProperties; - buttonProps: React.HTMLProps & { as?: string }; + buttonProps: React.HTMLProps & { as?: string; 'data-testid'?: string }; panelProps?: Omit, 'children' | 'className' | 'as' | 'refName' | 'onKeyDown'>; buttonStyle?: CSSProperties; size?: SmallMediumLarge | sizeXLarge | FullWidth;