diff --git a/tests/ui-testing/playwright-tests/dashboards/custom-charts.spec.js b/tests/ui-testing/playwright-tests/dashboards/custom-charts.spec.js index e8954a7f68..e3acbcd068 100644 --- a/tests/ui-testing/playwright-tests/dashboards/custom-charts.spec.js +++ b/tests/ui-testing/playwright-tests/dashboards/custom-charts.spec.js @@ -2,11 +2,10 @@ import { test, expect } from "../baseFixtures"; import path from "path"; import fs from "fs"; import logsdata from "../../../test-data/logs_data.json"; -import { DashboardPage } from '../../pages/dashboardPage'; +import { DashboardPage } from "../../pages/dashboardPage"; // Function to handle login async function login(page) { - await page.goto(process.env["ZO_BASE_URL"]); if (await page.getByText("Login as internal user").isVisible()) { await page.getByText("Login as internal user").click(); @@ -14,8 +13,12 @@ async function login(page) { console.log("ZO_BASE_URL", process.env["ZO_BASE_URL"]); await page.waitForTimeout(1000); - await page.locator('[data-cy="login-user-id"]').fill(process.env["ZO_ROOT_USER_EMAIL"]); - await page.locator('[data-cy="login-password"]').fill(process.env["ZO_ROOT_USER_PASSWORD"]); + await page + .locator('[data-cy="login-user-id"]') + .fill(process.env["ZO_ROOT_USER_EMAIL"]); + await page + .locator('[data-cy="login-password"]') + .fill(process.env["ZO_ROOT_USER_PASSWORD"]); await page.locator('[data-cy="login-sign-in"]').click(); await page.waitForTimeout(4000); await page.goto(process.env["ZO_BASE_URL"]); @@ -29,23 +32,29 @@ async function ingestion(page) { ).toString("base64"); const headers = { - "Authorization": `Basic ${basicAuthCredentials}`, + Authorization: `Basic ${basicAuthCredentials}`, "Content-Type": "application/json", }; - const response = await page.evaluate(async ({ url, headers, orgId, streamName, logsdata }) => { - const fetchResponse = await fetch(`${url}/api/${orgId}/${streamName}/_json`, { - method: "POST", + const response = await page.evaluate( + async ({ url, headers, orgId, streamName, logsdata }) => { + const fetchResponse = await fetch( + `${url}/api/${orgId}/${streamName}/_json`, + { + method: "POST", + headers: headers, + body: JSON.stringify(logsdata), + } + ); + return await fetchResponse.json(); + }, + { + url: process.env.INGESTION_URL, headers: headers, - body: JSON.stringify(logsdata) - }); - return await fetchResponse.json(); - }, { - url: process.env.INGESTION_URL, - headers: headers, - orgId: orgId, - streamName: streamName, - logsdata: logsdata - }); + orgId: orgId, + streamName: streamName, + logsdata: logsdata, + } + ); console.log(response); } @@ -59,27 +68,23 @@ function readJsonFile(filename) { return fs.readFileSync(filePath, "utf8"); } -test.describe("Sanity Tests", () => { let dashboardPage +test.describe("Sanity Tests", () => { + let dashboardPage; let pictorialJSON, lineJSON; test.beforeEach(async ({ page }) => { - dashboardPage = new DashboardPage(page); - -}); + }); test.beforeAll(() => { - const jsonString = readJsonFile("pictorial.json"); - pictorialJSON = jsonString + pictorialJSON = jsonString; lineJSON = readJsonFile("line.json"); }); test.beforeEach(async ({ page }) => { - await login(page); - - + await page.waitForTimeout(1000); await ingestion(page); }); @@ -90,38 +95,43 @@ test.describe("Sanity Tests", () => { let dashboardPage return; } await dashboardPage.addCustomChart(); - // Type the content with raw modifier to bypass autocomplete - await page.keyboard.insertText(pictorialJSON); - - await page.waitForTimeout(1000); - await page.locator('[data-test="dashboard-panel-error-bar-icon"]').click(); - await page.locator('[data-test="dashboard-panel-query-editor"]').getByRole("textbox").fill('select * from "e2e_automate"'); - await page.waitForTimeout(2000); - await page.locator('[data-test="dashboard-apply"]').click(); - await page.waitForTimeout(3000); - await expect(page.getByText("Unsafe code detected: Access to 'document' is not allowed")).toBeVisible(); + // Type the content with raw modifier to bypass autocomplete + await page.keyboard.insertText(pictorialJSON); - -}); + await page.waitForTimeout(1000); + // await page.locator('[data-test="dashboard-panel-error-bar-icon"]').click(); + await page + .locator('[data-test="dashboard-panel-query-editor"]') + .getByRole("textbox") + .fill('select * from "e2e_automate"'); + await page.waitForTimeout(2000); + await page.locator('[data-test="dashboard-apply"]').click(); + await page.waitForTimeout(3000); + await expect( + page.getByText( + "Unsafe code detected: Access to 'document' is not allowed" + ) + ).toBeVisible(); + }); -test("Add line JSON in Monaco Editor", async ({ page }) => { + test("Add line JSON in Monaco Editor", async ({ page }) => { if (!lineJSON) { console.error("Skipping test: pictorial.json not found"); return; } await dashboardPage.addCustomChart(); - // Type the content with raw modifier to bypass autocomplete - await page.keyboard.insertText(lineJSON); - - await page.waitForTimeout(1000); - await page.locator('[data-test="dashboard-panel-error-bar-icon"]').click(); - await page.locator('[data-test="dashboard-panel-query-editor"]').getByRole("textbox").fill('select * from "e2e_automate"'); - await page.waitForTimeout(3000); - await page.locator('[data-test="dashboard-apply"]').click(); - await page.waitForTimeout(3000); - // await expect(page.getByText("Unsafe code detected: Access to 'document' is not allowed")).toBeVisible(); - - -}); + // Type the content with raw modifier to bypass autocomplete + await page.keyboard.insertText(lineJSON); + await page.waitForTimeout(1000); + // await page.locator('[data-test="dashboard-panel-error-bar-icon"]').click(); + await page + .locator('[data-test="dashboard-panel-query-editor"]') + .getByRole("textbox") + .fill('select * from "e2e_automate"'); + await page.waitForTimeout(3000); + await page.locator('[data-test="dashboard-apply"]').click(); + await page.waitForTimeout(3000); + // await expect(page.getByText("Unsafe code detected: Access to 'document' is not allowed")).toBeVisible(); + }); }); 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 ed0db58152..e743ee55c9 100644 --- a/tests/ui-testing/playwright-tests/dashboards/dashboard-filter.spec.js +++ b/tests/ui-testing/playwright-tests/dashboards/dashboard-filter.spec.js @@ -347,7 +347,7 @@ test.describe("dashboard filter testcases", () => { await page.getByLabel("Value").fill("$variablename"); await page.locator('[data-test="dashboard-apply"]').click(); - await page.getByText("arrow_rightQueryAutoPromQLCustom SQL").click(); + // await page.getByText("arrow_rightQueryAutoPromQLCustom SQL").click(); await expect(page.getByText("'$variablename'").first()).toBeVisible(); await page .locator('[data-test="dashboard-panel-data-view-query-inspector-btn"]') @@ -596,7 +596,7 @@ test.describe("dashboard filter testcases", () => { await page.locator('[data-test="dashboard-apply"]').click(); await page.locator('[data-test="dashboard-apply"]').click(); - await page.getByText("arrow_rightQueryAutoPromQLCustom SQL").click(); + // await page.getByText("arrow_rightQueryAutoPromQLCustom SQL").click(); await expect(page.getByText("'$variablename'").first()).toBeVisible(); await page .locator('[data-test="dashboard-panel-data-view-query-inspector-btn"]') diff --git a/tests/ui-testing/playwright-tests/dashboards/dashboard2.spec.js b/tests/ui-testing/playwright-tests/dashboards/dashboard2.spec.js index 81b44eae15..6f6161b588 100644 --- a/tests/ui-testing/playwright-tests/dashboards/dashboard2.spec.js +++ b/tests/ui-testing/playwright-tests/dashboards/dashboard2.spec.js @@ -515,7 +515,7 @@ test.describe("dashboard UI testcases", () => { await page.getByRole("button", { name: "9" }).last().click(); await page.getByRole("button", { name: "16" }).last().click(); - await page.locator('[data-test="chart-renderer"] div').click(); + // await page.locator('[data-test="chart-renderer"] div').click(); await page.locator('[data-test="dashboard-apply"]').click(); await page.reload(); diff --git a/web/src/components/dashboards/addPanel/DashboardQueryEditor.vue b/web/src/components/dashboards/addPanel/DashboardQueryEditor.vue index c7ea720e57..7f1e37dfc0 100644 --- a/web/src/components/dashboards/addPanel/DashboardQueryEditor.vue +++ b/web/src/components/dashboards/addPanel/DashboardQueryEditor.vue @@ -25,19 +25,6 @@ along with this program. If not, see . style="display: flex; flex-direction: row; align-items: center" data-test="dashboard-query-data" > -
- -
({ layout: { splitter: 20, querySplitter: 41, - showQueryBar: false, + showQueryBar: true, isConfigPanelOpen: false, currentQueryIndex: 0, vrlFunctionToggle: false, diff --git a/web/src/views/Dashboards/addPanel/AddPanel.vue b/web/src/views/Dashboards/addPanel/AddPanel.vue index bfd5814d35..7d69e6645b 100644 --- a/web/src/views/Dashboards/addPanel/AddPanel.vue +++ b/web/src/views/Dashboards/addPanel/AddPanel.vue @@ -180,138 +180,99 @@ along with this program. If not, see . />