mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
### **User description** ## Summary Adds comprehensive E2E automation tests for Bug #9967 (cannot save alert when selecting PromQL mode for metrics streams). ### Test Coverage **Test 1: Comprehensive PromQL alert creation validation (P0/P1)** - Verifies PromQL tab visibility for metrics streams - Validates "Trigger if the value is" condition row appears in Step 4 - Tests operator dropdown and value input visibility - Verifies mode switching clears PromQL condition when switching to Custom - Creates and saves alerts with different operators (`>=`, `<=`) **Test 2: Loading existing PromQL alert (P2)** - Creates a PromQL alert via API - Opens alert for editing - Verifies PromQL condition fields load correctly in edit mode ### Files Changed | File | Description | |------|-------------| | `tests/ui-testing/playwright-tests/RegressionSet/alerts-regression.spec.js` | New test file with 2 comprehensive tests | | `tests/ui-testing/pages/alertsPages/alertsPage.js` | Added 20+ POM methods for PromQL alert testing | | `tests/ui-testing/pages/alertsPages/alertCreationWizard.js` | Fixed stream selection retry logic | | `tests/ui-testing/playwright-tests/cleanup.spec.js` | Added `e2e_promql_` cleanup patterns | ### New Page Object Methods - `clickAddAlertButton()`, `fillAlertName()`, `selectStreamType()`, `selectMetricsStream()` - `selectScheduledAlertType()`, `clickContinueButton()`, `clickBackButton()` - `expectPromqlTabVisible()`, `clickPromqlTab()`, `expectCustomTabVisible()`, `expectSqlTabVisible()` - `expectPromqlConditionRowVisible()`, `expectPromqlConditionRowNotVisible()` - `expectOperatorDropdownVisible()`, `expectValueInputVisible()`, `getPromqlConditionValue()` - `clickStepIndicator()`, `expectAlertRowVisible()`, `clickAlertUpdateButton()` ## Test plan - [x] Tests pass locally with `npx playwright test playwright-tests/RegressionSet/alerts-regression.spec.js` - [x] Code passes Sentinel audit (Page Object Model compliance) - [ ] CI pipeline passes ## Related - Fixes #9967 - Related PR #9970 (fix implementation) ___ ### **PR Type** Enhancement, Tests ___ ### **Description** - Add PromQL trigger condition support - Initialize and clear `promql_condition` logic - Include `promql_condition` in payload builder - Add unit and E2E tests for PromQL ___ ### Diagram Walkthrough ```mermaid flowchart LR Settings["AlertSettings.vue: PromQL input"] Component["AddAlert.vue: init and clear promql_condition"] Payload["AddAlert.vue: include/clear promql_condition"] UnitTests["AddAlert.spec.ts: PromQL unit tests"] E2ETests["alerts-regression.spec.js: PromQL E2E tests"] Settings --> Component Component --> Payload Payload --> UnitTests Payload --> E2ETests ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><details><summary>5 files</summary><table> <tr> <td><strong>AddAlert.spec.ts</strong><dd><code>Add unit tests for PromQL conditions</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+397/-0</a> </td> </tr> <tr> <td><strong>alertCreationWizard.js</strong><dd><code>E2E method for PromQL alert creation</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-3b0a08b55d132502596d17c9d5f197de6d4779684de96ce570282e2402942e2e">+239/-0</a> </td> </tr> <tr> <td><strong>alertsPage.js</strong><dd><code>Add POM methods for PromQL tests</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-79ee01d6d7f145f19207b93b87143b545a1188cfc6a82bc8c45fecfbf68f8a1d">+243/-0</a> </td> </tr> <tr> <td><strong>alerts-regression.spec.js</strong><dd><code>Add comprehensive PromQL E2E tests</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-123b8d960345fd76542aa75316be70b7d8fe088b4ba59127f14ddb53f5b52d8a">+562/-0</a> </td> </tr> <tr> <td><strong>cleanup.spec.js</strong><dd><code>Extend cleanup for PromQL test prefixes</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-c214275a512fa285a7e4f2ab61dfcb42d71a0436b0e4241f94d7b45693587983">+4/-2</a> </td> </tr> </table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>2 files</summary><table> <tr> <td><strong>AddAlert.vue</strong><dd><code>Initialize and handle `promql_condition` logic</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-7b426bb23e9ed0250c3877d6d97b099c42b2d20e22ddf4459915381b2233a0a8">+27/-0</a> </td> </tr> <tr> <td><strong>AlertSettings.vue</strong><dd><code>Add PromQL condition input and validation</code> </dd></td> <td><a href="https://github.com/openobserve/openobserve/pull/9995/files#diff-1d5bfd6a1ea672884193649b1271d751d6f3b8ec84af759071c9bfd169a8ab28">+111/-7</a> </td> </tr> </table></details></td></tr></tr></tbody></table> </details> ___ --------- Co-authored-by: sai nikhil kethe <nikhil@openobserve.ai> Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>