mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Stop the strict acceptance from waiting for itself
A scenario whose body ran past about 19 s idled until 45 s after its start, and twice one never exited and hit the runner's 300 s timeout after it had passed: something of Chrome outlived Browser.close and kept its stdout and stderr open. - scripts/qa/browser.mjs closes Chrome within 5 s, kills its process group and closes its pipes; the harness then finishes and exits with the scenario's code. QA_EXIT_DIAGNOSTICS=1 keeps the old ending and prints the open handles and Chrome's process tree 5 s after finish. - Every strict page starts with its clock at the 18:30 UTC nearest to the real time, so Navara's sun is up over the test cities whenever the acceptance runs; a scenario can ask for its own instant or the real clock (Wildlife does, for its freshness fixtures). - The runner records a scenario that passed but did not exit as hung, kills the whole process group on a timeout, runs a failed scenario once more and reports one that passes then as flaky, and appends each run to --history=FILE; scripts/report-acceptance-flake.mjs reads it.
This commit is contained in:
1 parent
a913e5466e
commit
ed6ae54ef6
19 files changed
+1039
-104
No files matched your search
@@ -0,0 +1,40 @@
|
||||
const DAY_MS = 86_400_000;
|
||||
|
||||
/**
|
||||
* Austin's early afternoon (18:30 UTC) nearest to `now`. The page clock then
|
||||
* moves by at most 12 hours: the sun is up over the test cities whenever a
|
||||
* scenario runs, and data stamped with the real time stays current.
|
||||
*/
|
||||
export function daytimeNear(now = Date.now()) {
|
||||
const day = new Date(now);
|
||||
const at = Date.UTC(
|
||||
day.getUTCFullYear(),
|
||||
day.getUTCMonth(),
|
||||
day.getUTCDate(),
|
||||
18,
|
||||
30,
|
||||
);
|
||||
const nearest = [at - DAY_MS, at, at + DAY_MS].reduce((best, next) =>
|
||||
Math.abs(next - now) < Math.abs(best - now) ? next : best,
|
||||
);
|
||||
return new Date(nearest).toISOString();
|
||||
}
|
||||
|
||||
export const DAYTIME = daytimeNear();
|
||||
|
||||
/** Keep elapsed time moving while giving the sun a repeatable position. */
|
||||
export function shiftTime(utc) {
|
||||
if (utc === 'real') return;
|
||||
const offset = Date.parse(utc) - Date.now();
|
||||
const RealDate = Date;
|
||||
class ShiftedDate extends RealDate {
|
||||
constructor(...args) {
|
||||
if (args.length === 0) super(RealDate.now() + offset);
|
||||
else super(...args);
|
||||
}
|
||||
static now() {
|
||||
return RealDate.now() + offset;
|
||||
}
|
||||
}
|
||||
globalThis.Date = ShiftedDate;
|
||||
}
|
||||
Reference in new issue
Block a user