Skip to content
File

Blob: tests/e2e/specs/29-oidc-returning.spec.ts

typescript29 lines
1import { test, expect, loginPage } from "../fixtures/bland-test";
2 
3test.describe("OIDC returning user", () => {
4 test("two sign-ins do not duplicate the baseline workspace", async ({ page, browser }) => {
5 const first = await loginPage(page);
6 const wsRes = await page.request.get("/api/v1/workspaces", {
7 headers: { Authorization: `Bearer ${first.accessToken}` },
8 });
9 expect(wsRes.ok()).toBe(true);
10 const firstBody = (await wsRes.json()) as { workspaces: Array<{ id: string; slug: string }> };
11 const firstCount = firstBody.workspaces.length;
12 expect(firstCount).toBeGreaterThan(0);
13 
14 const secondContext = await browser.newContext();
15 const secondPage = await secondContext.newPage();
16 try {
17 const second = await loginPage(secondPage);
18 const wsRes2 = await secondPage.request.get("/api/v1/workspaces", {
19 headers: { Authorization: `Bearer ${second.accessToken}` },
20 });
21 expect(wsRes2.ok()).toBe(true);
22 const secondBody = (await wsRes2.json()) as { workspaces: Array<{ id: string; slug: string }> };
23 expect(secondBody.workspaces.length).toBe(firstCount);
24 } finally {
25 await secondContext.close();
26 }
27 });
28});