"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimizeCollectionsPage = void 0;
class OptimizeCollectionsPage {
    page;
    collectionsPageHeader;
    createNewButton;
    reportOption;
    modalCloseButton;
    processReport;
    collectionsLink;
    constructor(page) {
        this.page = page;
        this.collectionsPageHeader = page.getByRole('heading', {
            name: 'Collections, Dashboards, and Reports',
        });
        this.createNewButton = page.getByRole('button', {
            name: 'Create new',
            exact: true,
        });
        this.reportOption = page.getByText('Report', { exact: true });
        this.modalCloseButton = page.locator('button').filter({ hasText: /^Close$/ });
        this.processReport = page.getByText('Process Report').first();
        this.collectionsLink = page
            .getByRole('banner')
            .getByRole('link', { name: 'Collections' });
    }
    async clickCreateNewButton() {
        try {
            await this.modalCloseButton.click({ timeout: 90000 });
            await this.collectionsLink.click({ timeout: 90000 });
            await this.createNewButton.click({ timeout: 90000 });
        }
        catch (error) {
            await this.collectionsLink.click({ timeout: 90000 });
            await this.createNewButton.click({ timeout: 90000 });
        }
    }
    async clickReportOption() {
        await this.reportOption.click();
    }
    async clickMostRecentProcessReport(reportName) {
        await this.page.getByText(reportName).click({ timeout: 60000 });
    }
}
exports.OptimizeCollectionsPage = OptimizeCollectionsPage;
