test: fix dashboard filter testcase (#6790)

Fixed the skipped test cases by using an appropriate selector instead of
force: true.
This commit is contained in:
ktx-akshay
2025-05-14 12:13:35 +05:30
committed by GitHub
parent e1ab3da68f
commit 8eed07fbb6
@@ -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(