Skip to content

Commit 7e8067d

Browse files
JulianMaurinclaude
andcommitted
test: re-record browser-extension fixtures on the current GitHub DOM, by era
GitHub A/B-tests its PR page markup, so the extension carries selectors for more than one DOM era. Split the fixture corpus into date-stamped era directories so both are exercised: github_dom_2025_02/ (the existing captures, moved and now sanitized — they were leaking the original capturers' identities into this public repo) and github_dom_2026_07/ (freshly recorded from synthetic PRs on the mergify-sandbox org: opened, merged, no_mergify, no_timeline_actions, batch_closed). The fixture loader takes an era; the flat searchConfig* and mergify_timestamp fragment fixtures are unaffected. Existing tests pin the legacy era explicitly; a new suite asserts the era-agnostic detection (data-status pill, merged-by-Mergify timeline, Mergify app-avatar marker) against the current DOM. Recorded via the record-github-fixtures + extract-browser-cookies skills (Mergifyio/skills#32, #33). MRGFY-8087 Test plan: - npx jest (284 passing) — legacy suite green through the era loader; new current-DOM parity suite green. - npx biome check — clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KJbLFjMX9mb8o5T3JXTAXL Change-Id: I966a2d36a92c50664bdea6918b1987293014b822
1 parent 09b2ada commit 7e8067d

13 files changed

Lines changed: 19503 additions & 166 deletions
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
const { injectFixtureInDOM, CURRENT_ERA } = require("./utils");
2+
const {
3+
isPullRequestOpen,
4+
isPullRequestDraft,
5+
wasMergedByMergify,
6+
} = require("../queue.js");
7+
8+
// Parity coverage on the current-DOM era fixtures (github_dom_2026_07), recorded
9+
// from the mergify-sandbox org on the markup GitHub serves today. These exercise
10+
// the era-agnostic detection — the data-status pill, the merged-by-Mergify
11+
// timeline, and the Mergify app-avatar marker — against the current DOM, so a
12+
// GitHub change that breaks them fails here instead of silently in production.
13+
// Selector fixes that ride with the batch work are covered in the batch suite.
14+
describe("current-DOM era fixtures (github_dom_2026_07)", () => {
15+
afterEach(() => {
16+
document.body.innerHTML = "";
17+
});
18+
19+
const APP_AVATAR =
20+
'img[src^="https://avatars.githubusercontent.com/in/10562"]';
21+
22+
test("github_pr_opened: open, not draft, Mergify enabled", () => {
23+
injectFixtureInDOM("github_pr_opened", CURRENT_ERA);
24+
expect(isPullRequestOpen()).toBe(true);
25+
expect(isPullRequestDraft()).toBe(false);
26+
expect(wasMergedByMergify()).toBe(false);
27+
expect(document.querySelector(APP_AVATAR)).not.toBeNull();
28+
});
29+
30+
test("github_pr_merged: closed and merged by Mergify", () => {
31+
injectFixtureInDOM("github_pr_merged", CURRENT_ERA);
32+
expect(isPullRequestOpen()).toBe(false);
33+
expect(wasMergedByMergify()).toBe(true);
34+
});
35+
36+
test("github_pr_no_timeline_actions: closed, not merged", () => {
37+
injectFixtureInDOM("github_pr_no_timeline_actions", CURRENT_ERA);
38+
expect(isPullRequestOpen()).toBe(false);
39+
expect(wasMergedByMergify()).toBe(false);
40+
});
41+
42+
test("github_pr_no_mergify: open, no Mergify app avatar", () => {
43+
injectFixtureInDOM("github_pr_no_mergify", CURRENT_ERA);
44+
expect(isPullRequestOpen()).toBe(true);
45+
expect(document.querySelector(APP_AVATAR)).toBeNull();
46+
});
47+
48+
test("github_pr_batch_closed: closed", () => {
49+
injectFixtureInDOM("github_pr_batch_closed", CURRENT_ERA);
50+
expect(isPullRequestOpen()).toBe(false);
51+
});
52+
});

src/__tests__/fixtures/github_pr_merged.html renamed to src/__tests__/fixtures/github_dom_2025_02/github_pr_merged.html

Lines changed: 18 additions & 18 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_pr_no_mergify.html renamed to src/__tests__/fixtures/github_dom_2025_02/github_pr_no_mergify.html

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_pr_no_timeline_actions.html renamed to src/__tests__/fixtures/github_dom_2025_02/github_pr_no_timeline_actions.html

Lines changed: 40 additions & 40 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_pr_opened.html renamed to src/__tests__/fixtures/github_dom_2025_02/github_pr_opened.html

Lines changed: 46 additions & 46 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_dom_2026_07/github_pr_batch_closed.html

Lines changed: 4093 additions & 0 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_dom_2026_07/github_pr_merged.html

Lines changed: 4932 additions & 0 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_dom_2026_07/github_pr_no_mergify.html

Lines changed: 2982 additions & 0 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_dom_2026_07/github_pr_no_timeline_actions.html

Lines changed: 2968 additions & 0 deletions
Large diffs are not rendered by default.

src/__tests__/fixtures/github_dom_2026_07/github_pr_opened.html

Lines changed: 4299 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)