From 9bbe3f2f5ff7c0b563fad30051e35e8979cb0ef7 Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Sun, 10 Sep 2023 14:38:20 +0800 Subject: [PATCH] refactor(test): rename directories --- packages/integration-tests/package.json | 2 +- .../src/{ui-helpers => page-helpers}/index.ts | 0 .../src/tests/{ui => console}/bootstrap.test.ts | 0 .../src/tests/{ui => console}/connectors/helpers.ts | 2 +- .../connectors/passwordless-connector-test-cases.ts | 0 .../connectors/passwordless-connectors.test.ts | 2 +- .../connectors/social-connector-test-cases.ts | 0 .../connectors/social-connectors.test.ts | 2 +- .../src/tests/{ui => console}/rbac.test.ts | 2 +- .../sign-in-experience/branding.test.ts | 2 +- .../{ui => console}/sign-in-experience/helpers.ts | 2 +- .../sign-in-experience/sign-in-preview.test.ts | 2 +- .../sign-up-and-sign-in/connector-setup-helpers.ts | 2 +- .../sign-up-and-sign-in/happy-path.test.ts | 2 +- .../sign-in-experience/sign-up-and-sign-in/helpers.ts | 0 .../sign-up-and-sign-in/sad-path.test.ts | 2 +- .../src/tests/{ui => console}/user-management.test.ts | 2 +- .../src/tests/{ui => console}/webhooks.test.ts | 2 +- .../src/tests/main-flow/bootstrap.test.ts | 11 +++++++++++ 19 files changed, 24 insertions(+), 13 deletions(-) rename packages/integration-tests/src/{ui-helpers => page-helpers}/index.ts (100%) rename packages/integration-tests/src/tests/{ui => console}/bootstrap.test.ts (100%) rename packages/integration-tests/src/tests/{ui => console}/connectors/helpers.ts (97%) rename packages/integration-tests/src/tests/{ui => console}/connectors/passwordless-connector-test-cases.ts (100%) rename packages/integration-tests/src/tests/{ui => console}/connectors/passwordless-connectors.test.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/connectors/social-connector-test-cases.ts (100%) rename packages/integration-tests/src/tests/{ui => console}/connectors/social-connectors.test.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/rbac.test.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/branding.test.ts (97%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/helpers.ts (98%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/sign-in-preview.test.ts (98%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/sign-up-and-sign-in/helpers.ts (100%) rename packages/integration-tests/src/tests/{ui => console}/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/user-management.test.ts (99%) rename packages/integration-tests/src/tests/{ui => console}/webhooks.test.ts (99%) create mode 100644 packages/integration-tests/src/tests/main-flow/bootstrap.test.ts diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index abc008a69..6b44ca240 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -14,7 +14,7 @@ "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", "test": "pnpm build && pnpm test:api && pnpm test:ui", "test:api": "pnpm test:only -i ./lib/tests/api/", - "test:ui": "pnpm test:only -i --config=jest.config.ui.js ./lib/tests/ui/", + "test:ui": "pnpm test:only -i --config=jest.config.ui.js ./lib/tests/console/ ./lib/tests/main-flow/", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", "start": "pnpm test" diff --git a/packages/integration-tests/src/ui-helpers/index.ts b/packages/integration-tests/src/page-helpers/index.ts similarity index 100% rename from packages/integration-tests/src/ui-helpers/index.ts rename to packages/integration-tests/src/page-helpers/index.ts diff --git a/packages/integration-tests/src/tests/ui/bootstrap.test.ts b/packages/integration-tests/src/tests/console/bootstrap.test.ts similarity index 100% rename from packages/integration-tests/src/tests/ui/bootstrap.test.ts rename to packages/integration-tests/src/tests/console/bootstrap.test.ts diff --git a/packages/integration-tests/src/tests/ui/connectors/helpers.ts b/packages/integration-tests/src/tests/console/connectors/helpers.ts similarity index 97% rename from packages/integration-tests/src/tests/ui/connectors/helpers.ts rename to packages/integration-tests/src/tests/console/connectors/helpers.ts index f3e7f3cc5..dd4147228 100644 --- a/packages/integration-tests/src/tests/ui/connectors/helpers.ts +++ b/packages/integration-tests/src/tests/console/connectors/helpers.ts @@ -1,7 +1,7 @@ import { ConnectorType } from '@logto/connector-kit'; import { type Page } from 'puppeteer'; -import { expectConfirmModalAndAct, waitForToast } from '#src/ui-helpers/index.js'; +import { expectConfirmModalAndAct, waitForToast } from '#src/page-helpers/index.js'; import { passwordlessConnectorTestCases, diff --git a/packages/integration-tests/src/tests/ui/connectors/passwordless-connector-test-cases.ts b/packages/integration-tests/src/tests/console/connectors/passwordless-connector-test-cases.ts similarity index 100% rename from packages/integration-tests/src/tests/ui/connectors/passwordless-connector-test-cases.ts rename to packages/integration-tests/src/tests/console/connectors/passwordless-connector-test-cases.ts diff --git a/packages/integration-tests/src/tests/ui/connectors/passwordless-connectors.test.ts b/packages/integration-tests/src/tests/console/connectors/passwordless-connectors.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/connectors/passwordless-connectors.test.ts rename to packages/integration-tests/src/tests/console/connectors/passwordless-connectors.test.ts index a34c784c7..924e93974 100644 --- a/packages/integration-tests/src/tests/ui/connectors/passwordless-connectors.test.ts +++ b/packages/integration-tests/src/tests/console/connectors/passwordless-connectors.test.ts @@ -7,7 +7,7 @@ import { goToAdminConsole, expectToSaveChanges, waitForToast, -} from '#src/ui-helpers/index.js'; +} from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { diff --git a/packages/integration-tests/src/tests/ui/connectors/social-connector-test-cases.ts b/packages/integration-tests/src/tests/console/connectors/social-connector-test-cases.ts similarity index 100% rename from packages/integration-tests/src/tests/ui/connectors/social-connector-test-cases.ts rename to packages/integration-tests/src/tests/console/connectors/social-connector-test-cases.ts diff --git a/packages/integration-tests/src/tests/ui/connectors/social-connectors.test.ts b/packages/integration-tests/src/tests/console/connectors/social-connectors.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/connectors/social-connectors.test.ts rename to packages/integration-tests/src/tests/console/connectors/social-connectors.test.ts index 78c47ebea..8d4e96134 100644 --- a/packages/integration-tests/src/tests/ui/connectors/social-connectors.test.ts +++ b/packages/integration-tests/src/tests/console/connectors/social-connectors.test.ts @@ -7,7 +7,7 @@ import { goToAdminConsole, expectToSaveChanges, waitForToast, -} from '#src/ui-helpers/index.js'; +} from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { diff --git a/packages/integration-tests/src/tests/ui/rbac.test.ts b/packages/integration-tests/src/tests/console/rbac.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/rbac.test.ts rename to packages/integration-tests/src/tests/console/rbac.test.ts index 039a9586f..a8136b177 100644 --- a/packages/integration-tests/src/tests/ui/rbac.test.ts +++ b/packages/integration-tests/src/tests/console/rbac.test.ts @@ -4,7 +4,7 @@ import { expectToClickDetailsPageOption, goToAdminConsole, waitForToast, -} from '#src/ui-helpers/index.js'; +} from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname, diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/branding.test.ts b/packages/integration-tests/src/tests/console/sign-in-experience/branding.test.ts similarity index 97% rename from packages/integration-tests/src/tests/ui/sign-in-experience/branding.test.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/branding.test.ts index beaa09fb7..8b9fbf71b 100644 --- a/packages/integration-tests/src/tests/ui/sign-in-experience/branding.test.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/branding.test.ts @@ -1,5 +1,5 @@ import { logtoConsoleUrl as logtoConsoleUrlString } from '#src/constants.js'; -import { goToAdminConsole } from '#src/ui-helpers/index.js'; +import { goToAdminConsole } from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { waitForFormCard, expectToSelectColor, expectToSaveSignInExperience } from './helpers.js'; diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/helpers.ts b/packages/integration-tests/src/tests/console/sign-in-experience/helpers.ts similarity index 98% rename from packages/integration-tests/src/tests/ui/sign-in-experience/helpers.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/helpers.ts index 416333bf8..324127f93 100644 --- a/packages/integration-tests/src/tests/ui/sign-in-experience/helpers.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/helpers.ts @@ -4,7 +4,7 @@ import { expectToSaveChanges, expectConfirmModalAndAct, waitForToast, -} from '#src/ui-helpers/index.js'; +} from '#src/page-helpers/index.js'; export const waitForFormCard = async (page: Page, title: string) => { await expect(page).toMatchElement('div[class$=tabContent] div[class$=card] div[class$=title]', { diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-in-preview.test.ts b/packages/integration-tests/src/tests/console/sign-in-experience/sign-in-preview.test.ts similarity index 98% rename from packages/integration-tests/src/tests/ui/sign-in-experience/sign-in-preview.test.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/sign-in-preview.test.ts index a099fe38b..ce84df9b5 100644 --- a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-in-preview.test.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/sign-in-preview.test.ts @@ -2,7 +2,7 @@ import { type Nullable } from '@silverhand/essentials'; import { type Page, type Target } from 'puppeteer'; import { logtoConsoleUrl as logtoConsoleUrlString, logtoUrl } from '#src/constants.js'; -import { goToAdminConsole } from '#src/ui-helpers/index.js'; +import { goToAdminConsole } from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { expectToSelectPreviewLanguage, waitForFormCard } from './helpers.js'; diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts index 58c6922d3..59a1ef43c 100644 --- a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/connector-setup-helpers.ts @@ -2,7 +2,7 @@ import { ConnectorType } from '@logto/schemas'; import { type Page } from 'puppeteer'; import { logtoConsoleUrl as logtoConsoleUrlString } from '#src/constants.js'; -import { expectToClickDetailsPageOption, waitForToast } from '#src/ui-helpers/index.js'; +import { expectToClickDetailsPageOption, waitForToast } from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts index ebcf69c8d..5b5900ee0 100644 --- a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/happy-path.test.ts @@ -1,5 +1,5 @@ import { logtoConsoleUrl as logtoConsoleUrlString } from '#src/constants.js'; -import { expectToClickNavTab, goToAdminConsole } from '#src/ui-helpers/index.js'; +import { expectToClickNavTab, goToAdminConsole } from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { expectToSaveSignInExperience, waitForFormCard } from '../helpers.js'; diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/helpers.ts b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/helpers.ts similarity index 100% rename from packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/helpers.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/helpers.ts diff --git a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts rename to packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts index 59e931d2e..85d2c0331 100644 --- a/packages/integration-tests/src/tests/ui/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts +++ b/packages/integration-tests/src/tests/console/sign-in-experience/sign-up-and-sign-in/sad-path.test.ts @@ -3,7 +3,7 @@ import { expectToClickNavTab, goToAdminConsole, expectToSaveChanges, -} from '#src/ui-helpers/index.js'; +} from '#src/page-helpers/index.js'; import { expectNavigation, appendPathname } from '#src/utils.js'; import { expectToSaveSignInExperience, waitForFormCard } from '../helpers.js'; diff --git a/packages/integration-tests/src/tests/ui/user-management.test.ts b/packages/integration-tests/src/tests/console/user-management.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/user-management.test.ts rename to packages/integration-tests/src/tests/console/user-management.test.ts index 3ef039eec..7526b9d8f 100644 --- a/packages/integration-tests/src/tests/ui/user-management.test.ts +++ b/packages/integration-tests/src/tests/console/user-management.test.ts @@ -4,7 +4,7 @@ import { expectToSaveChanges, waitForToast, expectToDiscardChanges, -} from '#src/ui-helpers/index.js'; +} from '#src/page-helpers/index.js'; import { appendPathname, expectNavigation, diff --git a/packages/integration-tests/src/tests/ui/webhooks.test.ts b/packages/integration-tests/src/tests/console/webhooks.test.ts similarity index 99% rename from packages/integration-tests/src/tests/ui/webhooks.test.ts rename to packages/integration-tests/src/tests/console/webhooks.test.ts index 3dfb27348..e234c3a77 100644 --- a/packages/integration-tests/src/tests/ui/webhooks.test.ts +++ b/packages/integration-tests/src/tests/console/webhooks.test.ts @@ -1,5 +1,5 @@ import { logtoConsoleUrl as logtoConsoleUrlString } from '#src/constants.js'; -import { goToAdminConsole, expectToSaveChanges, waitForToast } from '#src/ui-helpers/index.js'; +import { goToAdminConsole, expectToSaveChanges, waitForToast } from '#src/page-helpers/index.js'; import { appendPathname, expectNavigation } from '#src/utils.js'; await page.setViewport({ width: 1280, height: 720 }); diff --git a/packages/integration-tests/src/tests/main-flow/bootstrap.test.ts b/packages/integration-tests/src/tests/main-flow/bootstrap.test.ts new file mode 100644 index 000000000..736d6ba79 --- /dev/null +++ b/packages/integration-tests/src/tests/main-flow/bootstrap.test.ts @@ -0,0 +1,11 @@ +/** + * NOTE: This test suite assumes test cases will run sequentially (which is Jest default). + * Parallel execution will lead to errors. + */ +// Tip: See https://github.com/argos-ci/jest-puppeteer/blob/main/packages/expect-puppeteer/README.md +// for convenient expect methods +describe('smoke testing for the main flow', () => { + it('should not explode', async () => { + expect(true); + }); +});