From aa144e1d467cf76f034d081a7523f3eddbfeb41d Mon Sep 17 00:00:00 2001 From: christopherhardy Date: Thu, 16 Jul 2026 14:38:05 +0100 Subject: [PATCH] refactor: move spec URL consts into a shared constants.ts The SDV_MOD_URL declared at the top of mods.spec.ts, mods-deploy.spec.ts and mods-manual.spec.ts is now exported from packages/e2e/src/constants.ts, so hard-coded URLs are maintained in one place. The specs import it instead of re-declaring it. Co-Authored-By: Claude Opus 4.8 --- packages/e2e/src/constants.ts | 6 ++++++ packages/e2e/src/tests/mods-deploy.spec.ts | 3 +-- packages/e2e/src/tests/mods-manual.spec.ts | 3 +-- packages/e2e/src/tests/mods.spec.ts | 3 +-- 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 packages/e2e/src/constants.ts diff --git a/packages/e2e/src/constants.ts b/packages/e2e/src/constants.ts new file mode 100644 index 0000000000..db39de7ebf --- /dev/null +++ b/packages/e2e/src/constants.ts @@ -0,0 +1,6 @@ +/** + * Shared constants for E2E specs — keep hard-coded URLs here (rather than as + * per-spec consts) so they're maintained in one place. + */ + +export const SDV_MOD_URL = "https://www.nexusmods.com/stardewvalley/mods/2400"; diff --git a/packages/e2e/src/tests/mods-deploy.spec.ts b/packages/e2e/src/tests/mods-deploy.spec.ts index e5dab0f28e..c529956759 100644 --- a/packages/e2e/src/tests/mods-deploy.spec.ts +++ b/packages/e2e/src/tests/mods-deploy.spec.ts @@ -7,6 +7,7 @@ * Deploy it from the Mods list. Runs for both free and premium. * */ +import { SDV_MOD_URL } from "../constants"; import { test, expect, type NexusUser } from "../fixtures/vortex-app"; import { downloadModViaModManager } from "../helpers/modDownload"; import { Timeouts } from "../helpers/timeouts"; @@ -15,8 +16,6 @@ import { ModsPage } from "../selectors/modsPage"; import { NavBar } from "../selectors/navbar"; import { AUTOMATION_LABELS, SettingsPage } from "../selectors/settings"; -const SDV_MOD_URL = "https://www.nexusmods.com/stardewvalley/mods/2400"; - const TIERS = [ { tier: "free", user: freeUser }, { tier: "premium", user: premiumUser }, diff --git a/packages/e2e/src/tests/mods-manual.spec.ts b/packages/e2e/src/tests/mods-manual.spec.ts index 935fce4516..858a7a8f08 100644 --- a/packages/e2e/src/tests/mods-manual.spec.ts +++ b/packages/e2e/src/tests/mods-manual.spec.ts @@ -7,6 +7,7 @@ import path from "node:path"; * has no real launcher). Native file picker is bypassed by overriding * dialog.showOpenDialog from the test side. */ +import { SDV_MOD_URL } from "../constants"; import { test, expect, type NexusUser } from "../fixtures/vortex-app"; import { acceptConsent } from "../helpers/consent"; import { Timeouts } from "../helpers/timeouts"; @@ -15,8 +16,6 @@ import { ModsPage } from "../selectors/modsPage"; import { NavBar } from "../selectors/navbar"; import { NexusModPage } from "../selectors/nexusModPage"; -const SDV_MOD_URL = "https://www.nexusmods.com/stardewvalley/mods/2400"; - const TIERS = [ { tier: "free", user: freeUser }, { tier: "premium", user: premiumUser }, diff --git a/packages/e2e/src/tests/mods.spec.ts b/packages/e2e/src/tests/mods.spec.ts index 6e4182fddd..6e76cdef2e 100644 --- a/packages/e2e/src/tests/mods.spec.ts +++ b/packages/e2e/src/tests/mods.spec.ts @@ -3,14 +3,13 @@ * SMAPI (mods/2400) — picked because it has no further prerequisites, so the * install completes cleanly. Premium users skip the slow-download interstitial. */ +import { SDV_MOD_URL } from "../constants"; import { test, expect, type NexusUser } from "../fixtures/vortex-app"; import { downloadModViaModManager } from "../helpers/modDownload"; import { Timeouts } from "../helpers/timeouts"; import { freeUser, premiumUser } from "../helpers/users"; import { NavBar } from "../selectors/navbar"; -const SDV_MOD_URL = "https://www.nexusmods.com/stardewvalley/mods/2400"; - const TIERS = [ { tier: "free", user: freeUser }, { tier: "premium", user: premiumUser },