diff --git a/cypress/e2e/tasks.cy.js b/cypress/e2e/tasks.cy.js index 6f34fef..e755a59 100644 --- a/cypress/e2e/tasks.cy.js +++ b/cypress/e2e/tasks.cy.js @@ -13,6 +13,15 @@ const checkTaskHasClass = (taskName, className) => { cy.get(`g[data-element-id=${taskName}]`).should('have.class', className); }; +const kickOffModelWithForm = (modelId, formName) => { + cy.navigateToProcessModel( + 'Acceptance Tests Group One', + 'Acceptance Tests Model 2', + 'acceptance-tests-model-2' + ); + cy.runPrimaryBpmnFile(true); +}; + describe('tasks', () => { beforeEach(() => { cy.login(); @@ -107,21 +116,15 @@ describe('tasks', () => { cy.contains('Status: complete'); }); - // it('can paginate items', () => { - // cy.navigateToProcessModel( - // 'Acceptance Tests Group One', - // 'Acceptance Tests Model 1', - // 'acceptance-tests-model-1' - // ); - // - // // make sure we have some tasks - // cy.runPrimaryBpmnFile(); - // cy.runPrimaryBpmnFile(); - // cy.runPrimaryBpmnFile(); - // cy.runPrimaryBpmnFile(); - // cy.runPrimaryBpmnFile(); - // - // cy.navigateToHome(); - // cy.basicPaginationTest(); - // }); + it('can paginate items', () => { + // make sure we have some tasks + kickOffModelWithForm(); + kickOffModelWithForm(); + kickOffModelWithForm(); + kickOffModelWithForm(); + kickOffModelWithForm(); + + cy.navigateToHome(); + cy.basicPaginationTest(); + }); }); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index a593719..6b0e59a 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -32,9 +32,8 @@ Cypress.Commands.add('getBySel', (selector, ...args) => { }); Cypress.Commands.add('navigateToHome', () => { - cy.get('button[aria-label="Open menu"]').click(); + cy.getBySel('header-menu-expand-button').click(); cy.getBySel('side-nav-items').contains('Home').click(); - // cy.getBySel('nav-home').click(); }); Cypress.Commands.add('navigateToAdmin', () => { @@ -85,14 +84,21 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => { cy.contains(`Process Model: ${modelDisplayName}`); }); -Cypress.Commands.add('runPrimaryBpmnFile', (reload = true) => { - cy.contains('Run').click(); - if (reload) { - cy.contains(/Process Instance.*kicked off/); - cy.reload(true); - cy.contains(/Process Instance.*kicked off/).should('not.exist'); +Cypress.Commands.add( + 'runPrimaryBpmnFile', + (expectAutoRedirectToHumanTask = false) => { + cy.contains('Run').click(); + 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. + cy.url().should('include', `/tasks/`); + cy.contains('Task: '); + } else { + cy.contains(/Process Instance.*kicked off/); + cy.reload(true); + cy.contains(/Process Instance.*kicked off/).should('not.exist'); + } } -}); +); Cypress.Commands.add( 'navigateToProcessModel', diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx index cc7137f..fb482cd 100644 --- a/src/components/NavigationBar.tsx +++ b/src/components/NavigationBar.tsx @@ -177,6 +177,7 @@ export default function NavigationBar() {