add start of pp1 test
This commit is contained in:
parent
fe4e3e4d9c
commit
e2d9b395d6
|
@ -24,13 +24,19 @@ const deleteVideosOnSuccess = (on) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let spiffWorkflowFrontendUrl = `http://localhost:${process.env.SPIFFWORKFLOW_FRONTEND_PORT || 7001}`
|
||||||
|
|
||||||
|
if (process.env.SPIFFWORKFLOW_FRONTEND_URL) {
|
||||||
|
spiffWorkflowFrontendUrl = process.env.SPIFFWORKFLOW_FRONTEND_URL
|
||||||
|
}
|
||||||
|
|
||||||
const cypressConfig = {
|
const cypressConfig = {
|
||||||
projectId: 'crax1q',
|
projectId: 'crax1q',
|
||||||
|
|
||||||
videoUploadOnPasses: false,
|
videoUploadOnPasses: false,
|
||||||
chromeWebSecurity: false,
|
chromeWebSecurity: false,
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: `http://localhost:${process.env.SPIFFWORKFLOW_FRONTEND_PORT || 7001}`,
|
baseUrl: spiffWorkflowFrontendUrl,
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
deleteVideosOnSuccess(on)
|
deleteVideosOnSuccess(on)
|
||||||
require('@cypress/grep/src/plugin')(config);
|
require('@cypress/grep/src/plugin')(config);
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
const submitInputIntoFormField = (taskName, fieldKey, fieldValue) => {
|
||||||
|
cy.contains(`Task: ${taskName}`, { timeout: 10000 });
|
||||||
|
cy.get(fieldKey).clear().type(fieldValue);
|
||||||
|
cy.contains('Submit').click();
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkFormFieldIsReadOnly = (formName, fieldKey) => {
|
||||||
|
cy.contains(`Task: ${formName}`);
|
||||||
|
cy.get(fieldKey).invoke('attr', 'disabled').should('exist');
|
||||||
|
};
|
||||||
|
|
||||||
|
const checkTaskHasClass = (taskName, className) => {
|
||||||
|
cy.get(`g[data-element-id=${taskName}]`).should('have.class', className);
|
||||||
|
};
|
||||||
|
|
||||||
|
const kickOffModelWithForm = () => {
|
||||||
|
cy.navigateToProcessModel(
|
||||||
|
'Acceptance Tests Group One',
|
||||||
|
'Acceptance Tests Model 2'
|
||||||
|
);
|
||||||
|
cy.runPrimaryBpmnFile(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('tasks', () => {
|
||||||
|
it.only('can run PP1', () => {
|
||||||
|
cy.login('core5.contributor', 'core5.contributor');
|
||||||
|
cy.visit('/');
|
||||||
|
cy.contains('Start New +').click();
|
||||||
|
cy.contains('Raise New Demand Request');
|
||||||
|
cy.runPrimaryBpmnFile(true);
|
||||||
|
|
||||||
|
// const groupDisplayName = 'Acceptance Tests Group One';
|
||||||
|
// const modelDisplayName = `Acceptance Tests Model 2`;
|
||||||
|
// const completedTaskClassName = 'completed-task-highlight';
|
||||||
|
// const activeTaskClassName = 'active-task-highlight';
|
||||||
|
//
|
||||||
|
// cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
|
||||||
|
//
|
||||||
|
// 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').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);
|
||||||
|
// 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('Go').click();
|
||||||
|
//
|
||||||
|
// submitInputIntoFormField(
|
||||||
|
// 'get_user_generated_number_four',
|
||||||
|
// '#root_user_generated_number_4',
|
||||||
|
// 5
|
||||||
|
// );
|
||||||
|
// cy.url().should('include', '/tasks');
|
||||||
|
//
|
||||||
|
// cy.navigateToProcessModel(groupDisplayName, modelDisplayName);
|
||||||
|
// 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');
|
||||||
|
});
|
||||||
|
});
|
|
@ -41,10 +41,15 @@ Cypress.Commands.add('navigateToAdmin', () => {
|
||||||
cy.visit('/admin');
|
cy.visit('/admin');
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('login', (selector, ...args) => {
|
Cypress.Commands.add('login', (username, password) => {
|
||||||
|
// Cypress.Commands.add('login', (selector, ...args) => {
|
||||||
cy.visit('/admin');
|
cy.visit('/admin');
|
||||||
const username = Cypress.env('SPIFFWORKFLOW_FRONTEND_USERNAME') || 'ciadmin1';
|
if (!username) {
|
||||||
const password = Cypress.env('SPIFFWORKFLOW_FRONTEND_PASSWORD') || 'ciadmin1';
|
const username =
|
||||||
|
Cypress.env('SPIFFWORKFLOW_FRONTEND_USERNAME') || 'ciadmin1';
|
||||||
|
const password =
|
||||||
|
Cypress.env('SPIFFWORKFLOW_FRONTEND_PASSWORD') || 'ciadmin1';
|
||||||
|
}
|
||||||
cy.get('#username').type(username);
|
cy.get('#username').type(username);
|
||||||
cy.get('#password').type(password);
|
cy.get('#password').type(password);
|
||||||
if (Cypress.env('SPIFFWORKFLOW_FRONTEND_AUTH_WITH_KEYCLOAK') === true) {
|
if (Cypress.env('SPIFFWORKFLOW_FRONTEND_AUTH_WITH_KEYCLOAK') === true) {
|
||||||
|
@ -97,7 +102,8 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => {
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'runPrimaryBpmnFile',
|
'runPrimaryBpmnFile',
|
||||||
(expectAutoRedirectToHumanTask = false) => {
|
(expectAutoRedirectToHumanTask = false) => {
|
||||||
cy.contains('Start').click();
|
cy.getBySel('start-process-instance').click();
|
||||||
|
// cy.contains('Start').click();
|
||||||
if (expectAutoRedirectToHumanTask) {
|
if (expectAutoRedirectToHumanTask) {
|
||||||
// the url changes immediately, so also make sure we get some content from the next page, "Task:", or else when we try to interact with the page, it'll re-render and we'll get an error with cypress.
|
// the url changes immediately, so also make sure we get some content from the next page, "Task:", or else when we try to interact with the page, it'll re-render and we'll get an error with cypress.
|
||||||
cy.url().should('include', `/tasks/`);
|
cy.url().should('include', `/tasks/`);
|
||||||
|
|
|
@ -126,7 +126,11 @@ export default function ProcessInstanceRun({
|
||||||
if (checkPermissions) {
|
if (checkPermissions) {
|
||||||
return (
|
return (
|
||||||
<Can I="POST" a={processInstanceCreatePath} ability={ability}>
|
<Can I="POST" a={processInstanceCreatePath} ability={ability}>
|
||||||
<Button onClick={processInstanceCreateAndRun} className={className}>
|
<Button
|
||||||
|
data-qa="start-process-instance"
|
||||||
|
onClick={processInstanceCreateAndRun}
|
||||||
|
className={className}
|
||||||
|
>
|
||||||
Start
|
Start
|
||||||
</Button>
|
</Button>
|
||||||
</Can>
|
</Can>
|
||||||
|
|
Loading…
Reference in New Issue