fixed cypress tests w/ burnettk

This commit is contained in:
jasquat 2023-05-01 14:54:11 -04:00
parent 7e3ad411e4
commit ca8af1bce0
6 changed files with 37 additions and 53 deletions

View File

@ -161,7 +161,7 @@ describe('process-instances', () => {
cy.getBySel('process-instance-list-link').click(); cy.getBySel('process-instance-list-link').click();
cy.getBySel('process-instance-show-link-id').first().click(); cy.getBySel('process-instance-show-link-id').first().click();
cy.getBySel('process-instance-log-list-link').click(); cy.getBySel('process-instance-log-list-link').click();
cy.getBySel('process-instance-log-detailed').click(); cy.getBySel('process-instance-log-events').click();
cy.contains('process_model_one'); cy.contains('process_model_one');
cy.contains('task_completed'); cy.contains('task_completed');
cy.basicPaginationTest(); cy.basicPaginationTest();

View File

@ -1,9 +1,6 @@
import { slowCypressDown } from 'cypress-slow-down';
import { modifyProcessIdentifierForPathParam } from '../../src/helpers'; import { modifyProcessIdentifierForPathParam } from '../../src/helpers';
import { miscDisplayName } from '../support/helpers'; import { miscDisplayName } from '../support/helpers';
// slowCypressDown(500);
describe('process-models', () => { describe('process-models', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
@ -15,7 +12,7 @@ describe('process-models', () => {
const groupDisplayName = 'Acceptance Tests Group One'; const groupDisplayName = 'Acceptance Tests Group One';
const deleteProcessModelButtonId = 'delete-process-model-button'; const deleteProcessModelButtonId = 'delete-process-model-button';
const saveChangesButtonText = 'Save Changes'; const saveChangesButtonText = 'Save Changes';
const fileNameInputSelector = 'input[name=file_name]'; const fileNameInputSelector = 'input#process_model_file_name';
it('can perform crud operations', () => { it('can perform crud operations', () => {
const uuid = () => Cypress._.random(0, 1e6); const uuid = () => Cypress._.random(0, 1e6);
@ -36,7 +33,8 @@ describe('process-models', () => {
cy.contains(`Process Model: ${modelDisplayName}`); cy.contains(`Process Model: ${modelDisplayName}`);
cy.getBySel('edit-process-model-button').click(); cy.getBySel('edit-process-model-button').click();
cy.get('input[name=display_name]').clear().type(newModelDisplayName); cy.get('input[name=display_name]').clear();
cy.get('input[name=display_name]').type(newModelDisplayName);
cy.contains('Submit').click(); cy.contains('Submit').click();
cy.contains(`Process Model: ${newModelDisplayName}`); cy.contains(`Process Model: ${newModelDisplayName}`);
@ -50,7 +48,6 @@ describe('process-models', () => {
const uuid = () => Cypress._.random(0, 1e6); const uuid = () => Cypress._.random(0, 1e6);
const id = uuid(); const id = uuid();
const directParentGroupId = 'acceptance-tests-group-one'; const directParentGroupId = 'acceptance-tests-group-one';
const directParentGroupName = 'Acceptance Tests Group One';
const groupId = `misc/${directParentGroupId}`; const groupId = `misc/${directParentGroupId}`;
const modelDisplayName = `Test Model 2 ${id}`; const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`; const modelId = `test-model-2-${id}`;
@ -58,7 +55,7 @@ describe('process-models', () => {
const bpmnFileName = `bpmn_test_file_${id}`; const bpmnFileName = `bpmn_test_file_${id}`;
const dmnFileName = `dmn_test_file_${id}`; const dmnFileName = `dmn_test_file_${id}`;
const jsonFileName = `json_test_file_${id}`; const jsonFileName = `json_test_file_${id}`;
const decision_acceptance_test_id = `decision_acceptance_test_${id}`; const decisionAcceptanceTestId = `decision_acceptance_test_${id}`;
cy.contains(miscDisplayName).click(); cy.contains(miscDisplayName).click();
cy.contains(groupDisplayName).click(); cy.contains(groupDisplayName).click();
@ -79,9 +76,10 @@ describe('process-models', () => {
// add new bpmn file // add new bpmn file
cy.contains('New BPMN File').click(); cy.contains('New BPMN File').click();
cy.contains(/^Process Model File$/); cy.contains(/^Process Model File$/);
cy.get('g[data-element-id=StartEvent_1]').click().should('exist'); cy.get('g[data-element-id=StartEvent_1]').click();
cy.contains('General').click(); cy.contains('General').click();
cy.get('#bio-properties-panel-name').clear().type('Start Event Name'); cy.get('#bio-properties-panel-name').clear();
cy.get('#bio-properties-panel-name').type('Start Event Name');
cy.wait(500); cy.wait(500);
cy.contains('Save').click(); cy.contains('Save').click();
cy.contains('Start Event Name'); cy.contains('Start Event Name');
@ -96,11 +94,10 @@ describe('process-models', () => {
// add new dmn file // add new dmn file
cy.contains('New DMN File').click(); cy.contains('New DMN File').click();
cy.contains(/^Process Model File$/); cy.contains(/^Process Model File$/);
cy.get('g[data-element-id=decision_1]').click().should('exist'); cy.get('g[data-element-id=decision_1]').click();
cy.contains('General').click(); cy.contains('General').click();
cy.get('#bio-properties-panel-id') cy.get('#bio-properties-panel-id').clear();
.clear() cy.get('#bio-properties-panel-id').type(decisionAcceptanceTestId);
.type(decision_acceptance_test_id);
cy.contains('General').click(); cy.contains('General').click();
cy.contains('Save').click(); cy.contains('Save').click();
cy.get(fileNameInputSelector).type(dmnFileName); cy.get(fileNameInputSelector).type(dmnFileName);
@ -135,7 +132,7 @@ describe('process-models', () => {
cy.get('.tile-process-group-content-container').should('exist'); cy.get('.tile-process-group-content-container').should('exist');
}); });
it.only('can upload and run a bpmn file', () => { it('can upload and run a bpmn file', () => {
const uuid = () => Cypress._.random(0, 1e6); const uuid = () => Cypress._.random(0, 1e6);
const id = uuid(); const id = uuid();
const directParentGroupId = 'acceptance-tests-group-one'; const directParentGroupId = 'acceptance-tests-group-one';
@ -192,7 +189,8 @@ describe('process-models', () => {
}); });
it('can allow searching for model', () => { it('can allow searching for model', () => {
cy.getBySel('process-model-selection').click().type('model-3'); cy.getBySel('process-model-selection').click();
cy.getBySel('process-model-selection').type('model-3');
cy.contains('acceptance-tests-group-one/acceptance-tests-model-3').click(); cy.contains('acceptance-tests-group-one/acceptance-tests-model-3').click();
cy.contains('Acceptance Tests Model 3'); cy.contains('Acceptance Tests Model 3');
}); });

View File

@ -1,13 +1,14 @@
const submitInputIntoFormField = (taskName, fieldKey, fieldValue) => { const submitInputIntoFormField = (taskName, fieldKey, fieldValue) => {
cy.contains(`Task: ${taskName}`, { timeout: 10000 }); cy.contains(`Task: ${taskName}`, { timeout: 10000 });
cy.get(fieldKey).clear().type(fieldValue); cy.get(fieldKey).clear();
cy.get(fieldKey).type(fieldValue);
cy.contains('Submit').click(); cy.contains('Submit').click();
}; };
const checkFormFieldIsReadOnly = (formName, fieldKey) => { // const checkFormFieldIsReadOnly = (formName, fieldKey) => {
cy.contains(`Task: ${formName}`); // cy.contains(`Task: ${formName}`);
cy.get(fieldKey).invoke('attr', 'disabled').should('exist'); // cy.get(fieldKey).invoke('attr', 'disabled').should('exist');
}; // };
const checkTaskHasClass = (taskName, className) => { const checkTaskHasClass = (taskName, className) => {
cy.get(`g[data-element-id=${taskName}]`).should('have.class', className); cy.get(`g[data-element-id=${taskName}]`).should('have.class', className);
@ -38,38 +39,26 @@ describe('tasks', () => {
cy.navigateToProcessModel(groupDisplayName, modelDisplayName); cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
cy.runPrimaryBpmnFile(true); cy.runPrimaryBpmnFile(true);
submitInputIntoFormField( submitInputIntoFormField('get_form_num_one', '#root_form_num_1', 2);
'get_user_generated_number_one', submitInputIntoFormField('get_form_num_two', '#root_form_num_2', 3);
'#root_user_generated_number_1',
2
);
submitInputIntoFormField(
'get_user_generated_number_two',
'#root_user_generated_number_2',
3
);
cy.contains('Task: get_user_generated_number_three'); cy.contains('Task: get_form_num_three');
// TODO: remove this if we decide to completely kill form navigation // TODO: remove this if we decide to completely kill form navigation
// cy.getBySel('form-nav-form2').click(); // cy.getBySel('form-nav-form2').click();
// checkFormFieldIsReadOnly( // checkFormFieldIsReadOnly(
// 'get_user_generated_number_two', // 'get_form_num_two',
// '#root_user_generated_number_2' // '#root_form_num_2'
// ); // );
// cy.getBySel('form-nav-form1').click(); // cy.getBySel('form-nav-form1').click();
// checkFormFieldIsReadOnly( // checkFormFieldIsReadOnly(
// 'get_user_generated_number_one', // 'get_form_num_one',
// '#root_user_generated_number_1' // '#root_form_num_1'
// ); // );
// //
// cy.getBySel('form-nav-form3').click(); // cy.getBySel('form-nav-form3').click();
submitInputIntoFormField( submitInputIntoFormField('get_form_num_three', '#root_form_num_3', 4);
'get_user_generated_number_three',
'#root_user_generated_number_3',
4
);
cy.contains('Task: get_user_generated_number_four'); cy.contains('Task: get_form_num_four');
cy.navigateToProcessModel(groupDisplayName, modelDisplayName); cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
cy.getBySel('process-instance-list-link').click(); cy.getBySel('process-instance-list-link').click();
cy.assertAtLeastOneItemInPaginatedResults(); cy.assertAtLeastOneItemInPaginatedResults();
@ -79,10 +68,10 @@ describe('tasks', () => {
cy.contains('Process Instance Id: '); cy.contains('Process Instance Id: ');
cy.get(`g[data-element-id=form3]`).click(); cy.get(`g[data-element-id=form3]`).click();
cy.contains('"user_generated_number_1": 2'); cy.contains('"form_num_1": 2');
cy.contains('"user_generated_number_2": 3'); cy.contains('"form_num_2": 3');
cy.contains('"user_generated_number_3": 4'); cy.contains('"form_num_3": 4');
cy.contains('"user_generated_number_4": 5').should('not.exist'); cy.contains('"form_num_4": 5').should('not.exist');
checkTaskHasClass('form1', completedTaskClassName); checkTaskHasClass('form1', completedTaskClassName);
checkTaskHasClass('form2', completedTaskClassName); checkTaskHasClass('form2', completedTaskClassName);
checkTaskHasClass('form3', completedTaskClassName); checkTaskHasClass('form3', completedTaskClassName);
@ -97,11 +86,7 @@ describe('tasks', () => {
// FIXME: this will probably need a better way to link to the proper form that we want // FIXME: this will probably need a better way to link to the proper form that we want
cy.contains('Go').click(); cy.contains('Go').click();
submitInputIntoFormField( submitInputIntoFormField('get_form_num_four', '#root_form_num_4', 5);
'get_user_generated_number_four',
'#root_user_generated_number_4',
5
);
cy.url().should('include', '/tasks'); cy.url().should('include', '/tasks');
cy.navigateToProcessModel(groupDisplayName, modelDisplayName); cy.navigateToProcessModel(groupDisplayName, modelDisplayName);

View File

@ -1692,7 +1692,7 @@ export default function ProcessInstanceListTable({
data-qa="process-instance-list-link" data-qa="process-instance-list-link"
kind="ghost" kind="ghost"
renderIcon={ArrowRight} renderIcon={ArrowRight}
iconDescription="Go to Filterable List" iconDescription="View Filterable List"
hasIconOnly hasIconOnly
size="lg" size="lg"
onClick={() => onClick={() =>

View File

@ -494,7 +494,7 @@ export default function ProcessInstanceLogList({ variant }: OwnProps) {
<TabList aria-label="List of tabs"> <TabList aria-label="List of tabs">
<Tab <Tab
title="Only show a subset of the logs, and show fewer columns" title="Only show a subset of the logs, and show fewer columns"
data-qa="process-instance-log-simple" data-qa="process-instance-log-milestones"
onClick={() => { onClick={() => {
resetFilters(); resetFilters();
searchParams.set('events', 'false'); searchParams.set('events', 'false');

View File

@ -174,6 +174,7 @@ export default function ReactFormEditor() {
<span> <span>
<input <input
name="file_name" name="file_name"
id="process_model_file_name"
type="text" type="text"
value={newFileName} value={newFileName}
onChange={(e) => setNewFileName(e.target.value)} onChange={(e) => setNewFileName(e.target.value)}