"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClusterPage = void 0;
const test_1 = require("@playwright/test");
class ClusterPage {
    page;
    clustersList;
    defaultClusterName = process.env.CLUSTER_NAME || 'integration-zeebe';
    cluster;
    constructor(page) {
        this.page = page;
        this.clustersList = page.locator('tbody').getByRole('row');
        this.cluster = this.clustersList.getByText(this.defaultClusterName).first();
    }
    async clickClusterLink() {
        await (0, test_1.expect)(this.cluster).toBeVisible({ timeout: 60000 });
        await this.cluster.click({ timeout: 30000 });
        await (0, test_1.expect)(this.page.getByText('Cluster details').first()).toBeVisible({
            timeout: 10000,
        });
    }
    async assertCustomTagsAreVisible(tags) {
        // The previous implementation called page.waitForLoadState('networkidle')
        // here. The Console clusters page emits continuous polling/SSE traffic,
        // so networkidle never fires — the test would hang for 12 min then
        // retry, costing ~24 min total. The toBeVisible auto-waits below
        // already cover the readiness window we actually need.
        for (const tag of tags) {
            await (0, test_1.expect)(this.page.getByText(tag, { exact: true }).first()).toBeVisible({
                timeout: 60000,
            });
        }
    }
}
exports.ClusterPage = ClusterPage;
