mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-02-15 11:16:39 +00:00
2149f03f5 fix breadcrumb 4106c5aac Merge pull request #28 from sartography/bug/browser_lock_on_dmn_selection d9f04b932 one instance test left for cypress w/ burnettk db4ff9019 kill a few consoles 8fd0cbafc fixing up routes for launching editor. Also some fixes in the bpmn-js-spiffworkflow to avoid locking up the browser if no files are available. 063fc1e0c process model cypress tests are passing a1de9eca1 camelcase 67116e6ac fix process model create and a couple tests, docker build refactor 6dbdbffad fixed lint issue w/ burnettk cullerton 441e300c6 merged in main and resolved conflicts w/ burnettk cullerton 8c29bc3f6 fixed some acceptance tests w/ burnettk cullerton cf9af691e updated breadcrumbs to work with new process models ids w/ burnettk cullerton 23ff4e816 made a process model form w/ burnettk dbe0b9c71 Merge branch 'main' into feature/nested-groups 099ce24bb lint da1bd979d return next task when running an instance w/ burnettk ee76c5c81 More frontend changes ff0e4c762 process model show page lists files as accordion with action icons w/ burnettk a8cf19162 Merge remote-tracking branch 'origin/main' into feature/carbon_process_model_show 0b334f08d some minor chnages to prepare for chnaging actions dropdown to buttons 4e7d4733f First pass at custom report/perspective for Process Instance List (#23) 381cd4578 change action dropdown direction based on if it is the last one or not ec72afceb add back run and edit and add actions menu 331c079e1 added a table for files w/ burnettk 65874023b updated process modal show page to use accordion component w/ burnettk d50d23f14 First stab at fixing routes and urls d26b67865 Merge remote-tracking branch 'origin/main' into feature/carbon_process_model_show 6d8fee5eb Merge commit '44e49e6ae6a1f644162489a27618c39194f4628d' into main 01218b3ca update gitignore. ee11c1c2f updated the breadcrumb component and added a test for buttons in file dropdown git-subtree-dir: spiffworkflow-frontend git-subtree-split: 2149f03f5d352ba2f40b4dc41e9435cfb396d0e5
131 lines
4.2 KiB
JavaScript
131 lines
4.2 KiB
JavaScript
const submitInputIntoFormField = (taskName, fieldKey, fieldValue) => {
|
|
cy.contains(`Task: ${taskName}`);
|
|
cy.get(fieldKey).clear().type(fieldValue);
|
|
cy.contains('Submit').click();
|
|
};
|
|
|
|
const checkFormFieldIsReadOnly = (formName, fieldKey) => {
|
|
cy.contains(`Task: ${formName}`);
|
|
cy.get(fieldKey).invoke('attr', 'readonly').should('exist');
|
|
};
|
|
|
|
const checkTaskHasClass = (taskName, className) => {
|
|
cy.get(`g[data-element-id=${taskName}]`).should('have.class', className);
|
|
};
|
|
|
|
describe('tasks', () => {
|
|
beforeEach(() => {
|
|
cy.login();
|
|
});
|
|
afterEach(() => {
|
|
cy.logout();
|
|
});
|
|
|
|
// TODO: need to fix the next_task thing to make this pass
|
|
it('can complete and navigate a form', () => {
|
|
const groupDisplayName = 'Acceptance Tests Group One';
|
|
const modelId = `acceptance-tests-model-2`;
|
|
const modelDisplayName = `Acceptance Tests Model 2`;
|
|
const completedTaskClassName = 'completed-task-highlight';
|
|
const activeTaskClassName = 'active-task-highlight';
|
|
|
|
cy.navigateToProcessModel(groupDisplayName, modelDisplayName, modelId);
|
|
|
|
// avoid reloading so we can click on the task link that appears on running the process instance
|
|
cy.runPrimaryBpmnFile(false);
|
|
|
|
cy.contains('my task').click();
|
|
|
|
submitInputIntoFormField(
|
|
'get_user_generated_number_one',
|
|
'#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.getBySel('form-nav-form2').click();
|
|
checkFormFieldIsReadOnly(
|
|
'get_user_generated_number_two',
|
|
'#root_user_generated_number_2'
|
|
);
|
|
cy.getBySel('form-nav-form1').click();
|
|
checkFormFieldIsReadOnly(
|
|
'get_user_generated_number_one',
|
|
'#root_user_generated_number_1'
|
|
);
|
|
|
|
cy.getBySel('form-nav-form3').should('have.text', 'form3 - Current');
|
|
cy.getBySel('form-nav-form3').click();
|
|
submitInputIntoFormField(
|
|
'get_user_generated_number_three',
|
|
'#root_user_generated_number_3',
|
|
4
|
|
);
|
|
|
|
cy.contains('Task: get_user_generated_number_four');
|
|
cy.navigateToProcessModel(groupDisplayName, modelDisplayName, modelId);
|
|
cy.getBySel('process-instance-list-link').click();
|
|
cy.assertAtLeastOneItemInPaginatedResults();
|
|
|
|
// This should get the first one which should be the one we just completed
|
|
cy.getBySel('process-instance-show-link').first().click();
|
|
cy.contains('Process Instance Id: ');
|
|
|
|
cy.get(`g[data-element-id=form3]`).click();
|
|
cy.contains('"user_generated_number_1": 2');
|
|
cy.contains('"user_generated_number_2": 3');
|
|
cy.contains('"user_generated_number_3": 4');
|
|
cy.contains('"user_generated_number_4": 5').should('not.exist');
|
|
checkTaskHasClass('form1', completedTaskClassName);
|
|
checkTaskHasClass('form2', completedTaskClassName);
|
|
checkTaskHasClass('form3', completedTaskClassName);
|
|
checkTaskHasClass('form4', activeTaskClassName);
|
|
cy.get('.is-visible .cds--modal-close').click();
|
|
|
|
cy.navigateToHome();
|
|
cy.contains('Tasks').should('exist');
|
|
|
|
// FIXME: this will probably need a better way to link to the proper form that we want
|
|
cy.contains('Complete Task').click();
|
|
|
|
submitInputIntoFormField(
|
|
'get_user_generated_number_four',
|
|
'#root_user_generated_number_4',
|
|
5
|
|
);
|
|
cy.url().should('include', '/tasks');
|
|
|
|
cy.navigateToProcessModel(groupDisplayName, modelDisplayName, modelId);
|
|
cy.getBySel('process-instance-list-link').click();
|
|
cy.assertAtLeastOneItemInPaginatedResults();
|
|
|
|
// This should get the first one which should be the one we just completed
|
|
cy.getBySel('process-instance-show-link').first().click();
|
|
cy.contains('Process Instance Id: ');
|
|
cy.contains('Status: complete');
|
|
});
|
|
|
|
it('can paginate items', () => {
|
|
cy.navigateToProcessModel(
|
|
'Acceptance Tests Group One',
|
|
'Acceptance Tests Model 2',
|
|
'acceptance-tests-model-2'
|
|
);
|
|
|
|
// make sure we have some tasks
|
|
cy.runPrimaryBpmnFile();
|
|
cy.runPrimaryBpmnFile();
|
|
cy.runPrimaryBpmnFile();
|
|
cy.runPrimaryBpmnFile();
|
|
cy.runPrimaryBpmnFile();
|
|
|
|
cy.navigateToHome();
|
|
cy.basicPaginationTest();
|
|
});
|
|
});
|