Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Use a fixed Playwright API token upsert and run E2E on all PR bases.

Kiran K03e635811a43
diff --git a/.github/workflows/playwright.yaml b/.github/workflows/playwright.yaml
index f81f9d93a2..fbe5b9a105 100644
--- a/.github/workflows/playwright.yaml
+++ b/.github/workflows/playwright.yaml
@@ -2,7 +2,6 @@ name: Playwright E2E Tests
on:
pull_request:
- branches: [main]
paths:
- "apps/web/**"
- "packages/**"
diff --git a/apps/web/playwright/api/setup-test-workspace.ts b/apps/web/playwright/api/setup-test-workspace.ts
index 9a8700b37a..887bc21b03 100644
--- a/apps/web/playwright/api/setup-test-workspace.ts
+++ b/apps/web/playwright/api/setup-test-workspace.ts
@@ -1,7 +1,6 @@
import { createId } from "@/lib/api/create-id";
import { hashToken } from "@/lib/auth/hash-token";
import { prisma } from "@/lib/prisma";
-import { nanoid } from "@dub/utils";
import { config as loadEnv } from "dotenv-flow";
import { mkdir, writeFile } from "fs/promises";
import path from "path";
@@ -19,6 +18,7 @@ export const TEST_WORKSPACE = {
},
token: {
name: "Playwright API",
+ value: "dub_playwright_api_test_key_fixed", // Fixed local/CI-only key
},
} as const;
@@ -104,20 +104,22 @@ export async function setupTestWorkspace() {
},
});
- const token = `dub_${nanoid(24)}`;
+ const token = TEST_WORKSPACE.token.value;
const hashedKey = await hashToken(token);
const partialKey = `${token.slice(0, 3)}...${token.slice(-4)}`;
- // Drop any prior tokens with this name (including orphaned rows from bad seeds)
- await prisma.restrictedToken.deleteMany({
+ await prisma.restrictedToken.upsert({
where: {
+ hashedKey,
+ },
+ update: {
name: TEST_WORKSPACE.token.name,
+ partialKey,
+ userId: user.id,
projectId: workspace.id,
+ scopes: "apis.all",
},
- });
-
- await prisma.restrictedToken.create({
- data: {
+ create: {
name: TEST_WORKSPACE.token.name,
hashedKey,
partialKey,