diff --git a/integration/templates/next-app-router/src/app/create-organization/page.tsx b/integration/templates/next-app-router/src/app/create-organization/page.tsx new file mode 100644 index 0000000000..ee02fb133d --- /dev/null +++ b/integration/templates/next-app-router/src/app/create-organization/page.tsx @@ -0,0 +1,9 @@ +import { CreateOrganization } from '@clerk/nextjs'; + +export default function Page() { + return ( +
+ Loading create organization} /> +
+ ); +} diff --git a/integration/templates/next-app-router/src/app/organization-list/page.tsx b/integration/templates/next-app-router/src/app/organization-list/page.tsx new file mode 100644 index 0000000000..ac4e1e6a5f --- /dev/null +++ b/integration/templates/next-app-router/src/app/organization-list/page.tsx @@ -0,0 +1,9 @@ +import { OrganizationList } from '@clerk/nextjs'; + +export default function Page() { + return ( +
+ Loading organization list} /> +
+ ); +} diff --git a/integration/templates/next-app-router/src/app/organization-profile/page.tsx b/integration/templates/next-app-router/src/app/organization-profile/page.tsx new file mode 100644 index 0000000000..2145cf662b --- /dev/null +++ b/integration/templates/next-app-router/src/app/organization-profile/page.tsx @@ -0,0 +1,12 @@ +import { OrganizationProfile } from '@clerk/nextjs'; + +export default function Page() { + return ( +
+ Loading organization profile} + /> +
+ ); +} diff --git a/integration/templates/next-app-router/src/app/page.tsx b/integration/templates/next-app-router/src/app/page.tsx index 0151dfe307..a4fd6f599c 100644 --- a/integration/templates/next-app-router/src/app/page.tsx +++ b/integration/templates/next-app-router/src/app/page.tsx @@ -1,4 +1,4 @@ -import { SignedIn, SignedOut, SignIn, UserButton, Protect } from '@clerk/nextjs'; +import { SignedIn, SignedOut, SignIn, UserButton, Protect, OrganizationSwitcher } from '@clerk/nextjs'; import Link from 'next/link'; import { ClientId } from './client-id'; @@ -6,6 +6,7 @@ export default function Home() { return (
Loading user button} /> + Loading organization switcher} /> SignedIn SignedOut diff --git a/integration/templates/next-app-router/src/app/waitlist/page.tsx b/integration/templates/next-app-router/src/app/waitlist/page.tsx new file mode 100644 index 0000000000..5638940a29 --- /dev/null +++ b/integration/templates/next-app-router/src/app/waitlist/page.tsx @@ -0,0 +1,9 @@ +import { Waitlist } from '@clerk/nextjs'; + +export default function Page() { + return ( +
+ Loading waitlist} /> +
+ ); +} diff --git a/integration/templates/react-vite/src/App.tsx b/integration/templates/react-vite/src/App.tsx index 98e3530af6..3696ded74d 100644 --- a/integration/templates/react-vite/src/App.tsx +++ b/integration/templates/react-vite/src/App.tsx @@ -6,7 +6,7 @@ function App() { return (
- + Loading organization switcher} /> SignedOut SignedIn diff --git a/integration/templates/react-vite/src/create-organization/index.tsx b/integration/templates/react-vite/src/create-organization/index.tsx new file mode 100644 index 0000000000..7f268110e7 --- /dev/null +++ b/integration/templates/react-vite/src/create-organization/index.tsx @@ -0,0 +1,9 @@ +import { CreateOrganization } from '@clerk/clerk-react'; + +export default function Page() { + return ( +
+ Loading create organization} /> +
+ ); +} diff --git a/integration/templates/react-vite/src/main.tsx b/integration/templates/react-vite/src/main.tsx index 015a037595..f011cf9726 100644 --- a/integration/templates/react-vite/src/main.tsx +++ b/integration/templates/react-vite/src/main.tsx @@ -12,6 +12,10 @@ import UserProfileCustom from './custom-user-profile'; import UserButtonCustom from './custom-user-button'; import UserButtonCustomTrigger from './custom-user-button-trigger'; import UserButton from './user-button'; +import Waitlist from './waitlist'; +import OrganizationProfile from './organization-profile'; +import OrganizationList from './organization-list'; +import CreateOrganization from './create-organization'; const Root = () => { const navigate = useNavigate(); @@ -74,6 +78,22 @@ const router = createBrowserRouter([ path: '/custom-user-button-trigger', element: , }, + { + path: '/waitlist', + element: , + }, + { + path: '/organization-profile', + element: , + }, + { + path: '/organization-list', + element: , + }, + { + path: '/create-organization', + element: , + }, ], }, ]); diff --git a/integration/templates/react-vite/src/organization-list/index.tsx b/integration/templates/react-vite/src/organization-list/index.tsx new file mode 100644 index 0000000000..393856f058 --- /dev/null +++ b/integration/templates/react-vite/src/organization-list/index.tsx @@ -0,0 +1,9 @@ +import { OrganizationList } from '@clerk/clerk-react'; + +export default function Page() { + return ( +
+ Loading organization list} /> +
+ ); +} diff --git a/integration/templates/react-vite/src/organization-profile/index.tsx b/integration/templates/react-vite/src/organization-profile/index.tsx new file mode 100644 index 0000000000..144b8b1a53 --- /dev/null +++ b/integration/templates/react-vite/src/organization-profile/index.tsx @@ -0,0 +1,12 @@ +import { OrganizationProfile } from '@clerk/clerk-react'; + +export default function Page() { + return ( +
+ Loading organization profile} + /> +
+ ); +} diff --git a/integration/templates/react-vite/src/waitlist/index.tsx b/integration/templates/react-vite/src/waitlist/index.tsx new file mode 100644 index 0000000000..effbf8a5a4 --- /dev/null +++ b/integration/templates/react-vite/src/waitlist/index.tsx @@ -0,0 +1,9 @@ +import { Waitlist } from '@clerk/clerk-react'; + +export default function Page() { + return ( +
+ Loading waitlist} /> +
+ ); +} diff --git a/integration/testUtils/appPageObject.ts b/integration/testUtils/appPageObject.ts index 70b2b21832..306c293a39 100644 --- a/integration/testUtils/appPageObject.ts +++ b/integration/testUtils/appPageObject.ts @@ -13,7 +13,7 @@ export const createAppPageObject = (testArgs: { page: Page }, app: Application) // do not fail the test if interstitial is returned (401) } }, - goToRelative: (path: string, opts: { searchParams?: URLSearchParams; timeout?: number } = {}) => { + goToRelative: (path: string, opts: { waitUntil?: any; searchParams?: URLSearchParams; timeout?: number } = {}) => { let url: URL; try { @@ -35,7 +35,7 @@ export const createAppPageObject = (testArgs: { page: Page }, app: Application) if (opts.searchParams) { url.search = opts.searchParams.toString(); } - return page.goto(url.toString(), { timeout: opts.timeout ?? 20000 }); + return page.goto(url.toString(), { timeout: opts.timeout ?? 20000, waitUntil: opts.waitUntil }); }, waitForClerkJsLoaded: async () => { return page.waitForFunction(() => { diff --git a/integration/tests/components.test.ts b/integration/tests/components.test.ts index fe819bbe53..3863d8c766 100644 --- a/integration/tests/components.test.ts +++ b/integration/tests/components.test.ts @@ -1,11 +1,12 @@ import { expect, test } from '@playwright/test'; import { appConfigs } from '../presets'; -import type { FakeUser } from '../testUtils'; +import type { FakeOrganization, FakeUser } from '../testUtils'; import { createTestUtils, testAgainstRunningApps } from '../testUtils'; testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('component smoke tests @generic', ({ app }) => { let fakeUser: FakeUser; + let fakeOrganization: FakeOrganization; test.beforeAll(async () => { const u = createTestUtils({ app }); @@ -13,12 +14,14 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('component withPhoneNumber: true, withUsername: true, }); - await u.services.users.createBapiUser(fakeUser); + const user = await u.services.users.createBapiUser(fakeUser); + fakeOrganization = await u.services.users.createFakeOrganization(user.id); }); test.afterAll(async () => { await app.teardown(); await fakeUser.deleteIfExists(); + await fakeOrganization.delete(); }); const components = [ @@ -44,6 +47,35 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('component protected: true, fallback: 'Loading user button', }, + { + name: 'Waitlist', + path: '/waitlist', + fallback: 'Loading waitlist', + }, + { + name: 'OrganizationSwitcher', + path: '/', + fallback: 'Loading organization switcher', + protected: true, + }, + { + name: 'OrganizationProfile', + path: '/organization-profile', + fallback: 'Loading organization profile', + protected: true, + }, + { + name: 'OrganizationList', + path: '/organization-list', + fallback: 'Loading organization list', + protected: true, + }, + { + name: 'CreateOrganization', + path: '/create-organization', + fallback: 'Loading create organization', + protected: true, + }, ]; const signIn = async ({ app, page, context }) => { @@ -68,7 +100,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('component } const u = createTestUtils({ app, page, context }); - await u.page.goToRelative(component.path); + await u.page.goToRelative(component.path, { waitUntil: 'commit' }); await expect(u.page.getByText(component.fallback)).toBeVisible(); await signOut({ app, page, context });