e2e/review-apply-fixture.md
The review-apply Playwright tests exercise the backend-owned review_apply API
without talking to real GitHub.
playwright/src/fakeGithub.ts starts a small HTTP server that imitates the
GitHub Enterprise API routes the app needs:
GET /api/v3/userGET /api/v3/repos/acme/widgets/pullsGET /api/v3/repos/acme/widgets/pulls/42playwright/scripts/project-with-github-fork-pr.sh creates the local Git
repositories used by the tests:
remote-project, the base repositoryfork-project, a working clone with a fork PR branchfork-project-bare, the fork repository fetched by the backendlocal-clone, the GitButler project under testplaywright/tests/branches.spec.ts registers fake GitHub Enterprise
credentials with store_github_enterprise_pat, opens the Branches view, and
applies PR #42 through the UI.The fake GitHub server only serves API JSON. It does not implement Git smart
HTTP. Instead, PR payloads return local filesystem paths as head.repo.clone_url
and head.repo.ssh_url.
That means the backend still does real work:
For fork PRs, the payload points at fork-project-bare. For same-repository
PRs, the payload points at remote-project.
From the repository root:
cargo build -p but-server
corepack pnpm --filter @gitbutler/e2e exec playwright test \
--config ./playwright/playwright.config.ts \
--tsconfig ./playwright/tsconfig.json \
playwright/tests/branches.spec.ts \
-g "GitHub review apply"
The group covers:
Prefer extending startFakeGitHubServer() options rather than adding another
fake server. If a new case needs different Git contents, add that branch or file
to project-with-github-fork-pr.sh and keep the PR payload pointing at a local
repository path so backend fetch behavior remains real and deterministic.