mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 10:52:20 +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
@@ -15,9 +15,11 @@ const EXPECTED_SCENARIO_IDS = [
|
||||
"watch-render",
|
||||
"reload",
|
||||
"spa-navigation",
|
||||
"watch-action-topology",
|
||||
"sidebar-navigation-stress",
|
||||
"shorts-render",
|
||||
"responsive-visual",
|
||||
"post-navigation-vote",
|
||||
"reaction-matrix",
|
||||
];
|
||||
const EXPECTED_BUILD_ID = "0123456789abcdef0123456789abcdef";
|
||||
@@ -25,13 +27,18 @@ const EXPECTED_BUILD_ID = "0123456789abcdef0123456789abcdef";
|
||||
const ALL_DRIVER_METHODS = [
|
||||
"assertCurrentShortsControl",
|
||||
"assertCurrentVideo",
|
||||
"assertCurrentWatchResult",
|
||||
"assertDislikeCountChangesObservable",
|
||||
"assertRenderedDislikeCount",
|
||||
"assertRuntime",
|
||||
"assertSignedIn",
|
||||
"captureReactionStateVisual",
|
||||
"captureNativeShortsVisual",
|
||||
"captureSyntheticShortsVisual",
|
||||
"captureWatchActionTopologyVisual",
|
||||
"captureWatchRatioVisual",
|
||||
"clickAction",
|
||||
"configureRequestAttributionRuntime",
|
||||
"navigateFromColdChannelToShort",
|
||||
"navigateFromColdChannelToWatch",
|
||||
"navigateToNextShort",
|
||||
@@ -45,9 +52,11 @@ const ALL_DRIVER_METHODS = [
|
||||
"readViewportSize",
|
||||
"reload",
|
||||
"setViewportSize",
|
||||
"soakCurrentShortsControl",
|
||||
"soakWatchRatioVisual",
|
||||
"waitForDislikeText",
|
||||
"waitForReactionState",
|
||||
"withExactVotesRequest",
|
||||
"withNoProductionInteractions",
|
||||
];
|
||||
|
||||
@@ -59,7 +68,7 @@ function createDriver(overrides = {}) {
|
||||
}
|
||||
|
||||
function createAdapter(runtime, driver = createDriver(), expectedBuildId = EXPECTED_BUILD_ID) {
|
||||
const options = { driver, expectedBuildId, expectedVersion: runtime === "userscript" ? "3.2.0" : "4.0.4" };
|
||||
const options = { driver, expectedBuildId, expectedVersion: runtime === "userscript" ? "3.2.0" : "4.0.5" };
|
||||
return runtime === "userscript"
|
||||
? createUserscriptLiveRuntimeAdapter(options)
|
||||
: createExtensionLiveRuntimeAdapter(options);
|
||||
@@ -72,9 +81,11 @@ function createImplementations(events) {
|
||||
"runWatchRenderScenario",
|
||||
"runReloadScenario",
|
||||
"runSpaNavigationScenario",
|
||||
"runWatchActionTopologyScenario",
|
||||
"runSidebarStressScenario",
|
||||
"runShortsRenderScenario",
|
||||
"runResponsiveVisualScenario",
|
||||
"runPostNavigationVoteScenario",
|
||||
"runProductionReactionMatrixScenario",
|
||||
];
|
||||
return Object.fromEntries(
|
||||
@@ -96,6 +107,10 @@ describe("shared live runtime profiles", () => {
|
||||
credentialStore: "gm-storage",
|
||||
ownsShortsDislikeControl: true,
|
||||
shortsControlModel: "synthetic-owned",
|
||||
shortsControlModelBySurface: {
|
||||
desktop: "synthetic-owned",
|
||||
mobile: "native-youtube-required",
|
||||
},
|
||||
shortsVisualModel: "strict-synthetic",
|
||||
},
|
||||
buildMarkerAttribute: "data-ryd-userscript-build",
|
||||
@@ -110,16 +125,20 @@ describe("shared live runtime profiles", () => {
|
||||
capabilities: {
|
||||
backgroundVoteTransport: true,
|
||||
credentialStore: "browser.storage",
|
||||
ownsShortsDislikeControl: false,
|
||||
shortsControlModel: "native-youtube",
|
||||
shortsVisualModel: "native-pair",
|
||||
ownsShortsDislikeControl: true,
|
||||
shortsControlModel: "synthetic-owned",
|
||||
shortsControlModelBySurface: {
|
||||
desktop: "synthetic-owned",
|
||||
mobile: "native-youtube-required",
|
||||
},
|
||||
shortsVisualModel: "strict-synthetic",
|
||||
},
|
||||
buildMarkerAttribute: "data-ryd-extension-build",
|
||||
markerAttribute: "data-ryd-extension-version",
|
||||
selectors: {
|
||||
rateBar: "#ryd-bar",
|
||||
rateBarContainer: "#ryd-bar-container",
|
||||
shortsDislikeControl: null,
|
||||
shortsDislikeControl: "[data-ryd-synthetic-shorts-dislike]",
|
||||
},
|
||||
});
|
||||
expect(Object.isFrozen(LIVE_RUNTIME_PROFILES.userscript.capabilities)).toBe(true);
|
||||
@@ -130,23 +149,41 @@ describe("shared live runtime profiles", () => {
|
||||
const driver = createDriver();
|
||||
const adapter = createAdapter(runtime, driver);
|
||||
|
||||
expect(driver.configureRequestAttributionRuntime).toHaveBeenCalledWith(runtime);
|
||||
|
||||
await adapter.driver.assertRuntime(runtime, adapter.expectedVersion, adapter.expectedBuildId);
|
||||
await adapter.driver.assertCurrentShortsControl("abcdefghijk", runtime);
|
||||
const expectedCounts = { dislikes: 123, likes: 456 };
|
||||
await adapter.driver.assertCurrentWatchResult("abcdefghijk", runtime, expectedCounts);
|
||||
await adapter.driver.assertDislikeCountChangesObservable([{ after: 124, before: 123 }], runtime);
|
||||
await adapter.driver.assertRenderedDislikeCount("123", 123, runtime);
|
||||
await adapter.driver.soakCurrentShortsControl("abcdefghijk", runtime, 123, { durationMs: 10 });
|
||||
await adapter.driver.captureWatchRatioVisual(runtime, "watch.png");
|
||||
await adapter.driver.captureReactionStateVisual({
|
||||
expectedCounts,
|
||||
expectedState: "neutral",
|
||||
isShort: false,
|
||||
runtime,
|
||||
screenshotPath: "reaction.png",
|
||||
shortsVisualModel: adapter.capabilities.shortsVisualModel,
|
||||
videoId: "abcdefghijk",
|
||||
});
|
||||
|
||||
expect(driver.assertRuntime).toHaveBeenCalledWith(runtime, adapter.expectedVersion, adapter.expectedBuildId);
|
||||
expect(driver.assertCurrentShortsControl).toHaveBeenCalledWith("abcdefghijk", runtime);
|
||||
expect(driver.assertCurrentWatchResult).toHaveBeenCalledWith("abcdefghijk", runtime, expectedCounts);
|
||||
expect(driver.assertDislikeCountChangesObservable).toHaveBeenCalledWith([{ after: 124, before: 123 }], runtime);
|
||||
expect(driver.assertRenderedDislikeCount).toHaveBeenCalledWith("123", 123, runtime);
|
||||
expect(driver.soakCurrentShortsControl).toHaveBeenCalledWith("abcdefghijk", runtime, 123, { durationMs: 10 });
|
||||
expect(driver.captureWatchRatioVisual).toHaveBeenCalledWith(runtime, "watch.png");
|
||||
expect(driver.captureReactionStateVisual).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ runtime, videoId: "abcdefghijk" }),
|
||||
expect.objectContaining({
|
||||
runtime,
|
||||
shortsVisualModel: adapter.capabilities.shortsVisualModel,
|
||||
videoId: "abcdefghijk",
|
||||
}),
|
||||
);
|
||||
expect(adapter.createScenarioOptions()).toMatchObject({ capabilities: adapter.capabilities });
|
||||
});
|
||||
|
||||
test("rejects scenario options and calls for another runtime", async () => {
|
||||
@@ -158,6 +195,18 @@ describe("shared live runtime profiles", () => {
|
||||
expect(() => adapter.driver.assertRuntime("extension", adapter.expectedVersion)).toThrow(
|
||||
"The asserted runtime does not match",
|
||||
);
|
||||
expect(() => adapter.driver.soakCurrentShortsControl("abcdefghijk", "extension", 123)).toThrow(
|
||||
"The Shorts-control soak runtime does not match",
|
||||
);
|
||||
expect(() =>
|
||||
adapter.driver.captureReactionStateVisual({
|
||||
expectedState: "neutral",
|
||||
isShort: true,
|
||||
runtime: "userscript",
|
||||
shortsVisualModel: "native-pair",
|
||||
videoId: "abcdefghijk",
|
||||
}),
|
||||
).toThrow("The reaction-visual Shorts model does not match");
|
||||
});
|
||||
|
||||
test.each([undefined, "", "stale", "A".repeat(32)])(
|
||||
@@ -199,23 +248,26 @@ describe("shared live scenario contract", () => {
|
||||
expect(assertSharedLiveScenarioAdapter(adapter)).toEqual(EXPECTED_SCENARIO_IDS);
|
||||
});
|
||||
|
||||
test("requires each runtime's Shorts visual model from the shared responsive scenario", () => {
|
||||
const driver = createDriver();
|
||||
delete driver.captureSyntheticShortsVisual;
|
||||
test.each(["channel-shorts-navigation", "responsive-visual"])(
|
||||
"requires each runtime's Shorts visual model from shared scenario %s",
|
||||
(scenarioId) => {
|
||||
const driver = createDriver();
|
||||
delete driver.captureSyntheticShortsVisual;
|
||||
|
||||
expect(() => assertSharedLiveScenarioAdapter(createAdapter("userscript", driver), ["responsive-visual"])).toThrow(
|
||||
"must implement captureSyntheticShortsVisual()",
|
||||
);
|
||||
expect(assertSharedLiveScenarioAdapter(createAdapter("extension", driver), ["responsive-visual"])).toEqual([
|
||||
"responsive-visual",
|
||||
]);
|
||||
expect(() => assertSharedLiveScenarioAdapter(createAdapter("userscript", driver), [scenarioId])).toThrow(
|
||||
"must implement captureSyntheticShortsVisual()",
|
||||
);
|
||||
expect(() => assertSharedLiveScenarioAdapter(createAdapter("extension", driver), [scenarioId])).toThrow(
|
||||
"must implement captureSyntheticShortsVisual()",
|
||||
);
|
||||
|
||||
const extensionDriver = createDriver();
|
||||
delete extensionDriver.captureNativeShortsVisual;
|
||||
expect(() =>
|
||||
assertSharedLiveScenarioAdapter(createAdapter("extension", extensionDriver), ["responsive-visual"]),
|
||||
).toThrow("must implement captureNativeShortsVisual()");
|
||||
});
|
||||
const driverWithoutNativeCapture = createDriver();
|
||||
delete driverWithoutNativeCapture.captureNativeShortsVisual;
|
||||
expect(
|
||||
assertSharedLiveScenarioAdapter(createAdapter("extension", driverWithoutNativeCapture), [scenarioId]),
|
||||
).toEqual([scenarioId]);
|
||||
},
|
||||
);
|
||||
|
||||
test("executes the same scenario IDs through both runtime adapters", async () => {
|
||||
const events = [];
|
||||
@@ -224,8 +276,10 @@ describe("shared live scenario contract", () => {
|
||||
const services = {
|
||||
consumeVoteApproval: jest.fn(),
|
||||
createRecorder: jest.fn(),
|
||||
shortsNavigationOptions: { outputDirectory: "shorts-evidence" },
|
||||
visualOptions: { outputDirectory: "evidence" },
|
||||
sidebarOptions: { outputDirectory: "sidebar-evidence" },
|
||||
topologyOptions: { outputDirectory: "topology-evidence" },
|
||||
};
|
||||
|
||||
const userscriptResults = await runner.runAll(createAdapter("userscript"), {}, services);
|
||||
@@ -240,6 +294,62 @@ describe("shared live scenario contract", () => {
|
||||
expect(Object.values(implementations).every((implementation) => implementation.mock.calls.length === 2)).toBe(true);
|
||||
});
|
||||
|
||||
test.each(["userscript", "extension"])(
|
||||
"routes the shared Shorts navigation evidence options through %s",
|
||||
async (runtime) => {
|
||||
const implementation = jest.fn(async () => "verified");
|
||||
const runner = createSharedLiveScenarioRunner({
|
||||
implementations: { runChannelShortsNavigationScenario: implementation },
|
||||
});
|
||||
const adapter = createAdapter(runtime);
|
||||
const shortsNavigationOptions = { outputDirectory: "shorts-evidence" };
|
||||
|
||||
await expect(runner.run(adapter, "channel-shorts-navigation", {}, { shortsNavigationOptions })).resolves.toBe(
|
||||
"verified",
|
||||
);
|
||||
expect(implementation).toHaveBeenCalledWith(
|
||||
adapter.driver,
|
||||
expect.objectContaining({ runtime }),
|
||||
shortsNavigationOptions,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test.each(["userscript", "extension"])(
|
||||
"routes the shared post-navigation vote services through %s",
|
||||
async (runtime) => {
|
||||
const implementation = jest.fn(async () => "verified");
|
||||
const runner = createSharedLiveScenarioRunner({
|
||||
implementations: { runPostNavigationVoteScenario: implementation },
|
||||
});
|
||||
const adapter = createAdapter(runtime);
|
||||
const createRecorder = jest.fn();
|
||||
const consumeVoteApproval = jest.fn();
|
||||
|
||||
await expect(
|
||||
runner.run(adapter, "post-navigation-vote", {}, { createRecorder, consumeVoteApproval }),
|
||||
).resolves.toBe("verified");
|
||||
expect(implementation).toHaveBeenCalledWith(
|
||||
adapter.driver,
|
||||
expect.objectContaining({ runtime }),
|
||||
createRecorder,
|
||||
consumeVoteApproval,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test("requires both protected services before running the post-navigation vote", async () => {
|
||||
const implementation = jest.fn();
|
||||
const runner = createSharedLiveScenarioRunner({
|
||||
implementations: { runPostNavigationVoteScenario: implementation },
|
||||
});
|
||||
|
||||
await expect(
|
||||
runner.run(createAdapter("extension"), "post-navigation-vote", {}, { createRecorder: jest.fn() }),
|
||||
).rejects.toThrow("requires services.consumeVoteApproval()");
|
||||
expect(implementation).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("rejects unknown IDs before invoking a scenario implementation", async () => {
|
||||
const implementations = createImplementations([]);
|
||||
const runner = createSharedLiveScenarioRunner({ implementations });
|
||||
|
||||
Reference in new issue
Block a user