🔧 Fix race condition in colorpicket gradient tests (#6722)

This commit is contained in:
Belén Albeza 2025-06-19 08:57:38 +02:00 committed by GitHub
parent 386c729507
commit 70a29c43ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 16 deletions

View file

@ -61,24 +61,28 @@ test("Create a LINEAR gradient", async ({ page }) => {
const removeBtn = workspacePage.colorpicker const removeBtn = workspacePage.colorpicker
.getByRole("button", { name: "Remove color" }) .getByRole("button", { name: "Remove color" })
.nth(2); .last();
await removeBtn.click(); await removeBtn.click();
await removeBtn.click(); await removeBtn.click();
const inputColor1 = workspacePage.colorpicker const inputColor1 = workspacePage.colorpicker
.getByPlaceholder("Mixed") .getByRole("textbox", { name: "Color" })
.nth(1); .first();
await inputColor1.fill("fabada"); await inputColor1.fill("#fabada");
const inputOpacity1 = workspacePage.colorpicker.getByPlaceholder("--").nth(1); const inputOpacity1 = workspacePage.colorpicker
.getByTestId("opacity-input")
.first();
await inputOpacity1.fill("100"); await inputOpacity1.fill("100");
const inputColor2 = workspacePage.colorpicker const inputColor2 = workspacePage.colorpicker
.getByPlaceholder("Mixed") .getByRole("textbox", { name: "Color" })
.nth(2); .last();
await inputColor2.fill("red"); await inputColor2.fill("#ff0000");
const inputOpacity2 = workspacePage.colorpicker.getByPlaceholder("--").nth(2); const inputOpacity2 = workspacePage.colorpicker
.getByTestId("opacity-input")
.last();
await inputOpacity2.fill("40"); await inputOpacity2.fill("40");
const inputOpacityGlobal = workspacePage.colorpicker.getByTestId( const inputOpacityGlobal = workspacePage.colorpicker.getByTestId(
@ -139,20 +143,28 @@ test("Create a RADIAL gradient", async ({ page }) => {
const removeBtn = workspacePage.colorpicker const removeBtn = workspacePage.colorpicker
.getByRole("button", { name: "Remove color" }) .getByRole("button", { name: "Remove color" })
.nth(2); .last();
await removeBtn.click(); await removeBtn.click();
await removeBtn.click(); await removeBtn.click();
const inputColor1 = workspacePage.page.getByPlaceholder("Mixed").nth(1); const inputColor1 = workspacePage.page
await inputColor1.fill("fabada"); .getByRole("textbox", { name: "Color" })
.first();
await inputColor1.fill("#fabada");
const inputOpacity1 = workspacePage.colorpicker.getByPlaceholder("--").nth(1); const inputOpacity1 = workspacePage.colorpicker
.getByTestId("opacity-input")
.first();
await inputOpacity1.fill("100"); await inputOpacity1.fill("100");
const inputColor2 = workspacePage.page.getByPlaceholder("Mixed").nth(2); const inputColor2 = workspacePage.page
await inputColor2.fill("red"); .getByRole("textbox", { name: "Color" })
.last();
await inputColor2.fill("#ff0000");
const inputOpacity2 = workspacePage.colorpicker.getByPlaceholder("--").nth(2); const inputOpacity2 = workspacePage.colorpicker
.getByTestId("opacity-input")
.last();
await inputOpacity2.fill("100"); await inputOpacity2.fill("100");
const inputOpacityGlobal = workspacePage.colorpicker.getByTestId( const inputOpacityGlobal = workspacePage.colorpicker.getByTestId(

View file

@ -268,6 +268,7 @@
:on-focus on-focus :on-focus on-focus
:on-blur on-blur :on-blur on-blur
:on-change handle-opacity-change :on-change handle-opacity-change
:data-testid "opacity-input"
:default 100 :default 100
:min 0 :min 0
:max 100}]])] :max 100}]])]