Skip to content

Commit a6f2541

Browse files
Marek Danogcgoncalves
authored andcommitted
fix: playwright test failures in deleting resources and tools
Signed-off-by: Marek Dano <Marek.Dano@ibm.com>
1 parent 51db400 commit a6f2541

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

client/e2e/resources.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,16 +425,18 @@ test.describe("Resources page", () => {
425425

426426
test("card group disappears from grid when its only resource is deleted", async ({ page }) => {
427427
const SOLO = makeResource("lone_resource", "lone-gateway");
428+
let resourceDeleted = false;
428429

429430
await page.route("**/resources?*", async (route) => {
430431
await route.fulfill({
431432
status: 200,
432433
contentType: "application/json",
433-
body: JSON.stringify([SOLO, RESOURCE_A1]),
434+
body: JSON.stringify(resourceDeleted ? [RESOURCE_A1] : [SOLO, RESOURCE_A1]),
434435
});
435436
});
436437
await page.route(`**/resources/${SOLO.id}`, async (route) => {
437438
if (route.request().method() === "DELETE") {
439+
resourceDeleted = true;
438440
await route.fulfill({ status: 204 });
439441
} else {
440442
await route.fallback();

client/e2e/tools.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,18 @@ test.describe("Tools page", () => {
474474

475475
test("card group disappears from grid when its only tool is deleted", async ({ page }) => {
476476
const SOLO = makeTool("lone_tool", "lone-gateway");
477+
let toolDeleted = false;
477478

478479
await page.route("**/tools?*", async (route) => {
479480
await route.fulfill({
480481
status: 200,
481482
contentType: "application/json",
482-
body: JSON.stringify([SOLO, TOOL_A1]),
483+
body: JSON.stringify(toolDeleted ? [TOOL_A1] : [SOLO, TOOL_A1]),
483484
});
484485
});
485486
await page.route(`**/tools/${SOLO.id}`, async (route) => {
486487
if (route.request().method() === "DELETE") {
488+
toolDeleted = true;
487489
await route.fulfill({ status: 204 });
488490
} else {
489491
await route.fallback();

0 commit comments

Comments
 (0)