mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 00:08:55 +00:00
test: pipeline updated assertions (#5413)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new suite of Playwright tests for validating enrichment table functionality. - Added new functions for enhanced navigation and interaction within the pipeline UI. - Added tests to assert the data in every derived stream with condition, function and only source + derived stream - Added tests to assert if user clicks on any menu option and cancel on dialog box, user stays on pipeline page - Added tests to assert if user clicks on dashboard menu option and accept on dialog box, user navigates to dashboard page - **Bug Fixes** - Improved error handling in tests to ensure accurate feedback during interactions. - **Chores** - Updated the GitHub Actions workflow to include additional integration tests. - Removed outdated test files related to function management, Kinesis ingestion, and reporting functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -113,6 +113,7 @@ jobs:
|
||||
"join.spec.js",
|
||||
"changeOrg.spec.js",
|
||||
"serviceAccount.spec.js",
|
||||
"enrichment.spec.js",
|
||||
|
||||
|
||||
]
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="no way of currently testing this")
|
||||
def test_e2e_ingestkineses(create_session, base_url):
|
||||
"""Running an E2E ingest data using valid access key"""
|
||||
|
||||
session = create_session
|
||||
url = base_url
|
||||
org_id = "e2e"
|
||||
access_key = "cm9vdEBhbHBoYTEuY29tOlgxT1JaSFNlckhJdDhjTEI="
|
||||
headers = {
|
||||
"X-Amz-Firehose-Access-Key": access_key,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
payload = {
|
||||
"records": [
|
||||
{
|
||||
"data": "H4sICE6PQmUAA2YxLmpzb24ARY/NCsIwEITvPsWSs0g9+NPeRFovVcEWPIhIbNcm2CYlSS0ivrtprPWykPmGycxrBEAq1JoWmD5rJAGQ9X6XHvbxZRsmyWoTknHnka1A5Wgpm7ylJmOxLPQXlrLYKNnUHR+UxCik1V/SzVVniteGSxHx0qDSFp7OP3/4QGGcZAWAl7sW8XzIcG/DbV9Dq+636dxfLufebOF7njc4+j2u7TGGfg/0ewJYM8zuXBTAkJaGgbxBbiO5oF03iLhCJjVOiAt823sevT+zyFHsKgEAAA=="
|
||||
}
|
||||
],
|
||||
"requestId": "9ec6b6f8-8b93-4734-8521-3e78a9517f5f",
|
||||
"timestamp": 1698860579000,
|
||||
}
|
||||
|
||||
resp_ingestkineses = session.post(
|
||||
f"{url}aws/default/{org_id}/_kinesis_firehose", json=payload, headers=headers
|
||||
)
|
||||
|
||||
print(resp_ingestkineses.content)
|
||||
assert (
|
||||
resp_ingestkineses.status_code == 200
|
||||
), f"Creating a user 200, but got {resp_ingestkineses.status_code} {resp_ingestkineses.content}"
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="no way of currently testing this")
|
||||
def test_e2e_invalidingestkineses(create_session, base_url):
|
||||
"""Running an E2E test for incorrect access key while data ingestion."""
|
||||
|
||||
session = create_session
|
||||
url = base_url
|
||||
org_id = "e2e"
|
||||
access_key = "cm9vdEBhbHBoYTEuY29tOlgxT1JaSFNlckh"
|
||||
headers = {
|
||||
"X-Amz-Firehose-Access-Key": access_key,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
payload = {
|
||||
"records": [
|
||||
{
|
||||
"data": "H4sICE6PQmUAA2YxLmpzb24ARY/NCsIwEITvPsWSs0g9+NPeRFovVcEWPIhIbNcm2CYlSS0ivrtprPWykPmGycxrBEAq1JoWmD5rJAGQ9X6XHvbxZRsmyWoTknHnka1A5Wgpm7ylJmOxLPQXlrLYKNnUHR+UxCik1V/SzVVniteGSxHx0qDSFp7OP3/4QGGcZAWAl7sW8XzIcG/DbV9Dq+636dxfLufebOF7njc4+j2u7TGGfg/0ewJYM8zuXBTAkJaGgbxBbiO5oF03iLhCJjVOiAt823sevT+zyFHsKgEAAA=="
|
||||
}
|
||||
],
|
||||
"requestId": "9ec6b6f8-8b93-4734-8521-3e78a9517f5f",
|
||||
"timestamp": 1698860579000,
|
||||
}
|
||||
|
||||
resp_ingestkineses = session.post(
|
||||
f"{url}aws/default/{org_id}/_kinesis_firehose", json=payload, headers=headers
|
||||
)
|
||||
|
||||
print(resp_ingestkineses.content)
|
||||
assert (
|
||||
resp_ingestkineses.status_code == 401
|
||||
), f"Creating a user 200, but got {resp_ingestkineses.status_code} {resp_ingestkineses.content}"
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="no way of currently testing this")
|
||||
def test_e2e_incorrertdatakineses(create_session, base_url):
|
||||
"""Running an E2E test for missing request id in response."""
|
||||
|
||||
session = create_session
|
||||
url = base_url
|
||||
org_id = "e2e"
|
||||
access_key = "cm9vdEBhbHBoYTEuY29tOlgxT1JaSFNlckhJdDhjTEI="
|
||||
headers = {
|
||||
"X-Amz-Firehose-Access-Key": access_key,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
payload = {
|
||||
"records": [
|
||||
{
|
||||
"data": "H4sICE6PQmUAA2YxLmpzb24ARY/NCsIwEITvPsWSs0g9+NPeRFovVcEWPIhIbNcm2CYlSS0ivrtprPWykPmGycxrBEAq1JoWmD5rJAGQ9X6XHvbxZRsmyWoTknHnka1A5Wgpm7ylJmOxLPQXlrLYKNnUHR+UxCik1V/SzVVniteGSxHx0qDSFp7OP3/4QGGcZAWAl7sW8XzIcG/DbV9Dq+636dxfLufebOF7njc4+j2u7TGGfg/0ewJYM8zuXBTAkJaGgbxBbiO5oF03iLhCJjVOiAt823sevT+zyFHsKgEAAA=="
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
resp_ingestkineses = session.post(
|
||||
f"{url}aws/default/{org_id}/_kinesis_firehose", json=payload, headers=headers
|
||||
)
|
||||
|
||||
print(resp_ingestkineses.content)
|
||||
assert (
|
||||
resp_ingestkineses.status_code == 400
|
||||
), f"Missing requestID 200 , but got {resp_ingestkineses.status_code} {resp_ingestkineses.content}"
|
||||
@@ -0,0 +1,322 @@
|
||||
import { test, expect } from "./baseFixtures";
|
||||
import logData from "../../ui-testing/cypress/fixtures/log.json";
|
||||
// import { log } from "console";
|
||||
import logsdata from "../../test-data/logs_data.json";
|
||||
import PipelinePage from "../pages/pipelinePage";
|
||||
// import { pipeline } from "stream";
|
||||
// import fs from "fs";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
test.describe.configure({ mode: "parallel" });
|
||||
|
||||
const randomPipelineName = `Pipeline${Math.floor(Math.random() * 1000)}`;
|
||||
const randomFunctionName = `Pipeline${Math.floor(Math.random() * 1000)}`;
|
||||
|
||||
async function login(page) {
|
||||
await page.goto(process.env["ZO_BASE_URL"]);
|
||||
// await page.getByText('Login as internal user').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page
|
||||
.locator('[data-cy="login-user-id"]')
|
||||
.fill(process.env["ZO_ROOT_USER_EMAIL"]);
|
||||
//Enter Password
|
||||
await page.locator("label").filter({ hasText: "Password *" }).click();
|
||||
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"]);
|
||||
}
|
||||
async function ingestion(page) {
|
||||
const orgId = process.env["ORGNAME"];
|
||||
const streamName = "e2e_automate";
|
||||
const basicAuthCredentials = Buffer.from(
|
||||
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
|
||||
).toString('base64');
|
||||
|
||||
const headers = {
|
||||
"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',
|
||||
headers: headers,
|
||||
body: JSON.stringify(logsdata)
|
||||
});
|
||||
return await fetchResponse.json();
|
||||
}, {
|
||||
url: process.env.INGESTION_URL,
|
||||
headers: headers,
|
||||
orgId: orgId,
|
||||
streamName: streamName,
|
||||
logsdata: logsdata
|
||||
});
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
const selectStreamAndStreamTypeForLogs = async (page, stream) => {
|
||||
await page.waitForTimeout(4000);
|
||||
await page
|
||||
.locator('[data-test="log-search-index-list-select-stream"]')
|
||||
.click({ force: true });
|
||||
await page
|
||||
.locator("div.q-item")
|
||||
.getByText(`${stream}`)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
};
|
||||
|
||||
|
||||
test.describe("Enrichment data testcases", () => {
|
||||
// let logData;
|
||||
function removeUTFCharacters(text) {
|
||||
// console.log(text, "tex");
|
||||
// Remove UTF characters using regular expression
|
||||
return text.replace(/[^\x00-\x7F]/g, " ");
|
||||
}
|
||||
async function applyQueryButton(page) {
|
||||
// click on the run query button
|
||||
// Type the value of a variable into an input field
|
||||
const search = page.waitForResponse(logData.applyQuery);
|
||||
await page.waitForTimeout(3000);
|
||||
await page.locator("[data-test='logs-search-bar-refresh-btn']").click({
|
||||
force: true,
|
||||
});
|
||||
// get the data from the search variable
|
||||
await expect.poll(async () => (await search).status()).toBe(200);
|
||||
// await search.hits.FIXME_should("be.an", "array");
|
||||
}
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await login(page);
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
|
||||
// ("ingests logs via API", () => {
|
||||
const orgId = process.env["ORGNAME"];
|
||||
const streamName = "e2e_automate";
|
||||
const basicAuthCredentials = Buffer.from(
|
||||
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
|
||||
).toString("base64");
|
||||
|
||||
const headers = {
|
||||
Authorization: `Basic ${basicAuthCredentials}`,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
await ingestion(page);
|
||||
await page.goto(
|
||||
`${logData.logsUrl}?org_identifier=${process.env["ORGNAME"]}`
|
||||
);
|
||||
const allsearch = page.waitForResponse("**/api/default/_search**");
|
||||
await selectStreamAndStreamTypeForLogs(page, logData.Stream);
|
||||
await applyQueryButton(page);
|
||||
});
|
||||
|
||||
|
||||
|
||||
test("should upload an enrichment table under functions", async ({
|
||||
page,
|
||||
}) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
|
||||
// Generate a unique file name and replace hyphens with underscores
|
||||
let fileName = `enrichment_info_${uuidv4()}_csv`.replace(/-/g, "_");
|
||||
console.log("Generated File Name:", fileName);
|
||||
|
||||
// Set the file to be uploaded
|
||||
const fileContentPath = "../test-data/enrichment_info.csv";
|
||||
const inputFile = await page.locator('input[type="file"]');
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
|
||||
// Enter the file name
|
||||
await page.fill(".q-input > .q-field__inner > .q-field__control", fileName);
|
||||
|
||||
// Click on 'Save'
|
||||
await page.getByText("Save").click({ force: true });
|
||||
|
||||
// Wait for the process to complete
|
||||
await page.reload();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
// Explore the uploaded table
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
await page.locator('[data-test="log-table-column-0-_timestamp"]').click();
|
||||
await page.locator('[data-test="close-dialog"]').click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Return to the pipeline menu and verify the uploaded table
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
|
||||
// Verify and delete enrichment tables
|
||||
await pipelinePage.deleteEnrichmentTableByName(fileName)
|
||||
});
|
||||
|
||||
test.skip("should upload an enrichment table under functions with VRL", async ({
|
||||
page,
|
||||
}) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
|
||||
// Generate a unique file name
|
||||
let fileName = `protocols_${uuidv4()}_csv`;
|
||||
console.log("Generated File Name:", fileName);
|
||||
fileName = fileName.replace(/-/g, "_");
|
||||
|
||||
// Set the file to be uploaded
|
||||
const fileContentPath = "../test-data/protocols.csv";
|
||||
const inputFile = await page.locator('input[type="file"]');
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
|
||||
// Enter the file name
|
||||
await page.fill(".q-input > .q-field__inner > .q-field__control", fileName);
|
||||
|
||||
// Click on 'Save'
|
||||
await page.getByText("Save").click({ force: true });
|
||||
|
||||
// Reload the page to ensure table is updated
|
||||
await page.reload();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Search for the uploaded file name
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Verify the file name in the enrichment table
|
||||
const rows = await page.locator("tbody tr");
|
||||
let fileFound = false;
|
||||
|
||||
for (let i = 0; i < (await rows.count()); i++) {
|
||||
const row = rows.nth(i);
|
||||
const displayedName = await row
|
||||
.locator("td.text-left")
|
||||
.nth(1)
|
||||
.textContent();
|
||||
if (displayedName?.trim() === fileName) {
|
||||
fileFound = true;
|
||||
console.log("File found in table:", displayedName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileFound) {
|
||||
throw new Error(`File name "${fileName}" not found in the table.`);
|
||||
}
|
||||
|
||||
// Explore the file
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
await page.locator("#fnEditor").getByLabel("Editor content;Press Alt+F1")
|
||||
.fill(`
|
||||
abc, err = get_enrichment_table_record("${fileName}", {
|
||||
"protocol_number": to_string!(.protocol_number)
|
||||
})
|
||||
.protocol_keyword = abc.keyword
|
||||
`);
|
||||
|
||||
// Wait briefly to allow input processing
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// Apply the query
|
||||
await applyQueryButton(page);
|
||||
|
||||
// Verify that no warning is shown for query execution
|
||||
const warningElement = page.locator("text=warning Query execution");
|
||||
await expect(warningElement).toBeHidden();
|
||||
|
||||
// Expand the first row in the logs table
|
||||
await page.waitForTimeout(3000);
|
||||
await page
|
||||
.locator(
|
||||
'[data-test="log-table-column-0-_timestamp"] [data-test="table-row-expand-menu"]'
|
||||
)
|
||||
.click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page
|
||||
.locator('[data-test="log-expand-detail-key-protocol_keyword-text"]')
|
||||
.click();
|
||||
// Return to the pipeline menu and delete the uploaded table
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
await pipelinePage.deleteEnrichmentTableByName(fileName)
|
||||
|
||||
});
|
||||
|
||||
|
||||
test("should display error when CSV not added in enrichment table", async ({
|
||||
page,
|
||||
}) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
await page.getByLabel('Name').fill('test')
|
||||
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByText('CSV File is required!').click();
|
||||
})
|
||||
|
||||
|
||||
test("should append an enrichment table under functions", async ({ page }) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
|
||||
// Generate a unique file name and replace hyphens with underscores
|
||||
let fileName = `append_${uuidv4()}_csv`.replace(/-/g, "_");
|
||||
console.log("Generated File Name:", fileName);
|
||||
|
||||
// First upload step
|
||||
const fileContentPath = "../test-data/append.csv";
|
||||
const inputFile = await page.locator('input[type="file"]');
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
|
||||
// Enter the file name
|
||||
await page.fill(".q-input > .q-field__inner > .q-field__control", fileName);
|
||||
|
||||
// Click on 'Save'
|
||||
await page.getByText("Save").click({ force: true });
|
||||
|
||||
// Wait for the process to complete
|
||||
await page.reload();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Explore the uploaded table
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
await page.locator('[data-test="log-table-column-0-_timestamp"]').click();
|
||||
await page.locator('[data-test="close-dialog"]').click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Navigate to append data to the existing enrichment table
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.getByRole("button", { name: "Enrichment Tables" }).click();
|
||||
|
||||
// Select the append toggle
|
||||
await page.getByLabel("Append data to existing").locator("div").first().click();
|
||||
|
||||
|
||||
// Upload the CSV again for appending
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
// Explore the uploaded table
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
|
||||
const showingText = page.getByText('Showing 1 to 2 out of 2');
|
||||
await expect(showingText).toBeVisible()
|
||||
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await pipelinePage.deleteEnrichmentTableByName(fileName)
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,248 +0,0 @@
|
||||
import { test, expect } from "./baseFixtures";
|
||||
import logData from "../../ui-testing/cypress/fixtures/log.json";
|
||||
import { log } from "console";
|
||||
import logsdata from "../../test-data/logs_data.json";
|
||||
const uniqueText = `${new Date().valueOf()}`
|
||||
|
||||
|
||||
|
||||
// test.describe.configure({ mode: 'parallel' });
|
||||
const { v4: uuidv4 } = require("uuid");
|
||||
|
||||
// Generate UUID
|
||||
const uuid = uuidv4();
|
||||
|
||||
// Remove non-alphabetic characters from UUID
|
||||
const alphaUuid = uuid.replace(/[^a-zA-Z]/g, "");
|
||||
|
||||
// Construct function name
|
||||
const functionName = `automate${alphaUuid}`;
|
||||
|
||||
|
||||
|
||||
|
||||
async function login(page) {
|
||||
await page.goto(process.env["ZO_BASE_URL"]);
|
||||
await page.waitForTimeout(1000);
|
||||
// await page.getByText('Login as internal user').click();
|
||||
await page
|
||||
.locator('[data-cy="login-user-id"]')
|
||||
.fill(process.env["ZO_ROOT_USER_EMAIL"]);
|
||||
//Enter Password
|
||||
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"]);
|
||||
}
|
||||
|
||||
|
||||
const selectStreamAndStreamTypeForLogs = async (page,stream) => {await page.waitForTimeout(
|
||||
4000);await page.locator(
|
||||
'[data-test="log-search-index-list-select-stream"]').click({ force: true });await page.locator(
|
||||
"div.q-item").getByText(`${stream}`).first().click({ force: true });
|
||||
};
|
||||
test.describe("Functions testcases", () => {
|
||||
// let logData;
|
||||
function removeUTFCharacters(text) {
|
||||
// console.log(text, "tex");
|
||||
// Remove UTF characters using regular expression
|
||||
return text.replace(/[^\x00-\x7F]/g, " ");
|
||||
}
|
||||
async function applyQueryButton(page) {
|
||||
// click on the run query button
|
||||
// Type the value of a variable into an input field
|
||||
const search = page.waitForResponse(logData.applyQuery);
|
||||
await page.waitForTimeout(3000);
|
||||
await page.locator("[data-test='logs-search-bar-refresh-btn']").click({
|
||||
force: true,
|
||||
});
|
||||
// get the data from the search variable
|
||||
await expect.poll(async () => (await search).status()).toBe(200);
|
||||
// await search.hits.FIXME_should("be.an", "array");
|
||||
}
|
||||
// tebefore(async function () {
|
||||
// // logData("log");
|
||||
// // const data = page;
|
||||
// // logData = data;
|
||||
|
||||
// console.log("--logData--", logData);
|
||||
// });
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await login(page);
|
||||
await page.waitForTimeout(5000)
|
||||
|
||||
// ("ingests logs via API", () => {
|
||||
const orgId = process.env["ORGNAME"];
|
||||
const streamName = "e2e_automate";
|
||||
const basicAuthCredentials = Buffer.from(
|
||||
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
|
||||
).toString('base64');
|
||||
|
||||
const headers = {
|
||||
"Authorization": `Basic ${basicAuthCredentials}`,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
// const logsdata = {}; // Fill this with your actual data
|
||||
|
||||
// Making a POST request using fetch API
|
||||
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,
|
||||
orgId: orgId,
|
||||
streamName: streamName,
|
||||
logsdata: logsdata
|
||||
});
|
||||
|
||||
console.log(response);
|
||||
// });
|
||||
// const allorgs = page.waitForResponse("**/api/default/organizations**");
|
||||
// const functions = page.waitForResponse("**/api/default/functions**");
|
||||
await page.goto(
|
||||
`${logData.functionUrl}functions?org_identifier=${process.env["ORGNAME"]}`
|
||||
|
||||
);
|
||||
// const allsearch = page.waitForResponse("**/api/default/_search**");
|
||||
// await selectStreamAndStreamTypeForLogs(page,logData.Stream);
|
||||
// await applyQueryButton(page);
|
||||
// const streams = page.waitForResponse("**/api/default/streams**");
|
||||
});
|
||||
|
||||
|
||||
|
||||
test("should display error when creating function without mandatory fields", async ({ page }) => {await page.getByText(/Create new function/).first().click({
|
||||
force: true });await expect(page.getByText(/Save/).first()).toBeVisible();await page.getByText(/Save/).first().click({
|
||||
force: true });await expect(page.getByText(/Field is required/).first()).toBeVisible();
|
||||
|
||||
});
|
||||
|
||||
test("should display error on entering invalid name under function and save", async ({ page }) => {await page.getByText(/Create new function/).first().click({
|
||||
force: true });await page.locator(
|
||||
".q-pb-sm > .q-field > .q-field__inner > .q-field__control").fill(
|
||||
uniqueText);await expect(page.getByText(/Save/).first()).toBeVisible();await page.getByText(/Save/).first().click({
|
||||
|
||||
force: true });await expect(page.getByText(/Invalid method name\./).first()).toBeVisible();
|
||||
|
||||
});
|
||||
|
||||
test("should display error on entering invalid function and save", async ({ page }) => {await page.getByText(/Create new function/).first().click({
|
||||
force: true });await page.locator(
|
||||
".q-pb-sm > .q-field > .q-field__inner > .q-field__control").fill(
|
||||
functionName);
|
||||
await page.locator('.view-lines').click();
|
||||
|
||||
// Type into the focused element
|
||||
await page.keyboard.type('.test=1');
|
||||
await expect(page.getByText(/Save/).first()).toBeVisible();await page.getByText(/Save/).first().click({
|
||||
force: true });await expect(page.locator(
|
||||
".q-notification__message").getByText(/Function saved successfully/).first()).toBeVisible();
|
||||
await page.locator('[data-test="functions-list-search-input"]').click()
|
||||
await page.keyboard.type(functionName);
|
||||
await page.waitForTimeout(1000)
|
||||
await page.click('button[title="Delete Function"]');
|
||||
await page.click('[data-test="confirm-button"] > .q-btn__content')
|
||||
});
|
||||
|
||||
test("should display error on adding function with same name", async ({ page }) =>
|
||||
{await page.getByText(/Create new function/).first().click({
|
||||
force: true });await page.locator(
|
||||
".q-pb-sm > .q-field > .q-field__inner > .q-field__control").fill(
|
||||
functionName);
|
||||
await page.locator('.view-lines').click();
|
||||
await page.keyboard.type('.test=1');
|
||||
await expect(page.getByText(/Save/).first()).toBeVisible();
|
||||
await page.getByText(/Save/).first().click({
|
||||
force: true });
|
||||
await expect(page.locator(
|
||||
".q-notification__message").getByText(/Function saved successfully/).first()).toBeVisible();
|
||||
await page.getByText(/Create new function/).first().click({force: true });
|
||||
await page.locator(
|
||||
".q-pb-sm > .q-field > .q-field__inner > .q-field__control").fill(functionName);
|
||||
await page.locator('.view-lines').click();
|
||||
await page.keyboard.type('.test=1');
|
||||
await expect(page.getByText(/Save/).first()).toBeVisible();await page.getByText(/Save/).first().click({
|
||||
force: true });
|
||||
await expect(page.locator(
|
||||
".q-notification__message").getByText(/Function creation failed/).first()).toBeVisible();
|
||||
await page.getByText(/Cancel/).first().click({force: true });
|
||||
await page.locator('[data-test="functions-list-search-input"]').click()
|
||||
await page.keyboard.type(functionName);
|
||||
await page.waitForTimeout(1000)
|
||||
await page.click('button[title="Delete Function"]');
|
||||
await page.click('[data-test="confirm-button"] > .q-btn__content')
|
||||
});
|
||||
|
||||
|
||||
// test("should add a function and associate a stream with the same", async ({ page }) => {await page.getByText(/Create new function/).first().click({
|
||||
// force: true });await page.locator(
|
||||
// ".q-pb-sm > .q-field > .q-field__inner > .q-field__control").fill(
|
||||
// functionName);
|
||||
// await page.locator('.view-lines').click();
|
||||
// await page.keyboard.type('.test=1');
|
||||
// await expect(page.getByText(/Save/).first()).toBeVisible();await page.getByText(/Save/).first().click({
|
||||
// force: true });await expect(page.locator(
|
||||
// ".q-notification__message").getByText(/Function saved successfully/).first()).toBeVisible();await page.locator(
|
||||
|
||||
|
||||
// '[data-test="function-stream-tab"]').click({ force: true });await page.waitForTimeout(
|
||||
// 2000);
|
||||
|
||||
// await page.locator('[data-test="stream-association-search-input"]').click()
|
||||
// await page.keyboard.type("e2e_automate");
|
||||
// await page.locator( '[data-test="log-stream-table"] >>> :nth-child(2) > :nth-child(1) > :nth-child(2)').click();
|
||||
// await page.waitForTimeout(1000)
|
||||
// await page.click('button[data-test="stream-association-associate-function-btn"]');
|
||||
|
||||
|
||||
// // cy.get('[style="cursor: pointer;"] > :nth-child(3)').click({ force: true });
|
||||
// // await page.getByText(/Associate Function/).first().click({ force: true });
|
||||
// await page.locator(
|
||||
|
||||
// '[style="height: min-content; border: 1px solid black;"] > [colspan="100%"] > [style=""] > .q-table__container > .q-table__middle > .q-table > tbody > .q-tr > :nth-child(2) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container').fill(
|
||||
// functionName);await page.waitForTimeout(
|
||||
// 2000);await page.locator(
|
||||
// ".q-item__label > span").click({ force: true });await page.waitForTimeout(
|
||||
// 1000);const scope = page.locator(
|
||||
|
||||
|
||||
// "tr").filter({ has: page.locator("tr.q-tr").getByText(functionName).first() });
|
||||
|
||||
// // Click the delete button
|
||||
// await scope.locator(
|
||||
// 'button[data-test="stream-association-delete-function-btn"]').click();await page.locator(
|
||||
|
||||
|
||||
|
||||
// '[href="/web/functions/functions?org_identifier=default"] > .q-tab__content').click({
|
||||
// force: true });
|
||||
// await page.keyboard.type(functionName);
|
||||
// await page.waitForTimeout(1000)
|
||||
// await page.click('button[title="Delete Function"]');
|
||||
// await page.click('[data-test="confirm-button"] > .q-btn__content')
|
||||
// // await page.locator(
|
||||
// // '[data-test="functions-list-search-input"]').fill(functionName);
|
||||
// // {const scope = page.locator(
|
||||
|
||||
|
||||
// // "tr").filter({ has: page.locator("tr").getByText(functionName).first() });
|
||||
|
||||
// // // Click the delete button
|
||||
// // await scope.locator('button[title="Delete Function"]').click();}await page.locator(
|
||||
|
||||
// // '[data-test="confirm-button"] > .q-btn__content').click();
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -1,10 +1,10 @@
|
||||
import { test, expect } from "./baseFixtures";
|
||||
import logData from "../../ui-testing/cypress/fixtures/log.json";
|
||||
import { log } from "console";
|
||||
// import { log } from "console";
|
||||
import logsdata from "../../test-data/logs_data.json";
|
||||
import PipelinePage from "../pages/pipelinePage";
|
||||
import { pipeline } from "stream";
|
||||
import fs from "fs";
|
||||
// import { pipeline } from "stream";
|
||||
// import fs from "fs";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
test.describe.configure({ mode: "parallel" });
|
||||
@@ -25,8 +25,34 @@ async function login(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"]);
|
||||
|
||||
}
|
||||
async function ingestion(page) {
|
||||
const orgId = process.env["ORGNAME"];
|
||||
const streamName = "e2e_automate";
|
||||
const basicAuthCredentials = Buffer.from(
|
||||
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
|
||||
).toString('base64');
|
||||
|
||||
const headers = {
|
||||
"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',
|
||||
headers: headers,
|
||||
body: JSON.stringify(logsdata)
|
||||
});
|
||||
return await fetchResponse.json();
|
||||
}, {
|
||||
url: process.env.INGESTION_URL,
|
||||
headers: headers,
|
||||
orgId: orgId,
|
||||
streamName: streamName,
|
||||
logsdata: logsdata
|
||||
});
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
const selectStreamAndStreamTypeForLogs = async (page, stream) => {
|
||||
@@ -40,6 +66,46 @@ const selectStreamAndStreamTypeForLogs = async (page, stream) => {
|
||||
.first()
|
||||
.click({ force: true });
|
||||
};
|
||||
async function exploreStreamAndNavigateToPipeline(page, streamName) {
|
||||
// Navigate to the streams menu
|
||||
await page.locator('[data-test="menu-link-\\/streams-item"]').click();
|
||||
|
||||
// Search for the stream
|
||||
await page.getByPlaceholder('Search Stream').click();
|
||||
await page.getByPlaceholder('Search Stream').fill(streamName);
|
||||
|
||||
// Click on the 'Explore' button
|
||||
await page.getByRole('button', { name: 'Explore' }).first().click();
|
||||
|
||||
// Expand the log table menu
|
||||
await page.locator('[data-test="log-table-column-1-_timestamp"] [data-test="table-row-expand-menu"]').click();
|
||||
|
||||
// Navigate to the pipeline menu
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
}
|
||||
|
||||
async function exploreStreamAndInteractWithLogDetails(page, streamName) {
|
||||
// Navigate to the streams menu
|
||||
await page.locator('[data-test="menu-link-\\/streams-item"]').click();
|
||||
|
||||
// Search for the stream
|
||||
await page.getByPlaceholder('Search Stream').click();
|
||||
await page.getByPlaceholder('Search Stream').fill(streamName);
|
||||
|
||||
// Click on the 'Explore' button
|
||||
await page.getByRole('button', { name: 'Explore' }).first().click();
|
||||
|
||||
// Expand the log table menu
|
||||
await page.locator('[data-test="log-table-column-1-_timestamp"] [data-test="table-row-expand-menu"]').click();
|
||||
|
||||
// Interact with the log detail key
|
||||
await page.locator('[data-test="log-expand-detail-key-a-text"]').click();
|
||||
|
||||
// Navigate to the pipeline menu
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
}
|
||||
|
||||
|
||||
async function deletePipeline(page, randomPipelineName) {
|
||||
// Click the back button
|
||||
await page.locator('[data-test="add-pipeline-back-btn"]').click();
|
||||
@@ -97,31 +163,7 @@ test.describe("Pipeline testcases", () => {
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
// const logsdata = {}; // Fill this with your actual data
|
||||
|
||||
// Making a POST request using fetch API
|
||||
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,
|
||||
orgId: orgId,
|
||||
streamName: streamName,
|
||||
logsdata: logsdata,
|
||||
}
|
||||
);
|
||||
|
||||
console.log(response);
|
||||
await ingestion(page);
|
||||
await page.goto(
|
||||
`${logData.logsUrl}?org_identifier=${process.env["ORGNAME"]}`
|
||||
);
|
||||
@@ -268,6 +310,9 @@ test.describe("Pipeline testcases", () => {
|
||||
const pipelineName = `pipeline-${Math.random().toString(36).substring(7)}`;
|
||||
await pipelinePage.enterPipelineName(pipelineName);
|
||||
await pipelinePage.savePipeline();
|
||||
await ingestion(page);
|
||||
// Verify the data ingested in destination and verify under logs page
|
||||
await exploreStreamAndNavigateToPipeline(page, 'destination_node');
|
||||
await pipelinePage.searchPipeline(pipelineName);
|
||||
await page.waitForTimeout(1000);
|
||||
const deletePipelineButton = page.locator(
|
||||
@@ -355,13 +400,13 @@ test.describe("Pipeline testcases", () => {
|
||||
await pipelinePage.enterFunctionName(randomFunctionName);
|
||||
await page.locator(".view-lines").click();
|
||||
// Type the function text with a delay to ensure each character registers
|
||||
await page.keyboard.type(".a=2", { delay: 100 });
|
||||
await page.keyboard.type(".a=41", { delay: 100 });
|
||||
await page.keyboard.press("Enter");
|
||||
await page.keyboard.type(".", { delay: 100 });
|
||||
await page.getByText("Note: The function will be").click();
|
||||
|
||||
// Check if the required text is present in the editor
|
||||
await page.getByText(".a=2 .");
|
||||
await page.getByText(".a=41 .");
|
||||
|
||||
// Optional: Add a short wait to confirm the action is processed
|
||||
await page.waitForTimeout(1000);
|
||||
@@ -391,6 +436,9 @@ test.describe("Pipeline testcases", () => {
|
||||
const pipelineName = `pipeline-${Math.random().toString(36).substring(7)}`;
|
||||
await pipelinePage.enterPipelineName(pipelineName);
|
||||
await pipelinePage.savePipeline();
|
||||
await ingestion(page);
|
||||
// Verify the data ingested in destination & function and verify under logs page
|
||||
await exploreStreamAndInteractWithLogDetails(page, 'destination_node');
|
||||
await pipelinePage.searchPipeline(pipelineName);
|
||||
await page.waitForTimeout(1000);
|
||||
const deletePipelineButton = page.locator(
|
||||
@@ -530,6 +578,9 @@ test.describe("Pipeline testcases", () => {
|
||||
const pipelineName = `pipeline-${Math.random().toString(36).substring(7)}`;
|
||||
await pipelinePage.enterPipelineName(pipelineName);
|
||||
await pipelinePage.savePipeline();
|
||||
await ingestion(page);
|
||||
// Verify the data ingested in destination and verify under logs page
|
||||
await exploreStreamAndNavigateToPipeline(page, 'destination_node');
|
||||
await page.waitForTimeout(1000);
|
||||
await pipelinePage.searchPipeline(pipelineName);
|
||||
await page.waitForTimeout(1000);
|
||||
@@ -616,208 +667,78 @@ test.describe("Pipeline testcases", () => {
|
||||
await page.getByText("Please connect all nodes").click();
|
||||
});
|
||||
|
||||
test("should upload an enrichment table under functions", async ({
|
||||
|
||||
test("should navigate to dashboard page if user accepts dialog box", async ({
|
||||
page,
|
||||
}) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
|
||||
// Generate a unique file name and replace hyphens with underscores
|
||||
let fileName = `enrichment_info_${uuidv4()}_csv`.replace(/-/g, "_");
|
||||
console.log("Generated File Name:", fileName);
|
||||
|
||||
// Set the file to be uploaded
|
||||
const fileContentPath = "../test-data/enrichment_info.csv";
|
||||
const inputFile = await page.locator('input[type="file"]');
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
|
||||
// Enter the file name
|
||||
await page.fill(".q-input > .q-field__inner > .q-field__control", fileName);
|
||||
|
||||
// Click on 'Save'
|
||||
await page.getByText("Save").click({ force: true });
|
||||
|
||||
// Wait for the process to complete
|
||||
await page.reload();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
// Explore the uploaded table
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
await page.locator('[data-test="log-table-column-0-_timestamp"]').click();
|
||||
await page.locator('[data-test="close-dialog"]').click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Return to the pipeline menu and verify the uploaded table
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
|
||||
// Verify and delete enrichment tables
|
||||
await pipelinePage.deleteEnrichmentTableByName(fileName)
|
||||
});
|
||||
|
||||
test.skip("should upload an enrichment table under functions with VRL", async ({
|
||||
page,
|
||||
}) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
|
||||
// Generate a unique file name
|
||||
let fileName = `protocols_${uuidv4()}_csv`;
|
||||
console.log("Generated File Name:", fileName);
|
||||
fileName = fileName.replace(/-/g, "_");
|
||||
|
||||
// Set the file to be uploaded
|
||||
const fileContentPath = "../test-data/protocols.csv";
|
||||
const inputFile = await page.locator('input[type="file"]');
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
|
||||
// Enter the file name
|
||||
await page.fill(".q-input > .q-field__inner > .q-field__control", fileName);
|
||||
|
||||
// Click on 'Save'
|
||||
await page.getByText("Save").click({ force: true });
|
||||
|
||||
// Reload the page to ensure table is updated
|
||||
await page.reload();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Search for the uploaded file name
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Verify the file name in the enrichment table
|
||||
const rows = await page.locator("tbody tr");
|
||||
let fileFound = false;
|
||||
|
||||
for (let i = 0; i < (await rows.count()); i++) {
|
||||
const row = rows.nth(i);
|
||||
const displayedName = await row
|
||||
.locator("td.text-left")
|
||||
.nth(1)
|
||||
.textContent();
|
||||
if (displayedName?.trim() === fileName) {
|
||||
fileFound = true;
|
||||
console.log("File found in table:", displayedName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileFound) {
|
||||
throw new Error(`File name "${fileName}" not found in the table.`);
|
||||
}
|
||||
|
||||
// Explore the file
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
await page.locator("#fnEditor").getByLabel("Editor content;Press Alt+F1")
|
||||
.fill(`
|
||||
abc, err = get_enrichment_table_record("${fileName}", {
|
||||
"protocol_number": to_string!(.protocol_number)
|
||||
})
|
||||
.protocol_keyword = abc.keyword
|
||||
`);
|
||||
|
||||
// Wait briefly to allow input processing
|
||||
await pipelinePage.openPipelineMenu();
|
||||
await page.waitForTimeout(1000);
|
||||
await pipelinePage.addPipeline();
|
||||
await pipelinePage.selectStream();
|
||||
await pipelinePage.streamButton.waitFor({ state: "visible" });
|
||||
await pipelinePage.dragStreamToTarget(pipelinePage.streamButton);
|
||||
await pipelinePage.selectLogs();
|
||||
|
||||
// Apply the query
|
||||
await applyQueryButton(page);
|
||||
|
||||
// Verify that no warning is shown for query execution
|
||||
const warningElement = page.locator("text=warning Query execution");
|
||||
await expect(warningElement).toBeHidden();
|
||||
|
||||
// Expand the first row in the logs table
|
||||
await page.waitForTimeout(3000);
|
||||
await page
|
||||
.locator(
|
||||
'[data-test="log-table-column-0-_timestamp"] [data-test="table-row-expand-menu"]'
|
||||
)
|
||||
.click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page
|
||||
.locator('[data-test="log-expand-detail-key-protocol_keyword-text"]')
|
||||
.click();
|
||||
// Return to the pipeline menu and delete the uploaded table
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
await pipelinePage.deleteEnrichmentTableByName(fileName)
|
||||
|
||||
// Interact with stream name and save
|
||||
await page.waitForTimeout(2000);
|
||||
await pipelinePage.enterStreamName("e2e");
|
||||
await pipelinePage.enterStreamName("e2e_automate");
|
||||
await page.waitForTimeout(2000);
|
||||
await pipelinePage.selectStreamOption();
|
||||
await pipelinePage.saveInputNodeStream();
|
||||
await page.locator('[data-test="menu-link-\\/dashboards-item"]').click();
|
||||
page.once('dialog', async (dialog) => {
|
||||
console.log(`Dialog message: ${dialog.message()}`);
|
||||
await dialog.accept();
|
||||
});
|
||||
|
||||
// Click on the first menu link
|
||||
await page.locator('[data-test="menu-link-\\/dashboards-item"]').click();
|
||||
|
||||
// Assert the page navigates to the desired URL containing "dashboards"
|
||||
await page.waitForURL(/dashboards/);
|
||||
|
||||
});
|
||||
|
||||
|
||||
test("should display error when CSV not added in enrichment table", async ({
|
||||
test("should stay on pipeline page if user dismisses the dialog box", async ({
|
||||
page,
|
||||
}) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
await page.getByLabel('Name').fill('test')
|
||||
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByText('CSV File is required!').click();
|
||||
})
|
||||
|
||||
await pipelinePage.openPipelineMenu();
|
||||
await page.waitForTimeout(1000);
|
||||
await pipelinePage.addPipeline();
|
||||
await pipelinePage.selectStream();
|
||||
await pipelinePage.streamButton.waitFor({ state: "visible" });
|
||||
await pipelinePage.dragStreamToTarget(pipelinePage.streamButton);
|
||||
await pipelinePage.selectLogs();
|
||||
|
||||
test("should append an enrichment table under functions", async ({ page }) => {
|
||||
const pipelinePage = new PipelinePage(page);
|
||||
await pipelinePage.navigateToAddEnrichmentTable();
|
||||
|
||||
// Generate a unique file name and replace hyphens with underscores
|
||||
let fileName = `append_${uuidv4()}_csv`.replace(/-/g, "_");
|
||||
console.log("Generated File Name:", fileName);
|
||||
|
||||
// First upload step
|
||||
const fileContentPath = "../test-data/append.csv";
|
||||
const inputFile = await page.locator('input[type="file"]');
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
|
||||
// Enter the file name
|
||||
await page.fill(".q-input > .q-field__inner > .q-field__control", fileName);
|
||||
|
||||
// Click on 'Save'
|
||||
await page.getByText("Save").click({ force: true });
|
||||
|
||||
// Wait for the process to complete
|
||||
await page.reload();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Explore the uploaded table
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
await page.locator('[data-test="log-table-column-0-_timestamp"]').click();
|
||||
await page.locator('[data-test="close-dialog"]').click();
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Navigate to append data to the existing enrichment table
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.getByRole("button", { name: "Enrichment Tables" }).click();
|
||||
|
||||
// Select the append toggle
|
||||
await page.getByLabel("Append data to existing").locator("div").first().click();
|
||||
|
||||
|
||||
// Upload the CSV again for appending
|
||||
await inputFile.setInputFiles(fileContentPath);
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// Explore the uploaded table
|
||||
await page.getByRole("button", { name: "Explore" }).click();
|
||||
// Interact with stream name and save
|
||||
await page.waitForTimeout(2000);
|
||||
await pipelinePage.enterStreamName("e2e");
|
||||
await pipelinePage.enterStreamName("e2e_automate");
|
||||
await page.waitForTimeout(2000);
|
||||
await pipelinePage.selectStreamOption();
|
||||
await pipelinePage.saveInputNodeStream();
|
||||
await page.locator('[data-test="menu-link-\\/dashboards-item"]').click();
|
||||
page.once('dialog', async (dialog) => {
|
||||
console.log(`Dialog message: ${dialog.message()}`);
|
||||
await dialog.dismiss();
|
||||
});
|
||||
|
||||
// Click on the first menu link
|
||||
await page.locator('[data-test="menu-link-\\/dashboards-item"]').click();
|
||||
|
||||
|
||||
// Assert page url to have pipeline
|
||||
await expect(page).toHaveURL(/pipeline/);
|
||||
|
||||
const showingText = page.getByText('Showing 1 to 2 out of 2');
|
||||
await expect(showingText).toBeVisible()
|
||||
// Log confirmation
|
||||
console.log('URL contains "pipeline"!')
|
||||
|
||||
});
|
||||
|
||||
await page.locator('[data-test="menu-link-\\/pipeline-item"]').click();
|
||||
await page.locator('[data-test="function-enrichment-table-tab"]').click();
|
||||
await page.getByPlaceholder("Search Enrichment Table").fill(fileName);
|
||||
await pipelinePage.deleteEnrichmentTableByName(fileName)
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,482 +0,0 @@
|
||||
import { test, expect } from "./baseFixtures";
|
||||
import logData from "../../ui-testing/cypress/fixtures/log.json";
|
||||
import { log } from "console";
|
||||
import logsdata from "../../test-data/logs_data.json";
|
||||
|
||||
test.describe.configure({ mode: "parallel" });
|
||||
const dashboardName = `dashboard${Date.now()}`;
|
||||
|
||||
async function createDashboard(page) {
|
||||
await page.locator('[data-test="menu-link-\\/dashboards-item"]').click();
|
||||
await page.waitForTimeout(5000);
|
||||
await page.locator('[data-test="dashboard-add"]').click();
|
||||
await page.waitForTimeout(5000);
|
||||
await page.locator('[data-test="add-dashboard-name"]').click();
|
||||
|
||||
await page.locator('[data-test="add-dashboard-name"]').fill(dashboardName);
|
||||
await page.locator('[data-test="dashboard-add-submit"]').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await page
|
||||
.locator('[data-test="dashboard-if-no-panel-add-panel-btn"]')
|
||||
.click();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.locator('[data-test="index-dropdown-stream"]').click();
|
||||
await page.locator('[data-test="index-dropdown-stream"]').fill("e2e");
|
||||
await page
|
||||
.getByRole("option", { name: "e2e_automate" })
|
||||
.locator("div")
|
||||
.nth(2)
|
||||
.click();
|
||||
await page.waitForTimeout(3000);
|
||||
await page
|
||||
.locator(
|
||||
'[data-test="field-list-item-logs-e2e_automate-kubernetes_annotations_kubectl_kubernetes_io_default_container"] [data-test="dashboard-add-y-data"]'
|
||||
)
|
||||
.click();
|
||||
await page.locator('[data-test="dashboard-apply"]').click();
|
||||
await page.locator('[data-test="date-time-btn"]').click();
|
||||
await page.locator('[data-test="date-time-relative-5-d-btn"]').click();
|
||||
await page.locator('[data-test="dashboard-apply"]').click();
|
||||
await page.locator('[data-test="chart-renderer"] canvas').click({
|
||||
position: {
|
||||
x: 753,
|
||||
y: 200,
|
||||
},
|
||||
});
|
||||
await page.locator('[data-test="dashboard-panel-save"]').click();
|
||||
await page.locator('[data-test="dashboard-panel-name"]').click();
|
||||
await page.locator('[data-test="dashboard-panel-name"]').fill("sanitydash");
|
||||
await page.waitForTimeout(2000);
|
||||
await page.locator('[data-test="dashboard-panel-save"]').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await page.locator('[data-test="dashboard-back-btn"]').click();
|
||||
}
|
||||
async function deleteDashboard(page) {
|
||||
await page.locator('[data-test="menu-link-\\/dashboards-item"]').click();
|
||||
await page.getByRole("cell", { name: dashboardName }).click();
|
||||
await page
|
||||
.locator('[data-test="dashboard-edit-panel-sanitydash-dropdown"]')
|
||||
.click();
|
||||
await page.locator('[data-test="dashboard-delete-panel"]').click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.locator('[data-test="dashboard-back-btn"]').click();
|
||||
await page.locator('[data-test="dashboard-search"]').click();
|
||||
await page.locator('[data-test="dashboard-search"]').fill(dashboardName);
|
||||
await page.locator('[data-test="dashboard-delete"]').click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
}
|
||||
|
||||
async function login(page) {
|
||||
await page.goto(process.env["ZO_BASE_URL"]);
|
||||
// await page.getByText('Login as internal user').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page
|
||||
.locator('[data-cy="login-user-id"]')
|
||||
.fill(process.env["ZO_ROOT_USER_EMAIL"]);
|
||||
//Enter Password
|
||||
await page.locator("label").filter({ hasText: "Password *" }).click();
|
||||
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"]);
|
||||
}
|
||||
|
||||
const selectStreamAndStreamTypeForLogs = async (page, stream) => {
|
||||
await page.waitForTimeout(4000);
|
||||
await page
|
||||
.locator('[data-test="log-search-index-list-select-stream"]')
|
||||
.click({ force: true });
|
||||
await page
|
||||
.locator("div.q-item")
|
||||
.getByText(`${stream}`)
|
||||
.first()
|
||||
.click({ force: true });
|
||||
};
|
||||
test.describe("Report testcases", () => {
|
||||
// let logData;
|
||||
function removeUTFCharacters(text) {
|
||||
// console.log(text, "tex");
|
||||
// Remove UTF characters using regular expression
|
||||
return text.replace(/[^\x00-\x7F]/g, " ");
|
||||
}
|
||||
async function applyQueryButton(page) {
|
||||
// click on the run query button
|
||||
// Type the value of a variable into an input field
|
||||
const search = page.waitForResponse(logData.applyQuery);
|
||||
await page.waitForTimeout(3000);
|
||||
await page.locator("[data-test='logs-search-bar-refresh-btn']").click({
|
||||
force: true,
|
||||
});
|
||||
// get the data from the search variable
|
||||
await expect.poll(async () => (await search).status()).toBe(200);
|
||||
// await search.hits.FIXME_should("be.an", "array");
|
||||
}
|
||||
// tebefore(async function () {
|
||||
// // logData("log");
|
||||
// // const data = page;
|
||||
// // logData = data;
|
||||
|
||||
// console.log("--logData--", logData);
|
||||
// });
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await login(page);
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
// ("ingests logs via API", () => {
|
||||
const orgId = process.env["ORGNAME"];
|
||||
const streamName = "e2e_automate";
|
||||
const basicAuthCredentials = Buffer.from(
|
||||
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
|
||||
).toString("base64");
|
||||
|
||||
const headers = {
|
||||
Authorization: `Basic ${basicAuthCredentials}`,
|
||||
"Content-Type": "application/json",
|
||||
};
|
||||
|
||||
// const logsdata = {}; // Fill this with your actual data
|
||||
|
||||
// Making a POST request using fetch API
|
||||
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,
|
||||
orgId: orgId,
|
||||
streamName: streamName,
|
||||
logsdata: logsdata,
|
||||
}
|
||||
);
|
||||
|
||||
console.log(response);
|
||||
// });
|
||||
// const allorgs = page.waitForResponse("**/api/default/organizations**");
|
||||
// const functions = page.waitForResponse("**/api/default/functions**");
|
||||
await page.goto(
|
||||
`${logData.logsUrl}?org_identifier=${process.env["ORGNAME"]}`
|
||||
);
|
||||
const allsearch = page.waitForResponse("**/api/default/_search**");
|
||||
await selectStreamAndStreamTypeForLogs(page, logData.Stream);
|
||||
await applyQueryButton(page);
|
||||
});
|
||||
|
||||
test("should create once type report and delete it", async ({ page }) => {
|
||||
await createDashboard(page);
|
||||
await page.locator('[data-test="menu-link-\\/reports-item"]').click();
|
||||
await page.locator('[data-test="report-list-add-report-btn"]').click();
|
||||
await page.getByLabel("Name *").click();
|
||||
await page.getByLabel("Name *").fill("rreport1");
|
||||
await page.getByLabel("Folder *").click();
|
||||
await page.getByLabel("Folder *").click();
|
||||
await page.getByLabel("Folder *").fill("default");
|
||||
await page.waitForTimeout(2000);
|
||||
await page
|
||||
.getByRole("option", { name: "default" })
|
||||
.locator("div")
|
||||
.nth(2)
|
||||
.click();
|
||||
await page.getByLabel("Dashboard *").click();
|
||||
await page.getByLabel("Dashboard *").fill("sanitydash");
|
||||
await page.getByRole("option", { name: dashboardName }).click();
|
||||
await page.getByLabel("Dashboard Tab *").click();
|
||||
await page.getByRole("option", { name: "Default" }).click();
|
||||
await page.locator('[data-test="add-report-step1-continue-btn"]').click();
|
||||
await page.locator('[data-test="add-report-schedule-sendNow-btn"]').click();
|
||||
await page.locator('[data-test="add-report-step2-continue-btn"]').click();
|
||||
await page.getByLabel("Title *").click();
|
||||
await page.getByLabel("Title *").fill("e2eautomate");
|
||||
await page.getByPlaceholder("Invite by email. Multiple").click();
|
||||
await page
|
||||
.getByPlaceholder("Invite by email. Multiple")
|
||||
.fill("neha@test.com");
|
||||
await page.getByPlaceholder("Invite by email. Multiple").click({
|
||||
clickCount: 3,
|
||||
});
|
||||
await page
|
||||
.getByPlaceholder("Invite by email. Multiple")
|
||||
.fill("e2e@test.com");
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.click();
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.fill("testingnew");
|
||||
await page.locator('[data-test="add-report-save-btn"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').click();
|
||||
await page
|
||||
.locator('[data-test="report-list-search-input"]')
|
||||
.fill("report1");
|
||||
await page
|
||||
.locator('[data-test="report-list-rreport1-delete-report"]')
|
||||
.click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await deleteDashboard(page);
|
||||
});
|
||||
|
||||
test("should create hourly report and delete it ", async ({ page }) => {
|
||||
await createDashboard(page);
|
||||
await page.locator('[data-test="menu-link-\\/reports-item"]').click();
|
||||
await page.locator('[data-test="report-list-add-report-btn"]').click();
|
||||
await page.getByLabel("Name *").click();
|
||||
await page.getByLabel("Name *").fill("e2ereport");
|
||||
await page
|
||||
.locator('[data-test="add-report-folder-select"]')
|
||||
.getByText("arrow_drop_down")
|
||||
.click();
|
||||
await page
|
||||
.getByRole("option", { name: "default" })
|
||||
.locator("div")
|
||||
.nth(2)
|
||||
.click();
|
||||
await page
|
||||
.locator(
|
||||
".q-my-sm > div:nth-child(2) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native"
|
||||
)
|
||||
.click();
|
||||
await page.getByRole("option", { name: dashboardName }).click();
|
||||
await page.getByLabel("Dashboard Tab *").click();
|
||||
await page
|
||||
.getByRole("option", { name: "Default" })
|
||||
.locator("div")
|
||||
.nth(2)
|
||||
.click();
|
||||
await page.locator('[data-test="add-report-step1-continue-btn"]').click();
|
||||
await page
|
||||
.locator('[data-test="add-report-schedule-frequency-hours-btn"]')
|
||||
.click();
|
||||
await page.getByText("event").click();
|
||||
await page.getByRole("button", { name: "22" }).click();
|
||||
await page
|
||||
.locator("div")
|
||||
.filter({ hasText: /^access_time$/ })
|
||||
.click();
|
||||
await page
|
||||
.locator("#q-portal--menu--10 div")
|
||||
.filter({ hasText: /^4$/ })
|
||||
.click();
|
||||
await page.getByText("20").click();
|
||||
await page.getByRole("button", { name: "Close" }).click();
|
||||
await page
|
||||
.locator("label")
|
||||
.filter({ hasText: "Timezone *arrow_drop_down" })
|
||||
.click();
|
||||
await page
|
||||
.getByRole("option", { name: "UTC" })
|
||||
.locator("div")
|
||||
.nth(2)
|
||||
.click();
|
||||
await page.locator('[data-test="add-report-step2-continue-btn"]').click();
|
||||
await page.getByLabel("Title *").click();
|
||||
await page.getByLabel("Title *").fill("test hourly");
|
||||
await page.getByPlaceholder("Invite by email. Multiple").click();
|
||||
await page
|
||||
.getByPlaceholder("Invite by email. Multiple")
|
||||
.fill("automate@test.com");
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.click();
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.fill("testmessage");
|
||||
await page.locator('[data-test="add-report-save-btn"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').click();
|
||||
await page
|
||||
.locator('[data-test="report-list-search-input"]')
|
||||
.fill("e2ereport");
|
||||
await page
|
||||
.locator('[data-test="report-list-e2ereport-delete-report"]')
|
||||
.click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await deleteDashboard(page);
|
||||
});
|
||||
|
||||
test("should create hourly- send now report and delete it ", async ({
|
||||
page,
|
||||
}) => {
|
||||
await createDashboard(page);
|
||||
await page.locator('[data-test="menu-link-\\/reports-item"]').click();
|
||||
await page.locator('[data-test="report-list-add-report-btn"]').click();
|
||||
await page.getByLabel("Name *").click();
|
||||
await page.getByLabel("Name *").fill("e2ereport");
|
||||
await page.getByLabel("Folder *").click();
|
||||
await page.getByRole("option", { name: "default" }).click();
|
||||
await page.getByLabel("Dashboard *").click();
|
||||
await page.getByRole("option", { name: dashboardName }).click();
|
||||
await page.locator('[data-test="add-report-dashboard-0"]').click();
|
||||
await page.getByLabel("Dashboard Tab *").click();
|
||||
await page.getByRole("option", { name: "Default" }).click();
|
||||
await page.locator('[data-test="add-report-step1-continue-btn"]').click();
|
||||
await page.locator('[data-test="add-report-schedule-sendNow-btn"]').click();
|
||||
await page.locator('[data-test="add-report-step2-continue-btn"]').click();
|
||||
await page.getByLabel("Title *").click();
|
||||
await page.getByLabel("Title *").fill("testautomate");
|
||||
await page.getByPlaceholder("Invite by email. Multiple").click();
|
||||
await page
|
||||
.getByPlaceholder("Invite by email. Multiple")
|
||||
.fill("report@gmail.com");
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.click();
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.fill("testreport");
|
||||
await page.locator('[data-test="add-report-save-btn"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').click();
|
||||
await page
|
||||
.locator('[data-test="report-list-search-input"]')
|
||||
.fill("e2ereport");
|
||||
await page
|
||||
.locator('[data-test="report-list-e2ereport-delete-report"]')
|
||||
.click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await deleteDashboard(page);
|
||||
});
|
||||
|
||||
test("should create daily- send now report and delete it ", async ({
|
||||
page,
|
||||
}) => {
|
||||
await createDashboard(page);
|
||||
await page.locator('[data-test="menu-link-\\/reports-item"]').click();
|
||||
await page.locator('[data-test="report-list-add-report-btn"]').click();
|
||||
await page.getByLabel("Name *").click();
|
||||
await page.getByLabel("Name *").fill("e2eautomate");
|
||||
await page
|
||||
.locator(
|
||||
".q-my-sm > div > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native"
|
||||
)
|
||||
.first()
|
||||
.click();
|
||||
await page.getByRole("option", { name: "default" }).click();
|
||||
await page.getByLabel("Dashboard *").click();
|
||||
await page
|
||||
.getByRole("option", { name: dashboardName })
|
||||
.locator("div")
|
||||
.nth(2)
|
||||
.click();
|
||||
await page.getByLabel("Dashboard Tab *").click();
|
||||
await page.getByRole("option", { name: "Default" }).click();
|
||||
await page.getByLabel("Description").click();
|
||||
await page.locator('[data-test="add-report-step1-continue-btn"]').click();
|
||||
await page
|
||||
.locator('[data-test="add-report-schedule-frequency-days-btn"]')
|
||||
.click();
|
||||
await page.locator('[data-test="add-report-schedule-sendNow-btn"]').click();
|
||||
await page.locator('[data-test="add-report-step2-continue-btn"]').click();
|
||||
await page.getByLabel("Title *").click();
|
||||
await page.getByLabel("Title *").fill("daily-sendnow");
|
||||
await page.getByPlaceholder("Invite by email. Multiple").click();
|
||||
await page
|
||||
.getByPlaceholder("Invite by email. Multiple")
|
||||
.fill("test@gmail.com");
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.click();
|
||||
await page
|
||||
.locator('[data-test="add-report-share-message-input"]')
|
||||
.getByLabel("")
|
||||
.fill("testreport");
|
||||
await page.locator('[data-test="add-report-save-btn"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').click();
|
||||
await page
|
||||
.locator('[data-test="report-list-search-input"]')
|
||||
.fill("e2eautomate");
|
||||
await page
|
||||
.locator('[data-test="report-list-e2eautomate-delete-report"]')
|
||||
.click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await deleteDashboard(page);
|
||||
});
|
||||
|
||||
test("should create weekly- send now report and delete it ", async ({
|
||||
page,
|
||||
}) => {
|
||||
await createDashboard(page);
|
||||
await page.locator('[data-test="menu-link-\\/reports-item"]').click();
|
||||
await page.locator('[data-test="report-list-add-report-btn"]').click();
|
||||
await page.getByLabel('Name *').click();
|
||||
await page.getByLabel('Name *').fill('weekly');
|
||||
await page.locator('.q-my-sm > div > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native').first().click();
|
||||
await page.getByRole('option', { name: 'default' }).click();
|
||||
await page.getByText('Dashboard *arrow_drop_down').click();
|
||||
await page.getByText(dashboardName).click();
|
||||
await page.locator('div:nth-child(3) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native').click();
|
||||
await page.getByRole('option', { name: 'Default' }).click();
|
||||
await page.locator('[data-test="add-report-step1-continue-btn"]').click();
|
||||
await page.locator('[data-test="add-report-schedule-sendNow-btn"]').click();
|
||||
await page.locator('[data-test="add-report-step2-continue-btn"]').click();
|
||||
await page.getByLabel('Title *').click();
|
||||
await page.getByLabel('Title *').fill('weekly');
|
||||
await page.getByPlaceholder('Invite by email. Multiple').click();
|
||||
await page.getByPlaceholder('Invite by email. Multiple').fill('test@gmail.com');
|
||||
await page.locator('[data-test="add-report-save-btn"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').fill('weekly');
|
||||
await page.locator('[data-test="report-list-weekly-delete-report"]').click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.getByText('Delete report successfully.').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await deleteDashboard(page);
|
||||
});
|
||||
|
||||
|
||||
test("should create monthly- send now report and delete it ", async ({
|
||||
page,
|
||||
}) => {
|
||||
await createDashboard(page);
|
||||
await page.locator('[data-test="menu-link-\\/reports-item"]').click();
|
||||
await page.locator('[data-test="report-list-add-report-btn"]').click();
|
||||
await page.getByLabel('Name *').click();
|
||||
await page.getByLabel('Name *').click();
|
||||
await page.getByLabel('Name *').fill('monthly');
|
||||
await page.getByLabel('Folder *').click();
|
||||
await page.getByRole('option', { name: 'default' }).click();
|
||||
await page.locator('.q-my-sm > div:nth-child(2) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native').click();
|
||||
await page.getByRole('option', { name:dashboardName }).click();
|
||||
await page.locator('[data-test="add-report-tab-select"] label').click();
|
||||
await page.getByRole('option', { name: 'Default' }).click();
|
||||
await page.locator('[data-test="add-report-step1-continue-btn"]').click();
|
||||
await page.locator('[data-test="add-report-schedule-frequency-months-btn"]').click();
|
||||
await page.locator('[data-test="add-report-schedule-sendNow-btn"]').click();
|
||||
await page.locator('[data-test="add-report-step2-continue-btn"]').click();
|
||||
await page.getByLabel('Title *').click();
|
||||
await page.getByLabel('Title *').fill('monthly');
|
||||
await page.getByPlaceholder('Invite by email. Multiple').click();
|
||||
await page.getByPlaceholder('Invite by email. Multiple').fill('test@gmail.comt');
|
||||
await page.locator('[data-test="add-report-share-message-input"]').getByLabel('').fill('e');
|
||||
await page.locator('[data-test="add-report-share-message-input"]').getByLabel('').click();
|
||||
await page.locator('[data-test="add-report-share-message-input"]').getByLabel('').fill('est');
|
||||
await page.locator('[data-test="add-report-share-message-input"]').getByLabel('').click();
|
||||
await page.locator('[data-test="add-report-share-message-input"]').getByLabel('').fill('test');
|
||||
await page.locator('[data-test="add-report-save-btn"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').click();
|
||||
await page.locator('[data-test="report-list-search-input"]').fill('monthly');
|
||||
await page.locator('[data-test="report-list-monthly-delete-report"]').click();
|
||||
await page.locator('[data-test="confirm-button"]').click();
|
||||
await page.getByText('Delete report successfully.').click();
|
||||
await page.waitForTimeout(2000);
|
||||
await deleteDashboard(page);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user