Skip to content

Commit be35c47

Browse files
committed
wip
1 parent f045134 commit be35c47

File tree

5 files changed

+119
-1
lines changed

5 files changed

+119
-1
lines changed

integration/presets/envs.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ const withEmailCodesQuickstart = withEmailCodes
8181
.setEnvVariable('public', 'CLERK_SIGN_IN_URL', '')
8282
.setEnvVariable('public', 'CLERK_SIGN_UP_URL', '');
8383

84+
// Uses staging instance which runs Core 3
85+
const withAPCore3ClerkV6 = environmentConfig()
86+
.setId('withAPCore3ClerkV6')
87+
.setEnvVariable('public', 'CLERK_TELEMETRY_DISABLED', true)
88+
.setEnvVariable('private', 'CLERK_API_URL', 'https://api.clerkstage.dev')
89+
.setEnvVariable('private', 'CLERK_SECRET_KEY', instanceKeys.get('with-billing-staging').sk)
90+
.setEnvVariable('public', 'CLERK_PUBLISHABLE_KEY', instanceKeys.get('with-billing-staging').pk);
91+
8492
// Uses staging instance which runs Core 3
8593
const withAPCore3ClerkLatest = environmentConfig()
8694
.setId('withAPCore3ClerkLatest')
@@ -186,6 +194,7 @@ export const envs = {
186194
sessionsProd1,
187195
withAPIKeys,
188196
withAPCore3ClerkLatest,
197+
withAPCore3ClerkV6,
189198
withBilling,
190199
withBillingJwtV2,
191200
withCustomRoles,

integration/presets/next.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ const appRouterAPWithClerkNextLatest = appRouterQuickstart
2828
.clone()
2929
.setName('next-app-router-ap-clerk-next-latest');
3030

31+
const appRouterAPWithClerkNextV6 = appRouterQuickstart
32+
.clone()
33+
.setName('next-app-router-ap-clerk-next-v6')
34+
.addDependency('@clerk/nextjs', '6');
35+
3136
export const next = {
3237
appRouter,
3338
appRouterTurbo,
3439
appRouterQuickstart,
3540
appRouterAPWithClerkNextLatest,
41+
appRouterAPWithClerkNextV6,
3642
} as const;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
# local env files
28+
.env*.local
29+
30+
# vercel
31+
.vercel
32+
33+
# typescript
34+
*.tsbuildinfo
35+
next-env.d.ts

integration/templates/next-app-router-quickstart/src/app/page.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
1-
import { Show, SignInButton, SignUpButton, UserButton } from '@clerk/nextjs';
1+
import * as Clerk from '@clerk/nextjs';
2+
import type { ComponentType, ReactNode } from 'react';
3+
4+
type ShowProps = {
5+
children: ReactNode;
6+
when: 'signedIn' | 'signedOut';
7+
};
8+
9+
const Show: ComponentType<ShowProps> =
10+
(Clerk as { Show?: ComponentType<ShowProps> }).Show ||
11+
(({ children, when }) => {
12+
const SignedIn = (Clerk as { SignedIn?: ComponentType<{ children: ReactNode }> }).SignedIn;
13+
const SignedOut = (Clerk as { SignedOut?: ComponentType<{ children: ReactNode }> }).SignedOut;
14+
15+
if (when === 'signedIn' && SignedIn) {
16+
return <SignedIn>{children}</SignedIn>;
17+
}
18+
19+
if (when === 'signedOut' && SignedOut) {
20+
return <SignedOut>{children}</SignedOut>;
21+
}
22+
23+
return null;
24+
});
25+
26+
const SignInButton = (Clerk as { SignInButton: ComponentType }).SignInButton;
27+
const SignUpButton = (Clerk as { SignUpButton: ComponentType }).SignUpButton;
28+
const UserButton = (Clerk as { UserButton: ComponentType }).UserButton;
229

330
export default function Home() {
431
return (
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { test } from '@playwright/test';
2+
3+
import type { Application } from '../../models/application';
4+
import { appConfigs } from '../../presets';
5+
import type { FakeUser } from '../../testUtils';
6+
import { createTestUtils } from '../../testUtils';
7+
import { testSignIn, testSignUp, testSSR } from './common';
8+
9+
test.describe('Next with ClerkJS V6 <-> Account Portal Core 3 @ap-flows', () => {
10+
test.describe.configure({ mode: 'serial' });
11+
let app: Application;
12+
let fakeUser: FakeUser;
13+
14+
test.beforeAll(async () => {
15+
test.setTimeout(90_000); // Wait for app to be ready
16+
app = await appConfigs.next.appRouterAPWithClerkNextV6.clone().commit();
17+
await app.setup();
18+
await app.withEnv(appConfigs.envs.withAPCore3ClerkV6);
19+
await app.dev();
20+
const u = createTestUtils({ app });
21+
fakeUser = u.services.users.createFakeUser();
22+
await u.services.users.createBapiUser(fakeUser);
23+
});
24+
25+
test.afterAll(async () => {
26+
await fakeUser.deleteIfExists();
27+
await app.teardown();
28+
});
29+
30+
test('sign in', async ({ page, context }) => {
31+
await testSignIn({ app, page, context, fakeUser });
32+
});
33+
34+
test('sign up', async ({ page, context }) => {
35+
await testSignUp({ app, page, context, fakeUser });
36+
});
37+
38+
test('ssr', async ({ page, context }) => {
39+
await testSSR({ app, page, context, fakeUser });
40+
});
41+
});

0 commit comments

Comments
 (0)