"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OptimizeHomePage = void 0;
const test_1 = require("@playwright/test");
class OptimizeHomePage {
    page;
    collectionsLink;
    dashboardLink;
    modalCloseButton;
    optimizeBanner;
    openUserSettingsButton;
    logoutButton;
    licenseKeyTagNonProduction;
    licenseKeyTagProduction;
    constructor(page) {
        this.page = page;
        this.collectionsLink = page
            .getByRole('banner')
            .getByRole('link', { name: 'Collections' });
        this.dashboardLink = page.getByRole('link', { name: 'Dashboard' });
        this.modalCloseButton = page.getByText('Close', { exact: true });
        this.optimizeBanner = page.getByRole('link', {
            name: 'Camunda logo Optimize',
        });
        this.openUserSettingsButton = page.getByLabel('Open User');
        this.logoutButton = page.getByRole('button', { name: 'Logout' });
        this.licenseKeyTagNonProduction = page
            .getByText('Non-production license')
            .first();
        this.licenseKeyTagProduction = page.getByText('Production license').first();
    }
    async clickCollectionsLink() {
        try {
            await this.modalCloseButton.click();
            await this.collectionsLink.click();
        }
        catch (error) {
            await this.collectionsLink.click();
        }
    }
    async clickDashboardLink() {
        try {
            await this.modalCloseButton.click();
            await this.dashboardLink.click();
        }
        catch (error) {
            await this.dashboardLink.click();
        }
    }
    async assertProcessHasBeenImported(processId) {
        await this.clickDashboardLink();
        await this.page.reload();
        await (0, test_1.expect)(this.page.getByRole('link', { name: processId })).toBeVisible({
            timeout: 180000,
        });
    }
    async clickOpenUserSettingsButton() {
        await this.openUserSettingsButton.click();
    }
    async clickLogoutButton() {
        await this.logoutButton.click();
    }
}
exports.OptimizeHomePage = OptimizeHomePage;
