mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-29 17:37:54 +01:00
Prepare 4.0.5 Firefox update and Shorts fixes
Add Firefox data consent, repair contributor sign-in, and introduce optional Hide clutter buttons. Harden video navigation, voting, and action layouts with shared browser regression coverage and reproducible release packaging.
This commit is contained in:
1 parent
3657de9b2c
commit
e500088e65
196 files changed
+39706
-2694
No files matched your search
@@ -0,0 +1,46 @@
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const VISUAL_CAPTURE_ENVIRONMENT_VARIABLE = "RYD_CAPTURE_VISUALS";
|
||||
|
||||
function visualCaptureIsEnabled(environment = process.env) {
|
||||
return environment?.[VISUAL_CAPTURE_ENVIRONMENT_VARIABLE] === "1";
|
||||
}
|
||||
|
||||
async function captureOptionalVisualEvidence({ capture, environment = process.env, outputPath }) {
|
||||
if (!visualCaptureIsEnabled(environment)) {
|
||||
return Object.freeze({ captured: false, outputPath: null, reason: "capture-disabled" });
|
||||
}
|
||||
if (typeof capture !== "function") throw new TypeError("Visual evidence capture must be a function.");
|
||||
if (typeof outputPath !== "string" || outputPath.length === 0) {
|
||||
throw new TypeError("Visual evidence outputPath must be a non-empty string.");
|
||||
}
|
||||
|
||||
await capture(outputPath);
|
||||
return Object.freeze({ captured: true, outputPath, reason: null });
|
||||
}
|
||||
|
||||
function annotateVisualEvidence(testInfo, evidence) {
|
||||
testInfo.annotations.push({
|
||||
description: evidence.captured ? `captured:${evidence.outputPath}` : `not-captured:${evidence.reason}`,
|
||||
type: "visual-evidence",
|
||||
});
|
||||
return evidence;
|
||||
}
|
||||
|
||||
function assertVisualEvidenceCaptured(evidence, label = "Visual evidence") {
|
||||
assert.equal(
|
||||
evidence?.captured,
|
||||
true,
|
||||
`${label} was not captured. Structural browser assertions alone are not inspected screenshot evidence.`,
|
||||
);
|
||||
assert.equal(typeof evidence.outputPath, "string", `${label} has no screenshot path.`);
|
||||
return evidence;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
VISUAL_CAPTURE_ENVIRONMENT_VARIABLE,
|
||||
annotateVisualEvidence,
|
||||
assertVisualEvidenceCaptured,
|
||||
captureOptionalVisualEvidence,
|
||||
visualCaptureIsEnabled,
|
||||
};
|
||||
Reference in new issue
Block a user