Skip to content

Commit 54e49d3

Browse files
nicoladclaude
andcommitted
Fix company link URL to include source query param and add Playwright tests
- Use job.company?.key ?? job.company_key for the company href so the properly linked company record key is used when available - Append ?source=<source_kind> (ashby, greenhouse, etc.) to the company URL - Add e2e/job-company-navigation.spec.ts with two tests covering the href format and click navigation - Add playwright.config.ts with webServer auto-start and chromium project - Install @playwright/test as devDependency Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent cfd3c16 commit 54e49d3

File tree

5 files changed

+101
-25
lines changed

5 files changed

+101
-25
lines changed

e2e/job-company-navigation.spec.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { test, expect } from "@playwright/test";
2+
3+
const JOB_URL =
4+
"/jobs/7d4b6e9a-5383-4604-a958-1fea0d5c41fa?company=alaro&source=ashby";
5+
6+
test.describe("job detail — company link navigation", () => {
7+
test("company link includes source=ashby query param", async ({ page }) => {
8+
await page.goto(JOB_URL);
9+
10+
// Wait for the job title heading to appear
11+
await expect(
12+
page.getByRole("heading", { name: "AI Engineer @ Alaro", level: 1 })
13+
).toBeVisible();
14+
15+
// The company link is the "alaro" text link below the job title
16+
const companyLink = page.getByRole("link", { name: "alaro", exact: true });
17+
18+
const href = await companyLink.getAttribute("href");
19+
expect(href).toMatch(/^\/companies\//);
20+
expect(href).toContain("source=ashby");
21+
});
22+
23+
test("clicking company link navigates to company page with source param", async ({
24+
page,
25+
}) => {
26+
await page.goto(JOB_URL);
27+
28+
await expect(
29+
page.getByRole("heading", { name: "AI Engineer @ Alaro", level: 1 })
30+
).toBeVisible();
31+
32+
await page.getByRole("link", { name: "alaro", exact: true }).click();
33+
34+
// Should navigate to /companies/<key>?source=ashby
35+
await expect(page).toHaveURL(/\/companies\/.+\?source=ashby/);
36+
});
37+
});

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"@graphql-codegen/typescript": "^5.0.7",
103103
"@graphql-codegen/typescript-operations": "^5.0.7",
104104
"@graphql-codegen/typescript-react-apollo": "^4.4.0",
105+
"@playwright/test": "^1.58.2",
105106
"@trigger.dev/build": "4.3.3",
106107
"@types/lodash": "^4.17.23",
107108
"@types/node": "22.19.7",

playwright.config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineConfig, devices } from "@playwright/test";
2+
3+
export default defineConfig({
4+
testDir: "./e2e",
5+
fullyParallel: true,
6+
forbidOnly: !!process.env.CI,
7+
retries: process.env.CI ? 2 : 0,
8+
workers: process.env.CI ? 1 : undefined,
9+
reporter: "list",
10+
use: {
11+
baseURL: "http://localhost:3000",
12+
trace: "on-first-retry",
13+
},
14+
projects: [
15+
{
16+
name: "chromium",
17+
use: { ...devices["Desktop Chrome"] },
18+
},
19+
],
20+
webServer: {
21+
command: "pnpm dev",
22+
url: "http://localhost:3000",
23+
reuseExistingServer: !process.env.CI,
24+
timeout: 120000,
25+
},
26+
});

0 commit comments

Comments
 (0)