"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const test_1 = require("@playwright/test");
const _8_8_1 = require("../../fixtures/8.8");
const _setup_1 = require("../../test-setup.js");
const TaskPanelPage_1 = require("../../pages/8.8/TaskPanelPage");
const TaskDetailsPage_1 = require("../../pages/8.8/TaskDetailsPage");
const OperateHomePage_1 = require("../../pages/8.8/OperateHomePage");
const AppsPage_1 = require("../../pages/8.8/AppsPage");
const OperateProcessesPage_1 = require("../../pages/8.8/OperateProcessesPage");
const OperateProcessInstancePage_1 = require("../../pages/8.8/OperateProcessInstancePage");
const UtilitiesPage_1 = require("../../pages/8.8/UtilitiesPage");
const sleep_1 = require("../../utils/sleep");
const fileUpload_1 = require("../../utils/fileUpload");
const resetSession_1 = require("../../utils/resetSession");
const expectTextWithPagination_1 = require("../../utils/assertionHelpers/expectTextWithPagination");
const expectTextWithRetry_1 = require("../../utils/assertionHelpers/expectTextWithRetry");
const users_1 = require("../../utils/users");
const testUser = (0, users_1.getTestUser)('nineteenthUser');
_8_8_1.test.describe.configure({ mode: 'parallel' });
_8_8_1.test.describe('HTO User Flow Tests', () => {
    const clusterName = 'Test Cluster';
    _8_8_1.test.beforeEach(async ({ page, loginPage }, testInfo) => {
        await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
    });
    _8_8_1.test.afterEach(async ({ page }, testInfo) => {
        await (0, _setup_1.captureScreenshot)(page, testInfo);
        await (0, _setup_1.captureFailureVideo)(page, testInfo);
    });
    (0, _8_8_1.test)('Job Worker User Task Most Common Flow @tasklistV1', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, }) => {
        _8_8_1.test.slow();
        const processName = 'User_Task_Process' + (await (0, _setup_1.generateRandomStringAsync)(3));
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 180000,
            });
        });
        await _8_8_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 _8_8_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
            await modelerCreatePage.modelJobWorkerDiagram(processName);
            await modelerCreatePage.runProcessInstance(clusterName);
        });
        await _8_8_1.test.step('View Process Instance in Operate, complete User Task in Tasklist & assert process complete in Operate', async () => {
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 120000,
            });
            await modelerCreatePage.clickViewProcessInstanceLink();
            const operateTabPromise = page.waitForEvent('popup', { timeout: 60000 });
            const operateTab = await operateTabPromise;
            const operateTabHomePage = new OperateHomePage_1.OperateHomePage(operateTab);
            const operateTabProcessesPage = new OperateProcessesPage_1.OperateProcessesPage(operateTab);
            const operateTabAppsPage = new AppsPage_1.AppsPage(operateTab);
            const operateTabTaskPanelPage = new TaskPanelPage_1.TaskPanelPage(operateTab);
            const operateTabTaskDetailsPage = new TaskDetailsPage_1.TaskDetailsPage(operateTab);
            const operateTabProcessInstancePage = new OperateProcessInstancePage_1.OperateProcessInstancePage(operateTab);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(operateTabProcessInstancePage, operateTabProcessInstancePage.activeIcon, 'active icon');
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickTasklist(clusterName);
            await operateTabTaskPanelPage.openTask(processName);
            await operateTabTaskDetailsPage.clickAssignToMeButton();
            await operateTabTaskDetailsPage.clickCompleteTaskButton();
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickOperate(clusterName);
            await operateTabHomePage.clickProcessesTab();
            await (0, sleep_1.sleep)(10000);
            await operateTab.reload();
            await operateTabProcessesPage.clickProcessCompletedCheckbox();
            await operateTabProcessesPage.clickProcessInstanceLink(processName);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(operateTabProcessInstancePage, operateTabProcessInstancePage.completedIcon, 'completed icon');
        });
    });
    (0, _8_8_1.test)('Camunda User Task Most Common Flow @tasklistV2', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, }) => {
        _8_8_1.test.slow();
        const processName = 'Camunda_User_Task_Process' + (await (0, _setup_1.generateRandomStringAsync)(3));
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 180000,
            });
        });
        await _8_8_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 _8_8_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
            await modelerCreatePage.modelCamundaUserTaskDiagram(processName);
            await modelerCreatePage.runProcessInstance(clusterName);
        });
        await _8_8_1.test.step('View Process Instance in Operate, complete User Task in Tasklist & assert process complete in Operate', async () => {
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 120000,
            });
            await modelerCreatePage.clickViewProcessInstanceLink();
            const operateTabPromise = page.waitForEvent('popup', { timeout: 60000 });
            const operateTab = await operateTabPromise;
            const operateTabHomePage = new OperateHomePage_1.OperateHomePage(operateTab);
            const operateTabProcessesPage = new OperateProcessesPage_1.OperateProcessesPage(operateTab);
            const operateTabAppsPage = new AppsPage_1.AppsPage(operateTab);
            const operateTabTaskPanelPage = new TaskPanelPage_1.TaskPanelPage(operateTab);
            const operateTabTaskDetailsPage = new TaskDetailsPage_1.TaskDetailsPage(operateTab);
            const operateTabProcessInstancePage = new OperateProcessInstancePage_1.OperateProcessInstancePage(operateTab);
            await (0, test_1.expect)(operateTabProcessInstancePage.activeIcon).toBeVisible({
                timeout: 1200000,
            });
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickTasklist(clusterName);
            await (0, UtilitiesPage_1.assertPageTextWithRetry)(operateTab, processName, false, 60000);
            await operateTabTaskPanelPage.openTask(processName);
            await operateTabTaskDetailsPage.clickAssignToMeButton();
            await operateTabTaskDetailsPage.clickCompleteTaskButton();
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickOperate(clusterName);
            await operateTabHomePage.clickProcessesTab();
            await (0, sleep_1.sleep)(10000);
            await operateTab.reload();
            await operateTabProcessesPage.clickProcessCompletedCheckbox();
            await operateTabProcessesPage.clickProcessInstanceLink(processName);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(operateTabProcessInstancePage, operateTabProcessInstancePage.completedIcon, 'completed icon');
        });
    });
    (0, _8_8_1.test)('User Task Editing Variables Flow @tasklistV1', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, }) => {
        _8_8_1.test.slow();
        const processName = 'User_Task_Editing_Variables' + (await (0, _setup_1.generateRandomStringAsync)(3));
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 120000,
            });
        });
        await _8_8_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 _8_8_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
            await modelerCreatePage.modelJobWorkerDiagram(processName);
            await modelerCreatePage.runProcessInstance(clusterName, '{"testVariable":"testValue"}');
        });
        await _8_8_1.test.step('View Process Instance in Operate, Edit the Variable & Assert the Variable is Updated in Tasklist', async () => {
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 120000,
            });
            await modelerCreatePage.clickViewProcessInstanceLink();
            const operateTab = await page.waitForEvent('popup');
            const operateTabHomePage = new OperateHomePage_1.OperateHomePage(operateTab);
            const operateTabAppsPage = new AppsPage_1.AppsPage(operateTab);
            const operateTabProcessInstancePage = new OperateProcessInstancePage_1.OperateProcessInstancePage(operateTab);
            const operateTabTaskPanelPage = new TaskPanelPage_1.TaskPanelPage(operateTab);
            await (0, test_1.expect)(operateTabProcessInstancePage.activeIcon).toBeVisible({
                timeout: 1200000,
            });
            await (0, test_1.expect)(operateTab.getByText('"testValue"')).toBeVisible({
                timeout: 90000,
            });
            await (0, test_1.expect)(operateTab.getByText('testVariable', { exact: true })).toBeVisible();
            await operateTabHomePage.clickEditVariableButton('testVariable');
            await operateTabHomePage.clickVariableValueInput();
            await operateTabHomePage.clearVariableValueInput();
            await operateTabHomePage.fillVariableValueInput('"updatedValue"');
            await operateTabHomePage.clickSaveVariableButton();
            await (0, test_1.expect)(operateTabHomePage.editVariableSpinner).not.toBeVisible({
                timeout: 180000,
            });
            await (0, test_1.expect)(operateTab.getByText('"testValue"')).not.toBeVisible({
                timeout: 60000,
            });
            await (0, test_1.expect)(operateTab.getByText('"updatedValue"')).toBeVisible({
                timeout: 90000,
            });
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickTasklist(clusterName);
            await operateTabTaskPanelPage.openTask(processName);
            await (0, test_1.expect)(operateTab.getByText('testVariable')).toBeVisible({
                timeout: 60000,
            });
            await (0, test_1.expect)(operateTab.getByText('"updatedValue"')).toBeVisible();
            await (0, test_1.expect)(operateTab.getByText('"testValue"')).not.toBeVisible();
        });
    });
    (0, _8_8_1.test)('Camunda User Task Editing Variables Flow @tasklistV2', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, operateHomePage, operateProcessesPage, operateProcessInstancePage, taskPanelPage, }) => {
        _8_8_1.test.slow();
        const processName = 'Camunda_User_Task_Editing_Variables' +
            (await (0, _setup_1.generateRandomStringAsync)(3));
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 120000,
            });
        });
        await _8_8_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 _8_8_1.test.step('Create BPMN Diagram with User Task and Start Process Instance', async () => {
            await modelerCreatePage.modelCamundaUserTaskDiagram(processName);
            await modelerCreatePage.runProcessInstance(clusterName, '{"testVariable":"testValue"}');
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 120000,
            });
        });
        await _8_8_1.test.step('View Process Instance in Operate, Edit the Variable & Assert the Variable is Updated in Tasklist', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickOperate(clusterName);
            await (0, test_1.expect)(operateHomePage.processesTab).toBeVisible({
                timeout: 60000,
            });
            await operateHomePage.clickProcessesTab();
            await operateProcessesPage.clickProcessInstanceLink(processName);
            await (0, test_1.expect)(operateProcessInstancePage.activeIcon).toBeVisible({
                timeout: 60000,
            });
            await (0, test_1.expect)(page.getByText('"testValue"')).toBeVisible({
                timeout: 90000,
            });
            await (0, test_1.expect)(page.getByText('testVariable', { exact: true })).toBeVisible();
            await operateHomePage.clickEditVariableButton('testVariable');
            await operateHomePage.clickVariableValueInput();
            await operateHomePage.clearVariableValueInput();
            await operateHomePage.fillVariableValueInput('"updatedValue"');
            await operateHomePage.clickSaveVariableButton();
            await (0, test_1.expect)(operateHomePage.editVariableSpinner).not.toBeVisible({
                timeout: 180000,
            });
            await (0, test_1.expect)(page.getByText('"testValue"')).not.toBeVisible({
                timeout: 60000,
            });
            await (0, test_1.expect)(page.getByText('"updatedValue"')).toBeVisible({
                timeout: 90000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickTasklist(clusterName);
            await (0, test_1.expect)(taskPanelPage.taskListPageBanner).toBeVisible({
                timeout: 20000,
            });
            await (0, expectTextWithRetry_1.expectTextWithRetry)(page, processName);
            await taskPanelPage.openTask(processName);
            await (0, test_1.expect)(page.getByText('testVariable')).toBeVisible({
                timeout: 60000,
            });
            await (0, UtilitiesPage_1.assertPageTextWithRetry)(page, '"updatedValue"');
            await (0, test_1.expect)(page.getByText('"testValue"')).not.toBeVisible();
        });
    });
    (0, _8_8_1.test)('RBA Off User Flow', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, clusterPage, clusterDetailsPage, taskPanelPage, taskProcessesPage, }) => {
        _8_8_1.test.slow();
        const randomString = await (0, _setup_1.generateRandomStringAsync)(3);
        const processName = 'User_Task_Process_RBA_OFF_' + randomString + '_';
        await _8_8_1.test.step('Navigate to Console', async () => {
            await (0, UtilitiesPage_1.disableRBA)(clusterName, homePage, clusterPage, clusterDetailsPage, appsPage);
        });
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 120000,
            });
        });
        await _8_8_1.test.step('Navigate to Cross Component Test Project', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
        });
        await _8_8_1.test.step('Create Two BPMN Diagrams with User Task and Start Process Instance', async () => {
            await (0, UtilitiesPage_1.runMultipleProcesses)(clusterName, page, modelerHomePage, modelerCreatePage, {
                processName: processName,
                uploadFromFile: 'Camunda_Simple_User_Task_5',
            });
        });
        await _8_8_1.test.step('Navigate to Tasklist and Make Sure that the Two Deployed Processes Are Accessible', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickTasklist(clusterName);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, taskPanelPage.taskListPageBanner, 'Tasklist banner');
            await taskPanelPage.clickProcessesTab();
            await taskProcessesPage.clickpopupContinueButton();
            await (0, expectTextWithPagination_1.expectTextWithPagination)(page, processName + '1');
            await (0, expectTextWithPagination_1.expectTextWithPagination)(page, processName + '2');
        });
    });
    (0, _8_8_1.test)('Zeebe User Task With Priority', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, taskPanelPage, taskDetailsPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
        const randomName = await (0, _setup_1.generateRandomStringAsync)(3);
        const processName = 'Zeebe_User_Task_Process_With_Priority' + randomName;
        const taskName = 'priorityTest' + randomName;
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 120000,
            });
        });
        await _8_8_1.test.step('Create a BPMN Diagram Template', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickBpmnTemplateOption();
        });
        await _8_8_1.test.step('Create BPMN Diagram with multiple Zeebe User Tasks with Priority and Start Process Instance', async () => {
            await (0, test_1.expect)(modelerCreatePage.generalPanel).toBeVisible({
                timeout: 120000,
            });
            await modelerCreatePage.enterDiagramName(processName);
            await (0, sleep_1.sleep)(10000);
            await modelerCreatePage.addParallelUserTasks(4, taskName);
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickAppendEndEventButton('parallelGateway');
            await modelerCreatePage.setPriority(taskName, 1, 4);
            await (0, sleep_1.sleep)(10000);
            await modelerCreatePage.runProcessInstance(clusterName);
        });
        await _8_8_1.test.step('Complete User Task in Tasklist & assert process complete in Operate', async () => {
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickTasklist(clusterName);
            await (0, test_1.expect)(taskPanelPage.taskListPageBanner).toBeVisible({
                timeout: 15000,
            });
            await (0, expectTextWithRetry_1.expectTextWithRetry)(page, processName);
            await (0, UtilitiesPage_1.completeTaskWithRetry)(taskPanelPage, taskDetailsPage, `${taskName}4`, 'critical');
            await (0, UtilitiesPage_1.completeTaskWithRetry)(taskPanelPage, taskDetailsPage, `${taskName}3`, 'high');
            await (0, UtilitiesPage_1.completeTaskWithRetry)(taskPanelPage, taskDetailsPage, `${taskName}2`, 'medium');
            await (0, UtilitiesPage_1.completeTaskWithRetry)(taskPanelPage, taskDetailsPage, `${taskName}1`, 'low');
            await taskPanelPage.filterBy('Completed');
            await (0, expectTextWithRetry_1.expectTextWithRetry)(page, processName);
            await (0, UtilitiesPage_1.expectCountToBeOneOf)(page.getByText(processName), 4, 5);
            await taskPanelPage.openTask(`${taskName}4`);
            await (0, test_1.expect)(taskDetailsPage.detailsInfo.getByText(processName)).toBeVisible({ timeout: 60000 });
            await (0, test_1.expect)(taskDetailsPage.detailsPanel.getByText('critical')).toBeVisible();
        });
        await appsPage.clickCamundaApps();
        await appsPage.clickOperate(clusterName);
        await operateHomePage.clickProcessesTab();
        await operateProcessesPage.clickProcessCompletedCheckbox();
        await operateProcessesPage.clickProcessInstanceLink(processName);
        await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(40000);
    });
    (0, _8_8_1.test)('Document Handling HTO User Flow - GCP', async ({ homePage, modelerHomePage, appsPage, formJsPage, modelerCreatePage, taskPanelPage, taskDetailsPage, operateHomePage, operateProcessInstancePage, operateProcessesPage, page, }) => {
        _8_8_1.test.slow();
        const randomName = await (0, _setup_1.generateRandomStringAsync)(3);
        const processName = 'HTO_Document_Handling_Process' + randomName;
        const formNameFilePicker = 'File Picker Form ' + randomName;
        const formNameDocumentPreview = 'Document Preview Form ' + randomName;
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 120000,
            });
        });
        await _8_8_1.test.step('Open Cross Component Test Project', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
        });
        await _8_8_1.test.step('Create a Form with a File Picker Field', async () => {
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickFormOption();
            await modelerHomePage.enterFormName(formNameFilePicker);
            await (0, sleep_1.sleep)(10000);
            await formJsPage.dragAndDrop(formJsPage.filePicker, formJsPage.formEditor);
            await formJsPage.clickGeneralPropertiesPanel();
            await formJsPage.fillKeyInput('Upload_Files');
            await formJsPage.enableUploadMultipleFiles();
            await (0, sleep_1.sleep)(10000);
            await formJsPage.deployForm(clusterName);
        });
        await _8_8_1.test.step('Create a Form with a Document Preview Field', async () => {
            await modelerHomePage.clickProjectBreadcrumb();
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickFormOption();
            await modelerHomePage.enterFormName(formNameDocumentPreview);
            await (0, sleep_1.sleep)(10000);
            await formJsPage.dragAndDrop(formJsPage.documentPreview, formJsPage.formEditor);
            await formJsPage.clickGeneralPropertiesPanel();
            await formJsPage.filldocumentReferenceInput('Upload_Files');
            await (0, sleep_1.sleep)(10000);
            await formJsPage.deployForm(clusterName);
        });
        await _8_8_1.test.step('Add A BPMN Template To The Project', async () => {
            await modelerHomePage.clickProjectBreadcrumb();
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickBpmnTemplateOption();
        });
        await _8_8_1.test.step('Create a BPMN Diagram with Two User Tasks and Linked Forms', async () => {
            await (0, test_1.expect)(modelerCreatePage.generalPanel).toBeVisible({
                timeout: 120000,
            });
            await modelerCreatePage.enterDiagramName(processName);
            await (0, sleep_1.sleep)(20000);
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickAppendTaskButton();
            await modelerCreatePage.clickChangeTypeButton();
            await modelerCreatePage.clickUserTaskOption();
            await modelerCreatePage.assertImplementationOption('zeebeUserTask');
            await modelerCreatePage.embedForm(formNameFilePicker);
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickAppendTaskButton();
            await modelerCreatePage.clickChangeTypeButton();
            await modelerCreatePage.clickUserTaskOption();
            await modelerCreatePage.assertImplementationOption('zeebeUserTask');
            await modelerCreatePage.embedForm(formNameDocumentPreview);
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickAppendEndEventButton();
            await (0, sleep_1.sleep)(20000);
            await modelerCreatePage.runProcessInstance(clusterName);
        });
        await _8_8_1.test.step('Navigate to Tasklist and Assert Document Upload And Preview', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickTasklist(clusterName);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, taskPanelPage.taskListPageBanner, 'Tasklist banner');
            await taskPanelPage.openTask(processName);
            await taskDetailsPage.clickAssignToMeButton();
            await (0, fileUpload_1.uploadFile)(page, [
                'simple_text.txt',
                'simple_pdf.pdf',
                'camunda.png',
            ]);
            await taskDetailsPage.clickCompleteTaskButton();
            await (0, sleep_1.sleep)(10000);
            await page.reload();
            await taskPanelPage.openTask(processName);
            await taskDetailsPage.clickAssignToMeButton();
            await taskDetailsPage.assertLoadedImage('camunda.png');
            await taskDetailsPage.assertDocumentDownloadButton('camunda.png');
            await (0, test_1.expect)(taskDetailsPage.noPreviewContainer).toContainText('simple_text.txt');
            await taskDetailsPage.assertDocumentDownloadButton('simple_text.txt');
            await (0, test_1.expect)(taskDetailsPage.previewContainer).toHaveCount(2, {
                timeout: 60000,
            });
            await taskDetailsPage.assertPdfPreviewViewerExists();
            await taskDetailsPage.clickCompleteTaskButton();
        });
        await _8_8_1.test.step('Navigate to Operate and Assert Documents And StoreId', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickOperate(clusterName);
            await operateHomePage.clickProcessesTab();
            await operateProcessesPage.clickProcessCompletedCheckbox();
            await operateProcessesPage.clickProcessInstanceLink(processName);
            await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(40000);
            await page.reload();
            await operateProcessInstancePage.assertProcessVariableContainsText('Upload_Files', 'camunda.png');
            await operateProcessInstancePage.assertProcessVariableContainsText('Upload_Files', 'simple_pdf.pdf');
            await operateProcessInstancePage.assertProcessVariableContainsText('Upload_Files', 'simple_text.txt');
            await operateProcessInstancePage.assertProcessVariableContainsText('Upload_Files', 'gcp');
        });
    });
    (0, _8_8_1.test)('Public Start Form @tasklistV2', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, formJsPage, browser, taskDetailsPage, }) => {
        _8_8_1.test.slow();
        const randomString = await (0, _setup_1.generateRandomStringAsync)(3);
        const processName = 'User_Task_Process_With_Public_Form' + randomString;
        const formName = 'Public form' + randomString;
        await _8_8_1.test.step('Navigate to Web Modeler', async () => {
            await (0, test_1.expect)(homePage.camundaComponentsButton).toBeVisible({
                timeout: 120000,
            });
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 180000,
            });
        });
        await _8_8_1.test.step('Open Cross Component Test Project', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
        });
        await _8_8_1.test.step('Create a Form with a Text Field', async () => {
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickFormOption();
            await modelerHomePage.enterFormName(formName);
            await (0, sleep_1.sleep)(10000);
            await formJsPage.dragAndDrop(formJsPage.textField, formJsPage.formEditor);
            await (0, sleep_1.sleep)(10000);
        });
        await _8_8_1.test.step('Add A BPMN Template To The Project', async () => {
            await modelerHomePage.clickProjectBreadcrumb();
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickBpmnTemplateOption();
        });
        await _8_8_1.test.step('Create BPMN Diagram with a Public Start Form and Deploy the Process', async () => {
            await modelerCreatePage.modelCamundaUserTaskDiagram(processName, processName);
            await modelerCreatePage.linkFormToStartEvent(formName);
            await modelerCreatePage.enablePublicAccessIfDisabled();
            await modelerCreatePage.deployDiagram(clusterName);
            await (0, sleep_1.sleep)(5000);
        });
        let publicFormLink;
        await _8_8_1.test.step('Enable Public Access and Get Publication Link', async () => {
            publicFormLink = await modelerCreatePage.getPublicationLink();
            await (0, sleep_1.sleep)(1000);
        });
        await _8_8_1.test.step('Clear Cookies and Reset Session', async () => {
            await (0, resetSession_1.resetSession)(browser, page);
        });
        await _8_8_1.test.step('Access Public Form After Session Reset', async () => {
            console.log('Navigating to public form:', publicFormLink);
            await page.goto(publicFormLink);
            await test_1.expect
                .poll(() => taskDetailsPage.publicFormsNotSupportedHeading.innerText(), { timeout: 60000, intervals: [1000, 2000] })
                .toContain('Public forms not supported');
        });
    });
});
