added some support for using the backend openid server for cypress tests w/ burnettk

This commit is contained in:
jasquat 2023-02-16 12:09:44 -05:00
parent 9a88dc2d81
commit 5342b50bac
No known key found for this signature in database
6 changed files with 29 additions and 12 deletions

View File

@ -101,6 +101,7 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPIFFWORKFLOW_FRONTEND_AUTH_WITH_KEYCLOAK: "true"
- name: get_backend_logs_from_docker_compose
if: failure()
working-directory: ./spiffworkflow-backend

View File

@ -15,16 +15,16 @@
<form id="login" method="post" action="{{ url_for('openid.form_submit') }}">
<p><b>Important:</b> This login form is for demonstration purposes only. In production systems you should
be using a real Open ID System.</p>
<input type="text" class="cds--text-input" name="Uname" id="Uname" placeholder="Username">
<input type="text" class="cds--text-input" name="Uname" id="username" placeholder="Username">
<br><br>
<input type="Password" class="cds--text-input" name="Pass" id="Pass" placeholder="Password">
<input type="Password" class="cds--text-input" name="Pass" id="password" placeholder="Password">
<br><br>
<input type="hidden" name="state" value="{{state}}"/>
<input type="hidden" name="response_type" value="{{response_type}}"/>
<input type="hidden" name="client_id" value="{{client_id}}"/>
<input type="hidden" name="scope" value="{{scope}}"/>
<input type="hidden" name="redirect_uri" value="{{redirect_uri}}"/>
<input type="submit" name="log" class="cds--btn cds--btn--primary" value="Log In">
<input type="submit" name="log" class="cds--btn cds--btn--primary" id="spiff-login-button" value="Log In">
<br><br>
<!-- should maybe add this stuff in eventually, but this is just for testing.
<input type="checkbox" id="check">

View File

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

View File

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

View File

@ -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) => {

View File

@ -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 */}
<div data-qa="process-groups-loaded" hidden />
{processGroupArea()}
</>
);
}
return null;
}