Files
openobserve/tests/ui-testing/pages/aboutPage.js
T
Bhargav bbd34911c6 fix: about page locator and link (#5815)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a new help menu option to the About Page for improved
navigation.
- Enhanced testability by adding data-test attributes to key elements in
the layout.

- **Tests**
- Updated tests to include interactions with the new help menu before
validating the About page.
	- Adjusted method calls for consistency in validation tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-01-27 16:29:59 +05:30

61 lines
1.8 KiB
JavaScript

// aboutPage.js
import { expect } from '@playwright/test';
export class AboutPage {
constructor(page) {
this.page = page;
this.helpPageMenu = page.locator('[data-test="menu-link-help-item"]');
this.aboutPageMenu = page.locator('[data-test="menu-link-about-item"]');
// this.aboutPageMenu = page.locator('[data-test="menu-link-about-item"]');
}
async clickHelpMenu() {
await this.helpPageMenu.click();
}
async gotoAboutPage() {
await this.aboutPageMenu.click();
}
async aboutPageDefaultOrg() {
await this.page.locator('[data-test="navbar-organizations-select"]').getByText('arrow_drop_down').click();
await this.page.getByText('default', { exact: true }).click();
}
async aboutPageDefaultMultiOrg() {
await this.page.locator('[data-test="navbar-organizations-select"]').getByText('arrow_drop_down').click();
await this.page.getByRole('option', { name: 'defaulttestmulti' }).locator('div').nth(2).click();
}
async aboutPageURLValidation() {
await expect(this.page).toHaveURL(/defaulttestmulti/);
}
async aboutURLValidation() {
await expect(this.page).toHaveURL(/about/);
}
async selectOrganization(orgName) {
const dropdown = this.page.locator('[data-test="navbar-organizations-select"]');
await dropdown.getByText('arrow_drop_down').click();
try {
if (orgName === 'default') {
await this.page.getByText('default', { exact: true }).click();
} else {
await this.page.getByRole('option', { name: orgName }).locator('div').nth(2).click();
}
await this.page.waitForLoadState('networkidle');
} catch (error) {
throw new Error(`Failed to select organization: ${orgName}`);
}
}
}