diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index d51c0e494..5731af576 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -15,6 +15,9 @@ jobs: package: runs-on: buildjet-4vcpu-ubuntu-2204 + env: + INTEGRATION_TEST: true + steps: - uses: actions/checkout@v4 diff --git a/packages/console/src/consts/env.ts b/packages/console/src/consts/env.ts index 147fa6d25..b2406a527 100644 --- a/packages/console/src/consts/env.ts +++ b/packages/console/src/consts/env.ts @@ -3,3 +3,6 @@ import { yes } from '@silverhand/essentials'; export const isProduction = process.env.NODE_ENV === 'production'; export const isCloud = yes(process.env.IS_CLOUD); export const adminEndpoint = process.env.ADMIN_ENDPOINT; +// eslint-disable-next-line unicorn/prevent-abbreviations -- we love dev +export const isDevFeaturesEnabled = + yes(process.env.DEV_FEATURES_ENABLED) || yes(process.env.INTEGRATION_TEST); diff --git a/packages/console/src/pages/SignInExperience/index.tsx b/packages/console/src/pages/SignInExperience/index.tsx index aef0f8c95..294da8e0a 100644 --- a/packages/console/src/pages/SignInExperience/index.tsx +++ b/packages/console/src/pages/SignInExperience/index.tsx @@ -12,7 +12,7 @@ import useSWR from 'swr'; import RequestDataError from '@/components/RequestDataError'; import SubmitFormChangesActionBar from '@/components/SubmitFormChangesActionBar'; import UnsavedChangesAlertModal from '@/components/UnsavedChangesAlertModal'; -import { isCloud } from '@/consts/env'; +import { isCloud, isDevFeaturesEnabled } from '@/consts/env'; import CardTitle from '@/ds-components/CardTitle'; import ConfirmModal from '@/ds-components/ConfirmModal'; import TabNav, { TabNavItem } from '@/ds-components/TabNav'; @@ -218,8 +218,7 @@ function SignInExperience() { <PageTab href="../content" errorCount={getContentErrorCount(errors)}> {t('sign_in_exp.tabs.content')} </PageTab> - {/* Remove the `isCloud` check until all the changes are merged */} - {isCloud && ( + {isDevFeaturesEnabled && ( <PageTab href="../password-policy">{t('sign_in_exp.tabs.password_policy')}</PageTab> )} </TabNav> diff --git a/packages/integration-tests/src/tests/console/sign-in-experience/password-policy.test.ts b/packages/integration-tests/src/tests/console/sign-in-experience/password-policy.test.ts index d3cf21fe6..8dddc61ad 100644 --- a/packages/integration-tests/src/tests/console/sign-in-experience/password-policy.test.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/password-policy.test.ts @@ -1,11 +1,10 @@ import ExpectConsole from '#src/ui-helpers/expect-console.js'; import { getInputValue } from '#src/ui-helpers/index.js'; -const expectConsole = new ExpectConsole(await browser.newPage(), { tenantId: 'default' }); +const expectConsole = new ExpectConsole(await browser.newPage()); -// Skip this test suite since it's not public yet -describe.skip('sign-in experience: password policy', () => { - it('navigate to sign-in experience page', async () => { +describe('sign-in experience: password policy', () => { + it('navigates to sign-in experience page', async () => { await expectConsole.start(); await expectConsole.gotoPage('/sign-in-experience', 'Sign-in experience'); await expectConsole.toClickTab('Password policy'); diff --git a/packages/integration-tests/src/ui-helpers/expect-console.ts b/packages/integration-tests/src/ui-helpers/expect-console.ts index c533ab66e..9d608ed17 100644 --- a/packages/integration-tests/src/ui-helpers/expect-console.ts +++ b/packages/integration-tests/src/ui-helpers/expect-console.ts @@ -53,7 +53,7 @@ export default class ExpectConsole extends ExpectPage { async gotoPage(pathname: string, title: ConsoleTitle) { await this.navigateTo(this.buildUrl(path.join(this.options.tenantId, pathname))); await expect(this.page).toMatchElement( - 'div[class$=main] div[class$=container] div[class$=cardTitle]', + 'div[class*=_main] div[class*=_container] div[class*=_cardTitle]', { text: title } ); } @@ -67,7 +67,7 @@ export default class ExpectConsole extends ExpectPage { await Promise.all( titles.map(async (title) => { return expect(this.page).toMatchElement( - 'div[class$=tabContent] div[class$=card] div[class$=title]', + 'div[class*=_tabContent] div[class*=_card] div[class*=_title]', { text: new RegExp(title, 'i'), visible: true } ); }) @@ -78,7 +78,7 @@ export default class ExpectConsole extends ExpectPage { const fieldTitle = await expect(this.page).toMatchElement( // Use `:has()` for a quick and dirty way to match the field title. // Not harmful in most cases. - 'div[class$=field]:has(div[class$=title])', + 'div[class*=_field]:has(div[class*=_title])', { text: new RegExp(title, 'i'), visible: true, @@ -100,7 +100,7 @@ export default class ExpectConsole extends ExpectPage { * Click a `<nav>` navigation tab (not the page tab) in the Console. */ async toClickTab(tabName: string | RegExp) { - await expect(this.page).toClick(`nav div[class$=item] div[class$=link] a`, { text: tabName }); + await expect(this.page).toClick(`nav div[class*=_item] div[class*=_link] a`, { text: tabName }); } async toSaveChanges(confirmation?: string | RegExp) {