fix(app): make e2e setup an auto fixture so first-of-spec tests get setup (#702)

* fix(app): make e2e setup an auto fixture so it runs for the first test of every spec

The fixtures.ts beforeEach was declared at the top level of a non-test
fixture file. Playwright sometimes skipped it for the first test of a
subsequent spec when multiple specs ran in the same worker — that test
hit page.evaluate without the seed nonce or daemon registry in
localStorage and failed (then passed on retry, masking the bug behind
retries: 1). Reproduced locally by running sidebar-workspace then
startup-loading: the first startup-loading test got no fixture setup
and threw "Expected e2e seed nonce".

Move the setup into an `auto: true` fixture, the canonical Playwright
pattern for running setup for every test in a workspace. The afterEach
console-attachment is folded into the same fixture's teardown.

* refactor(server): simplify nullish handling in workspace-git-metadata

Drop the explicit `null` arg in `deriveProjectSlug(input.cwd, null)` —
the second parameter already defaults to `null`. Inline the
`repoName && repoName.length > 0` check in `parseGitHubRepoNameFromRemote`
since `pop()` on a non-empty array returns a non-empty string here, and
`|| null` covers the empty-string case directly.
This commit is contained in:
Mohamed Boudra
2026-05-05 19:56:52 +07:00
parent f974812dfc
commit ab9f07dd8a
2 changed files with 92 additions and 97 deletions
@@ -25,8 +25,7 @@ export function parseGitHubRepoNameFromRemote(remoteUrl: string): string | null
return null;
}
const repoName = githubRepo.split("/").pop();
return repoName && repoName.length > 0 ? repoName : null;
return githubRepo.split("/").pop() || null;
}
export function deriveProjectSlug(cwd: string, remoteUrl: string | null = null): string {
@@ -51,7 +50,7 @@ export function buildWorkspaceGitMetadataFromSnapshot(input: {
workspaceDisplayName: input.directoryName,
gitRemote: null,
isWorktree: false,
projectSlug: deriveProjectSlug(input.cwd, null),
projectSlug: deriveProjectSlug(input.cwd),
repoRoot: null,
currentBranch: null,
remoteUrl: null,