fixed cypress tests

This commit is contained in:
jasquat 2022-11-23 09:38:45 -05:00
parent 0f9266e80a
commit 76050f602f
4 changed files with 40 additions and 44 deletions

View File

@ -19,18 +19,12 @@ describe('process-groups', () => {
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(`Process Group: ${groupDisplayName}`);
cy.contains('Edit process group').click();
cy.getBySel('edit-process-group-button').click();
cy.get('input[name=display_name]').clear().type(newGroupDisplayName);
cy.contains('Submit').click();
cy.contains(`Process Group: ${newGroupDisplayName}`);
cy.contains('Edit process group').click();
cy.get('input[name=display_name]').should(
'have.value',
newGroupDisplayName
);
cy.contains('Delete').click();
cy.getBySel('delete-process-group-button').click();
cy.contains('Are you sure');
cy.getBySel('delete-process-group-button-modal-confirmation-dialog')
.find('.cds--btn--danger')

View File

@ -1,4 +1,4 @@
import { modifyProcessModelPath } from '../../src/helpers';
import { modifyProcessIdentifierForPathParam } from '../../src/helpers';
describe('process-models', () => {
beforeEach(() => {
@ -16,25 +16,22 @@ describe('process-models', () => {
const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`;
const newModelDisplayName = `${modelDisplayName} edited`;
cy.contains('Misc').click();
cy.contains('99-Shared Resources').click();
cy.wait(500);
cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName);
cy.url().should(
'include',
`process-models/${modifyProcessModelPath(groupId)}:${modelId}`
`process-models/${modifyProcessIdentifierForPathParam(
groupId
)}:${modelId}`
);
cy.contains(`Process Model: ${modelDisplayName}`);
cy.contains('Edit process model').click();
cy.getBySel('edit-process-model-button').click();
cy.get('input[name=display_name]').clear().type(newModelDisplayName);
cy.contains('Submit').click();
cy.contains(`Process Model: ${groupId}/${modelId}`);
cy.contains('Submit').click();
cy.get('input[name=display_name]').should(
'have.value',
newModelDisplayName
);
cy.contains(`Process Model: ${newModelDisplayName}`);
// go back to process model show by clicking on the breadcrumb
cy.contains(modelId).click();
@ -46,7 +43,7 @@ describe('process-models', () => {
.click();
cy.url().should(
'include',
`process-groups/${modifyProcessModelPath(groupId)}`
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
);
cy.contains(modelId).should('not.exist');
});
@ -64,15 +61,17 @@ describe('process-models', () => {
const dmnFileName = `dmn_test_file_${id}`;
const jsonFileName = `json_test_file_${id}`;
cy.contains('Misc').click();
cy.contains('99-Shared Resources').click();
cy.wait(500);
cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName);
cy.contains(directParentGroupId).click();
cy.contains(modelId).click();
cy.contains(modelDisplayName).click();
cy.url().should(
'include',
`process-models/${modifyProcessModelPath(groupId)}:${modelId}`
`process-models/${modifyProcessIdentifierForPathParam(
groupId
)}:${modelId}`
);
cy.contains(`Process Model: ${modelDisplayName}`);
cy.contains(`${bpmnFileName}.bpmn`).should('not.exist');
@ -135,8 +134,12 @@ describe('process-models', () => {
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
.find('.cds--btn--danger')
.click();
cy.url().should('include', `process-groups/${modifyProcessModelPath(groupId)}`);
cy.url().should(
'include',
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
);
cy.contains(modelId).should('not.exist');
cy.contains(modelDisplayName).should('not.exist');
});
it('can upload and run a bpmn file', () => {
@ -148,17 +151,19 @@ describe('process-models', () => {
const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`;
cy.contains('Add a process group');
cy.contains('Misc').click();
cy.contains('99-Shared Resources').click();
cy.wait(500);
cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName);
cy.contains(`${directParentGroupId}`).click();
cy.contains('Add a process model');
cy.contains(modelId).click();
cy.contains(modelDisplayName).click();
cy.url().should(
'include',
`process-models/${modifyProcessModelPath(groupId)}:${modelId}`
`process-models/${modifyProcessIdentifierForPathParam(
groupId
)}:${modelId}`
);
cy.contains(`Process Model: ${modelDisplayName}`);
@ -190,17 +195,19 @@ describe('process-models', () => {
.click();
cy.url().should(
'include',
`process-groups/${modifyProcessModelPath(groupId)}`
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
);
cy.contains(modelId).should('not.exist');
cy.contains(modelDisplayName).should('not.exist');
});
it('can paginate items', () => {
cy.contains('Misc').click();
cy.wait(500);
cy.contains('Acceptance Tests Group One').click();
cy.basicPaginationTest();
});
// process models no longer has pagination post-tiles
// it.only('can paginate items', () => {
// cy.contains('99-Shared Resources').click();
// cy.wait(500);
// cy.contains('Acceptance Tests Group One').click();
// cy.basicPaginationTest();
// });
it('can allow searching for model', () => {
cy.getBySel('process-model-selection').click().type('model-3');

View File

@ -1,5 +1,5 @@
import { string } from 'prop-types';
import { modifyProcessModelPath } from '../../src/helpers';
import { modifyProcessIdentifierForPathParam } from '../../src/helpers';
// ***********************************************
// This example commands.js shows you how to
@ -78,8 +78,7 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => {
cy.url().should(
'include',
`process-models/${modifyProcessModelPath(groupId)}:${modelId}`
// `process-models/${groupId}:${modelId}`
`process-models/${modifyProcessIdentifierForPathParam(groupId)}:${modelId}`
);
cy.contains(`Process Model: ${modelDisplayName}`);
});
@ -104,12 +103,12 @@ Cypress.Commands.add(
'navigateToProcessModel',
(groupDisplayName, modelDisplayName, modelIdentifier) => {
cy.navigateToAdmin();
cy.contains('Misc').click();
cy.contains(`Process Group: 99-Misc`, { timeout: 10000 });
cy.contains('99-Shared Resources').click();
cy.contains(`Process Group: 99-Shared Resources`, { timeout: 10000 });
cy.contains(groupDisplayName).click();
cy.contains(`Process Group: ${groupDisplayName}`);
// https://stackoverflow.com/q/51254946/6090676
cy.getBySel('process-model-show-link').contains(modelIdentifier).click();
cy.getBySel('process-model-show-link').contains(modelDisplayName).click();
cy.contains(`Process Model: ${modelDisplayName}`);
}
);
@ -133,8 +132,3 @@ Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => {
Cypress.Commands.add('assertNoItemInPaginatedResults', () => {
cy.contains(/\b00 of 0 items/);
});
Cypress.Commands.add('modifyProcessModelPath', (path) => {
path.replace('/', ':');
return path;
});

View File

@ -79,6 +79,7 @@ export default function ProcessModelListTiles({
<div className="tile-process-group-content-container">
<div className="tile-title-top">
<a
data-qa="process-model-show-link"
href={`/admin/process-models/${modifyProcessIdentifierForPathParam(
row.id
)}`}