Skip to content

Commit eec60c7

Browse files
committed
chore(e2e): update integration presets and simplify test configuration
Simplified integration test configuration and removed redundant setup: - Removed 'integration' dist-tag from linkPackage calls in all presets (astro, express, react, custom-flows) since tests now use snapshot versions from Verdaccio - Renamed CLEANUP to E2E_CLEANUP in constants for better namespacing with other E2E environment variables - Removed manual clerkSetup() calls from custom-flows tests since this is now handled automatically in Application.dev() - Converted machine-auth component test from testAgainstRunningApps pattern to inline app creation, providing more flexibility and reducing long-running app dependencies - Removed MAILSAC_API_KEY from .env.local.sample as mailsac is no longer used - Updated README.md to reflect these changes These changes reduce boilerplate and test complexity while maintaining the same test coverage.
1 parent 548ca65 commit eec60c7

File tree

11 files changed

+28
-56
lines changed

11 files changed

+28
-56
lines changed

integration/.env.local.sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
MAILSAC_API_KEY=
21
VERCEL_PROJECT_ID=
32
VERCEL_ORG_ID=
43
VERCEL_TOKEN=

integration/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ Below you can find code snippets for running tests in a specific manner, easily
7575

7676
#### Keep temporary site
7777

78-
During E2E runs a temporary site is created in which the template is copied into. If you want to keep the site around, pass the `CLEANUP` environment variable:
78+
During E2E runs a temporary site is created in which the template is copied into. If you want to keep the site around, pass the `E2E_CLEANUP` environment variable:
7979

8080
```shell
81-
CLEANUP=0 pnpm test:integration:base
81+
E2E_CLEANUP=0 pnpm test:integration:base
8282
```
8383

8484
For all available environment variables, check the [`constants.ts`](../integration/constants.ts) file.
@@ -578,7 +578,6 @@ Before writing tests, it's important to understand how Playwright handles test i
578578
> [!NOTE]
579579
> The test suite also uses these environment variables to run some tests:
580580
>
581-
> - `MAILSAC_API_KEY`: Used for [Mailsac](https://mailsac.com/) to retrieve email codes and magic links from temporary email addresses.
582581
> - `VERCEL_PROJECT_ID`: Only required if you plan on running deployment tests locally. This is the Vercel project ID, and it points to an application created via the Vercel dashboard. The easiest way to get access to it is by linking a local app to the Vercel project using the Vercel CLI, and then copying the values from the `.vercel` directory.
583582
> - `VERCEL_ORG_ID`: The organization that owns the Vercel project. See above for more details.
584583
> - `VERCEL_TOKEN`: A personal access token. This corresponds to a real user running the deployment command. Attention: Be extra careful with this token as it can't be scoped to a single Vercel project, meaning that the token has access to every project in the account it belongs to.

integration/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export const constants = {
3838
*/
3939
E2E_APP_CLERK_UI_DIR: process.env.E2E_APP_CLERK_UI_DIR,
4040
/**
41-
* If CLEANUP=0 is used, the .tmp_integration directory will not be deleted.
41+
* If E2E_CLEANUP=0 is used, the .tmp_integration directory will not be deleted.
4242
* This is useful for debugging locally.
4343
*/
44-
CLEANUP: !(process.env.CLEANUP === '0' || process.env.CLEANUP === 'false'),
44+
E2E_CLEANUP: !(process.env.E2E_CLEANUP === '0' || process.env.E2E_CLEANUP === 'false'),
4545
DEBUG: process.env.DEBUG === 'true' || process.env.DEBUG === '1',
4646
/**
4747
* Used with E2E_APP_URL if the tests need to access BAPI.

integration/presets/astro.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const astroNode = applicationConfig()
1010
.addScript('dev', 'pnpm dev')
1111
.addScript('build', 'pnpm build')
1212
.addScript('serve', 'pnpm preview')
13-
.addDependency('@clerk/astro', linkPackage('astro', 'integration'))
14-
.addDependency('@clerk/shared', linkPackage('shared', 'integration'))
15-
.addDependency('@clerk/localizations', linkPackage('localizations', 'integration'));
13+
.addDependency('@clerk/astro', linkPackage('astro'))
14+
.addDependency('@clerk/shared', linkPackage('shared'))
15+
.addDependency('@clerk/localizations', linkPackage('localizations'));
1616

1717
const astroStatic = astroNode.clone().setName('astro-hybrid').useTemplate(templates['astro-hybrid']);
1818

integration/presets/custom-flows.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const reactVite = applicationConfig()
1010
.addScript('dev', 'pnpm dev')
1111
.addScript('build', 'pnpm build')
1212
.addScript('serve', 'pnpm preview')
13-
.addDependency('@clerk/react', linkPackage('react', 'integration'))
14-
.addDependency('@clerk/shared', linkPackage('shared', 'integration'))
15-
.addDependency('@clerk/ui', linkPackage('ui', 'integration'));
13+
.addDependency('@clerk/react', linkPackage('react'))
14+
.addDependency('@clerk/shared', linkPackage('shared'))
15+
.addDependency('@clerk/ui', linkPackage('ui'));
1616

1717
export const customFlows = {
1818
reactVite,

integration/presets/express.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const vite = applicationConfig()
1010
.addScript('dev', 'pnpm dev')
1111
.addScript('build', 'pnpm build')
1212
.addScript('serve', 'pnpm start')
13-
.addDependency('@clerk/express', linkPackage('express', 'integration'))
14-
.addDependency('@clerk/clerk-js', linkPackage('clerk-js', 'integration'))
15-
.addDependency('@clerk/ui', linkPackage('ui', 'integration'));
13+
.addDependency('@clerk/express', linkPackage('express'))
14+
.addDependency('@clerk/clerk-js', linkPackage('clerk-js'))
15+
.addDependency('@clerk/ui', linkPackage('ui'));
1616

1717
export const express = {
1818
vite,

integration/presets/react.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const cra = applicationConfig()
1010
.addScript('dev', 'pnpm start')
1111
.addScript('build', 'pnpm build')
1212
.addScript('serve', 'pnpm start')
13-
.addDependency('@clerk/react', linkPackage('react', 'integration'))
14-
.addDependency('@clerk/shared', linkPackage('shared', 'integration'))
15-
.addDependency('@clerk/ui', linkPackage('ui', 'integration'));
13+
.addDependency('@clerk/react', linkPackage('react'))
14+
.addDependency('@clerk/shared', linkPackage('shared'))
15+
.addDependency('@clerk/ui', linkPackage('ui'));
1616

1717
const vite = cra
1818
.clone()

integration/tests/custom-flows/sign-in.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { parsePublishableKey } from '@clerk/shared/keys';
2-
import { clerkSetup } from '@clerk/testing/playwright';
31
import { expect, test } from '@playwright/test';
42

53
import type { Application } from '../../models/application';
@@ -19,20 +17,6 @@ test.describe('Custom Flows Sign In @custom', () => {
1917
await app.withEnv(appConfigs.envs.withEmailCodes);
2018
await app.dev();
2119

22-
const publishableKey = appConfigs.envs.withEmailCodes.publicVariables.get('CLERK_PUBLISHABLE_KEY');
23-
const secretKey = appConfigs.envs.withEmailCodes.privateVariables.get('CLERK_SECRET_KEY');
24-
const apiUrl = appConfigs.envs.withEmailCodes.privateVariables.get('CLERK_API_URL');
25-
const { frontendApi: frontendApiUrl } = parsePublishableKey(publishableKey);
26-
27-
await clerkSetup({
28-
publishableKey,
29-
frontendApiUrl,
30-
secretKey,
31-
// @ts-expect-error
32-
apiUrl,
33-
dotenv: false,
34-
});
35-
3620
const u = createTestUtils({ app });
3721
fakeUser = u.services.users.createFakeUser({
3822
fictionalEmail: true,

integration/tests/custom-flows/sign-up.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { parsePublishableKey } from '@clerk/shared/keys';
2-
import { clerkSetup } from '@clerk/testing/playwright';
31
import { expect, test } from '@playwright/test';
42

53
import type { Application } from '../../models/application';
@@ -19,20 +17,6 @@ test.describe('Custom Flows Sign Up @custom', () => {
1917
await app.withEnv(appConfigs.envs.withEmailCodes);
2018
await app.dev();
2119

22-
const publishableKey = appConfigs.envs.withEmailCodes.publicVariables.get('CLERK_PUBLISHABLE_KEY');
23-
const secretKey = appConfigs.envs.withEmailCodes.privateVariables.get('CLERK_SECRET_KEY');
24-
const apiUrl = appConfigs.envs.withEmailCodes.privateVariables.get('CLERK_API_URL');
25-
const { frontendApi: frontendApiUrl } = parsePublishableKey(publishableKey);
26-
27-
await clerkSetup({
28-
publishableKey,
29-
frontendApiUrl,
30-
secretKey,
31-
// @ts-expect-error
32-
apiUrl,
33-
dotenv: false,
34-
});
35-
3620
const u = createTestUtils({ app });
3721
fakeUser = u.services.users.createFakeUser({
3822
fictionalEmail: true,

integration/tests/global.teardown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ setup('teardown long running apps', async () => {
1212
await killClerkJsHttpServer();
1313
await killClerkUiHttpServer();
1414

15-
if (appUrl || !constants.CLEANUP) {
15+
if (appUrl || !constants.E2E_CLEANUP) {
1616
// if appUrl is provided, it means that the user is running an app manually
1717
console.log('Skipping cleanup');
1818
return;

0 commit comments

Comments
 (0)