Files
openobserve/tests/ui-testing/playwright-tests
Shrinath RaoandClaude Opus 4.5 d852e7656b test: refactor alerts module with POM architecture and comprehensive e2e coverage (#9717)
### **User description**
## Summary
Complete refactoring of the Alerts UI testing module with Page Object
Model architecture, comprehensive E2E test coverage, and improved test
stability.

## Key Changes

### 🏗️ Architecture Refactoring
Refactored monolithic `AlertsPage` (2300+ lines) into modular Page
Object classes:

| Module | Responsibility |
|--------|---------------|
| `AlertCreationWizard` | Alert creation flows (real-time, scheduled,
multi-condition, deduplication) |
| `AlertManagement` | CRUD operations (update, clone, pause, resume,
delete, search) |
| `AlertBulkOperations` | Bulk operations (select, pause/unpause, move
across folders) |
| `AlertsPage` | Main entry point, folder operations, UI validations,
import/export |

### 🧪 Test Coverage
All 12 Alerts tests passing:

| Spec File | Tests | Coverage |
|-----------|-------|----------|
| `alerts-e2e-flow.spec.js` | 1 | Complete E2E flow: CRUD, clone,
pause/resume, move, search |
| `alerts-ui-operations.spec.js` | 4 | Template/destination CRUD,
scheduled alerts, UI validations |
| `alerts-import.spec.js` | 3 | Import/export alerts, templates,
destinations (URL + file) |
| `alerts-advanced.spec.js` | 4 | Multi-condition alerts, AND/OR toggle,
bulk operations, deduplication |

### 🔧 Stability Fixes
- Added `test.slow()` for long-running E2E flow test
- Fixed `moveAllAlertsToFolder` with proper success message assertion
- Fixed `deleteAllAlertsInFolder` by removing redundant verification
- Fixed `verifyAlertCreated` with navigation fallback for reliability
- Fixed `selectMultipleAlerts` with visibility check and search fallback
- Added post-creation waits in alert wizard to handle async UI updates

### 📝 Code Quality
- Cleaned up redundant comments across all alerts files
- Removed obvious "what" comments, kept meaningful "why" explanations
- Preserved section dividers for navigation in long methods
- Maintained JSDoc for method documentation

## New Page Object Methods

### AlertCreationWizard
- `createAlert()` - Standard real-time alert with column/operator/value
- `createAlertWithDefaults()` - Resilient creation using first available
column
- `createScheduledAlertWithSQL()` - Scheduled alert with SQL query
- `createAlertWithMultipleConditions()` - Multi-condition alert with AND
operator
- `createScheduledAlertWithDeduplication()` - Scheduled alert with dedup
config
- `testConditionOperatorToggle()` - Tests AND/OR toggle functionality

### AlertManagement
- `updateAlert()` - Edit alert via wizard
- `cloneAlert()` - Clone with stream selection
- `pauseAlert()` / `resumeAlert()` - Toggle alert state
- `deleteAlertByRow()` / `deleteImportedAlert()` - Delete operations
- `searchAlert()` / `searchAndDeleteAlert()` - Search operations

### AlertBulkOperations
- `selectMultipleAlerts()` - Select multiple alerts for bulk ops
- `bulkPauseAlerts()` / `bulkUnpauseAlerts()` - Bulk state toggle
- `moveAllAlertsToFolder()` - Move alerts between folders
- `deleteAllAlertsInFolder()` - Clean folder contents

## Test Results
```
Running 12 tests using 4 workers
12 passed (~6.2m)
```

## Test Plan
- [x] All 12 alerts tests passing locally
- [x] Tests are independent and cleanup after themselves
- [x] No regressions in existing functionality


___

### **PR Type**
Enhancement, Tests


___

### **Description**
- Refactor AlertsPage into modular PageObjects

- Centralize and expose locators in a map

- Delegate creation, management, bulk operations

- Add advanced E2E tests for multi-condition, bulk, dedup features

- Enhance LogsPage.selectStream with configurable wait


___

### Diagram Walkthrough


```mermaid
flowchart LR
  AP["AlertsPage"]
  ACW["AlertCreationWizard"]
  AM["AlertManagement"]
  ABO["AlertBulkOperations"]

  AP -- "delegates to" --> ACW
  AP -- "delegates to" --> AM
  AP -- "delegates to" --> ABO
```



<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><details><summary>5
files</summary><table>
<tr>
<td><strong>alertsPage.js</strong><dd><code>Modularize AlertsPage with
submodules and locators</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-79ee01d6d7f145f19207b93b87143b545a1188cfc6a82bc8c45fecfbf68f8a1d">+569/-1059</a></td>

</tr>

<tr>
<td><strong>alertManagement.js</strong><dd><code>Introduce
AlertManagement module for CRUD</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/9717/files#diff-53afe97106daddb1fb35c3624ccedc99f21476946edc181f6287f7e8fd1bbf37">+509/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>alertCreationWizard.js</strong><dd><code>Introduce
AlertCreationWizard module</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/9717/files#diff-3b0a08b55d132502596d17c9d5f197de6d4779684de96ce570282e2402942e2e">+1024/-0</a></td>

</tr>

<tr>
<td><strong>alertBulkOperations.js</strong><dd><code>Introduce
AlertBulkOperations module</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/9717/files#diff-dea39c18fea38783c9ef4ae71e11021eaa3663b7012ae1c481a30277139a6907">+299/-0</a>&nbsp;
</td>

</tr>

<tr>
<td><strong>logsPage.js</strong><dd><code>Enhance selectStream with
apiWaitMs parameter</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-8045b343491d8943869c1af74cdafab204dc49c02a70294417e73f47d35e0b59">+10/-6</a>&nbsp;
&nbsp; </td>

</tr>

</table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>1
files</summary><table>
<tr>
<td><strong>alerts-advanced.spec.js</strong><dd><code>Add advanced E2E
tests for alerts features</code>&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/9717/files#diff-710af4a4eaad54a1ddd5acf0d62f977bfa18c95462b38c4f84593a970297754d">+194/-0</a>&nbsp;
</td>

</tr>
</table></details></td></tr><tr><td><strong>Additional
files</strong></td><td><details><summary>8 files</summary><table>
<tr>
  <td><strong>alertDestinationsPage.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-57e5c53b4ef998b3d8708149620ff94dcc46807927f1a3a9e9f28ed3ebe25b0a">+95/-0</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>alertTemplatesPage.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-f4ebd248b2140051e74dbbbd1aabe344f01c80704ce5857e9c28a04350e018f3">+74/-4</a>&nbsp;
&nbsp; </td>

</tr>

<tr>
  <td><strong>apiCleanup.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-537fe76c0d8e26e81c5f77c83bd0ee35daaa973822105c809bf83171a26b33c5">+133/-221</a></td>

</tr>

<tr>
  <td><strong>commonActions.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-4d726dd2bdb34b2c90a31798ff49b6df5bc952bd049b7c38bebb18b6db0076e2">+156/-0</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>alerts-e2e-flow.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-32972e38c1fe0e8bb887f9f254b3130916a36f96ea924f9987493d44efefeab9">+38/-23</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>alerts-import.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-62b6ec4818685eacc0a934d68aaadfd73b512ef4f4be25fcd5135b97c2844912">+54/-106</a></td>

</tr>

<tr>
  <td><strong>alerts-ui-operations.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-c9b523b5f5dea834b69abdf20f4acef361bdf37b1585c450e10238b1d1984f2e">+38/-82</a>&nbsp;
</td>

</tr>

<tr>
  <td><strong>cleanup.spec.js</strong></td>
<td><a
href="https://github.com/openobserve/openobserve/pull/9717/files#diff-c214275a512fa285a7e4f2ab61dfcb42d71a0436b0e4241f94d7b45693587983">+3/-1</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>
</table></details></td></tr></tr></tbody></table>

</details>

___

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 21:07:00 +05:30
..
2025-12-23 23:47:36 +05:30