mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-05 16:10:43 +00:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new UI testing classes for various application pages, including `AlertsPage`, `DashboardPage`, `LogsPage`, `ReportsPage`, `TracesPage`, and `LoginPage`. - Added a new test suite focusing on time-related features across multiple pages. - **Bug Fixes** - Improved consistency in the GitHub Actions workflow for UI integration tests. - **Documentation** - Enhanced organization of locators and methods for better usability in UI testing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Neha P <144308844+neha00290@users.noreply.github.com>
68 lines
2.2 KiB
JavaScript
68 lines
2.2 KiB
JavaScript
import { expect } from '@playwright/test';
|
|
import{CommomnLocator} from '../pages/CommonLocator';
|
|
import{ dateTimeButtonLocator, relative30SecondsButtonLocator, absoluteTabLocator, Past30SecondsValue } from '../pages/CommonLocator.js';
|
|
|
|
|
|
export class ReportsPage {
|
|
constructor(page) {
|
|
this.page = page;
|
|
this.reportsMenuItem = page.locator('[data-test="menu-link-\\/reports-item"]');
|
|
this.addReportButton = page.locator('[data-test="report-list-add-report-btn"]');
|
|
|
|
this.dateTimeButton = dateTimeButtonLocator;
|
|
this.relative30SecondsButton = page.locator(relative30SecondsButtonLocator);
|
|
this.absoluteTab = absoluteTabLocator;
|
|
|
|
|
|
this.profileButton = page.locator('button').filter({ hasText: (process.env["ZO_ROOT_USER_EMAIL"]) });
|
|
this.signOutButton = page.getByText('Sign Out');
|
|
|
|
}
|
|
|
|
async navigateToReports() {
|
|
await this.reportsMenuItem.click();
|
|
}
|
|
|
|
async addNewReport() {
|
|
await this.addReportButton.click();
|
|
}
|
|
|
|
async setTimeToPast30Seconds() {
|
|
// Set the time filter to the last 30 seconds
|
|
await this.page.locator(this.dateTimeButton).click();
|
|
await this.relative30SecondsButton.click();
|
|
}
|
|
|
|
async verifyTimeSetTo30Seconds() {
|
|
// Verify that the time filter displays "Past 30 Seconds"
|
|
await expect(this.page.locator(this.dateTimeButton)).toContainText(Past30SecondsValue);
|
|
}
|
|
|
|
async setDateTime() {
|
|
await expect(this.page.locator(this.dateTimeButton)).toBeVisible();
|
|
await this.page.locator(this.dateTimeButton).click();
|
|
await this.page.locator(this.absoluteTab).click();
|
|
await this.page.waitForTimeout(1000);
|
|
|
|
}
|
|
|
|
async fillTimeRange(startTime, endTime) {
|
|
await this.page.getByRole('button', { name: '1', exact: true }).click();
|
|
await this.page.getByLabel('access_time').first().fill(startTime);
|
|
await this.page.getByRole('button', { name: '1', exact: true }).click();
|
|
await this.page.getByLabel('access_time').nth(1).fill(endTime);
|
|
|
|
}
|
|
|
|
async verifyDateTime(startTime, endTime) {
|
|
await expect(this.page.locator(this.dateTimeButton)).toContainText(`${startTime} - ${endTime}`);
|
|
}
|
|
|
|
async signOut() {
|
|
await this.profileButton.click();
|
|
await this.signOutButton.click();
|
|
}
|
|
}
|
|
|
|
|