test(e2e): use a secure random source for secret name tokens (#2665)
Co-authored-by: Kandev Agent <agent@kandev.dev> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { test, expect } from "../../fixtures/test-base";
|
||||
import {
|
||||
assertNoDescendantOverflowsRight,
|
||||
@@ -8,7 +10,7 @@ const WORKSPACE_VALUE = "e2e-mobile-copy-move-value";
|
||||
const GLOBAL_VALUE = "e2e-mobile-copy-move-global";
|
||||
|
||||
/** Unique per run so retries never collide with leftovers from a failed attempt. */
|
||||
const runToken = () => `${Date.now()}${Math.random().toString(36).slice(2, 6)}`;
|
||||
const runToken = () => `${Date.now()}${randomUUID().slice(0, 8)}`;
|
||||
|
||||
test.describe("mobile-secrets-copy-move", () => {
|
||||
test("moves a workspace secret to General and copies one back at phone width", async ({
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
import { test, expect } from "../../fixtures/test-base";
|
||||
|
||||
const GLOBAL_VALUE = "e2e-copy-move-global-value";
|
||||
|
||||
/** Unique per run so retries never collide with leftovers from a failed attempt. */
|
||||
const runToken = () => `${Date.now()}${Math.random().toString(36).slice(2, 6)}`;
|
||||
const runToken = () => `${Date.now()}${randomUUID().slice(0, 8)}`;
|
||||
const WORKSPACE_VALUE = "e2e-copy-move-workspace-value";
|
||||
|
||||
/** Creates a secret from the settings page via the Add secret dialog. */
|
||||
@@ -167,7 +169,7 @@ test.describe("secrets-copy-move", () => {
|
||||
test("restores focus to the trigger after closing the dialog", async ({ testPage }) => {
|
||||
// Unique per run: retries must not collide with a secret a previous
|
||||
// attempt left behind (the fixture reset does not remove secrets).
|
||||
const sourceName = `E2E Copy Move Focus ${Date.now()} ${Math.random().toString(36).slice(2, 6)}`;
|
||||
const sourceName = `E2E Copy Move Focus ${runToken()}`;
|
||||
await createSecretFromSettings(testPage, "/settings/general/secrets", sourceName, GLOBAL_VALUE);
|
||||
|
||||
await testPage.getByRole("button", { name: `Copy or move ${sourceName}` }).click();
|
||||
|
||||
Reference in New Issue
Block a user