Merge pull request #93 from sartography/bug/cypress-tests

Bug/cypress tests
This commit is contained in:
Kevin Burnett 2023-01-04 18:22:53 -08:00 committed by GitHub
commit 3420f7b416
3 changed files with 38 additions and 48 deletions

View File

@ -9,16 +9,19 @@ describe('process-models', () => {
cy.logout(); cy.logout();
}); });
const groupDisplayName = 'Acceptance Tests Group One';
const deleteProcessModelButtonId = 'delete-process-model-button';
const saveChangesButtonText = 'Save Changes';
const fileNameInputSelector = 'input[name=file_name]';
it('can perform crud operations', () => { it('can perform crud operations', () => {
const uuid = () => Cypress._.random(0, 1e6); const uuid = () => Cypress._.random(0, 1e6);
const id = uuid(); const id = uuid();
const groupId = 'misc/acceptance-tests-group-one'; const groupId = 'misc/acceptance-tests-group-one';
const groupDisplayName = 'Acceptance Tests Group One';
const modelDisplayName = `Test Model 2 ${id}`; const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`; const modelId = `test-model-2-${id}`;
const newModelDisplayName = `${modelDisplayName} edited`; const newModelDisplayName = `${modelDisplayName} edited`;
cy.contains(miscDisplayName).click(); cy.contains(miscDisplayName).click();
cy.wait(500);
cy.contains(groupDisplayName).click(); cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName); cy.createModel(groupId, modelId, modelDisplayName);
cy.url().should( cy.url().should(
@ -34,18 +37,8 @@ describe('process-models', () => {
cy.contains('Submit').click(); cy.contains('Submit').click();
cy.contains(`Process Model: ${newModelDisplayName}`); cy.contains(`Process Model: ${newModelDisplayName}`);
// go back to process model show by clicking on the breadcrumb cy.deleteProcessModelAndConfirm(deleteProcessModelButtonId, groupId);
cy.contains(modelDisplayName).click();
cy.getBySel('delete-process-model-button').click();
cy.contains('Are you sure');
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
.find('.cds--btn--danger')
.click();
cy.url().should(
'include',
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
);
cy.contains(modelId).should('not.exist'); cy.contains(modelId).should('not.exist');
cy.contains(modelDisplayName).should('not.exist'); cy.contains(modelDisplayName).should('not.exist');
}); });
@ -54,17 +47,17 @@ 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 groupDisplayName = 'Acceptance Tests Group One';
const modelDisplayName = `Test Model 2 ${id}`; const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`; const modelId = `test-model-2-${id}`;
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}`;
cy.contains(miscDisplayName).click(); cy.contains(miscDisplayName).click();
cy.wait(500);
cy.contains(groupDisplayName).click(); cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName); cy.createModel(groupId, modelId, modelDisplayName);
cy.contains(groupDisplayName).click(); cy.contains(groupDisplayName).click();
@ -89,8 +82,8 @@ describe('process-models', () => {
cy.wait(500); cy.wait(500);
cy.contains('Save').click(); cy.contains('Save').click();
cy.contains('Start Event Name'); cy.contains('Start Event Name');
cy.get('input[name=file_name]').type(bpmnFileName); cy.get(fileNameInputSelector).type(bpmnFileName);
cy.contains('Save Changes').click(); cy.contains(saveChangesButtonText).click();
cy.contains(`Process Model File: ${bpmnFileName}`); cy.contains(`Process Model File: ${bpmnFileName}`);
cy.contains(modelDisplayName).click(); cy.contains(modelDisplayName).click();
cy.contains(`Process Model: ${modelDisplayName}`); cy.contains(`Process Model: ${modelDisplayName}`);
@ -104,11 +97,11 @@ describe('process-models', () => {
cy.contains('General').click(); cy.contains('General').click();
cy.get('#bio-properties-panel-id') cy.get('#bio-properties-panel-id')
.clear() .clear()
.type('decision_acceptance_test_1'); .type(decision_acceptance_test_id);
cy.contains('General').click(); cy.contains('General').click();
cy.contains('Save').click(); cy.contains('Save').click();
cy.get('input[name=file_name]').type(dmnFileName); cy.get(fileNameInputSelector).type(dmnFileName);
cy.contains('Save Changes').click(); cy.contains(saveChangesButtonText).click();
cy.contains(`Process Model File: ${dmnFileName}`); cy.contains(`Process Model File: ${dmnFileName}`);
cy.contains(modelDisplayName).click(); cy.contains(modelDisplayName).click();
cy.contains(`Process Model: ${modelDisplayName}`); cy.contains(`Process Model: ${modelDisplayName}`);
@ -121,8 +114,8 @@ describe('process-models', () => {
// Some reason, cypress evals json strings so we have to escape it it with '{{}' // Some reason, cypress evals json strings so we have to escape it it with '{{}'
cy.get('.view-line').type('{{} "test_key": "test_value" }'); cy.get('.view-line').type('{{} "test_key": "test_value" }');
cy.getBySel('file-save-button').click(); cy.getBySel('file-save-button').click();
cy.get('input[name=file_name]').type(jsonFileName); cy.get(fileNameInputSelector).type(jsonFileName);
cy.contains('Save Changes').click(); cy.contains(saveChangesButtonText).click();
cy.contains(`Process Model File: ${jsonFileName}`); cy.contains(`Process Model File: ${jsonFileName}`);
// wait for json to load before clicking away to avoid network errors // wait for json to load before clicking away to avoid network errors
cy.wait(500); cy.wait(500);
@ -131,15 +124,7 @@ describe('process-models', () => {
// cy.getBySel('files-accordion').click(); // cy.getBySel('files-accordion').click();
cy.contains(`${jsonFileName}.json`).should('exist'); cy.contains(`${jsonFileName}.json`).should('exist');
cy.getBySel('delete-process-model-button').click(); cy.deleteProcessModelAndConfirm(deleteProcessModelButtonId, groupId);
cy.contains('Are you sure');
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
.find('.cds--btn--danger')
.click();
cy.url().should(
'include',
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
);
cy.contains(modelId).should('not.exist'); cy.contains(modelId).should('not.exist');
cy.contains(modelDisplayName).should('not.exist'); cy.contains(modelDisplayName).should('not.exist');
@ -152,12 +137,10 @@ describe('process-models', () => {
const id = uuid(); const id = uuid();
const directParentGroupId = 'acceptance-tests-group-one'; const directParentGroupId = 'acceptance-tests-group-one';
const groupId = `misc/${directParentGroupId}`; const groupId = `misc/${directParentGroupId}`;
const groupDisplayName = 'Acceptance Tests Group One';
const modelDisplayName = `Test Model 2 ${id}`; const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`; const modelId = `test-model-2-${id}`;
cy.contains('Add a process group'); cy.contains('Add a process group');
cy.contains(miscDisplayName).click(); cy.contains(miscDisplayName).click();
cy.wait(500);
cy.contains(groupDisplayName).click(); cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName); cy.createModel(groupId, modelId, modelDisplayName);
@ -193,7 +176,7 @@ describe('process-models', () => {
// in breadcrumb // in breadcrumb
cy.contains(modelDisplayName).click(); cy.contains(modelDisplayName).click();
cy.getBySel('delete-process-model-button').click(); cy.getBySel(deleteProcessModelButtonId).click();
cy.contains('Are you sure'); cy.contains('Are you sure');
cy.getBySel('delete-process-model-button-modal-confirmation-dialog') cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
.find('.cds--btn--danger') .find('.cds--btn--danger')
@ -206,14 +189,6 @@ describe('process-models', () => {
cy.contains(modelDisplayName).should('not.exist'); cy.contains(modelDisplayName).should('not.exist');
}); });
// process models no longer has pagination post-tiles
// it.only('can paginate items', () => {
// cy.contains(miscDisplayName).click();
// cy.wait(500);
// cy.contains('Acceptance Tests Group One').click();
// cy.basicPaginationTest();
// });
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().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();

View File

@ -151,3 +151,18 @@ Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => {
Cypress.Commands.add('assertNoItemInPaginatedResults', () => { Cypress.Commands.add('assertNoItemInPaginatedResults', () => {
cy.contains(/\b00 of 0 items/); cy.contains(/\b00 of 0 items/);
}); });
Cypress.Commands.add(
'deleteProcessModelAndConfirm',
(buttonId, groupId) => {
cy.getBySel(buttonId).click();
cy.contains('Are you sure');
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
.find('.cds--btn--danger')
.click();
cy.url().should(
'include',
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
);
}
);

View File

@ -9850,9 +9850,9 @@
"integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A=="
}, },
"node_modules/cypress": { "node_modules/cypress": {
"version": "12.1.0", "version": "12.2.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.1.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.2.0.tgz",
"integrity": "sha512-7fz8N84uhN1+ePNDsfQvoWEl4P3/VGKKmAg+bJQFY4onhA37Ys+6oBkGbNdwGeC7n2QqibNVPhk8x3YuQLwzfw==", "integrity": "sha512-kvl95ri95KK8mAy++tEU/wUgzAOMiIciZSL97LQvnOinb532m7dGvwN0mDSIGbOd71RREtmT9o4h088RjK5pKw==",
"dev": true, "dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
@ -38586,9 +38586,9 @@
"integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A=="
}, },
"cypress": { "cypress": {
"version": "12.1.0", "version": "12.2.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-12.1.0.tgz", "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.2.0.tgz",
"integrity": "sha512-7fz8N84uhN1+ePNDsfQvoWEl4P3/VGKKmAg+bJQFY4onhA37Ys+6oBkGbNdwGeC7n2QqibNVPhk8x3YuQLwzfw==", "integrity": "sha512-kvl95ri95KK8mAy++tEU/wUgzAOMiIciZSL97LQvnOinb532m7dGvwN0mDSIGbOd71RREtmT9o4h088RjK5pKw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@cypress/request": "^2.88.10", "@cypress/request": "^2.88.10",