Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/browser/account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ test("the lobby offers an editor or a whiteboard and carries the choice into the
interview,
"JSON.stringify({ problemId: problem.page, durationMin, interviewId, interviewLoop, interviewMode: mode, interviewProfile, ...(interviewGrounding",
);
assertIncludesCompact(interview, "durationMin, interviewLoop, report, };");
assertIncludesCompact(
interview,
"durationMin, interviewLoop, interviewMode: mode, report, };",
);
});

test("interview loop is explicit, budgeted, gated, and carried into artifacts", () => {
Expand Down
61 changes: 58 additions & 3 deletions tests/browser/editor-pipeline.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ after(async () => {
});

/// A page on the interview screen with an empty editor, no room joined. The
/// editor is enabled as soon as bindEvents runs; nothing under test needs a
/// live session, so this never waits on one.
/// pause control is revealed by bindEvents after the starter buffer is seeded.
/// The textarea starts enabled in HTML, so it cannot signal readiness. Nothing
/// under test needs a live session, so this never waits on one.
async function editorPage(t, { params = {}, beforeLoad } = {}) {
if (!browser) {
t.skip("playwright chromium unavailable");
Expand All @@ -50,7 +51,7 @@ async function editorPage(t, { params = {}, beforeLoad } = {}) {
await page.goto(`${base}/interview.html?${query}`, {
waitUntil: "domcontentloaded",
});
await page.waitForSelector("#editor:not([disabled])");
await page.waitForSelector("#pause:not([hidden])");
// The media preflight overlay sits over the editor until a candidate (or a
// stubbed device) clears it, and it blocks Playwright's own click on
// whatever is under it. A keystroke only needs the element focused, not
Expand Down Expand Up @@ -843,3 +844,57 @@ test("a proportional font keeps the textarea and highlight metrics aligned", asy
}
}
});

test("editor setup waits for delayed problem initialization before clearing the starter", async (t) => {
if (!browser) return t.skip("playwright chromium unavailable");
let releaseProblem;
const problemReady = new Promise((resolve) => {
releaseProblem = resolve;
});
let problemRequested;
const requested = new Promise((resolve) => {
problemRequested = resolve;
});
let loadingPage;
let setupFinished = false;
const setup = editorPage(t, {
beforeLoad: async (page) => {
loadingPage = page;
await page.route(
"**/problems/chargeback-pair-match.json",
async (route) => {
problemRequested();
await problemReady;
await route.continue();
},
);
},
}).then((ctx) => {
setupFinished = true;
return ctx;
});
try {
await requested;
await loadingPage.waitForSelector("#editor:not([disabled])");
assert.equal(await loadingPage.locator("#pause").isVisible(), false);
// Recreate the old helper's sequence before the module can initialize.
await loadingPage.evaluate(() => document.querySelector("#editor").focus());
await loadingPage.keyboard.press("ControlOrMeta+A");
await loadingPage.keyboard.press("Delete");
assert.equal((await caretState(loadingPage)).value, "");
assert.equal(
setupFinished,
false,
"setup must wait for the starter buffer",
);
releaseProblem();
const { page, errors } = await setup;
await page.waitForSelector("#pause:not([hidden])");
assert.equal((await caretState(page)).value, "");
assert.deepEqual(errors, []);
} finally {
releaseProblem();
await setup.catch(() => {});
await loadingPage?.close();
}
});
5 changes: 5 additions & 0 deletions tests/browser/interview-lifecycle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ test("only the newest overlapping report save can release the warning", async ()
"whiteboard",
"durationMin",
"interviewLoop",
"mode",
"saveReportHistory",
"reportIsPersisted",
"updateBeforeUnloadGuard",
Expand All @@ -264,6 +265,7 @@ test("only the newest overlapping report save can release the warning", async ()
false,
45,
"coding_only",
"whiteboard",
saveReportHistory,
reportIsPersisted,
updateBeforeUnloadGuard,
Expand All @@ -272,6 +274,9 @@ test("only the newest overlapping report save can release the warning", async ()
const provisional = saveHistory({ summary: "provisional" });
const final = saveHistory({ summary: "final" });
assert.equal(pending.length, 2);
assert.equal(pending[0].entry.interviewMode, "whiteboard");
assert.equal(pending[0].entry.interviewLoop, "coding_only");
assert.equal(pending[0].entry.durationMin, 45);
assert.equal(state.reportPersisted, false);

// The older provisional save finishes successfully after the final save has
Expand Down
Loading