Merge remote-tracking branch 'origin/main' into feature/new-ux-options-for-adding-files

This commit is contained in:
burnettk 2023-05-31 12:38:34 -04:00
commit e74c642a1d
24 changed files with 463 additions and 393 deletions

View File

@ -26,7 +26,9 @@ from spiffworkflow_backend import create_app # noqa: E402
@pytest.fixture(scope="session")
def app() -> Flask: # noqa
os.environ["SPIFFWORKFLOW_BACKEND_ENV"] = "unit_testing"
os.environ["FLASK_SESSION_SECRET_KEY"] = "e7711a3ba96c46c68e084a86952de16f"
os.environ["FLASK_SESSION_SECRET_KEY"] = (
"e7711a3ba96c46c68e084a86952de16f" # noqa: S105, do not care about security when running unit tests
)
app = create_app()
return app

View File

@ -172,12 +172,19 @@ select = [
# "ERA", # eradicate
"F", # pyflakes
"N", # pep8-naming
# "PL", # pylint
# "S", # flake8-bandit
"PL", # pylint
"S", # flake8-bandit
"UP", # pyupgrade
"W", # pycodestyle warning
"I001" # isort
]
ignore = [
"PLR", # "refactoring" category has "too many lines in method" type stuff
"PLC1901",
"PLE1205" # saw this Too many arguments for `logging` format string give a false positive once
]
line-length = 130
# target python 3.10
@ -185,6 +192,7 @@ target-version = "py310"
[tool.ruff.per-file-ignores]
"migrations/versions/*.py" = ["E501"]
"tests/**/*.py" = ["PLR2004", "S101"] # PLR2004 is about magic vars, S101 allows assert
[tool.ruff.isort]
force-single-line = true

View File

@ -9,6 +9,8 @@ from werkzeug.utils import ImportStringError
from spiffworkflow_backend.services.logging_service import setup_logger
HTTP_REQUEST_TIMEOUT_SECONDS = 15
class ConfigurationError(Exception):
pass

View File

@ -3,7 +3,7 @@ import os
from os import environ
TESTING = True
SECRET_KEY = "the_secret_key"
SECRET_KEY = "the_secret_key" # noqa: S105, do not care about security when running unit tests
SPIFFWORKFLOW_BACKEND_LOG_TO_FILE = environ.get("SPIFFWORKFLOW_BACKEND_LOG_TO_FILE", default="true") == "true"
SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get(

View File

@ -5,6 +5,8 @@ import requests
from flask import current_app
from flask.wrappers import Response
from spiffworkflow_backend.config import HTTP_REQUEST_TIMEOUT_SECONDS
def connector_proxy_typeahead_url() -> Any:
"""Returns the connector proxy type ahead url."""
@ -14,7 +16,7 @@ def connector_proxy_typeahead_url() -> Any:
def typeahead(category: str, prefix: str, limit: int) -> flask.wrappers.Response:
url = f"{connector_proxy_typeahead_url()}/v1/typeahead/{category}?prefix={prefix}&limit={limit}"
proxy_response = requests.get(url)
proxy_response = requests.get(url, timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
status = proxy_response.status_code
response = proxy_response.text

View File

@ -139,7 +139,7 @@ permission_cache = None
def get_users() -> Any:
"""Load users from a local configuration file."""
global permission_cache
global permission_cache # noqa: PLW0603, allow global for performance
if not permission_cache:
with open(current_app.config["SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_ABSOLUTE_PATH"]) as file:
permission_cache = yaml.safe_load(file)

View File

@ -430,20 +430,21 @@ def _interstitial_stream(process_instance: ProcessInstanceModel) -> Generator[st
break # No more tasks to report
spiff_task = processor.next_task()
task = ProcessInstanceService.spiff_task_to_api_task(processor, processor.next_task())
if task.id not in reported_ids:
try:
instructions = render_instructions(spiff_task)
except Exception as e:
api_error = ApiError(
error_code="engine_steps_error",
message=f"Failed to complete an automated task. Error was: {str(e)}",
status_code=400,
)
yield render_data("error", api_error)
raise e
task.properties = {"instructionsForEndUser": instructions}
yield render_data("task", task)
if spiff_task is not None:
task = ProcessInstanceService.spiff_task_to_api_task(processor, spiff_task)
if task.id not in reported_ids:
try:
instructions = render_instructions(spiff_task)
except Exception as e:
api_error = ApiError(
error_code="engine_steps_error",
message=f"Failed to complete an automated task. Error was: {str(e)}",
status_code=400,
)
yield render_data("error", api_error)
raise e
task.properties = {"instructionsForEndUser": instructions}
yield render_data("task", task)
def get_ready_engine_step_count(bpmn_process_instance: BpmnWorkflow) -> int:

View File

@ -160,7 +160,7 @@ class Script:
def get_all_subclasses(cls) -> list[type[Script]]:
"""Get_all_subclasses."""
# This is expensive to generate, never changes after we load up.
global SCRIPT_SUB_CLASSES
global SCRIPT_SUB_CLASSES # noqa: PLW0603, allow global for performance
if not SCRIPT_SUB_CLASSES:
SCRIPT_SUB_CLASSES = Script._get_all_subclasses(Script)
return SCRIPT_SUB_CLASSES

View File

@ -7,6 +7,7 @@ import jwt
import requests
from flask import current_app
from flask import redirect
from spiffworkflow_backend.config import HTTP_REQUEST_TIMEOUT_SECONDS
from spiffworkflow_backend.models.db import db
from spiffworkflow_backend.models.refresh_token import RefreshTokenModel
from werkzeug.wrappers import Response
@ -78,7 +79,7 @@ class AuthenticationService:
openid_config_url = f"{cls.server_url()}/.well-known/openid-configuration"
if name not in AuthenticationService.ENDPOINT_CACHE:
try:
response = requests.get(openid_config_url)
response = requests.get(openid_config_url, timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
AuthenticationService.ENDPOINT_CACHE = response.json()
except requests.exceptions.ConnectionError as ce:
raise OpenIdConnectionError(f"Cannot connect to given open id url: {openid_config_url}") from ce
@ -139,7 +140,7 @@ class AuthenticationService:
request_url = self.open_id_endpoint_for_name("token_endpoint")
response = requests.post(request_url, data=data, headers=headers)
response = requests.post(request_url, data=data, headers=headers, timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
auth_token_object: dict = json.loads(response.text)
return auth_token_object
@ -244,6 +245,6 @@ class AuthenticationService:
request_url = cls.open_id_endpoint_for_name("token_endpoint")
response = requests.post(request_url, data=data, headers=headers)
response = requests.post(request_url, data=data, headers=headers, timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
auth_token_object: dict = json.loads(response.text)
return auth_token_object

View File

@ -514,7 +514,6 @@ class ProcessInstanceService:
add_docs_and_forms: bool = False,
calling_subprocess_task_id: str | None = None,
) -> Task:
"""Spiff_task_to_api_task."""
task_type = spiff_task.task_spec.description
props = {}

View File

@ -132,7 +132,7 @@ class ProcessModelTestRunnerMostlyPureSpiffDelegate(ProcessModelTestRunnerDelega
with open(bpmn_file, "rb") as f_handle:
data = f_handle.read()
etree_xml_parser = etree.XMLParser(resolve_entities=False)
return etree.fromstring(data, parser=etree_xml_parser)
return etree.fromstring(data, parser=etree_xml_parser) # noqa: S320
def _find_related_bpmn_files(self, bpmn_file: str) -> list[str]:
related_bpmn_files = []
@ -160,7 +160,7 @@ class ProcessModelTestRunnerMostlyPureSpiffDelegate(ProcessModelTestRunnerDelega
# if we cannot load process model then ignore it since it can cause errors unrelated
# to the test and if it is related, it will most likely be caught further along the test
try:
root = etree.fromstring(file_contents, parser=etree_xml_parser)
root = etree.fromstring(file_contents, parser=etree_xml_parser) # noqa: S320
except etree.XMLSyntaxError:
continue

View File

@ -6,6 +6,7 @@ import requests
import sentry_sdk
from flask import current_app
from flask import g
from spiffworkflow_backend.config import HTTP_REQUEST_TIMEOUT_SECONDS
from spiffworkflow_backend.services.file_system_service import FileSystemService
from spiffworkflow_backend.services.secret_service import SecretService
from spiffworkflow_backend.services.user_service import UserService
@ -78,7 +79,7 @@ class ServiceTaskDelegate:
params = {k: ServiceTaskDelegate.check_prefixes(v["value"]) for k, v in bpmn_params.items()}
params["spiff__task_data"] = task_data
proxied_response = requests.post(call_url, json=params)
proxied_response = requests.post(call_url, json=params, timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
response_text = proxied_response.text
json_parse_error = None
@ -128,7 +129,7 @@ class ServiceTaskService:
def available_connectors() -> Any:
"""Returns a list of available connectors."""
try:
response = requests.get(f"{connector_proxy_url()}/v1/commands")
response = requests.get(f"{connector_proxy_url()}/v1/commands", timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
if response.status_code != 200:
return []
@ -143,7 +144,7 @@ class ServiceTaskService:
def authentication_list() -> Any:
"""Returns a list of available authentications."""
try:
response = requests.get(f"{connector_proxy_url()}/v1/auths")
response = requests.get(f"{connector_proxy_url()}/v1/auths", timeout=HTTP_REQUEST_TIMEOUT_SECONDS)
if response.status_code != 200:
return []

View File

@ -79,7 +79,7 @@ class SpecFileService(FileSystemService):
def get_etree_from_xml_bytes(cls, binary_data: bytes) -> etree.Element:
"""Get_etree_from_xml_bytes."""
etree_xml_parser = etree.XMLParser(resolve_entities=False)
return etree.fromstring(binary_data, parser=etree_xml_parser)
return etree.fromstring(binary_data, parser=etree_xml_parser) # noqa: S320
@classmethod
def get_references_for_file_contents(

View File

@ -1,5 +1,3 @@
import json
import pytest
from flask.app import Flask
from flask.testing import FlaskClient

View File

@ -84,31 +84,32 @@ const submitWithUser = (
// .click();
// }
cy.get('button').contains('Return to Home', { timeout: 60000 });
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
//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(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.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.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Consulting Fees Path - Without Files
@ -233,12 +234,12 @@ describe.only('Consulting Fees Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.wait(3000);
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -376,12 +377,12 @@ describe.only('Consulting Fees Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.wait(3000);
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -521,12 +522,12 @@ describe.only('Consulting Fees Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.wait(3000);
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -740,8 +741,8 @@ describe('Consulting Fees Path - With Files', () => {
.click();
cy.wait(9000);
cy.visit('/');
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -930,11 +931,11 @@ describe('Consulting Fees Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -1123,8 +1124,10 @@ describe('Consulting Fees Path - With Files', () => {
.contains(/^Submit$/)
.click();
cy.wait(9000);
cy.visit('/');
cy.contains('Started by me', { timeout: 60000 });
/*cy.get('button')
.contains(/^Return to Home$/)
.click();*/
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);

View File

@ -90,31 +90,32 @@ const submitWithUser = (
// .click();
// }
cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.wait(10000);
// cy.get('button').contains('Return to Home', { timeout: 60000 });
cy.logout();
};
//Check if the process instance is completed successfully
const checkProcessInstanceCompleted = (
username,
password,
processInstanceId
//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(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.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.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Equipment Path - Without Files
@ -253,11 +254,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
cy.log('=====after logout ---');
@ -382,11 +384,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -509,11 +512,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -663,11 +667,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -777,11 +782,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -891,11 +897,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1022,11 +1029,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1149,11 +1157,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1276,11 +1285,12 @@ describe.only('Equipment Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1519,11 +1529,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1696,11 +1706,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1872,11 +1882,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2076,11 +2086,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2240,11 +2250,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2403,11 +2413,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2583,11 +2593,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2759,11 +2769,11 @@ describe('Equipment Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2935,12 +2945,12 @@ describe('Equipment Path - With Files', () => {
.contains(/^Submit$/)
.click();
cy.wait(20000);
cy.get('button')
cy.wait(9000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);

View File

@ -105,11 +105,12 @@ describe.only('Initiate a Request - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -192,11 +193,12 @@ describe.only('Initiate a Request - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -329,11 +331,12 @@ describe.only('Initiate a Request - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -723,11 +726,12 @@ describe.only('Initiate a Request - Without Files', () => {
.contains(/^Cancel Request$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
});
});
@ -836,11 +840,12 @@ describe.only('Initiate a Request - Without Files', () => {
.contains(/^Cancel Request$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
});
});
@ -1197,11 +1202,12 @@ describe('Form validation', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -1311,11 +1317,12 @@ describe('Form validation', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -1480,11 +1487,12 @@ describe('Initiate a Request - With Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -1659,11 +1667,12 @@ describe('Initiate a Request - With Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -1850,11 +1859,12 @@ describe('Initiate a Request - With Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
});
@ -1991,11 +2001,10 @@ describe('Initiate a Request - With Files', () => {
.contains(/^Save and Close$/)
.click();
cy.wait(3000);
// cy.get('button')
// .contains(/^Return to Home$/)
// .click();
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.logout();
@ -2156,11 +2165,12 @@ describe('Initiate a Request - With Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
});
});

View File

@ -84,32 +84,33 @@ const submitWithUser = (
// .click();
// }
cy.get('button').contains('Return to Home', { timeout: 60000 });
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
//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(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.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.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
// Learning and Development Path - Without Files
@ -203,11 +204,12 @@ describe.only('Learning and Development Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -317,11 +319,12 @@ describe.only('Learning and Development Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -431,11 +434,12 @@ describe.only('Learning and Development Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -592,11 +596,12 @@ describe.only('Learning and Development Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -719,11 +724,12 @@ describe.only('Learning and Development Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -833,11 +839,12 @@ describe.only('Learning and Development Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -871,7 +878,7 @@ describe.only('Learning and Development Path - Without Files', () => {
'Task: Reminder: Check Existing Budget',
'approve'
);
const peopleOpsUsername = Cypress.env('peopleopssme_username');
const peopleOpsPassword = Cypress.env('peopleopssme_password');
cy.log(`=====peopleOpsUsername : ${peopleOpsUsername}`);
@ -884,6 +891,7 @@ describe.only('Learning and Development Path - Without Files', () => {
null,
'approve'
);
checkProcessInstanceCompleted(username, password, processInstanceId);
});
});
@ -1034,11 +1042,11 @@ describe('Learning and Development Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1199,11 +1207,11 @@ describe('Learning and Development Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1363,11 +1371,11 @@ describe('Learning and Development Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1575,11 +1583,11 @@ describe('Learning and Development Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1753,11 +1761,11 @@ describe('Learning and Development Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1918,11 +1926,11 @@ describe('Learning and Development Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);

View File

@ -84,34 +84,35 @@ const submitWithUser = (
// .click();
// }
cy.get('button').contains('Return to Home', { timeout: 60000 });
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
//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(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.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.get('button')
.contains(/^Submit$/)
.click();
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
cy.wait(2000);
cy.get('#tag-1 > span').contains('complete');
}
describe.only('Other Fees Path - Without Files', () => {
describe('Other Fees Path - Without Files', () => {
Cypress._.times(1, () => {
// Budget owner approves the request
it('Budget owner approves', () => {
@ -216,11 +217,12 @@ describe.only('Other Fees Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -331,11 +333,12 @@ describe.only('Other Fees Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -446,11 +449,12 @@ describe.only('Other Fees Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -491,7 +495,7 @@ describe.only('Other Fees Path - Without Files', () => {
});
});
describe('Other Fees Path - With Files', () => {
describe.only('Other Fees Path - With Files', () => {
Cypress._.times(1, () => {
// Budget owner approves the request
it('Budget owner approves', () => {
@ -646,12 +650,12 @@ describe('Other Fees Path - With Files', () => {
.contains(/^Submit$/)
.click();
cy.wait(20000);
cy.get('button')
cy.wait(9000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -813,11 +817,11 @@ describe('Other Fees Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);
@ -979,11 +983,11 @@ describe('Other Fees Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(1000);

View File

@ -78,42 +78,43 @@ const submitWithUser = (
if (expectAdditionalApprovalInfoPage === 'Task: Update Application Landscape') {
cy.contains(expectAdditionalApprovalInfoPage, { timeout: 60000 });
cy.get('button')
.contains(/^Continue$/)
.click();
}
cy.wait(5000);
// cy.getBySel('return-to-home-button', { timeout: 60000 });
cy.get('button').contains('Return to Home', { timeout: 60000 });
//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');
}
//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');
}
// Software and Licenses Path - Without Files
describe.only('Software and Licenses Path - Without Files', () => {
describe('Software and Licenses Path - Without Files', () => {
Cypress._.times(1, () => {
// Everyone approves with CP
it('Everyone approves with CP', () => {
@ -205,11 +206,12 @@ describe.only('Software and Licenses Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -329,7 +331,7 @@ describe.only('Software and Licenses Path - Without Files', () => {
);
cy.get('#root_item_1_qty').clear().type('1');
cy.get('#root_item_1_currency_type').select('Fiat');
cy.get('#root_item_1_currency').select('STN');
cy.get('#root_item_1_currency').select('COP');
cy.get('#root_item_1_unit_price').type('380');
cy.get('button')
@ -355,11 +357,12 @@ describe.only('Software and Licenses Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -421,7 +424,7 @@ describe.only('Software and Licenses Path - Without Files', () => {
});
// Budget owner rejects the request
it.only('Budget owner rejects', () => {
it('Budget owner rejects', () => {
const username = Cypress.env('requestor_username');
const password = Cypress.env('requestor_password');
cy.log(`=====username : ${username}`);
@ -510,7 +513,7 @@ describe.only('Software and Licenses Path - Without Files', () => {
.contains(/^Return to Home$/)
.click();
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -616,11 +619,12 @@ describe.only('Software and Licenses Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -765,11 +769,12 @@ describe.only('Software and Licenses Path - Without Files', () => {
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -825,7 +830,7 @@ describe.only('Software and Licenses Path - Without Files', () => {
});
// Software and Licenses Path - Without Files and with only mandatory fields
describe('Software and Licenses Path - Without Files and with only mandatory fields', () => {
describe.only('Software and Licenses Path - Without Files and with only mandatory fields', () => {
Cypress._.times(1, () => {
// Everyone approves with CP
it('Everyone approves with CP', () => {
@ -901,11 +906,12 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -1024,11 +1030,12 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -1163,11 +1170,12 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -1261,11 +1269,12 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -1398,11 +1407,12 @@ describe('Software and Licenses Path - Without Files and with only mandatory fi
.contains(/^Submit$/)
.click();
cy.get('button')
cy.wait(6000);
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -1612,11 +1622,11 @@ describe('Software and Licenses Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -1801,11 +1811,11 @@ describe('Software and Licenses Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2006,11 +2016,11 @@ describe('Software and Licenses Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2171,11 +2181,11 @@ describe('Software and Licenses Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2299,7 +2309,7 @@ describe('Software and Licenses Path - With Files', () => {
);
cy.get('#root_item_0_qty').clear().type('2');
cy.get('#root_item_0_currency_type').select('Fiat');
cy.get('#root_item_0_currency').select('STN');
cy.get('#root_item_0_currency').select('COP');
cy.get('#root_item_0_unit_price').type('2416');
cy.get('button')
@ -2376,11 +2386,11 @@ describe('Software and Licenses Path - With Files', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2610,11 +2620,11 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -2830,11 +2840,11 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -3067,11 +3077,11 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
cy.wait(2000);
@ -3262,11 +3272,11 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');
@ -3371,12 +3381,12 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
cy.get('body').click();
cy.get('#root_vendor').clear().type('Atlassian');
cy.get('#root_payment_method').select('Debit Card');
/*cy.get('button')
.contains(/^Submit$/)
.click();
cy.contains('Task: Enter NDR Items', { timeout: 60000 });*/
/* cy.get('button')
.contains(/^Submit$/)
.click();
cy.contains('Task: Enter NDR Items', { timeout: 60000 });*/
// item 0
cy.get('#root_item_0_sub_category').select('op_src');
cy.get('#root_item_0_item_name')
@ -3386,7 +3396,7 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
);
cy.get('#root_item_0_qty').clear().type('2');
cy.get('#root_item_0_currency_type').select('Fiat');
cy.get('#root_item_0_currency').select('THB');
cy.get('#root_item_0_currency').select('GBP');
cy.get('#root_item_0_unit_price').type('1350');
cy.get('#root_item > div:nth-child(3) > p > button').click();
@ -3400,7 +3410,7 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
);
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('TRY');
cy.get('#root_item_1_currency').select('SGD');
cy.get('#root_item_1_unit_price').type('3200');
cy.get('#root_item > div:nth-child(3) > p > button').click();
@ -3491,11 +3501,11 @@ describe('Software and Licenses Path - With Files and Multiple items', () => {
.click();
cy.wait(9000);
cy.get('button')
/*cy.get('button')
.contains(/^Return to Home$/)
.click();
.click();*/
cy.contains('Started by me', { timeout: 60000 });
cy.contains('Process Instance Id:', { timeout: 60000 });
cy.logout();
const budgetOwnerUsername = Cypress.env('budgetowner_username');

View File

@ -490,6 +490,7 @@ export default function ProcessInstanceListTable({
HttpService.makeCallToBackend({
path: `/process-instances/report-metadata${queryParamString}`,
successCallback: getProcessInstances,
onUnauthorized: stopRefreshing,
});
} else {
getProcessInstances();
@ -542,6 +543,7 @@ export default function ProcessInstanceListTable({
permissionsLoaded,
reportIdentifier,
searchParams,
stopRefreshing,
]);
const processInstanceReportSaveTag = () => {

View File

@ -49,7 +49,6 @@ export default function ProcessInterstitial({
}
},
onclose() {
console.log('The state is closed.');
setState('CLOSED');
},
});
@ -161,7 +160,7 @@ export default function ProcessInterstitial({
/** In the event there is no task information and the connection closed,
* redirect to the home page. */
if (state === 'CLOSED' && lastTask === null) {
if (state === 'CLOSED' && lastTask === null && allowRedirect) {
navigate(`/tasks`);
}

View File

@ -105,7 +105,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
[`${targetUris.processInstanceTerminatePath}`]: ['POST'],
[targetUris.processInstanceResetPath]: ['POST'],
[targetUris.messageInstanceListPath]: ['GET'],
[targetUris.processInstanceActionPath]: ['DELETE'],
[targetUris.processInstanceActionPath]: ['DELETE', 'GET'],
[targetUris.processInstanceLogListPath]: ['GET'],
[targetUris.processInstanceTaskDataPath]: ['GET', 'PUT'],
[targetUris.processInstanceSendEventPath]: ['POST'],
@ -125,8 +125,9 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
let processInstanceShowPageBaseUrl = `/admin/process-instances/for-me/${params.process_model_id}/${params.process_instance_id}`;
let processInstanceLogListPageBaseUrl = `/admin/logs/for-me/${params.process_model_id}/${params.process_instance_id}`;
const processInstanceShowPageBaseUrlAllVariant = `/admin/process-instances/${params.process_model_id}/${params.process_instance_id}`;
if (variant === 'all') {
processInstanceShowPageBaseUrl = `/admin/process-instances/${params.process_model_id}/${params.process_instance_id}`;
processInstanceShowPageBaseUrl = processInstanceShowPageBaseUrlAllVariant;
processInstanceLogListPageBaseUrl = `/admin/logs/${params.process_model_id}/${params.process_instance_id}`;
}
@ -209,9 +210,33 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
});
};
const queryParams = () => {
const processIdentifier = searchParams.get('process_identifier');
const callActivityTaskId = searchParams.get('bpmn_process_guid');
const queryParamArray = [];
if (processIdentifier) {
queryParamArray.push(`process_identifier=${processIdentifier}`);
}
if (callActivityTaskId) {
queryParamArray.push(`bpmn_process_guid=${callActivityTaskId}`);
}
let queryParamString = '';
if (queryParamArray.length > 0) {
queryParamString = `?${queryParamArray.join('&')}`;
}
return queryParamString;
};
// to force update the diagram since it could have changed
const refreshPage = () => {
window.location.reload();
// redirect to the all variant page if possible to avoid potential user/task association issues.
// such as terminating a process instance with a task that the current user is assigned to which
// will remove the task assigned to them and could potentially remove that users association to the process instance
if (ability.can('GET', targetUris.processInstanceActionPath)) {
window.location.href = `${processInstanceShowPageBaseUrlAllVariant}${queryParams()}`;
} else {
window.location.reload();
}
};
const terminateProcessInstance = () => {
@ -252,23 +277,6 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
return !taskToTimeTravelTo;
};
const queryParams = () => {
const processIdentifier = searchParams.get('process_identifier');
const callActivityTaskId = searchParams.get('bpmn_process_guid');
const queryParamArray = [];
if (processIdentifier) {
queryParamArray.push(`process_identifier=${processIdentifier}`);
}
if (callActivityTaskId) {
queryParamArray.push(`bpmn_process_guid=${callActivityTaskId}`);
}
let queryParamString = '';
if (queryParamArray.length > 0) {
queryParamString = `?${queryParamArray.join('&')}`;
}
return queryParamString;
};
const completionViewLink = (label: any, taskGuid: string) => {
return (
<Link

View File

@ -100,9 +100,11 @@ export default function TaskShow() {
const { addError, removeError } = useAPIError();
// if a user can complete a task then the for-me page should
// always work for them so use that since it will work in all cases
const navigateToInterstitial = (myTask: Task) => {
navigate(
`/admin/process-instances/${modifyProcessIdentifierForPathParam(
`/admin/process-instances/for-me/${modifyProcessIdentifierForPathParam(
myTask.process_model_identifier
)}/${myTask.process_instance_id}/interstitial`
);