2025-12-12 17:46:45 +01:00
|
|
|
import { Page } from '@playwright/test';
|
|
|
|
|
|
|
|
|
|
export class DataOverlayPageObject {
|
|
|
|
|
readonly page: Page;
|
2026-03-27 21:37:42 +01:00
|
|
|
readonly viewportId: string;
|
2025-12-12 17:46:45 +01:00
|
|
|
|
2026-03-27 21:37:42 +01:00
|
|
|
constructor(page: Page, viewportId: string) {
|
2025-12-12 17:46:45 +01:00
|
|
|
this.page = page;
|
2026-03-27 21:37:42 +01:00
|
|
|
this.viewportId = viewportId;
|
2025-12-12 17:46:45 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-02 14:52:23 +02:00
|
|
|
get menu() {
|
|
|
|
|
return this.page.getByTestId(`viewport-data-overlay-menu-${this.viewportId}`);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 21:37:42 +01:00
|
|
|
async toggle() {
|
|
|
|
|
await this.page.getByTestId(`dataOverlayMenu-${this.viewportId}-btn`).click();
|
2025-12-12 17:46:45 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-27 21:37:42 +01:00
|
|
|
async addSegmentation(segmentation: string) {
|
2026-04-02 14:52:23 +02:00
|
|
|
await this.openAddSegmentationDropdown();
|
2025-12-12 17:46:45 +01:00
|
|
|
await this.page.getByTestId(segmentation).click();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async changeSegmentation(from: string, to: string) {
|
|
|
|
|
await this.page.getByTestId(`overlay-ds-select-value-${from.toUpperCase()}`).click();
|
|
|
|
|
await this.page.getByTestId(`${to}-SEG`).click();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async remove(segmentation: string) {
|
|
|
|
|
await this.page.getByTestId(`overlay-ds-more-button-${segmentation}`).click();
|
|
|
|
|
await this.page.getByTestId(`overlay-ds-remove-button-${segmentation}`).click();
|
|
|
|
|
}
|
2026-04-02 14:52:23 +02:00
|
|
|
|
|
|
|
|
async openAddSegmentationDropdown() {
|
|
|
|
|
await this.page.getByTestId(`AddSegmentationDataOverlay-${this.viewportId}`).click();
|
|
|
|
|
await this.clickSelectSegmentation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async clickSelectSegmentation() {
|
|
|
|
|
await this.page.getByText('SELECT A SEGMENTATION').click();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getDropdownOptionLabels(): Promise<string[]> {
|
|
|
|
|
const options = this.page.getByRole('option');
|
|
|
|
|
const labels = (await options.allTextContents()).map(text => text.trim()).filter(Boolean);
|
|
|
|
|
return labels;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getOverlaySegmentationRow(label: string) {
|
|
|
|
|
return this.menu.getByTestId(`overlay-ds-select-value-${label.toUpperCase()}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get overlaySegmentationRows() {
|
|
|
|
|
return this.menu.locator('[data-cy^="overlay-ds-select-value-"]');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async changeBackgroundDisplaySet(backgroundLabel: string) {
|
|
|
|
|
await this.page.getByTestId(`overlay-background-ds-select-${this.viewportId}`).click();
|
|
|
|
|
await this.page.getByTestId(backgroundLabel).click();
|
|
|
|
|
}
|
2025-12-12 17:46:45 +01:00
|
|
|
}
|