mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
### **User description** Added automated tests for 4 verified bug fixes to the regression test suite: Bug Tests Added: - Bug #8349 (P1): SQL _timestamp alias rejection validation - Bug #7468 (P1): Multi-stream ellipsis with tooltip display - Bug #9475 (P1): Apostrophes/special characters without truncation - Bug #9877 (P0): Auto refresh time range updates Changes: - Added 3 bug tests to logs-regression.spec.js (#8349, #9475, #9877) - Added 1 bug test to streams-regression.spec.js (#7468) - Added 7 new POM methods to logsPage.js for stream display and tooltip handling - Removed duplicate tests from original locations (logspage.spec.js, logsqueries.spec.js) Test Results: - All 4 tests passing in sequential execution (3.4m total) - Bug #8349: 26s | Bug #7468: 56s | Bug #9475: 53s | Bug #9877: 40s POM Improvements: - getStreamDisplayElement(), expectStreamDisplayVisible() - getStreamDisplayText(), getStreamDisplayStyles() - hoverStreamDisplay(), isTooltipVisible(), getTooltipText() - Increased getLogsTableContent() timeout to 30s GitHub Issues: - https://github.com/openobserve/openobserve/issues/8349 - https://github.com/openobserve/openobserve/issues/7468 - https://github.com/openobserve/openobserve/issues/9475 - https://github.com/openobserve/openobserve/issues/9877 🤖 Generated with Claude Code ___ ### **PR Type** Tests ___ ### **Description** - Added regression tests for four bug fixes - Enhanced logsPage.js with stream POM methods - Cleaned up whitespace in log spec files - Increased table locator timeout in logsPage.js ___ ### Diagram Walkthrough ```mermaid flowchart LR POM["logsPage.js POM enhancements"] LogsReg["logs-regression.spec.js tests"] StreamsReg["streams-regression.spec.js tests"] POM -- "used in tests" --> LogsReg POM -- "used in tests" --> StreamsReg ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table> <tr> <td> <details> <summary><strong>logsPage.js</strong><dd><code>Add multi-stream POM and tooltip methods</code> </dd></summary> <hr> tests/ui-testing/pages/logsPages/logsPage.js <ul><li>Increased <code>getLogsTableContent</code> timeout to 30s<br> <li> Added stream display methods for multi-stream tests<br> <li> Implemented tooltip helper methods</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/9899/files#diff-8045b343491d8943869c1af74cdafab204dc49c02a70294417e73f47d35e0b59">+46/-1</a> </td> </tr> </table></td></tr><tr><td><strong>Formatting</strong></td><td><table> <tr> <td> <details> <summary><strong>logspage.spec.js</strong><dd><code>Whitespace cleanup in logspage spec</code> </dd></summary> <hr> tests/ui-testing/playwright-tests/Logs/logspage.spec.js - Removed extraneous whitespace </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/9899/files#diff-b1a64252adae01c5e8f7e758e3c820f5476260f60c44a4a57b4f15a05a59a85a">+1/-1</a> </td> </tr> <tr> <td> <details> <summary><strong>logsqueries.spec.js</strong><dd><code>Whitespace cleanup in logsqueries spec</code> </dd></summary> <hr> tests/ui-testing/playwright-tests/Logs/logsqueries.spec.js - Removed extraneous whitespace </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/9899/files#diff-c2055f6cef1580b15c5f94f5c8c2e496a6e921332b48bad943bb7c0630846a65">+16/-16</a> </td> </tr> </table></td></tr><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>logs-regression.spec.js</strong><dd><code>Add logs regression tests for bugs</code> </dd></summary> <hr> tests/ui-testing/playwright-tests/RegressionSet/logs-regression.spec.js <ul><li>Added test for SQL <code>_timestamp</code> alias rejection<br> <li> Added apostrophes display regression tests<br> <li> Added auto-refresh time range regression test</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/9899/files#diff-99da86ede55fa5f2e3d3fbef897ba7aaa5a7db702a0135f66ac4c888fc7311b6">+355/-0</a> </td> </tr> <tr> <td> <details> <summary><strong>streams-regression.spec.js</strong><dd><code>Add multi-stream ellipsis tooltip tests</code> </dd></summary> <hr> tests/ui-testing/playwright-tests/RegressionSet/streams-regression.spec.js <ul><li>Added regression test for multi-stream ellipsis tooltip (Bug #7468)<br> <li> Implemented helper functions for stream ingestion</ul> </details> </td> <td><a href="https://github.com/openobserve/openobserve/pull/9899/files#diff-1c2aad49737186272645ea4cf0f7e3080e28d0c4d8585b3d07edc1889368591d">+166/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> </details> ___ --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Shrinath Rao <shnath@openobserve.ai> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
95 lines
3.3 KiB
JavaScript
95 lines
3.3 KiB
JavaScript
const testLogger = require('./test-logger.js');
|
|
const logsdata = require("../../../test-data/logs_data.json");
|
|
|
|
/**
|
|
* Ingest test data into a stream via API
|
|
* @param {import('@playwright/test').Page} page - Playwright page object
|
|
* @param {string} streamName - Name of the stream to ingest data into (default: "e2e_automate")
|
|
* @returns {Promise<object>} - API response
|
|
*/
|
|
async function ingestTestData(page, streamName = "e2e_automate") {
|
|
const orgId = process.env["ORGNAME"];
|
|
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
|
|
});
|
|
|
|
testLogger.debug('Test data ingestion response', { response, streamName });
|
|
return response;
|
|
}
|
|
|
|
/**
|
|
* Generates authentication headers for API requests.
|
|
* Extracted from regression tests for reusability.
|
|
* @returns {Object} Headers object with Basic Authentication and Content-Type
|
|
* @example
|
|
* const headers = getHeaders();
|
|
* // Returns: { Authorization: "Basic ...", Content-Type: "application/json" }
|
|
*/
|
|
function getHeaders() {
|
|
const basicAuthCredentials = Buffer.from(
|
|
`${process.env["ZO_ROOT_USER_EMAIL"]}:${process.env["ZO_ROOT_USER_PASSWORD"]}`
|
|
).toString('base64');
|
|
|
|
return {
|
|
"Authorization": `Basic ${basicAuthCredentials}`,
|
|
"Content-Type": "application/json",
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Constructs the ingestion URL for a specific stream.
|
|
* @param {string} orgId - The organization ID
|
|
* @param {string} streamName - The name of the stream to ingest data into
|
|
* @returns {string} The complete ingestion URL
|
|
* @example
|
|
* const url = getIngestionUrl("default", "my_stream");
|
|
* // Returns: "http://localhost:5080/api/default/my_stream/_json"
|
|
*/
|
|
function getIngestionUrl(orgId, streamName) {
|
|
return `${process.env.INGESTION_URL}/api/${orgId}/${streamName}/_json`;
|
|
}
|
|
|
|
/**
|
|
* Sends an ingestion request via page.evaluate to bypass CORS restrictions.
|
|
* @param {Page} page - Playwright page object
|
|
* @param {string} url - The ingestion URL
|
|
* @param {Object} payload - The data payload to ingest
|
|
* @param {Object} headers - Request headers including authentication
|
|
* @returns {Promise<Object>} The API response
|
|
* @example
|
|
* const response = await sendRequest(page, url, { log: "test" }, headers);
|
|
* // Returns: { code: 200, status: [{ name: "stream", successful: 1 }] }
|
|
*/
|
|
async function sendRequest(page, url, payload, headers) {
|
|
return await page.evaluate(async ({ url, headers, payload }) => {
|
|
const fetchResponse = await fetch(url, {
|
|
method: 'POST',
|
|
headers: headers,
|
|
body: JSON.stringify(payload)
|
|
});
|
|
return await fetchResponse.json();
|
|
}, { url, headers, payload });
|
|
}
|
|
|
|
module.exports = { ingestTestData, getHeaders, getIngestionUrl, sendRequest };
|