From c5e8880eced33c578f656310d4f37c4ca0b83d7e Mon Sep 17 00:00:00 2001 From: joonashak Date: Tue, 24 Dec 2024 21:01:25 +0200 Subject: [PATCH] Randomize E2E map names --- testing/e2e/fixtures/map/map.fixture.ts | 4 ++-- testing/e2e/fixtures/map/map.ts | 11 ++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/testing/e2e/fixtures/map/map.fixture.ts b/testing/e2e/fixtures/map/map.fixture.ts index 9860b5a..4ea6ec0 100644 --- a/testing/e2e/fixtures/map/map.fixture.ts +++ b/testing/e2e/fixtures/map/map.fixture.ts @@ -2,8 +2,8 @@ import { authFixture } from "../auth.fixture"; import { Map } from "./map"; export const mapFixture = authFixture.extend<{ map: Map }>({ - map: async ({ page, account }, use) => { - const map = new Map(page, account); + map: async ({ page }, use) => { + const map = new Map(page); await map.create(); await use(map); }, diff --git a/testing/e2e/fixtures/map/map.ts b/testing/e2e/fixtures/map/map.ts index 157c827..ca75074 100644 --- a/testing/e2e/fixtures/map/map.ts +++ b/testing/e2e/fixtures/map/map.ts @@ -1,14 +1,11 @@ import { expect, Page } from "@playwright/test"; -import { Account } from "../auth.fixture"; export class Map { - constructor( - public readonly page: Page, - public readonly account: Account, - ) {} + constructor(public readonly page: Page) {} - async create() { - const mapName = `E2E Map ${this.account.eveId}`; + async create(name?: string) { + const hash = crypto.randomUUID().slice(9, 13); + const mapName = name || `E2E Map ${hash}`; await this.page.goto("/system/J104809"); await this.page.getByRole("button", { name: "Select active map" }).click(); await this.page.getByRole("menuitem", { name: "New Map" }).click();