"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const test_1 = require("@playwright/test");
const SM_8_9_1 = require("../../fixtures/SM-8.9");
const _setup_1 = require("../../test-setup.js");
const sleep_1 = require("../../utils/sleep");
const UtilitiesPage_1 = require("../../pages/SM-8.9/UtilitiesPage");
const UtilitiesPage_2 = require("../../pages/SM-8.9/UtilitiesPage");
if (process.env.IS_OPTIMIZE !== 'false') {
    SM_8_9_1.test.describe.configure({ mode: 'parallel' });
    SM_8_9_1.test.describe('Optimize User Flow Tests @tasklistV1', () => {
        SM_8_9_1.test.beforeEach(async ({ navigationPage }, testInfo) => {
            await navigationPage.goToModeler((testInfo.workerIndex + 1) * 1000);
        });
        SM_8_9_1.test.afterEach(async ({ page }, testInfo) => {
            await (0, _setup_1.captureScreenshot)(page, testInfo);
            await (0, _setup_1.captureFailureVideo)(page, testInfo);
        });
        (0, SM_8_9_1.test)('Process Import Flow', async ({ page, operateHomePage, modelerHomePage, navigationPage, modelerCreatePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeDashboardPage, }) => {
            SM_8_9_1.test.slow();
            const processName = 'Optimize_Job_Worker_User_Task_Flow' +
                (await (0, _setup_1.generateRandomStringAsync)(3));
            await SM_8_9_1.test.step('Open Cross Component Test Project and Create a BPMN Diagram Template', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickBpmnTemplateOption();
            });
            await SM_8_9_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
                await modelerCreatePage.modelJobWorkerDiagram(processName);
                await modelerCreatePage.runProcessInstance();
                await (0, sleep_1.sleep)(10000);
            });
            await SM_8_9_1.test.step('View Process Instance in Operate and Assert Process has been successfully imported in Optimize', async () => {
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName);
                await operateProcessInstancePage.activeIconAssertion();
                await navigationPage.goToOptimize();
                await optimizeHomePage.clickDashboardLink();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await optimizeDashboardPage.clickFilterTable();
                await optimizeDashboardPage.fillFilterTable(processName);
                await optimizeDashboardPage.processAssertion(processName);
            });
        });
        (0, SM_8_9_1.test)('Job Worker User Task User Flow', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeCollectionsPage, optimizeReportPage, }) => {
            SM_8_9_1.test.slow();
            const reportName = await (0, _setup_1.generateRandomStringAsync)(5);
            const processName = 'Optimize_Job_Worker_User_Task_Diagram' + reportName;
            await SM_8_9_1.test.step('Open Cross Component Test Project and Create a BPMN Diagram Template', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickBpmnTemplateOption();
            });
            await SM_8_9_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
                await modelerCreatePage.modelJobWorkerDiagram(processName);
                await modelerCreatePage.runProcessInstance();
                await (0, sleep_1.sleep)(10000);
            });
            await SM_8_9_1.test.step('View Process Instance in Operate, Create User Task Report in Optimize, Start Another Process Instance in Modeler & Assert the Report Updates', async () => {
                await navigationPage.goToOperate();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName);
                await operateProcessInstancePage.activeIconAssertion();
                await navigationPage.goToOptimize();
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await optimizeCollectionsPage.clickCreateNewButton();
                await optimizeCollectionsPage.clickReportOption();
                await optimizeReportPage.clickProcessSelectionButton();
                await optimizeReportPage.clickUserTaskProcess(processName);
                await (0, test_1.expect)(optimizeReportPage.versionSelection).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickVersionSelection();
                await optimizeReportPage.clickAlwaysDisplayLatestSelection();
                await optimizeReportPage.clickBlankReportButton();
                await optimizeReportPage.clickCreateReportLink();
                await optimizeReportPage.clickSelectDropdown();
                await optimizeReportPage.clickUserTaskOption();
                await optimizeReportPage.clickHeatMapButton();
                await (0, test_1.expect)(optimizeReportPage.tableOption).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickTableOption();
                await optimizeReportPage.clickReportName();
                await optimizeReportPage.clearReportName();
                await optimizeReportPage.fillReportName(reportName);
                await optimizeReportPage.clickSaveButton();
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, optimizeReportPage.oneUserTaskInstance, 'One user task count', 90000);
                await navigationPage.goToModeler();
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickProcessDiagram(processName);
                await modelerCreatePage.runProcessInstance();
                await (0, sleep_1.sleep)(10000);
                await navigationPage.goToOperate();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName);
                await operateProcessInstancePage.activeIconAssertion();
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(10000);
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, optimizeReportPage.twoUserTaskInstance, 'Two user tasks count', 90000);
                await (0, test_1.expect)(optimizeReportPage.oneUserTaskInstance).not.toBeVisible();
            });
        });
        (0, SM_8_9_1.test)('New Instances Updated Flow', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeCollectionsPage, optimizeReportPage, }) => {
            SM_8_9_1.test.slow();
            const reportName = await (0, _setup_1.generateRandomStringAsync)(5);
            const processName = 'Optimize_Job_Worker_User_Task_Flow_Updated' +
                (await (0, _setup_1.generateRandomStringAsync)(3));
            await SM_8_9_1.test.step('Open Cross Component Test Project and Create a BPMN Diagram Template', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickBpmnTemplateOption();
            });
            await SM_8_9_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
                await modelerCreatePage.modelJobWorkerDiagram(processName);
                await modelerCreatePage.deployProcessInstance();
                await (0, sleep_1.sleep)(10000);
            });
            await SM_8_9_1.test.step('Create Process Instance Count Report in Optimize, Start A Process Instance in Modeler & Assert the Report Updates', async () => {
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(40000);
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await optimizeCollectionsPage.clickCreateNewButton();
                await optimizeCollectionsPage.clickReportOption();
                await optimizeReportPage.clickProcessSelectionButton();
                await optimizeReportPage.clickUserTaskProcess(processName);
                await (0, test_1.expect)(optimizeReportPage.versionSelection).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickVersionSelection();
                await optimizeReportPage.clickAlwaysDisplayLatestSelection();
                await optimizeReportPage.clickBlankReportButton();
                await optimizeReportPage.clickCreateReportLink();
                await optimizeReportPage.clickSelectDropdown();
                await optimizeReportPage.clickUserTaskOption();
                await optimizeReportPage.clickHeatMapButton();
                await (0, test_1.expect)(optimizeReportPage.tableOption).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickTableOption();
                await optimizeReportPage.clickReportName();
                await optimizeReportPage.clearReportName();
                await optimizeReportPage.fillReportName(reportName);
                await optimizeReportPage.clickSaveButton();
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, 'Displaying data from 0 instances.', false, 30000);
                await navigationPage.goToModeler();
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickProcessDiagram(processName);
                await modelerCreatePage.runProcessInstance();
                await (0, sleep_1.sleep)(10000);
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName);
                await (0, test_1.expect)(operateProcessInstancePage.activeIcon).toBeVisible({
                    timeout: 1200000,
                });
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(15000);
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, 'Displaying data from 1 instance.', false, 30000);
            });
        });
        (0, SM_8_9_1.test)('Conditional Events - Process Import Flow @tasklistV2', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeDashboardPage, }) => {
            SM_8_9_1.test.slow();
            const bpmnFileName = 'Conditional_Events_All.bpmn';
            const processName = 'Conditional Events Auto-Run';
            await SM_8_9_1.test.step('Upload and deploy Conditional Events BPMN from Web Modeler', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickUploadFilesButton();
                const { uploadFile } = await Promise.resolve().then(() => __importStar(require('../../utils/fileUpload')));
                await uploadFile(page, bpmnFileName);
                await (0, sleep_1.sleep)(5000);
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
            });
            await SM_8_9_1.test.step('Start process instance with variable {"myVar": 8}', async () => {
                const variables = '{"myVar": 8}';
                await modelerCreatePage.runProcessInstance(variables);
            });
            await SM_8_9_1.test.step('Verify process instance is completed in Operate', async () => {
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
                await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(60000, 15);
                await operateProcessInstancePage.assertProcessVariableContainsText('myVar', '8');
            });
            await SM_8_9_1.test.step('Navigate to Optimize and verify Conditional Events process appears in Dashboards (CE-OPT-01)', async () => {
                await navigationPage.goToOptimize();
                await optimizeHomePage.clickDashboardLink();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await optimizeDashboardPage.clickFilterTable();
                await optimizeDashboardPage.fillFilterTable(processName);
                await optimizeDashboardPage.processAssertion(processName);
            });
            await SM_8_9_1.test.step('Verify the process link for Conditional Events is navigable in the Optimize dashboard (CE-OPT-02)', async () => {
                await page.reload();
                await optimizeDashboardPage.clickFilterTable();
                await optimizeDashboardPage.fillFilterTable(processName);
                await optimizeDashboardPage.processAssertion(processName);
                await page.getByTitle(processName).first().click({ timeout: 60000 });
                await (0, test_1.expect)(page.getByRole('link', { name: 'Camunda logo Optimize' })).toBeVisible({ timeout: 60000 });
            });
        });
        (0, SM_8_9_1.test)('Conditional Events - Create and Verify User Task Report @tasklistV2', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeCollectionsPage, optimizeReportPage, }) => {
            SM_8_9_1.test.slow();
            const bpmnFileName = 'Conditional_Events_All.bpmn';
            const processName = 'Conditional Events Auto-Run';
            const reportName = await (0, _setup_1.generateRandomStringAsync)(5);
            await SM_8_9_1.test.step('Upload and deploy Conditional Events BPMN from Web Modeler', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickUploadFilesButton();
                const { uploadFile } = await Promise.resolve().then(() => __importStar(require('../../utils/fileUpload')));
                await uploadFile(page, bpmnFileName);
                await (0, sleep_1.sleep)(5000);
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
            });
            await SM_8_9_1.test.step('Start process instance with variable {"myVar": 8}', async () => {
                const variables = '{"myVar": 8}';
                await modelerCreatePage.runProcessInstance(variables);
            });
            await SM_8_9_1.test.step('Verify process instance is completed in Operate', async () => {
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
                await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(60000, 15);
            });
            await SM_8_9_1.test.step('Navigate to Optimize and create a User Task Table report for Conditional Events process (CE-OPT-03)', async () => {
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await optimizeCollectionsPage.clickCreateNewButton();
                await optimizeCollectionsPage.clickReportOption();
                await optimizeReportPage.clickProcessSelectionButton();
                await optimizeReportPage.clickUserTaskProcess(processName);
                await (0, test_1.expect)(optimizeReportPage.versionSelection).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickVersionSelection();
                await optimizeReportPage.clickAlwaysDisplayLatestSelection();
                await optimizeReportPage.clickBlankReportButton();
                await optimizeReportPage.clickCreateReportLink();
                await optimizeReportPage.clickSelectDropdown();
                await optimizeReportPage.clickUserTaskOption();
                await optimizeReportPage.clickHeatMapButton();
                await (0, test_1.expect)(optimizeReportPage.tableOption).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickTableOption();
                await optimizeReportPage.clickReportName();
                await optimizeReportPage.clearReportName();
                await optimizeReportPage.fillReportName(reportName);
                await optimizeReportPage.clickSaveButton();
            });
            await SM_8_9_1.test.step('Verify the report is listed in Collections (CE-OPT-03)', async () => {
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
            });
            await SM_8_9_1.test.step('Verify the report shows exactly 1 completed instance for Conditional Events (CE-OPT-04)', async () => {
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, optimizeReportPage.oneUserTaskInstance, 'One user task instance count', 90000);
                await (0, test_1.expect)(optimizeReportPage.twoUserTaskInstance).not.toBeVisible();
            });
        });
        (0, SM_8_9_1.test)('Conditional Events - Report Updates After Second Process Run @tasklistV2', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeCollectionsPage, optimizeReportPage, }) => {
            SM_8_9_1.test.slow();
            const bpmnFileName = 'Conditional_Events_All.bpmn';
            const processName = 'Conditional Events Auto-Run';
            const reportName = await (0, _setup_1.generateRandomStringAsync)(5);
            await SM_8_9_1.test.step('Upload and deploy Conditional Events BPMN from Web Modeler', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickUploadFilesButton();
                const { uploadFile } = await Promise.resolve().then(() => __importStar(require('../../utils/fileUpload')));
                await uploadFile(page, bpmnFileName);
                await (0, sleep_1.sleep)(5000);
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
            });
            await SM_8_9_1.test.step('Start first process instance with variable {"myVar": 8}', async () => {
                const variables = '{"myVar": 8}';
                await modelerCreatePage.runProcessInstance(variables);
            });
            await SM_8_9_1.test.step('Verify first process instance is completed in Operate', async () => {
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
                await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(60000, 15);
            });
            await SM_8_9_1.test.step('Create a User Task Table report in Optimize and verify it shows count of 1', async () => {
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await optimizeCollectionsPage.clickCreateNewButton();
                await optimizeCollectionsPage.clickReportOption();
                await optimizeReportPage.clickProcessSelectionButton();
                await optimizeReportPage.clickUserTaskProcess(processName);
                await (0, test_1.expect)(optimizeReportPage.versionSelection).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickVersionSelection();
                await optimizeReportPage.clickAlwaysDisplayLatestSelection();
                await optimizeReportPage.clickBlankReportButton();
                await optimizeReportPage.clickCreateReportLink();
                await optimizeReportPage.clickSelectDropdown();
                await optimizeReportPage.clickUserTaskOption();
                await optimizeReportPage.clickHeatMapButton();
                await (0, test_1.expect)(optimizeReportPage.tableOption).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickTableOption();
                await optimizeReportPage.clickReportName();
                await optimizeReportPage.clearReportName();
                await optimizeReportPage.fillReportName(reportName);
                await optimizeReportPage.clickSaveButton();
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, optimizeReportPage.oneUserTaskInstance, 'One user task instance count', 90000);
            });
            await SM_8_9_1.test.step('Start a second process instance with variable {"myVar": 8} in Modeler', async () => {
                await navigationPage.goToModeler();
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
                const variables = '{"myVar": 8}';
                await modelerCreatePage.runProcessInstance(variables);
                await (0, sleep_1.sleep)(10000);
            });
            await SM_8_9_1.test.step('Verify second process instance is completed in Operate', async () => {
                await navigationPage.goToOperate();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
                await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(60000, 15);
            });
            await SM_8_9_1.test.step('Verify the Optimize report now shows 2 instances and the single instance count is gone (CE-OPT-05)', async () => {
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(10000);
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, optimizeReportPage.twoUserTaskInstance, 'Two user task instance count', 90000);
                await (0, test_1.expect)(optimizeReportPage.oneUserTaskInstance).not.toBeVisible();
            });
        });
        (0, SM_8_9_1.test)('Conditional Events - Report Starts at Zero and Updates After First Run @tasklistV2', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeCollectionsPage, optimizeReportPage, }) => {
            SM_8_9_1.test.slow();
            const bpmnFileName = 'Conditional_Events_All.bpmn';
            const processName = 'Conditional Events Auto-Run';
            const reportName = await (0, _setup_1.generateRandomStringAsync)(5);
            await SM_8_9_1.test.step('Upload and deploy Conditional Events BPMN from Web Modeler', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickUploadFilesButton();
                const { uploadFile } = await Promise.resolve().then(() => __importStar(require('../../utils/fileUpload')));
                await uploadFile(page, bpmnFileName);
                await (0, sleep_1.sleep)(5000);
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
            });
            await SM_8_9_1.test.step('Deploy the process without starting any instance', async () => {
                await modelerCreatePage.deployProcessInstance();
                await (0, sleep_1.sleep)(10000);
            });
            await SM_8_9_1.test.step('Create a User Task Table report in Optimize and verify it shows 0 instances (CE-OPT-08)', async () => {
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(40000);
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await optimizeCollectionsPage.clickCreateNewButton();
                await optimizeCollectionsPage.clickReportOption();
                await optimizeReportPage.clickProcessSelectionButton();
                await optimizeReportPage.clickUserTaskProcess(processName);
                await (0, test_1.expect)(optimizeReportPage.versionSelection).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickVersionSelection();
                await optimizeReportPage.clickAlwaysDisplayLatestSelection();
                await optimizeReportPage.clickBlankReportButton();
                await optimizeReportPage.clickCreateReportLink();
                await optimizeReportPage.clickSelectDropdown();
                await optimizeReportPage.clickUserTaskOption();
                await optimizeReportPage.clickHeatMapButton();
                await (0, test_1.expect)(optimizeReportPage.tableOption).toBeVisible({
                    timeout: 30000,
                });
                await optimizeReportPage.clickTableOption();
                await optimizeReportPage.clickReportName();
                await optimizeReportPage.clearReportName();
                await optimizeReportPage.fillReportName(reportName);
                await optimizeReportPage.clickSaveButton();
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, 'Displaying data from 0 instances.', false, 30000);
            });
            await SM_8_9_1.test.step('Start a process instance with variable {"myVar": 8} and verify completion in Operate', async () => {
                await navigationPage.goToModeler();
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
                const variables = '{"myVar": 8}';
                await modelerCreatePage.runProcessInstance(variables);
                await (0, sleep_1.sleep)(10000);
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName, 'completed');
                await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(60000, 15);
            });
            await SM_8_9_1.test.step('Verify the Optimize report now shows data from 1 instance (CE-OPT-07 & CE-OPT-08)', async () => {
                await navigationPage.goToOptimize();
                await (0, sleep_1.sleep)(15000);
                await page.reload();
                await optimizeHomePage.clickCollectionsLink();
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, reportName, false, 30000);
                await optimizeCollectionsPage.clickMostRecentProcessReport(reportName);
                await (0, UtilitiesPage_2.assertPageTextWithRetry)(page, 'Displaying data from 1 instance.', false, 30000);
            });
        });
        (0, SM_8_9_1.test)('Conditional Events - Instance Gated By Unmet Condition (CE-OPT-06) @tasklistV2', async ({ page, modelerHomePage, navigationPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, optimizeHomePage, optimizeDashboardPage, }) => {
            SM_8_9_1.test.slow();
            const bpmnFileName = 'Conditional_Events_All.bpmn';
            const processName = 'Conditional Events Auto-Run';
            await SM_8_9_1.test.step('Upload and deploy Conditional Events BPMN from Web Modeler', async () => {
                await modelerHomePage.clickCrossComponentProjectFolder();
                await modelerHomePage.clickDiagramTypeDropdown();
                await modelerHomePage.clickUploadFilesButton();
                const { uploadFile } = await Promise.resolve().then(() => __importStar(require('../../utils/fileUpload')));
                await uploadFile(page, bpmnFileName);
                await (0, sleep_1.sleep)(5000);
                await modelerHomePage.clickProcessDiagram(bpmnFileName.replace('.bpmn', ''));
            });
            await SM_8_9_1.test.step('Start process instance with variable {"myVar": 3}', async () => {
                const variables = '{"myVar": 3}';
                await modelerCreatePage.runProcessInstance(variables);
            });
            await SM_8_9_1.test.step('Verify the instance is gated (active, not completed) in Operate', async () => {
                await navigationPage.goToOperate();
                await operateHomePage.clickProcessesTab();
                await operateProcessesPage.clickProcessInstanceLink(processName, 'active');
                await operateProcessInstancePage.activeIconAssertion();
                await operateProcessInstancePage.assertProcessVariableContainsText('myVar', '3');
            });
            await SM_8_9_1.test.step('Verify the gated Conditional Events process is imported and visible in the Optimize dashboard (CE-OPT-06)', async () => {
                await navigationPage.goToOptimize();
                await optimizeHomePage.clickDashboardLink();
                await (0, sleep_1.sleep)(10000);
                await page.reload();
                await optimizeDashboardPage.clickFilterTable();
                await optimizeDashboardPage.fillFilterTable(processName);
                await optimizeDashboardPage.processAssertion(processName);
            });
        });
    });
}
