From 8eed07fbb6328278e6cada28999a8bee13ca0af7 Mon Sep 17 00:00:00 2001 From: ktx-akshay Date: Wed, 14 May 2025 12:13:35 +0530 Subject: [PATCH] test: fix dashboard filter testcase (#6790) Fixed the skipped test cases by using an appropriate selector instead of force: true. --- .../dashboards/dashboard-filter.spec.js | 42 +++++++------------ 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/tests/ui-testing/playwright-tests/dashboards/dashboard-filter.spec.js b/tests/ui-testing/playwright-tests/dashboards/dashboard-filter.spec.js index 8c66b55e6c..ed0db58152 100644 --- a/tests/ui-testing/playwright-tests/dashboards/dashboard-filter.spec.js +++ b/tests/ui-testing/playwright-tests/dashboards/dashboard-filter.spec.js @@ -416,10 +416,7 @@ test.describe("dashboard filter testcases", () => { await deleteDashboard(page, randomDashboardName); }); - - test.skip("Should apply the filter group inside group", async ({ - page, - }) => { + test("Should apply the filter group inside group", async ({ page }) => { await page.locator('[data-test="menu-link-\\/dashboards-item"]').click(); await waitForDashboardPage(page); await page.locator('[data-test="dashboard-add"]').click(); @@ -481,7 +478,6 @@ test.describe("dashboard filter testcases", () => { await page.waitForTimeout(1000); await button.click(); - // await page.waitForTimeout(2000); await page .locator('[data-test="index-dropdown-stream"]') @@ -534,11 +530,13 @@ test.describe("dashboard filter testcases", () => { .map((node) => node.textContent.trim()) // Trim whitespace .join(""); }); - console.log(textContent, "Text content"); - console.log(`[data-test="dashboard-add-condition-label-0-${textContent}"]`); + await page .locator(`[data-test="dashboard-add-condition-label-0-${textContent}"]`) - .click({ force: true }); + .waitFor({ state: "visible" }); + await page + .locator(`[data-test="dashboard-add-condition-label-0-${textContent}"]`) + .click(); await page .locator('[data-test="dashboard-add-condition-column-0\\}"]') @@ -569,26 +567,14 @@ test.describe("dashboard filter testcases", () => { await page .locator(`[data-test="dashboard-add-condition-label-0-${textContent}"]`) .click(); - // await page.waitForTimeout(3000); - await page + + const lastInput = page .locator('[data-test="dashboard-add-condition-column-0\\}"]') - .first() - .click(); + .last(); + await lastInput.click(); + lastInput.fill("kubernetes_container_image"); - await page - .locator('[data-test="dashboard-add-condition-column-0\\}"]') - .first() - .fill("kubernetes_container_image"); - - await page - .getByRole("option", { name: "kubernetes_container_image" }) - .first() - .click({ force: true }); - // const option = page.getByRole("option", { name: "kubernetes_container_image" }).first(); - - // await option.waitFor({ state: "visible", timeout: 10000 }); - - // await option.click(); + await page.getByText("kubernetes_container_image", { exact: true }).click(); await page .locator('[data-test="dashboard-add-condition-condition-0"]') @@ -1031,7 +1017,9 @@ test.describe("dashboard filter testcases", () => { await page.locator('[data-test="common-auto-complete-option"]').click(); await page.locator('[data-test="dashboard-apply"]').click(); // await page.getByText("Error Loading Data").click(); - await expect(page.getByText('sql parser error: Expected:').first()).toBeVisible(); + await expect( + page.getByText("sql parser error: Expected:").first() + ).toBeVisible(); await page .locator(