fix tests and add frontend tests

This commit is contained in:
burnettk 2022-11-21 22:09:13 -05:00
parent f3b5cb7ca5
commit 83f6185f17
3 changed files with 36 additions and 26 deletions

View File

@ -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();
});
});

View File

@ -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',

View File

@ -177,6 +177,7 @@ export default function NavigationBar() {
<Header aria-label="IBM Platform Name" className="cds--g100">
<SkipToContent />
<HeaderMenuButton
data-qa="header-menu-expand-button"
aria-label="Open menu"
onClick={onClickSideNavExpand}
isActive={isSideNavExpanded}