"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const test_1 = require("@playwright/test");
const _8_8_1 = require("../../fixtures/8.8");
const TaskPanelPage_1 = require("../../pages/8.8/TaskPanelPage");
const TaskDetailsPage_1 = require("../../pages/8.8/TaskDetailsPage");
const AppsPage_1 = require("../../pages/8.8/AppsPage");
const OperateProcessInstancePage_1 = require("../../pages/8.8/OperateProcessInstancePage");
const _setup_1 = require("../../test-setup.js");
const UtilitiesPage_1 = require("../../pages/8.8/UtilitiesPage");
const deleteOrg_1 = require("../../utils/deleteOrg");
const sleep_1 = require("../../utils/sleep");
const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
const expectLocatorWithRetry_1 = require("../../utils/assertionHelpers/expectLocatorWithRetry");
const users_1 = require("../../utils/users");
const testUser = (0, users_1.getTestUser)('eleventhUser');
_8_8_1.test.describe.configure({ mode: 'parallel' });
_8_8_1.test.describe('Web Modeler User Flow Tests', () => {
    const clusterName = 'Test Cluster';
    const inboxes = {
        'Invite New C8 User To Web Modeler Flow @tasklistV2': '',
        'Invite Existing C8 member to Web Modeler flow @tasklistV2': '',
    };
    _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);
        if (testInfo.title.includes('Invite New C8 User') ||
            testInfo.title.includes('Invite Existing C8 member')) {
            await (0, mailSlurpClient_1.deleteInbox)(inboxes[testInfo.title]);
        }
    });
    (0, _8_8_1.test)('Form.js Integration with User Task and AI Generated Form', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, formJsPage, }) => {
        _8_8_1.test.slow();
        const randomString = await (0, _setup_1.generateRandomStringAsync)(3);
        const processName = 'User_Task_Process_With_AI_Form' + randomString;
        const formName = 'New 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 an AI Generated Form', async () => {
            await modelerHomePage.createForm(formName);
            await formJsPage.generateAIForm();
            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 BPMN Diagram with a User Task with an embedded AI Generated Form and Start Process Instance', async () => {
            await modelerCreatePage.modelCamundaUserTaskDiagram(processName, processName, formName);
            await modelerCreatePage.runProcessInstance(clusterName);
        });
        await _8_8_1.test.step('View Process Instance in Operate and complete User Task in Tasklist', async () => {
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 180000,
            });
            await modelerCreatePage.clickViewProcessInstanceLink();
            const operateTab = await page.waitForEvent('popup', { timeout: 60000 });
            const operateTabAppsPage = new AppsPage_1.AppsPage(operateTab);
            const operateTabOperateProcessInstancePage = new OperateProcessInstancePage_1.OperateProcessInstancePage(operateTab);
            const operateTabTaskPanelPage = new TaskPanelPage_1.TaskPanelPage(operateTab);
            const operateTabTaskDetailsPage = new TaskDetailsPage_1.TaskDetailsPage(operateTab);
            await (0, test_1.expect)(operateTabOperateProcessInstancePage.activeIcon).toBeVisible({ timeout: 180000 });
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickTasklist(clusterName);
            await operateTabTaskPanelPage.openTask(processName);
            await operateTabTaskDetailsPage.clickAssignToMeButton();
            await (0, test_1.expect)(operateTabTaskDetailsPage.assignedToMeText).toBeVisible({
                timeout: 60000,
            });
            await operateTabTaskDetailsPage.fillName('test user');
            await operateTabTaskDetailsPage.checkCheckbox();
            await operateTabTaskDetailsPage.fillDate('11/11/1999');
            await operateTabTaskDetailsPage.fillNumber('10');
            await operateTabTaskDetailsPage.clickCompleteTaskButton();
        });
    });
    (0, _8_8_1.test)('Form.js Integration with AI generated Start form', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, formJsPage, }) => {
        _8_8_1.test.slow();
        const randomString = await (0, _setup_1.generateRandomStringAsync)(3);
        const processName = 'AI-generated-Start-form' + randomString;
        const formName = 'New 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: 120000,
            });
        });
        await _8_8_1.test.step('Open Cross Component Test Project', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
        });
        await _8_8_1.test.step('Create an AI Generated Form', async () => {
            await modelerHomePage.createForm(formName);
            await formJsPage.generateAIForm();
            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 BPMN Diagram with a AI generated Start Form and Start Process Instance', async () => {
            await (0, test_1.expect)(modelerCreatePage.generalPanel).toBeVisible({
                timeout: 90000,
            });
            await modelerCreatePage.enterDiagramName(processName);
            await (0, sleep_1.sleep)(10000);
            await modelerCreatePage.clickEmbedFormButton();
            await modelerCreatePage.clickForm(formName);
            await modelerCreatePage.clickEmbedButton();
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickAppendEndEventButton();
            await (0, sleep_1.sleep)(20000);
            await modelerCreatePage.runProcessInstance(clusterName, '', {
                formName: 'test user',
                checkbox: 'true',
                startDate: '11/11/1999',
                startNumber: '10',
            });
        });
        await _8_8_1.test.step('View Process Instance in Operate and check if process is complete', async () => {
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 180000,
            });
            await modelerCreatePage.clickViewProcessInstanceLink();
            const operateTab = await page.waitForEvent('popup', { timeout: 60000 });
            const operateTabOperateProcessInstancePage = new OperateProcessInstancePage_1.OperateProcessInstancePage(operateTab);
            await operateTab.reload();
            await (0, test_1.expect)(operateTabOperateProcessInstancePage.completedIcon).toBeVisible({
                timeout: 1800000,
            });
        });
    });
    //Skipped due to bug 4677: https://github.com/camunda/web-modeler/issues/4677
    _8_8_1.test.skip('Invite New C8 User To Web Modeler Flow @tasklistV2', async ({ page, homePage, appsPage, modelerHomePage, signUpPage, modelerUserInvitePage, loginPage, }) => {
        _8_8_1.test.slow();
        const inbox = await (0, mailSlurpClient_1.createInbox)();
        const id = inbox.id;
        const emailAddress = inbox.emailAddress;
        inboxes['Invite New C8 User To Web Modeler Flow @tasklistV2'] = id;
        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('Navigate to Cross Component Test Project', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
        });
        await _8_8_1.test.step('Add collaborator to Cross Component Test Project', async () => {
            await modelerUserInvitePage.clickAddUser();
            await modelerUserInvitePage.fillNewUserWithRetry(emailAddress);
            await modelerUserInvitePage.clickSendInviteButton();
            await (0, sleep_1.sleep)(30000);
            await modelerUserInvitePage.checkPendingInviteText(emailAddress);
            await modelerUserInvitePage.clickSettings();
            await modelerUserInvitePage.clickLogout();
            await (0, sleep_1.sleep)(60000);
            await (0, UtilitiesPage_1.clickInvitationLinkInEmail)(page, id, mailSlurpClient_1.mailSlurp);
        });
        await _8_8_1.test.step('Signup new collaborator to Cross Component Test Project', async () => {
            await signUpPage.clickFirstNameInput();
            await signUpPage.fillFirstNameInput('QA');
            await signUpPage.clickLastNameInput();
            await signUpPage.fillLastNameInput('Camunda');
            await signUpPage.clickPasswordInputInvitedUser();
            await signUpPage.fillPasswordInputInvitedUser(process.env.C8_PASSWORD);
            await signUpPage.clickSignupButton();
            await (0, sleep_1.sleep)(60000); //a workaround for https://github.com/camunda/web-modeler/issues/4677
            await loginPage.login({
                username: emailAddress,
                password: process.env.C8_PASSWORD,
            });
            await (0, test_1.expect)(page.getByText('Personalize your experience')).toBeVisible({
                timeout: 180000,
            });
            await modelerUserInvitePage.clickSkipCustomization();
            await modelerUserInvitePage.clickCloseHelpCenter();
            await modelerHomePage.clickMessageBanner();
        });
        await _8_8_1.test.step('Navigate to Cross Component Test project as Collaborator', async () => {
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(modelerHomePage, modelerHomePage.crossComponentProjectFolder, 'Cross Component Test Project');
            await modelerUserInvitePage.clickSettings();
            await modelerUserInvitePage.clickLogout();
        });
        await _8_8_1.test.step('Login as Project Admin', async () => {
            await (0, test_1.expect)(loginPage.loginMessage).toBeVisible({
                timeout: 60000,
            });
            await page.goto('/');
            await loginPage.login();
        });
        await _8_8_1.test.step('Navigate to Web Modeler as Project Admin', 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('Assert Collaborator presence as Project Admin', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
            await (0, UtilitiesPage_1.assertPageTextWithRetry)(page, emailAddress, false, 60000);
        });
    });
    //Skipped due to bug 4677: https://github.com/camunda/web-modeler/issues/4677
    _8_8_1.test.skip('Invite Existing C8 member to Web Modeler flow @tasklistV2', async ({ page, loginPage, signUpPage, homePage, modelerUserInvitePage, appsPage, modelerHomePage, settingsPage, }) => {
        _8_8_1.test.slow();
        const { id, emailAddress } = await (0, mailSlurpClient_1.createInbox)();
        inboxes['Invite Existing C8 member to Web Modeler flow @tasklistV2'] = id;
        let newOrganizationUuid = '';
        await _8_8_1.test.step('Sign up new user to C8', async () => {
            await signUpPage.signupToC8(emailAddress);
        });
        await _8_8_1.test.step('Log in to C8 as New User', async () => {
            await (0, UtilitiesPage_1.clickInvitationLinkInEmail)(page, id, mailSlurpClient_1.mailSlurp);
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 180000,
            });
            await modelerHomePage.clickMessageBanner();
            await settingsPage.clickOpenSettingsButton();
            await settingsPage.clickLogoutButton();
            await loginPage.loginWithoutOrgAssertion({
                username: emailAddress,
                password: process.env.C8_PASSWORD,
            });
            await (0, test_1.expect)(homePage.gettingStartedHeading).toBeVisible({
                timeout: 40000,
            });
            await homePage.clickSkipCustomization();
        });
        await _8_8_1.test.step('Navigate to Console', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickConsoleLink();
            await (0, test_1.expect)(homePage.consoleBanner).toBeVisible({
                timeout: 120000,
            });
            newOrganizationUuid = homePage.organizationUuid();
        });
        await _8_8_1.test.step('Login as Project Admin', async () => {
            await settingsPage.clickOpenSettingsButton();
            await settingsPage.clickLogoutButton();
            await loginPage.login();
        });
        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 and Add Collaborator', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
            await modelerUserInvitePage.clickAddUser();
            await modelerUserInvitePage.clickUserEmailInput();
            await modelerUserInvitePage.fillUserEmailInput(emailAddress);
            await modelerUserInvitePage.clickSendInviteButton();
            await modelerUserInvitePage.checkPendingInviteText(emailAddress);
        });
        await _8_8_1.test.step('Log out from Project Admin', async () => {
            await settingsPage.clickOpenSettingsButton();
            await settingsPage.clickLogoutButton();
            await (0, sleep_1.sleep)(60000);
        });
        await _8_8_1.test.step('Log in with Second User and Navigate to Cross Component Test project as Collaborator', async () => {
            await (0, UtilitiesPage_1.clickInvitationLinkInEmail)(page, id, mailSlurpClient_1.mailSlurp);
            await (0, sleep_1.sleep)(60000);
            await loginPage.login({
                username: emailAddress,
                password: process.env.C8_PASSWORD,
            });
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(modelerHomePage, modelerHomePage.crossComponentProjectFolder, 'Cross Component Test Project', 60000, false, 5);
        });
        await _8_8_1.test.step('Log out from Second User', async () => {
            await settingsPage.clickOpenSettingsButton();
            await settingsPage.clickLogoutButton();
        });
        await _8_8_1.test.step('Navigate to Web Modeler as Project Admin', async () => {
            await loginPage.login();
            await appsPage.clickCamundaApps();
            await appsPage.clickModeler();
            await (0, test_1.expect)(modelerHomePage.modelerPageBanner).toBeVisible({
                timeout: 120000,
            });
            // Assert Collaborator presence
            await modelerHomePage.clickCrossComponentProjectFolder();
            await (0, UtilitiesPage_1.assertPageTextWithRetry)(page, emailAddress, false, 60000);
        });
        await _8_8_1.test.step('Delete Organization', async () => {
            await (0, deleteOrg_1.deleteOrganization)(page, newOrganizationUuid);
        });
    });
    (0, _8_8_1.test)('Form.js Integration with User Task and Embedded Form @tasklistV1', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, }) => {
        _8_8_1.test.slow();
        const processName = 'User_Task_Process_With_embedded_form' +
            (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('Navigate to Cross Component Test Project', async () => {
            await modelerHomePage.clickCrossComponentProjectFolder();
        });
        await _8_8_1.test.step('Add A BPMN Template To The Project', async () => {
            await modelerHomePage.clickDiagramTypeDropdown();
            await modelerHomePage.clickBpmnTemplateOption();
        });
        await _8_8_1.test.step('Create BPMN Diagram with a embedded form and Start Process Instance', async () => {
            await modelerCreatePage.modelJobWorkerDiagram(processName, true);
            await modelerCreatePage.runProcessInstance(clusterName);
            await (0, test_1.expect)(modelerCreatePage.viewProcessInstanceLink).toBeVisible({
                timeout: 180000,
            });
            await modelerCreatePage.clickViewProcessInstanceLink();
            const operateTab = await page.waitForEvent('popup', { timeout: 60000 });
            const operateTabAppsPage = new AppsPage_1.AppsPage(operateTab);
            const operateTabOperateProcessInstancePage = new OperateProcessInstancePage_1.OperateProcessInstancePage(operateTab);
            const operateTabTaskPanelPage = new TaskPanelPage_1.TaskPanelPage(operateTab);
            const operateTabTaskDetailsPage = new TaskDetailsPage_1.TaskDetailsPage(operateTab);
            await (0, test_1.expect)(operateTabOperateProcessInstancePage.activeIcon).toBeVisible({ timeout: 180000 });
            await operateTabAppsPage.clickCamundaApps();
            await operateTabAppsPage.clickTasklist(clusterName);
            await operateTabTaskPanelPage.openTask(processName);
            await operateTabTaskDetailsPage.clickAssignToMeButton();
            await (0, test_1.expect)(operateTabTaskDetailsPage.assignedToMeText).toBeVisible({
                timeout: 60000,
            });
            await operateTabTaskDetailsPage.fillName('test user');
            await operateTabTaskDetailsPage.clickCompleteTaskButton();
        });
    });
    (0, _8_8_1.test)('Timer Event User Flow @tasklistV2', async ({ homePage, modelerHomePage, appsPage, modelerCreatePage, operateHomePage, operateProcessInstancePage, operateProcessesPage, }) => {
        const processName = 'Timer_Event_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 Timer Event and Deploy Diagram', async () => {
            await (0, test_1.expect)(modelerCreatePage.generalPanel).toBeVisible({
                timeout: 120000,
            });
            await modelerCreatePage.enterDiagramName(processName);
            await (0, sleep_1.sleep)(10000);
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickIntermediateBoundaryEvent();
            await modelerCreatePage.clickChangeTypeButton();
            await modelerCreatePage.clickTimerEventOption();
            await modelerCreatePage.clickTimerEventSettings();
            await modelerCreatePage.selectTimerType('timeDuration');
            await modelerCreatePage.clickTimerValue();
            await modelerCreatePage.fillTimerValue('PT90S');
            await modelerCreatePage.clickAppendElementButton();
            await modelerCreatePage.clickAppendEndEventButton();
            await (0, sleep_1.sleep)(10000);
            await modelerCreatePage.runProcessInstance(clusterName);
        });
        await _8_8_1.test.step('Assert Diagram Has Successfully Completed in Operate', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickOperate(clusterName);
            await (0, test_1.expect)(operateHomePage.processesTab).toBeVisible({ timeout: 120000 });
            await operateHomePage.clickProcessesTab();
            await operateProcessesPage.clickProcessCompletedCheckbox();
            await operateProcessesPage.clickProcessInstanceLink(processName);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(operateProcessInstancePage, operateProcessInstancePage.activeIcon, 'Active icon', 20000, false, 4);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(operateProcessInstancePage, operateProcessInstancePage.completedIcon, 'Completed icon', 60000, false, 5);
        });
    });
    //Skipped due to bug 22577: https://github.com/camunda/camunda-hub/issues/22577
    _8_8_1.test.skip('Public Start Form @tasklistV1', async ({ page, homePage, modelerHomePage, appsPage, modelerCreatePage, formJsPage, taskDetailsPage, loginPage, taskPanelPage, operateHomePage, operateProcessesPage, operateProcessInstancePage, }) => {
        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 formJsPage.dragAndDrop(formJsPage.textField, formJsPage.formEditor);
            await (0, test_1.expect)(formJsPage.textFieldInForm).toBeVisible();
            await formJsPage.clickGeneralPropertiesPanel();
            await formJsPage.fillKeyInput('Public_Form_Text_Field');
            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 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 page.context().clearCookies();
            await page.evaluate(() => {
                localStorage.clear();
                sessionStorage.clear();
            });
            await page.goto('/');
        });
        await _8_8_1.test.step('Access Public Form After Session Reset and Submit the Form', async () => {
            console.log('Navigating to public form:', publicFormLink);
            await page.goto(publicFormLink);
            await (0, expectLocatorWithRetry_1.expectLocatorWithRetry)(page, taskDetailsPage.textInput, {
                postAction: async () => {
                    await page.goto(publicFormLink);
                },
            });
            await taskDetailsPage.fillTextInput('Public Form Test Value');
            await taskDetailsPage.clickSubmitButton();
            await (0, test_1.expect)(page.getByRole('heading', { name: 'Success!' })).toBeVisible({
                timeout: 30000,
            });
        });
        await _8_8_1.test.step('Login to Tasklist and Check User Task Has the Correct Input Values and Can Be Completed', async () => {
            await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, 5000);
            await appsPage.clickCamundaApps();
            await appsPage.clickTasklist(clusterName);
            await (0, UtilitiesPage_1.assertLocatorVisibleWithRetry)(page, taskPanelPage.taskListPageBanner, 'Tasklist banner');
            await taskPanelPage.openTask(processName);
            await (0, test_1.expect)(page
                .getByRole('row')
                .filter({ hasText: 'Public_Form_Text_Field' })
                .getByText('"Public Form Test Value"')).toBeVisible({ timeout: 30000 });
            await taskDetailsPage.clickAssignToMeButton();
            await taskDetailsPage.clickCompleteTaskButton();
        });
        await _8_8_1.test.step('Assert Process Instance is Completed in Operate', async () => {
            await appsPage.clickCamundaApps();
            await appsPage.clickOperate(clusterName);
            await operateHomePage.clickProcessesTab();
            await operateProcessesPage.clickProcessCompletedCheckbox();
            await operateProcessesPage.clickProcessInstanceLink(processName);
            await operateProcessInstancePage.assertProcessCompleteStatusWithRetry(40000);
        });
    });
});
