Skip to content

Commit 548ca65

Browse files
committed
fix(e2e): simplify billing tests and fix environment configuration
Simplified billing-related integration tests by removing explicit environment constraints. Tests now run against the default withBilling environment instead of requiring explicit withEnv configuration, reducing test setup complexity. Fixed withBillingJwtV2 environment configuration: - Removed staging API URL override (now uses default production API) - Changed from 'with-billing-staging' to 'with-billing' instance keys - This aligns the test environment with the production billing setup Added CLERK_JS_URL and CLERK_UI_URL to withCustomRoles environment to support local development and CI testing scenarios where custom Clerk script URLs are needed. Also fixed minor typo in test name and removed extraneous blank line.
1 parent 9b56b36 commit 548ca65

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

integration/presets/envs.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ const withCustomRoles = base
6565
.clone()
6666
.setId('withCustomRoles')
6767
.setEnvVariable('private', 'CLERK_SECRET_KEY', instanceKeys.get('with-custom-roles').sk)
68-
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-custom-roles').pk);
68+
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-custom-roles').pk)
69+
.setEnvVariable('public', 'CLERK_JS_URL', constants.E2E_APP_CLERK_JS || 'http://localhost:18211/clerk.browser.js')
70+
.setEnvVariable('public', 'CLERK_UI_URL', constants.E2E_APP_CLERK_UI || 'http://localhost:18212/ui.browser.js');
6971

7072
const withReverification = base
7173
.clone()
@@ -165,9 +167,8 @@ const withSessionTasksResetPassword = base
165167
const withBillingJwtV2 = base
166168
.clone()
167169
.setId('withBillingJwtV2')
168-
.setEnvVariable('private', 'CLERK_API_URL', 'https://api.clerkstage.dev')
169-
.setEnvVariable('private', 'CLERK_SECRET_KEY', instanceKeys.get('with-billing-staging').sk)
170-
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-billing-staging').pk);
170+
.setEnvVariable('private', 'CLERK_SECRET_KEY', instanceKeys.get('with-billing').sk)
171+
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-billing').pk);
171172

172173
const withBilling = base
173174
.clone()

integration/tests/billing-hooks.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { expect, test } from '@playwright/test';
22

3-
import { appConfigs } from '../presets';
43
import type { FakeUser } from '../testUtils';
54
import { createTestUtils, testAgainstRunningApps } from '../testUtils';
65

7-
testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('billing hooks @billing', ({ app }) => {
6+
testAgainstRunningApps({})('billing hooks @billing', ({ app }) => {
87
test.describe.configure({ mode: 'parallel' });
98
test.skip(!app.name.includes('next'), 'Skipping: Only runs on next');
109

integration/tests/pricing-table.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import type { Locator } from '@playwright/test';
22
import { expect, test } from '@playwright/test';
33

4-
import { appConfigs } from '../presets';
54
import type { FakeUser } from '../testUtils';
65
import { createTestUtils, testAgainstRunningApps } from '../testUtils';
76

8-
testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing table @billing', ({ app }) => {
7+
testAgainstRunningApps({})('pricing table @billing', ({ app }) => {
98
test.describe.configure({ mode: 'parallel' });
109

1110
let fakeUser: FakeUser;
@@ -639,7 +638,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
639638
await fakeUser.deleteIfExists();
640639
});
641640

642-
test('displays notice then plan cannot change', async ({ page, context }) => {
641+
test('displays notice the plan cannot change', async ({ page, context }) => {
643642
const u = createTestUtils({ app, page, context });
644643

645644
const fakeUser = u.services.users.createFakeUser();
@@ -657,7 +656,6 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
657656
await u.po.checkout.fillTestCard();
658657
await u.po.checkout.clickPayOrSubscribe();
659658
await expect(u.po.page.getByText('Payment was successful!')).toBeVisible();
660-
661659
await u.po.checkout.confirmAndContinue();
662660
await u.po.pricingTable.startCheckout({ planSlug: 'pro', shouldSwitch: true, period: 'monthly' });
663661
await u.po.checkout.waitForMounted();

0 commit comments

Comments
 (0)