Files
openobserve/tests/ui-testing
cb0855360b test: add E2E automation for Bug #9967 - PromQL alert creation (#9995)
### **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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-84362398fea8abd9acf30f4f40ba8d4cf27348677454017bd4e6f568d5176ac6">+397/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alertCreationWizard.js</strong><dd><code>E2E method for
PromQL alert creation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-3b0a08b55d132502596d17c9d5f197de6d4779684de96ce570282e2402942e2e">+239/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alertsPage.js</strong><dd><code>Add POM methods for PromQL
tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-79ee01d6d7f145f19207b93b87143b545a1188cfc6a82bc8c45fecfbf68f8a1d">+243/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alerts-regression.spec.js</strong><dd><code>Add
comprehensive PromQL E2E tests</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-123b8d960345fd76542aa75316be70b7d8fe088b4ba59127f14ddb53f5b52d8a">+562/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>cleanup.spec.js</strong><dd><code>Extend cleanup for PromQL
test prefixes</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-c214275a512fa285a7e4f2ab61dfcb42d71a0436b0e4241f94d7b45693587983">+4/-2</a>&nbsp;
&nbsp; &nbsp; </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>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-7b426bb23e9ed0250c3877d6d97b099c42b2d20e22ddf4459915381b2233a0a8">+27/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
<td><strong>AlertSettings.vue</strong><dd><code>Add PromQL condition
input and validation</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9995/files#diff-1d5bfd6a1ea672884193649b1271d751d6f3b8ec84af759071c9bfd169a8ab28">+111/-7</a>&nbsp;
</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>
2026-01-15 21:54:06 +05:30
..
2024-11-13 15:13:36 +05:30

zinc-observe-ui-automation

Playwright UI Testing

Installation

npm install

Running Tests

cd playwright-runner
npm start

Then open http://localhost:3000 to access the test runner interface.

Using Command Line

# Run all tests
npx playwright test

# Run specific test by tag
npx playwright test -g @alertsImportExport

# Run in headed mode
npx playwright test --headed

# Run specific test file
npx playwright test Alerts/alerts-import.spec.js

Environment Configuration

Tests can be configured using:

  1. Playwright Runner UI - Set environment variables through the web interface
  2. Environment Variables - Set variables in terminal or .env file