diff --git a/cypress.config.js b/cypress.config.js index 770a3b0..3ad774c 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -30,7 +30,7 @@ const cypressConfig = { videoUploadOnPasses: false, chromeWebSecurity: false, e2e: { - baseUrl: 'http://localhost:7001', + baseUrl: `http://localhost:${process.env.SPIFFWORKFLOW_FRONTEND_PORT || 7001}`, setupNodeEvents(on, config) { deleteVideosOnSuccess(on) require('@cypress/grep/src/plugin')(config); diff --git a/cypress/e2e/process_groups.cy.js b/cypress/e2e/process_groups.cy.js index e10c485..7151021 100644 --- a/cypress/e2e/process_groups.cy.js +++ b/cypress/e2e/process_groups.cy.js @@ -33,7 +33,7 @@ describe('process-groups', () => { cy.contains(newGroupDisplayName).should('not.exist'); // meaning the process group list page is loaded, so we can sign out safely without worrying about ajax requests failing - cy.get('.tile-process-group-content-container').should('exist'); + cy.getBySel('process-groups-loaded').should('exist'); }); // process groups no longer has pagination post-tiles diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 0512641..6fd478f 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -43,17 +43,27 @@ Cypress.Commands.add('navigateToAdmin', () => { Cypress.Commands.add('login', (selector, ...args) => { cy.visit('/admin'); - cy.get('#username').type('ciadmin1'); - cy.get('#password').type('ciadmin1'); - cy.get('#kc-login').click(); + const username = Cypress.env('SPIFFWORKFLOW_FRONTEND_USERNAME') || 'ciadmin1'; + const password = Cypress.env('SPIFFWORKFLOW_FRONTEND_PASSWORD') || 'ciadmin1'; + cy.get('#username').type(username); + cy.get('#password').type(password); + if (Cypress.env('SPIFFWORKFLOW_FRONTEND_AUTH_WITH_KEYCLOAK') === 'true') { + cy.get('#kc-login').click(); + } else { + cy.get('#spiff-login-button').click(); + } }); Cypress.Commands.add('logout', (selector, ...args) => { cy.getBySel('logout-button').click(); - // otherwise we can click logout, quickly load the next page, and the javascript - // doesn't have time to actually sign you out - cy.contains('Sign in to your account'); + if (Cypress.env('SPIFFWORKFLOW_FRONTEND_AUTH_WITH_KEYCLOAK') === 'true') { + // otherwise we can click logout, quickly load the next page, and the javascript + // doesn't have time to actually sign you out + cy.contains('Sign in to your account'); + } else { + cy.get('#spiff-login-button').should('exist'); + } }); Cypress.Commands.add('createGroup', (groupId, groupDisplayName) => { diff --git a/src/components/ProcessGroupListTiles.tsx b/src/components/ProcessGroupListTiles.tsx index 06ea43e..ae3cb81 100644 --- a/src/components/ProcessGroupListTiles.tsx +++ b/src/components/ProcessGroupListTiles.tsx @@ -94,7 +94,13 @@ export default function ProcessGroupListTiles({ }; if (processGroups) { - return <>{processGroupArea()}; + return ( + <> + {/* so we can check if the groups have loaded in cypress tests */} +