diff --git a/.github/workflows/backend_tests.yml b/.github/workflows/backend_tests.yml index 6bce0e649..6f4a1dc1a 100644 --- a/.github/workflows/backend_tests.yml +++ b/.github/workflows/backend_tests.yml @@ -84,7 +84,7 @@ jobs: uses: actions/checkout@v3.3.0 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4.6.0 + uses: actions/setup-python@v4.6.1 with: python-version: ${{ matrix.python }} @@ -195,7 +195,7 @@ jobs: - name: Check out the repository uses: actions/checkout@v3.3.0 - name: Set up Python - uses: actions/setup-python@v4.6.0 + uses: actions/setup-python@v4.6.1 with: python-version: "3.11" - name: Install Poetry @@ -236,7 +236,7 @@ jobs: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v4.6.0 + uses: actions/setup-python@v4.6.1 with: python-version: "3.11" @@ -257,7 +257,7 @@ jobs: nox --version - name: Download coverage data - uses: actions/download-artifact@v3.0.1 + uses: actions/download-artifact@v3.0.2 with: name: coverage-data # this action doesn't seem to respect working-directory so include working-directory value in path @@ -273,7 +273,7 @@ jobs: nox --force-color --session=coverage -- xml - name: Upload coverage report - uses: codecov/codecov-action@v3.1.3 + uses: codecov/codecov-action@v3.1.4 - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@v1.9 diff --git a/bin/run_pyl b/bin/run_pyl index 9e1ce7c9a..d3a45ec8a 100755 --- a/bin/run_pyl +++ b/bin/run_pyl @@ -30,29 +30,17 @@ function get_python_dirs() { (git ls-tree -r HEAD --name-only | grep -E '\.py$' | awk -F '/' '{print $1}' | sort | uniq | grep -v '\.' | grep -Ev '^(bin|migrations)$') || echo '' } -function run_autoflake() { - # checking command -v autoflake8 is not good enough, since the asdf shim may be installed, which will make command -v succeed, - # but autoflake8 may not have been pip installed inside the correct version of python. - if ! autoflake8 --help >/dev/null ; then - pip install autoflake8 - asdf reshim python - fi - - if ! autoflake --help >/dev/null ; then - pip install autoflake - asdf reshim python - fi - - if ! autopep8 --help >/dev/null ; then - pip install autopep8 +function run_autofixers() { + # checking command -v ruff is not good enough, since the asdf shim may be installed, which will make command -v succeed, + # but ruff may not have been pip installed inside the correct version of python. + if ! ruff --help >/dev/null 2>&1; then + pip install ruff asdf reshim python fi python_dirs=$(get_python_dirs) python_files=$(find $python_dirs -type f -name "*.py" ! -name '.null-ls*' ! -name '_null-ls*') - autoflake8 --in-place --remove-unused-variables --remove-duplicate-keys --expand-star-imports --exit-zero-even-if-changed $python_files - autoflake --in-place --remove-all-unused-imports $python_files - autopep8 --in-place $python_files + ruff --fix $python_files } function run_pre_commmit() { @@ -71,7 +59,7 @@ done for python_project in "${python_projects[@]}" ; do if [[ "$subcommand" != "pre" ]] || [[ -n "$(git status --porcelain "$python_project")" ]]; then pushd "$python_project" - run_autoflake || run_autoflake + run_autofixers || run_autofixers popd fi done diff --git a/docs/quick_start/quick_start.md b/docs/quick_start/quick_start.md index a2b87c46c..38fb76675 100644 --- a/docs/quick_start/quick_start.md +++ b/docs/quick_start/quick_start.md @@ -186,8 +186,7 @@ Once you have successfully signed in, navigate to the process section. This sect ![Untitled](images/Untitled_16.png) -> **Step 2: Find and click on the process** -> +### Step 2: Find and click on the process You can either search for a process model using the search bar or navigate through displayed processes to find the process model. @@ -259,38 +258,4 @@ A prompt will appear, allowing you to provide a name for the identifier associat If you want to filter by ID, go to the "Find by Id" section of the page. Enter the ID and click "Submit". The system will show you the process instance with the corresponding ID. -You can now view the process instances that you filtered for and take appropriate action based on their status. This can help you manage your workflows more efficiently and keep track of the progress of various process instances. - ---- - -## 🗳️ How to request additional permissions - -As a user, you may be required to access certain process groups or start process models in order to perform desired actions. However, you may not have the necessary access or permissions to do so. In this case, you will need to request access or additional permissions from the admins - PPG team. - -By following these steps, you can submit a request and seek the necessary permissions to perform the desired actions. - -### Step 1: Navigate & Search - -Once you are signed in, navigate to the "**Process**" section. Use the search bar or browse through the available process models until you find "**Request Access**”. Click on the process model to open it. - -![Untitled](images/Untitled_29.png) - -If you want to access the request access process from **Home** section and click on the "**Start New +**" button. This will open the "Processes I can start" section where you can find the “Request Access” process. - -![Untitled](images/Untitled_30.png) - -### Step 2: Start the Process - -Once the "**Process Request**" model is open, initiate the process by clicking on the "Start" button. - -![Untitled](images/Untitled_31.png) - -### Step 3: Provide Request Details & Submit - -A task will be presented to capture the necessary information and details for special permissions request. Find the “**Description”** text field and enter the relevant information and details about your request. - -Ensure that all required details have been included such as Process name, Process group name, and type of permissions you need. Click on the "**Submit**" button or similar action to submit your access or special permissions request. - -![Untitled](images/Untitled_32.png) - -By following these steps, you can request the special permissions needed to carry out your tasks effectively. +You can now view the process instances that you filtered for and take appropriate action based on their status. This can help you manage your workflows more efficiently and keep track of the progress of various process instances. \ No newline at end of file diff --git a/spiffworkflow-backend/pyproject.toml b/spiffworkflow-backend/pyproject.toml index aa48b06d1..f116d4a35 100644 --- a/spiffworkflow-backend/pyproject.toml +++ b/spiffworkflow-backend/pyproject.toml @@ -171,7 +171,7 @@ select = [ "E", # pycodestyle error # "ERA", # eradicate "F", # pyflakes - # "N", # pep8-naming + "N", # pep8-naming # "PL", # pylint # "S", # flake8-bandit "UP", # pyupgrade diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py index cc2a9c1f3..f6ea12c3e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/__init__.py @@ -2,6 +2,7 @@ import os import threading import uuid +from urllib.parse import urlparse from flask.app import Flask from werkzeug.utils import ImportStringError @@ -78,6 +79,43 @@ def _set_up_tenant_specific_fields_as_list_of_strings(app: Flask) -> None: ) +# see the message in the ConfigurationError below for why we are checking this. +# we really do not want this to raise when there is not a problem, so there are lots of return statements littered throughout. +def _check_for_incompatible_frontend_and_backend_urls(app: Flask) -> None: + if not app.config.get("SPIFFWORKFLOW_BACKEND_CHECK_FRONTEND_AND_BACKEND_URL_COMPATIBILITY"): + return + + frontend_url = app.config.get("SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND") + backend_url = app.config.get("SPIFFWORKFLOW_BACKEND_URL") + + if frontend_url is None or backend_url is None: + return + if frontend_url == "" or backend_url == "": + return + if not frontend_url.startswith("https://") or not backend_url.startswith("https://"): + return + + frontend_url_parsed = urlparse(frontend_url) + frontend_domain = frontend_url_parsed.netloc + backend_url_parsed = urlparse(backend_url) + backend_domain = backend_url_parsed.netloc + + if frontend_domain == backend_domain: + # probably backend and frontend are using different paths. + # routing by path will work just fine and won't cause any problems with setting cookies + return + + if backend_domain.endswith(frontend_domain): + return + + raise ConfigurationError( + "SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND and SPIFFWORKFLOW_BACKEND_URL are incompatible. We need backend to set" + " cookies for frontend, so they need to be on the same domain. A common setup is to have frontend on" + " example.com and backend on api.example.com. If you do not need this functionality, you can avoid this check" + " by setting environment variable SPIFFWORKFLOW_BACKEND_CHECK_FRONTEND_AND_BACKEND_URL_COMPATIBILITY=false" + ) + + def setup_config(app: Flask) -> None: """Setup_config.""" # ensure the instance folder exists @@ -144,3 +182,4 @@ def setup_config(app: Flask) -> None: thread_local_data = threading.local() app.config["THREAD_LOCAL_DATA"] = thread_local_data _set_up_tenant_specific_fields_as_list_of_strings(app) + _check_for_incompatible_frontend_and_backend_urls(app) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py index 63f1ec7b3..59bb742d3 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/default.py @@ -47,6 +47,9 @@ SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND = environ.get( "SPIFFWORKFLOW_BACKEND_URL_FOR_FRONTEND", default="http://localhost:7001" ) SPIFFWORKFLOW_BACKEND_URL = environ.get("SPIFFWORKFLOW_BACKEND_URL", default="http://localhost:7000") +SPIFFWORKFLOW_BACKEND_CHECK_FRONTEND_AND_BACKEND_URL_COMPATIBILITY = ( + environ.get("SPIFFWORKFLOW_BACKEND_CHECK_FRONTEND_AND_BACKEND_URL_COMPATIBILITY", default="true") == "true" +) # service task connector proxy SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL = environ.get( "SPIFFWORKFLOW_BACKEND_CONNECTOR_PROXY_URL", default="http://localhost:7004" diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py index e7707724d..3c8845c3a 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/logging_service.py @@ -46,12 +46,14 @@ class JsonFormatter(logging.Formatter): self.default_msec_format = msec_format self.datefmt = None - def usesTime(self) -> bool: + def usesTime(self) -> bool: # noqa: N802, this is overriding a method from python's stdlib """Overwritten to look for the attribute in the format dict values instead of the fmt string.""" return "asctime" in self.fmt_dict.values() # we are overriding a method that returns a string and returning a dict, hence the Any - def formatMessage(self, record: logging.LogRecord) -> Any: + def formatMessage( # noqa: N802, this is overriding a method from python's stdlib + self, record: logging.LogRecord + ) -> Any: """Overwritten to return a dictionary of the relevant LogRecord attributes instead of a string. KeyError is raised if an unknown attribute is provided in the fmt_dict. diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py index 4f46f8c15..0bc8bbd6d 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/process_model_test_runner_service.py @@ -26,11 +26,11 @@ class NoTestCasesFoundError(Exception): pass -class MissingInputTaskData(Exception): +class MissingInputTaskDataError(Exception): pass -class UnsupporterRunnerDelegateGiven(Exception): +class UnsupporterRunnerDelegateGivenError(Exception): pass @@ -236,7 +236,7 @@ class ProcessModelTestRunner: self.test_case_identifier = test_case_identifier if not issubclass(process_model_test_runner_delegate_class, ProcessModelTestRunnerDelegate): - raise UnsupporterRunnerDelegateGiven( + raise UnsupporterRunnerDelegateGivenError( "Process model test runner delegate must inherit from ProcessModelTestRunnerDelegate. Given" f" class '{process_model_test_runner_delegate_class}' does not" ) @@ -342,7 +342,7 @@ class ProcessModelTestRunner: task_data_length = len(test_case_task_properties["data"]) test_case_index = self.task_data_index[test_case_task_key] if task_data_length <= test_case_index: - raise MissingInputTaskData( + raise MissingInputTaskDataError( f"Missing input task data for task: {test_case_task_key}. " f"Only {task_data_length} given in the json but task was called {test_case_index + 1} times" ) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py index f934c8a17..068a772a8 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/unit/test_process_model_test_runner.py @@ -5,7 +5,7 @@ from flask import Flask from flask import current_app from spiffworkflow_backend.services.process_model_test_runner_service import NoTestCasesFoundError from spiffworkflow_backend.services.process_model_test_runner_service import ProcessModelTestRunner -from spiffworkflow_backend.services.process_model_test_runner_service import UnsupporterRunnerDelegateGiven +from spiffworkflow_backend.services.process_model_test_runner_service import UnsupporterRunnerDelegateGivenError from tests.spiffworkflow_backend.helpers.base_test import BaseTest @@ -34,7 +34,7 @@ class TestProcessModelTestRunner(BaseTest): app: Flask, with_db_and_bpmn_file_cleanup: None, ) -> None: - with pytest.raises(UnsupporterRunnerDelegateGiven): + with pytest.raises(UnsupporterRunnerDelegateGivenError): ProcessModelTestRunner( os.path.join(self.root_path(), "DNE"), process_model_test_runner_delegate_class=NoTestCasesFoundError ) diff --git a/spiffworkflow-frontend/cypress/pilot/RequestTravel_PP2/initiate_travelrequest.cy.js b/spiffworkflow-frontend/cypress/pilot/RequestTravel_PP2/initiate_travelrequest.cy.js new file mode 100644 index 000000000..692434cd4 --- /dev/null +++ b/spiffworkflow-frontend/cypress/pilot/RequestTravel_PP2/initiate_travelrequest.cy.js @@ -0,0 +1,2341 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.wait(3000); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(2000); + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === 'approve') { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper') + .find('#root') + .type(username.concat(' is approving this.')); + } else if (approvaltype === 'reject') { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper') + .find('#root') + .type(username.concat(' is rejecting this.')); + } else if (approvaltype === 'needmoreinfo') { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + username.concat( + ' needs additional info. A software license is a document that provides legally binding guidelines for the use and distribution of software.Software licenses typically provide end users with the right to END.' + ) + ); + } else if (approvaltype === 'providemoreinfo') { + // Form 1 + cy.contains('Task: Submit Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + // Form 2 + /* cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); */ + // Form 3 + cy.contains('Task: Review the Request', { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .clear() + .type( + "Providing additional info. It’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We've got people for jobs of any size." + ); + + // cy.contains('Submit the Request').click(); + // cy.get('input[value="Submit the Request"]').click(); + } else { + } + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + } + + cy.wait(5000); + //cy.get('button').contains('Return to Home', { timeout: 60000 }); + cy.logout(); +}; + +//Check if the process instance is completed successfully +const checkProcessInstanceCompleted = ( + username, + password, + processInstanceId +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(2000); + cy.get('#tag-1 > span').contains('complete'); +} + +// Request Travel - Without Files +describe.only('Request Travel - Without Files', () => { + Cypress._.times(1, () => { + // Initiate request - Team Event - Without Files + it('Initiate request - Team Event - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Before you start planning your trip, make sure to check your company’s rules, procedures, and do’s & don’ts when it comes to corporate travel. Here you’ll find more information about corporate travel policies, which include things such as where to ..' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Great Guac Off is one of the best team building events. Participants compete in teams to perfect it.'); + + cy.get('#root_event_destination').clear('Tabaquite'); + cy.get('#root_event_destination').type('Tabaquite'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('o'); + cy.get('#root_departure_from').type('o'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('h'); + cy.get('#root_return_to').type('h'); + cy.get('#downshift-2-item-1 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Our staff can facilitate your accommodation needs from a range of Home-stay options and can also.' + ); + cy.get('#root_item_0_qty').clear().type('7'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('1.15'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('5'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CAD'); + cy.get('#root_item_1_unit_price').type('2300'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'Ensure a quality, cost effective and safe integrated transport system and services that will provi.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('AUD'); + cy.get('#root_item_2_unit_price').type('1205.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Book Your Tickets In Advance And Get A Chance To Experience Unlimited Rides On 1 Day. Experience....' + ); + cy.get('#root_item_3_qty').clear().type('18'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('SNT'); + cy.get('#root_item_3_unit_price').type('430.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A host brings all the ingredients, leads groups through mini-games, and encourages participants to taunt or cheer. This cookless cook-off is available in various venues. https://teambuilding.com/blog/team-building-events' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + }); + }); + // Initiate request - Conference - Without Files and with mandatory fields only + it('Initiate request - Conference - Without Files and with mandatory fields only', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Before you start planning your trip, make sure to check your company’s rules, procedures, and do’s & don’ts when it comes to corporate travel. Here you’ll find more information about corporate travel policies, which include things such as where to ..' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Great Guac Off is one of the best team building events. Participants compete in teams to perfect it.'); + + cy.get('#root_event_destination').clear('y'); + cy.get('#root_event_destination').type('yellow'); + cy.get('#downshift-0-item-3 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('c'); + cy.get('#root_departure_from').type('colombo'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('spring'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Our staff can facilitate your accommodation needs from a range of Home-stay options and can also.' + ); + cy.get('#root_item_0_qty').clear().type('7'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('1.15'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('5'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CAD'); + cy.get('#root_item_1_unit_price').type('2300'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'Ensure a quality, cost effective and safe integrated transport system and services that will provi.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('AUD'); + cy.get('#root_item_2_unit_price').type('1205.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Book Your Tickets In Advance And Get A Chance To Experience Unlimited Rides On 1 Day. Experience....' + ); + cy.get('#root_item_3_qty').clear().type('18'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('SNT'); + cy.get('#root_item_3_unit_price').type('430.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A host brings all the ingredients, leads groups through mini-games, and encourages participants to taunt or cheer. This cookless cook-off is available in various venues. https://teambuilding.com/blog/team-building-events' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + }); + }); + // Edit request - Meetup - Without Files + it('Edit request - Meetup - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Happy hours are a go-to team social event. These gatherings involve heading to a local watering hole, setting up a bar in the office, and socializing over drinks and snacks.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('27-02-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('26-02-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('04-03-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('The most common times for happy hours -directly after work or during the final hours of the workday.'); + + cy.get('#root_event_destination').clear('s'); + cy.get('#root_event_destination').type('sydney'); + cy.get('#downshift-0-item-2 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('o'); + cy.get('#root_departure_from').type('oslo'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ch'); + cy.get('#root_return_to').type('chica'); + cy.get('#downshift-2-item-1 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment ideas include answering icebreaker questions, playing pool or board games.' + ); + cy.get('#root_item_0_qty').clear().type('9'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('CHF'); + cy.get('#root_item_0_unit_price').type('140.65'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CNY'); + cy.get('#root_item_1_unit_price').type('5689'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Edit Request$/) + .click(); + + // Form 1 + cy.contains('Task: Submit Details', { timeout: 60000 }); + cy.wait(2000); + cy.get('button') + .contains(/^Submit$/) + .click(); + + // Form 2 + cy.contains('Task: Review the Request', { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').type('EDITING INFO'); + }); + }); + // Save and Close All fields Form 1 - All Hands - Without Files + it('Save and Close All fields - All Hands - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Scavenger hunts are among the most high-energy team building events. These games are customizable to fit various venues and occasions.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Most scavenger hunts involve players getting into groups and racing against each other to find clue.'); + + cy.get('#root_event_destination').clear('h'); + cy.get('#root_event_destination').type('houst'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('ma'); + cy.get('#root_departure_from').type('madrid'); + cy.get('#downshift-1-item-5 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ma'); + cy.get('#root_return_to').type('madrid'); + cy.get('#downshift-2-item-5 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Examples might include “find a statue that reminds you of your boss,” ' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('DAI'); + cy.get('#root_item_0_unit_price').type('986'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + '“show the oldest coin within your group’s wallets,” or “recreate the Crossing of the Delaware in.”' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('ETH'); + cy.get('#root_item_1_unit_price').type('0.05'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'typically, scavenger hunts have a theme and a time limit.' + ); + cy.get('#root_item_2_qty').clear().type('5'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('NZD'); + cy.get('#root_item_2_unit_price').type('976.75'); + + cy.get('button') + .contains(/^Save and Close$/) + .click(); + + cy.contains('Started by me', { timeout: 60000 }); + cy.logout(); + + }); + }); + + // Save and Close Few fields Form 1 - Meetup - Without Files + it('Save and Close Few fields - Meetup - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Escape rooms are one of the most popular team building events for small groups. In these games, participants usually enter a locked themed room and have a limited time to find clues and solve a mystery to escape and win the game.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('12-11-2024'); + cy.get('body').click(); + //cy.get('#root_core_contributor').clear().type('Core3 Contributor'); + cy.get('#root_start_date').clear().type('10-11-2024'); + cy.get('body').click(); + //cy.get('#root_end_date').clear().type('14-11-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + //cy.get('#root_event_name').clear().type('These challenges require team members to collaborate, communicate clearly, think critically.'); + + cy.get('#root_event_destination').clear('me'); + cy.get('#root_event_destination').type('melbo'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + //cy.get('#root_departure_from').clear('c'); + //cy.get('#root_departure_from').type('copen'); + //cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('l'); + cy.get('#root_return_to').type('london'); + cy.get('#downshift-2-item-2 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment venues like malls often host these attractions, and there are usually at least one.' + ); + cy.get('#root_item_0_qty').clear().type('1'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('COP'); + //cy.get('#root_item_0_unit_price').type('3489'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + + + cy.get('button') + .contains(/^Save and Close$/) + .click(); + + cy.contains('Started by me', { timeout: 60000 }); + cy.logout(); + }); + }); + + // Save and Close Form 2 - Team Event - Without Files + it('Save and Close Form 2 - Team Event - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work. These events allow employees to get out of the office and enjoy fresh air and sunshine.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('17-12-2023'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core4 Contributor'); + cy.get('#root_start_date').clear().type('06-12-2023'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('24-12-2023'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('You can take your staff on a trip to the beach.'); + + cy.get('#root_event_destination').clear('b'); + cy.get('#root_event_destination').type('bergen'); + cy.get('#downshift-0-item-9 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear(); + cy.get('#root_departure_from').type('bern'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('B'); + cy.get('#root_return_to').type('Bern'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks.' + ); + cy.get('#root_item_0_qty').clear().type('3'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('0.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('EUR'); + cy.get('#root_item_1_unit_price').type('235'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'As a bonding exercise you can ask teammates to submit photos of their favorite beach or dream beach.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('GBP'); + cy.get('#root_item_2_unit_price').type('765.35'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work' + ); + cy.get('#root_item_3_qty').clear().type('25'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('DAI'); + cy.get('#root_item_3_unit_price').type('245'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'You can take your staff on a trip to the beach or create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks. Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + + cy.get('button') + .contains(/^Save and Close$/) + .click(); + + cy.contains('Started by me', { timeout: 60000 }); + cy.logout(); + }); + }); + + // Cancel request Form 1 - Conference - Without Files + it('Cancel request Form 1 - Conference - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + //cy.get('#root_period').clear().type('30-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core5 Contributor'); + //cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('01-04-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + //cy.get('#root_event_destination').clear('mi'); + //cy.get('#root_event_destination').type('miami'); + //cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('mi'); + cy.get('#root_departure_from').type('milano'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('z'); + cy.get('#root_return_to').type('z'); + cy.get('#downshift-2-item-3 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('8'); + //cy.get('#root_item_0_currency_type').select('Crypto'); + //cy.get('#root_item_0_currency').select('SNT'); + //cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + //Item 1 is not filled + + cy.get('button') + .contains(/^Cancel Request$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + }); + }); + + // Cancel request Form 2 - Conference - Without Files + it('Cancel request Form 2 - Conference - Without Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('Zürich'); + cy.get('#root_event_destination').type('Zürich'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('t'); + cy.get('#root_departure_from').type('trondh'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('S'); + cy.get('#root_return_to').type('New york'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('JPY'); + cy.get('#root_item_0_unit_price').type('2355.25'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('HKD'); + cy.get('#root_item_1_unit_price').type('4325'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Cancel Request$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + }); + }); + + // Arrange items order + it('Arrange items order', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('05-11-2027'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('30-10-2027'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('07-11-2027'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('st'); + cy.get('#root_event_destination').type('stockh'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('s'); + cy.get('#root_departure_from').type('san die'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('san diego'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + '1.Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('1450.32'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + '2.Now you have all you need for your seamless flight. With a variety of services such as Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('AED'); + cy.get('#root_item_1_unit_price').type('1980'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + '3. Typically, scavenger hunts have a theme and a time limit.' + ); + cy.get('#root_item_2_qty').clear().type('5'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('NZD'); + cy.get('#root_item_2_unit_price').type('976.75'); + + cy.get('#root_item > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up').click(); + cy.get('#root_item > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up').click(); + + cy.wait(2000); + + cy.get('#root_item > div.row.array-item-list > div:nth-child(1) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-down').click(); + cy.get('#root_item > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-down').click(); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Delete items + it('Delete items', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Scavenger hunts are among the most high-energy team building events. These games are customizable to fit various venues and occasions.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Most scavenger hunts involve players getting into groups and racing against each other to find clue.'); + + cy.get('#root_event_destination').clear('h'); + cy.get('#root_event_destination').type('houst'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('ma'); + cy.get('#root_departure_from').type('madrid'); + cy.get('#downshift-1-item-5 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ma'); + cy.get('#root_return_to').type('madrid'); + cy.get('#downshift-2-item-5 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + '1.Examples might include “find a statue that reminds you of your boss” ' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('DAI'); + cy.get('#root_item_0_unit_price').type('986'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + '2.“show the oldest coin within your group’s wallets,” or “recreate the Crossing of the Delaware in.”' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('ETH'); + cy.get('#root_item_1_unit_price').type('0.05'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + '3. Typically, scavenger hunts have a theme and a time limit.' + ); + cy.get('#root_item_2_qty').clear().type('5'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('NZD'); + cy.get('#root_item_2_unit_price').type('976.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + '4.Beach parties are a beloved summertime activity for work.' + ); + cy.get('#root_item_3_qty').clear().type('25'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('DAI'); + cy.get('#root_item_3_unit_price').type('245'); + + //delete first and third items + cy.get('#root_item > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-danger.array-item-remove').click(); + cy.get('#root_item > div.row.array-item-list > div:nth-child(1) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-danger.array-item-remove').click(); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + '4.At the end of the game, the group that completes the most tasks or finds the most items wins the game and earns prize.' + ); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + }); +}); + +// Form validation +describe('Form validation', () => { + + //Special character check + it('Special character check', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Purpose is to test all the special characters work in the request. ~!@#$%^&*()_+`-= {}[]\a and ;\',./:"<>? end. | this text goes missing', { parseSpecialCharSequences: false } + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Special char test ,./;\'[]\b=-0987654321`~!@#$%^&*()_+{}:"<>? end.', { parseSpecialCharSequences: false }); + + cy.get('#root_event_destination').clear('Tromsø'); + cy.get('#root_event_destination').type('Tromsø'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('Ålesund'); + cy.get('#root_departure_from').type('Ålesund'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('Neuchâtel'); + cy.get('#root_return_to').type('Neuchâtel'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Special char test ,./;\'[]\=-0987654321`~!@#$%^&*()_+{}:"<>? end.', { parseSpecialCharSequences: false } + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('DAI'); + cy.get('#root_item_0_unit_price').type('986'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'Test Special chars afssfsfs,asfdf. sfsf? sfd/sfs f:sfsf " sfsdf; SDFfsd\' sfsdf{sfsfs} sfsdf[ sfsdf] fsfsfd\ sfsd sfsdf=S dfs+ sfd- sfsdf_ sfsfd (sfsd )sfsfsd * sf&sfsfs ^ sfs % sf $ ss# s@ sf! sfd` ss~ END.', { parseSpecialCharSequences: false } + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + + //Check field max lengths + it('Check field max lengths', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'It’s easy to keep connected with others during online events. Online events are virtual, accessible, entertaining, and a great way to make new friends. Meetup has online events on topics like gaming, music, technology, networking, wellness, or whatever.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('27-02-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('26-02-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('04-03-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('The most common times for happy hours -directly after work or during the final hours of the workday..'); + + cy.get('#root_event_destination').clear('s'); + cy.get('#root_event_destination').type('sydney'); + cy.get('#downshift-0-item-2 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('o'); + cy.get('#root_departure_from').type('oslo'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ch'); + cy.get('#root_return_to').type('chica'); + cy.get('#downshift-2-item-1 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment ideas include answering icebreaker questions, playing pool or board games.1234567890123' + ); + cy.get('#root_item_0_qty').clear().type('9'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('CHF'); + cy.get('#root_item_0_unit_price').type('140.654'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers...' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('DAI'); + cy.get('#root_item_1_unit_price').type('5689.1234'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'It’s easy to keep connected with others during online events. Online events are virtual, accessible, entertaining, and a great way to make new friends. Meetup has online events on topics like gaming, music, technology, networking, wellness, or whatever you’re looking for!' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); +}); + +// Request Travel - With Files +describe('Request Travel - With Files', () => { + Cypress._.times(1, () => { + // Initiate request - Team Event - With Files + it('Initiate request - Team Event - With Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Before you start planning your trip, make sure to check your company’s rules, procedures, and do’s & don’ts when it comes to corporate travel. Here you’ll find more information about corporate travel policies, which include things such as where to ..' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Great Guac Off is one of the best team building events. Participants compete in teams to perfect it.'); + + cy.get('#root_event_destination').clear('y'); + cy.get('#root_event_destination').type('yellow'); + cy.get('#downshift-0-item-3 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('c'); + cy.get('#root_departure_from').type('colombo'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('spring'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Our staff can facilitate your accommodation needs from a range of Home-stay options and can also.' + ); + cy.get('#root_item_0_qty').clear().type('7'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('1.15'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('5'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CAD'); + cy.get('#root_item_1_unit_price').type('2300'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'Ensure a quality, cost effective and safe integrated transport system and services that will provi.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('AUD'); + cy.get('#root_item_2_unit_price').type('1205.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Book Your Tickets In Advance And Get A Chance To Experience Unlimited Rides On 1 Day. Experience....' + ); + cy.get('#root_item_3_qty').clear().type('18'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('SNT'); + cy.get('#root_item_3_unit_price').type('430.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A host brings all the ingredients, leads groups through mini-games, and encourages participants to taunt or cheer. This cookless cook-off is available in various venues. https://teambuilding.com/blog/team-building-events' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['png-5mb-1.png']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(4) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + + cy.wait(2000); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + }); + }); + + // Edit request - Meetup - With Files + it('Edit request - Meetup - With Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Happy hours are a go-to team social event. These gatherings involve heading to a local watering hole, setting up a bar in the office, and socializing over drinks and snacks.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('27-02-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('26-02-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('04-03-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('The most common times for happy hours -directly after work or during the final hours of the workday.'); + + cy.get('#root_event_destination').clear('s'); + cy.get('#root_event_destination').type('sydney'); + cy.get('#downshift-0-item-2 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('o'); + cy.get('#root_departure_from').type('oslo'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ch'); + cy.get('#root_return_to').type('chica'); + cy.get('#downshift-2-item-1 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment ideas include answering icebreaker questions, playing pool or board games.' + ); + cy.get('#root_item_0_qty').clear().type('9'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('CHF'); + cy.get('#root_item_0_unit_price').type('140.65'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CNY'); + cy.get('#root_item_1_unit_price').type('5689'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['png-5mb-1.png']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(4) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + + cy.wait(2000); + + + cy.get('button') + .contains(/^Edit Request$/) + .click(); + + // Form 1 + cy.contains('Task: Submit Details', { timeout: 60000 }); + cy.wait(2000); + cy.get('button') + .contains(/^Submit$/) + .click(); + + // Form 2 + cy.contains('Task: Review the Request', { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper').find('#root').type('EDITING INFO'); + }); + }); + + // Save and Close Form 2 - Team Event - With Files + it('Save and Close Form 2 - Team Event - With Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work. These events allow employees to get out of the office and enjoy fresh air and sunshine.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('17-12-2023'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core4 Contributor'); + cy.get('#root_start_date').clear().type('06-12-2023'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('24-12-2023'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('You can take your staff on a trip to the beach.'); + + cy.get('#root_event_destination').clear('b'); + cy.get('#root_event_destination').type('bergen'); + cy.get('#downshift-0-item-9 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear(); + cy.get('#root_departure_from').type('bern'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('B'); + cy.get('#root_return_to').type('Bern'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks.' + ); + cy.get('#root_item_0_qty').clear().type('3'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('0.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('EUR'); + cy.get('#root_item_1_unit_price').type('235'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'As a bonding exercise you can ask teammates to submit photos of their favorite beach or dream beach.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('GBP'); + cy.get('#root_item_2_unit_price').type('765.35'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work' + ); + cy.get('#root_item_3_qty').clear().type('25'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('DAI'); + cy.get('#root_item_3_unit_price').type('245'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'You can take your staff on a trip to the beach or create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks. Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['png-5mb-1.png']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(4) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + + cy.wait(2000); + + + cy.get('button') + .contains(/^Save and Close$/) + .click(); + + cy.contains('Started by me', { timeout: 60000 }); + cy.logout(); + }); + }); + + // Cancel request Form 2 - Conference - With Files + it('Cancel request Form 2 - Conference - With Files', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('Zürich'); + cy.get('#root_event_destination').type('Zürich'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('t'); + cy.get('#root_departure_from').type('trondh'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('S'); + cy.get('#root_return_to').type('New york'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('JPY'); + cy.get('#root_item_0_unit_price').type('2355.25'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('HKD'); + cy.get('#root_item_1_unit_price').type('4325'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['png-5mb-1.png']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(4) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + + cy.wait(2000); + + + cy.get('button') + .contains(/^Cancel Request$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + }); + }); + }); +}); \ No newline at end of file diff --git a/spiffworkflow-frontend/cypress/pilot/RequestTravel_PP2/requesttravel.cy.js b/spiffworkflow-frontend/cypress/pilot/RequestTravel_PP2/requesttravel.cy.js new file mode 100644 index 000000000..d53ef3854 --- /dev/null +++ b/spiffworkflow-frontend/cypress/pilot/RequestTravel_PP2/requesttravel.cy.js @@ -0,0 +1,3411 @@ +const submitWithUser = ( + username, + password, + processInstanceId, + expectAdditionalApprovalInfoPage = false, + approvaltype +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.log('=======visit find by id : '); + cy.visit('/admin/process-instances/find-by-id'); + cy.wait(3000); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(2000); + cy.contains('Tasks I can complete', { timeout: 60000 }); + + cy.get('.cds--btn').contains(/^Go$/).click(); + + cy.wait(2000); + // approve! + if (approvaltype === 'approve') { + cy.get('#root > label:nth-child(1)').click(); + cy.get('.cds--text-area__wrapper') + .find('#root') + .type(username.concat(' is approving this.')); + } else if (approvaltype === 'reject') { + cy.get('#root > label:nth-child(3)').click(); + cy.get('.cds--text-area__wrapper') + .find('#root') + .type(username.concat(' is rejecting this.')); + } else if (approvaltype === 'needmoreinfo') { + cy.get('#root > label:nth-child(2)').click(); + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + username.concat( + ' needs additional info. A software license is a document that provides legally binding guidelines for the use and distribution of software.Software licenses typically provide end users with the right to END.' + ) + ); + } else if (approvaltype === 'providemoreinfo') { + // Form 1 + cy.contains('Task: Submit Details', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); + // Form 2 + /* cy.contains('Task: Enter NDR Items', { timeout: 60000 }); + cy.get('button') + .contains(/^Submit$/) + .click(); */ + // Form 3 + cy.contains('Task: Review the Request', { timeout: 60000 }); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .clear() + .type( + "Providing additional info. It’s free and easy to post a job. Simply fill in a title, description and budget and competitive bids come within minutes. No job is too big or too small. We've got people for jobs of any size." + ); + + // cy.contains('Submit the Request').click(); + // cy.get('input[value="Submit the Request"]').click(); + } else { + } + + cy.get('button') + .contains(/^Submit$/) + .click(); + + if (expectAdditionalApprovalInfoPage) { + cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 }); + + cy.get('button') + .contains(/^Continue$/) + .click(); + } + + cy.wait(5000); + //cy.get('button').contains('Return to Home', { timeout: 60000 }); + cy.logout(); +}; + +//Check if the process instance is completed successfully +const checkProcessInstanceCompleted = ( + username, + password, + processInstanceId +) => { + cy.wait(2000); + cy.log('========Login with : ', username); + cy.log('========processInstanceId: ', processInstanceId); + cy.login(username, password); + + cy.wait(1000); + cy.visit('/admin/process-instances/find-by-id'); + cy.get('#process-instance-id-input').type(processInstanceId); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(2000); + cy.get('#tag-1 > span').contains('complete'); +} + +// Request Travel - Without Files +describe('Request Travel - Without Files', () => { + Cypress._.times(1, () => { + // Everyone approves the request - Team Event + it('Everyone approves - Team Event', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Before you start planning your trip, make sure to check your company’s rules, procedures, and do’s & don’ts when it comes to corporate travel. Here you’ll find more information about corporate travel policies, which include things such as where to ..' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Great Guac Off is one of the best team building events. Participants compete in teams to perfect it.'); + + cy.get('#root_event_destination').clear('y'); + cy.get('#root_event_destination').type('yellow'); + cy.get('#downshift-0-item-3 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('c'); + cy.get('#root_departure_from').type('colombo'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('spring'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Our staff can facilitate your accommodation needs from a range of Home-stay options and can also.' + ); + cy.get('#root_item_0_qty').clear().type('7'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('1.15'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('5'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CAD'); + cy.get('#root_item_1_unit_price').type('2300'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'Ensure a quality, cost effective and safe integrated transport system and services that will provi.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('AUD'); + cy.get('#root_item_2_unit_price').type('1205.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Book Your Tickets In Advance And Get A Chance To Experience Unlimited Rides On 1 Day. Experience....' + ); + cy.get('#root_item_3_qty').clear().type('18'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('SNT'); + cy.get('#root_item_3_unit_price').type('430.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A host brings all the ingredients, leads groups through mini-games, and encourages participants to taunt or cheer. This cookless cook-off is available in various venues. https://teambuilding.com/blog/team-building-events' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Everyone approves the request - Conference + it('Everyone approves - Conference', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('05-11-2027'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('30-10-2027'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('07-11-2027'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('st'); + cy.get('#root_event_destination').type('stockh'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('s'); + cy.get('#root_departure_from').type('san die'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('san diego'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('1450.32'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('AED'); + cy.get('#root_item_1_unit_price').type('1980'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Everyone approves the request - Meetup + it('Everyone approves - Meetup', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Happy hours are a go-to team social event. These gatherings involve heading to a local watering hole, setting up a bar in the office, and socializing over drinks and snacks.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('27-02-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('26-02-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('04-03-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('The most common times for happy hours -directly after work or during the final hours of the workday.'); + + cy.get('#root_event_destination').clear('s'); + cy.get('#root_event_destination').type('sydney'); + cy.get('#downshift-0-item-2 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('o'); + cy.get('#root_departure_from').type('oslo'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ch'); + cy.get('#root_return_to').type('chica'); + cy.get('#downshift-2-item-1 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment ideas include answering icebreaker questions, playing pool or board games.' + ); + cy.get('#root_item_0_qty').clear().type('9'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('CHF'); + cy.get('#root_item_0_unit_price').type('140.65'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CNY'); + cy.get('#root_item_1_unit_price').type('5689'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Everyone approves the request - All Hands + it('Everyone approves - All Hands', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Scavenger hunts are among the most high-energy team building events. These games are customizable to fit various venues and occasions.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Most scavenger hunts involve players getting into groups and racing against each other to find clue.'); + + cy.get('#root_event_destination').clear('h'); + cy.get('#root_event_destination').type('houst'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('ma'); + cy.get('#root_departure_from').type('madrid'); + cy.get('#downshift-1-item-5 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ma'); + cy.get('#root_return_to').type('madrid'); + cy.get('#downshift-2-item-5 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Examples might include “find a statue that reminds you of your boss,” ' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('DAI'); + cy.get('#root_item_0_unit_price').type('986'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + '“show the oldest coin within your group’s wallets,” or “recreate the Crossing of the Delaware in.”' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('ETH'); + cy.get('#root_item_1_unit_price').type('0.05'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'typically, scavenger hunts have a theme and a time limit.' + ); + cy.get('#root_item_2_qty').clear().type('5'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('NZD'); + cy.get('#root_item_2_unit_price').type('976.75'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'At the end of the game, the group that completes the most tasks or finds the most items wins the game and earns a prize.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budges Owner rejects the request + it('Budges Owner rejects', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Escape rooms are one of the most popular team building events for small groups. In these games, participants usually enter a locked themed room and have a limited time to find clues and solve a mystery to escape and win the game.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('12-11-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core3 Contributor'); + cy.get('#root_start_date').clear().type('10-11-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('14-11-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('These challenges require team members to collaborate, communicate clearly, think critically.'); + + cy.get('#root_event_destination').clear('me'); + cy.get('#root_event_destination').type('melbo'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('c'); + cy.get('#root_departure_from').type('copen'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('l'); + cy.get('#root_return_to').type('london'); + cy.get('#downshift-2-item-2 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment venues like malls often host these attractions, and there are usually at least one.' + ); + cy.get('#root_item_0_qty').clear().type('1'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('COP'); + cy.get('#root_item_0_unit_price').type('3489'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('SNT'); + cy.get('#root_item_1_unit_price').type('5977'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'reject' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // People Ops rejects the request + it('People Ops rejects', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work. These events allow employees to get out of the office and enjoy fresh air and sunshine.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('17-12-2023'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core4 Contributor'); + cy.get('#root_start_date').clear().type('06-12-2023'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('24-12-2023'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('You can take your staff on a trip to the beach.'); + + cy.get('#root_event_destination').clear('b'); + cy.get('#root_event_destination').type('bergen'); + cy.get('#downshift-0-item-9 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear(); + cy.get('#root_departure_from').type('bern'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('B'); + cy.get('#root_return_to').type('Bern'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks.' + ); + cy.get('#root_item_0_qty').clear().type('3'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('0.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('EUR'); + cy.get('#root_item_1_unit_price').type('235'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'As a bonding exercise you can ask teammates to submit photos of their favorite beach or dream beach.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('GBP'); + cy.get('#root_item_2_unit_price').type('765.35'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work' + ); + cy.get('#root_item_3_qty').clear().type('25'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('DAI'); + cy.get('#root_item_3_unit_price').type('245'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'You can take your staff on a trip to the beach or create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks. Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'reject' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budget owner request for additional details + it('Budget owner need more info', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('30-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core5 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('01-04-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('mi'); + cy.get('#root_event_destination').type('miami'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('mi'); + cy.get('#root_departure_from').type('milano'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('z'); + cy.get('#root_return_to').type('z'); + cy.get('#downshift-2-item-3 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('8'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('3'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('SGD'); + cy.get('#root_item_1_unit_price').type('685'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // People Ops request for additional details + it('People Ops need more info', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('Zürich'); + cy.get('#root_event_destination').type('Zürich'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('t'); + cy.get('#root_departure_from').type('trondh'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('S'); + cy.get('#root_return_to').type('New york'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('JPY'); + cy.get('#root_item_0_unit_price').type('2355.25'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('HKD'); + cy.get('#root_item_1_unit_price').type('4325'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budget owner request for additional details in first round and People Ops request for additional details in second round + it('Budget owner and People Ops need more info in two rounds', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('31-10-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core10 Contributor'); + cy.get('#root_start_date').clear().type('29-10-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('05-01-2025'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('t'); + cy.get('#root_event_destination').type('tokyo'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('b'); + cy.get('#root_departure_from').type('beij'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('shanghai'); + cy.get('.cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('3'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('8'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('USD'); + cy.get('#root_item_1_unit_price').type('680.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves third time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + // people ops approves third time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budget owner request for additional details and People Ops rejects + it('Budget owner request for additional details and People Ops rejects', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('30-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core5 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('01-04-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('mi'); + cy.get('#root_event_destination').type('miami'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('mi'); + cy.get('#root_departure_from').type('milano'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('z'); + cy.get('#root_return_to').type('z'); + cy.get('#downshift-2-item-3 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('8'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('AED'); + cy.get('#root_item_1_unit_price').type('1980'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(6000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'reject' + ); + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + }); +}); + +// Request Travel - With Files +describe.only('Request Travel - With Files', () => { + Cypress._.times(1, () => { + // Everyone approves the request - Team Event + it('Everyone approves - Team Event', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Before you start planning your trip, make sure to check your company’s rules, procedures, and do’s & don’ts when it comes to corporate travel. Here you’ll find more information about corporate travel policies, which include things such as where to ..' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Great Guac Off is one of the best team building events. Participants compete in teams to perfect it.'); + + cy.get('#root_event_destination').clear('y'); + cy.get('#root_event_destination').type('yellow'); + cy.get('#downshift-0-item-3 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('c'); + cy.get('#root_departure_from').type('colombo'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('spring'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Our staff can facilitate your accommodation needs from a range of Home-stay options and can also.' + ); + cy.get('#root_item_0_qty').clear().type('7'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('1.15'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('5'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CAD'); + cy.get('#root_item_1_unit_price').type('2300'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'Ensure a quality, cost effective and safe integrated transport system and services that will provi.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('AUD'); + cy.get('#root_item_2_unit_price').type('1205.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Book Your Tickets In Advance And Get A Chance To Experience Unlimited Rides On 1 Day. Experience....' + ); + cy.get('#root_item_3_qty').clear().type('18'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('SNT'); + cy.get('#root_item_3_unit_price').type('430.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A host brings all the ingredients, leads groups through mini-games, and encourages participants to taunt or cheer. This cookless cook-off is available in various venues. https://teambuilding.com/blog/team-building-events' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['png-5mb-1.png']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Everyone approves the request - Conference + it('Everyone approves - Conference', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('05-11-2027'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('30-10-2027'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('07-11-2027'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('st'); + cy.get('#root_event_destination').type('stockh'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('s'); + cy.get('#root_departure_from').type('san die'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('san diego'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('1450.32'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('AED'); + cy.get('#root_item_1_unit_price').type('1980'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['sampletext.txt']); + + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Everyone approves the request - Meetup + it('Everyone approves - Meetup', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Happy hours are a go-to team social event. These gatherings involve heading to a local watering hole, setting up a bar in the office, and socializing over drinks and snacks.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('27-02-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core1 Contributor'); + cy.get('#root_start_date').clear().type('26-02-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('04-03-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('The most common times for happy hours -directly after work or during the final hours of the workday.'); + + cy.get('#root_event_destination').clear('s'); + cy.get('#root_event_destination').type('sydney'); + cy.get('#downshift-0-item-2 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('o'); + cy.get('#root_departure_from').type('oslo'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ch'); + cy.get('#root_return_to').type('chica'); + cy.get('#downshift-2-item-1 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment ideas include answering icebreaker questions, playing pool or board games.' + ); + cy.get('#root_item_0_qty').clear().type('9'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('CHF'); + cy.get('#root_item_0_unit_price').type('140.65'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('CNY'); + cy.get('#root_item_1_unit_price').type('5689'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['png-5mb-1.png']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(4) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Everyone approves the request - All Hands + it('Everyone approves - All Hands', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Scavenger hunts are among the most high-energy team building events. These games are customizable to fit various venues and occasions.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('17-09-2028'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('14-09-2028'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('20-09-2028'); + cy.get('body').click(); + cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Most scavenger hunts involve players getting into groups and racing against each other to find clue.'); + + cy.get('#root_event_destination').clear('h'); + cy.get('#root_event_destination').type('houst'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('ma'); + cy.get('#root_departure_from').type('madrid'); + cy.get('#downshift-1-item-5 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('ma'); + cy.get('#root_return_to').type('madrid'); + cy.get('#downshift-2-item-5 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Examples might include “find a statue that reminds you of your boss,” ' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('DAI'); + cy.get('#root_item_0_unit_price').type('986'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + '“show the oldest coin within your group’s wallets,” or “recreate the Crossing of the Delaware in.”' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('ETH'); + cy.get('#root_item_1_unit_price').type('0.05'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'typically, scavenger hunts have a theme and a time limit.' + ); + cy.get('#root_item_2_qty').clear().type('5'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('NZD'); + cy.get('#root_item_2_unit_price').type('976.75'); + + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'At the end of the game, the group that completes the most tasks or finds the most items wins the game and earns a prize.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['lorem-ipsum.pdf']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(1000); + + cy.get('#root > div:nth-child(3) > p > button').click(); + cy.wait(1000); + + cy.get( + '#root > div.row.array-item-list > div:nth-child(3) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + cy.get( + '#root > div.row.array-item-list > div:nth-child(2) > div > div.cds--sm\\:col-span-1.cds--md\\:col-span-1.cds--lg\\:col-span-1.cds--css-grid-column > div > div > button.btn.btn-default.array-item-move-up > svg' + ).click(); + cy.wait(1000); + + cy.get('input[type=file]').attachFile(['Free_Test_Data_1MB_PDF.pdf']); + + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budges Owner rejects the request + it('Budges Owner rejects', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Escape rooms are one of the most popular team building events for small groups. In these games, participants usually enter a locked themed room and have a limited time to find clues and solve a mystery to escape and win the game.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('12-11-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core3 Contributor'); + cy.get('#root_start_date').clear().type('10-11-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('14-11-2024'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('These challenges require team members to collaborate, communicate clearly, think critically.'); + + cy.get('#root_event_destination').clear('me'); + cy.get('#root_event_destination').type('melbo'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('c'); + cy.get('#root_departure_from').type('copen'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('l'); + cy.get('#root_return_to').type('london'); + cy.get('#downshift-2-item-2 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Entertainment venues like malls often host these attractions, and there are usually at least one.' + ); + cy.get('#root_item_0_qty').clear().type('1'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('COP'); + cy.get('#root_item_0_unit_price').type('3489'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'You could assign a theme or leave the event more free-form encourage teammates to chat with peers.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Crypto'); + cy.get('#root_item_1_currency').select('SNT'); + cy.get('#root_item_1_unit_price').type('5977'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'reject' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // People Ops rejects the request + it('People Ops rejects', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work. These events allow employees to get out of the office and enjoy fresh air and sunshine.' + ); + cy.get('#root_criticality').select('Low'); + cy.get('#root_period').clear().type('17-12-2023'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core4 Contributor'); + cy.get('#root_start_date').clear().type('06-12-2023'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('24-12-2023'); + cy.get('body').click(); + cy.get('#root_event_type').select('team_event'); + //cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('You can take your staff on a trip to the beach.'); + + cy.get('#root_event_destination').clear('b'); + cy.get('#root_event_destination').type('bergen'); + cy.get('#downshift-0-item-9 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear(); + cy.get('#root_departure_from').type('bern'); + cy.get('#downshift-1-item-0 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('B'); + cy.get('#root_return_to').type('Bern'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks.' + ); + cy.get('#root_item_0_qty').clear().type('3'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('ETH'); + cy.get('#root_item_0_unit_price').type('0.75'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('EUR'); + cy.get('#root_item_1_unit_price').type('235'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 2 + cy.get('#root_item_2_sub_category').select('transport'); + cy.get('#root_item_2_item_name') + .clear() + .type( + 'As a bonding exercise you can ask teammates to submit photos of their favorite beach or dream beach.' + ); + cy.get('#root_item_2_qty').clear().type('9'); + cy.get('#root_item_2_currency_type').select('Fiat'); + cy.get('#root_item_2_currency').select('GBP'); + cy.get('#root_item_2_unit_price').type('765.35'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 3 + cy.get('#root_item_3_sub_category').select('tickets'); + cy.get('#root_item_3_item_name') + .clear() + .type( + 'Beach parties are a beloved summertime activity for work' + ); + cy.get('#root_item_3_qty').clear().type('25'); + cy.get('#root_item_3_currency_type').select('Crypto'); + cy.get('#root_item_3_currency').select('DAI'); + cy.get('#root_item_3_unit_price').type('245'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'You can take your staff on a trip to the beach or create a beach-like atmosphere in your party space by handing out leis and serving tropical drinks. Some ideas include putting up a volleyball net, handing out branded beach balls and sunglasses.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'reject' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budget owner request for additional details + it('Budget owner need more info', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('30-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core5 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('01-04-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('mi'); + cy.get('#root_event_destination').type('miami'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('mi'); + cy.get('#root_departure_from').type('milano'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('z'); + cy.get('#root_return_to').type('z'); + cy.get('#downshift-2-item-3 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('8'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('3'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('SGD'); + cy.get('#root_item_1_unit_price').type('685'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // People Ops request for additional details + it.only('People Ops need more info', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core2 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('Zürich'); + cy.get('#root_event_destination').type('Zürich'); + cy.get('#downshift-0-item-6 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('t'); + cy.get('#root_departure_from').type('trondh'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('S'); + cy.get('#root_return_to').type('New york'); + cy.get('#downshift-2-item-0 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('12'); + cy.get('#root_item_0_currency_type').select('Fiat'); + cy.get('#root_item_0_currency').select('JPY'); + cy.get('#root_item_0_unit_price').type('2355.25'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('4'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('HKD'); + cy.get('#root_item_1_unit_price').type('4325'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budget owner request for additional details in first round and People Ops request for additional details in second round + it('Budget owner and People Ops need more info in two rounds', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('Medium'); + cy.get('#root_period').clear().type('31-10-2024'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core10 Contributor'); + cy.get('#root_start_date').clear().type('29-10-2024'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('05-01-2025'); + cy.get('body').click(); + cy.get('#root_event_type').select('conf'); + //cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('t'); + cy.get('#root_event_destination').type('tokyo'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('b'); + cy.get('#root_departure_from').type('beij'); + cy.get('.cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('s'); + cy.get('#root_return_to').type('shanghai'); + cy.get('.cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('3'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('8'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('USD'); + cy.get('#root_item_1_unit_price').type('680.50'); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves third time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + // people ops approves third time + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'approve' + ); + + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + + // Budget owner request for additional details and People Ops rejects + it('Budget owner request for additional details and People Ops rejects', () => { + const username = Cypress.env('requestor_username'); + const password = Cypress.env('requestor_password'); + cy.log(`=====username : ${username}`); + cy.log(`=====password : ${password}`); + + cy.login(username, password); + cy.visit('/'); + + cy.contains('Start New +').click(); + cy.contains('Coming soon - Request Travel').click(); + + cy.runPrimaryBpmnFile(true); + + cy.contains('Coming soon - Request Travel', { timeout: 60000 }); + + // cy.wait(5000); + cy.url().then((currentUrl) => { + // if url is "/tasks/8/d37c2f0f-016a-4066-b669-e0925b759560" + // extract the digits after /tasks + + const processInstanceId = currentUrl.match(/(?<=\/tasks\/)\d+/)[0]; + cy.log('==###############===processInstanceId : ', processInstanceId); + const projectId = Cypress.env('project_id'); + cy.wait(2000); + + cy.get('#root_project').select(projectId); + cy.get('#root_purpose') + .clear() + .type( + 'Ultimate Trivia Showdown elevates pub trivia into a game-show-like atmosphere. For 90-minutes, a professional performer plays the role of host and leads teams in new takes on quiz games.' + ); + cy.get('#root_criticality').select('High'); + cy.get('#root_period').clear().type('30-03-2026'); + cy.get('body').click(); + cy.get('#root_core_contributor').clear().type('Core5 Contributor'); + cy.get('#root_start_date').clear().type('29-03-2026'); + cy.get('body').click(); + cy.get('#root_end_date').clear().type('01-04-2026'); + cy.get('body').click(); + cy.get('#root_event_type').select('meetup'); + //cy.get('#root_event_type').select('all_hands'); + cy.get('#root_event_name').clear().type('Players collaborate against each other and compete against other teams to prove dominance.'); + + cy.get('#root_event_destination').clear('mi'); + cy.get('#root_event_destination').type('miami'); + cy.get('#downshift-0-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_departure_from').clear('mi'); + cy.get('#root_departure_from').type('milano'); + cy.get('#downshift-1-item-1 > .cds--list-box__menu-item__option').click(); + cy.get('#root_return_to').clear('z'); + cy.get('#root_return_to').type('z'); + cy.get('#downshift-2-item-3 > .cds--list-box__menu-item__option').click(); + // item 0 + cy.get('#root_item_0_sub_category').select('accom'); + cy.get('#root_item_0_item_name') + .clear() + .type( + 'Happen in a variety of indoor settings and can add a layer of fun and bonding to any team event.....' + ); + cy.get('#root_item_0_qty').clear().type('8'); + cy.get('#root_item_0_currency_type').select('Crypto'); + cy.get('#root_item_0_currency').select('SNT'); + cy.get('#root_item_0_unit_price').type('2680'); + + cy.get('#root_item > div:nth-child(3) > p > button').click(); + + // item 1 + cy.get('#root_item_1_sub_category').select('flights'); + cy.get('#root_item_1_item_name') + .clear() + .type( + 'Now you have all you need for your seamless flight. With a variety of services such as Flexi Ticket.' + ); + cy.get('#root_item_1_qty').clear().type('15'); + cy.get('#root_item_1_currency_type').select('Fiat'); + cy.get('#root_item_1_currency').select('AED'); + cy.get('#root_item_1_unit_price').type('1980'); + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.contains( + 'Task: Review the Request', + { timeout: 60000 } + ); + + cy.get('.cds--text-area__wrapper') + .find('#root') + .type( + 'A professional performer plays the role of host and leads teams in new takes on quiz games, like Majority Rules and Champion Challenge.' + ); + + cy.get('#root > div:nth-child(3) > p > button').click(); + + cy.get('input[type=file]').attachFile(['sampletext.txt']); + cy.wait(2000); + + cy.get('button') + .contains(/^Submit$/) + .click(); + + cy.wait(15000); + /*cy.get('button') + .contains(/^Return to Home$/) + .click();*/ + + cy.contains('Process Instance Id:', { timeout: 60000 }); + cy.logout(); + cy.wait(1000); + + const budgetOwnerUsername = Cypress.env('budgetowner_username'); + const budgetOwnerPassword = Cypress.env('budgetowner_password'); + cy.log(`=====budgetOwnerUsername : ${budgetOwnerUsername}`); + cy.log(`=====budgetOwnerPassword : ${budgetOwnerPassword}`); + + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + null, + 'needmoreinfo' + ); + + // requestor sending additional info + submitWithUser( + username, + password, + processInstanceId, + null, + 'providemoreinfo' + ); + + // budget owner approves second time + submitWithUser( + budgetOwnerUsername, + budgetOwnerPassword, + processInstanceId, + 'Task: Reminder: Check Existing Budget', + 'approve' + ); + + + const peopleOpsUsername = Cypress.env('peopleopssme_username'); + const peopleOpsPassword = Cypress.env('peopleopssme_password'); + cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`); + cy.log(`=====peopleOpsPassword : ${peopleOpsPassword}`); + + submitWithUser( + peopleOpsUsername, + peopleOpsPassword, + processInstanceId, + null, + 'reject' + ); + + checkProcessInstanceCompleted(username, password, processInstanceId); + }); + }); + }); +}); +