From b035c2039d0f276931d7e50973bb0eca50e18543 Mon Sep 17 00:00:00 2001 From: rstens Date: Tue, 12 Mar 2024 18:04:46 -0700 Subject: [PATCH 1/3] feature: create sso integrations --- testing/cypress/fixtures/sso-requests.json | 295 +++++++++++++++++++-- testing/cypress/fixtures/sso-test.json | 110 ++++++++ 2 files changed, 387 insertions(+), 18 deletions(-) create mode 100644 testing/cypress/fixtures/sso-test.json diff --git a/testing/cypress/fixtures/sso-requests.json b/testing/cypress/fixtures/sso-requests.json index a73d24e..3a28cd2 100644 --- a/testing/cypress/fixtures/sso-requests.json +++ b/testing/cypress/fixtures/sso-requests.json @@ -2,8 +2,8 @@ { "id": "", "create": { - "test_id": "STS-001", - "projectname": "STS-001", + "test_id": "SSO-001", + "projectname": "SSO-001", "team": true, "teamname": "Roland and Training Account", "newteam": false, @@ -26,7 +26,7 @@ "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "" + "description": "Just idir 7381" }, "update": {}, "devroles": {}, @@ -39,8 +39,8 @@ { "id": "", "create": { - "test_id": "STS-002", - "projectname": "STS-002", + "test_id": "SSO-002", + "projectname": "SSO-002", "team": true, "teamname": "Roland and Training Account", "newteam": false, @@ -63,7 +63,7 @@ "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "" + "description": "Just basicbceid 7925" }, "update": {}, "devroles": {}, @@ -76,8 +76,8 @@ { "id": "", "create": { - "test_id": "STS-003", - "projectname": "STS-003", + "test_id": "SSO-003", + "projectname": "SSO-003", "team": true, "teamname": "Roland and Training Account", "newteam": false, @@ -100,7 +100,7 @@ "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "" + "description": "Just Github BCGOV 8726" }, "update": {}, "devroles": {}, @@ -113,8 +113,8 @@ { "id": "", "create": { - "test_id": "STS-004", - "projectname": "STS-004", + "test_id": "SSO-004", + "projectname": "SSO-004", "team": true, "teamname": "Roland and Training Account", "newteam": false, @@ -137,7 +137,7 @@ "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "" + "description": "Just Azure idir 8728" }, "update": {}, "devroles": {}, @@ -150,8 +150,8 @@ { "id": "", "create": { - "test_id": "STS-005", - "projectname": "STS-005", + "test_id": "SSO-005", + "projectname": "SSO-005", "team": true, "teamname": "Roland and Training Account", "newteam": false, @@ -174,7 +174,7 @@ "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "" + "description": "Basic and Busines and Github bceid 8768" }, "update": {}, "devroles": {}, @@ -187,8 +187,8 @@ { "id": "", "create": { - "test_id": "STS-006", - "projectname": "STS-006", + "test_id": "SSO-006", + "projectname": "SSO-006", "team": true, "teamname": "Roland and Training Account", "newteam": false, @@ -211,7 +211,266 @@ "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "" + "description": "All IDPs 8763" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-007", + "projectname": "SSO-007", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR - MFA", "Basic or Business BCeID", "GitHub BC Gov"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Mutliple IDPs except IDIR 8812" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-008", + "projectname": "SSO-008", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR - MFA", "Basic or Business BCeID", "GitHub BC Gov"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Mutliple IDPs except IDIR 8812" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-007", + "projectname": "SSO-007", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR - MFA", "Basic or Business BCeID", "GitHub BC Gov"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Mutliple IDPs except IDIR 8812" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-008", + "projectname": "SSO-008", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR", "IDIR - MFA", "Basic or Business BCeID", "GitHub BC Gov"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "8764 (multiple idps)" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-009", + "projectname": "SSO-009", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["GitHub BC Gov"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Just github 8727" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-010", + "projectname": "SSO-010", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Just IDIR 8737" + }, + "update": {}, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "SSO-011", + "projectname": "SSO-011", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR - MFA"], + "additionalroleattribute": "tbd", + "environments": ["dev", "", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": [], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Just IDIR-MFA 8767" }, "update": {}, "devroles": {}, diff --git a/testing/cypress/fixtures/sso-test.json b/testing/cypress/fixtures/sso-test.json new file mode 100644 index 0000000..e5000bc --- /dev/null +++ b/testing/cypress/fixtures/sso-test.json @@ -0,0 +1,110 @@ +[ + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-002", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "8726", + "idp-hint-2": "githubbcgov", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-003", + "integration-1": "8726", + "idp-hint-1": "githubbcgov", + "integration-2": "7381", + "idp-hint-2": "idir", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + }, + { + "id": "STS-001", + "integration-1": "7381", + "idp-hint-1": "idir", + "integration-2": "7381", + "idp-hint-2": "bceidbasic", + "result-1": "success", + "result-2": "fail" + } +] From 48a32a55c624cb34f536bb706a532a3b899199b3 Mon Sep 17 00:00:00 2001 From: rstens Date: Fri, 15 Mar 2024 10:18:13 -0700 Subject: [PATCH 2/3] chore: fixing issues with run --- .github/workflows/main-e2e.yml | 23 +- testing/cypress/appActions/Request.ts | 71 ++- testing/cypress/appActions/Team.ts | 6 +- testing/cypress/appActions/Utilities.ts | 18 + ...bled-idpstopper-030-github-bcgov-idp.cy.ts | 6 +- .../e2e/disabled-idpstopper-060-saml.cy.ts | 2 +- .../cypress/e2e/idpstopper-010-test7-8.cy.ts | 2 +- .../cypress/e2e/idpstopper-020-test11.cy.ts | 2 +- ...r-050-login-page-name-capitalization.cy.ts | 2 +- ...ntegration-990-deleteAllIntegrations.cy.ts | 3 +- testing/cypress/e2e/sso-020-sessions.cy.ts | 102 ++++ testing/cypress/e2e/teamtest.cy.ts | 27 + testing/cypress/fixtures/requests copy2.json | 474 ++++++++++++++++++ testing/cypress/fixtures/requests.json | 40 +- testing/cypress/fixtures/sso-requests.json | 98 +--- testing/cypress/fixtures/sso-test.json | 148 ++---- testing/cypress/fixtures/teams.json | 242 +-------- testing/cypress/pageObjects/playgroundPage.ts | 8 + testing/package-lock.json | 14 +- testing/package.json | 2 +- 20 files changed, 791 insertions(+), 499 deletions(-) create mode 100644 testing/cypress/e2e/sso-020-sessions.cy.ts create mode 100644 testing/cypress/e2e/teamtest.cy.ts create mode 100644 testing/cypress/fixtures/requests copy2.json diff --git a/.github/workflows/main-e2e.yml b/.github/workflows/main-e2e.yml index 6c7fe8d..7ca7e90 100644 --- a/.github/workflows/main-e2e.yml +++ b/.github/workflows/main-e2e.yml @@ -55,10 +55,31 @@ jobs: spec: | cypress/e2e/**/integration-990-deleteAllIntegrations.cy.ts cypress/e2e/**/team-900-*.cy.ts - browser: electron + browser: chrome # project: ./e2e ci-build-id: ${{ github.event.number }} + - name: Run the reports + run: | + cd testing + npm run report + + - name: Upload Test Reports + uses: actions/upload-artifact@v4 + with: + name: smoke-test-results + path: testing/mochawesome-report/report.html + + - name: Rocket.Chat Notification + uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master + if: always() && github.ref == 'refs/heads/main' + with: + type: ${{ job.status }} + job_name: '*Smoke Test*' + mention_if: 'failure' + channel: '#sso-ops' + url: ${{ secrets.ROCKETCHAT_WEBHOOK }} + smoke-test: runs-on: ubuntu-latest strategy: diff --git a/testing/cypress/appActions/Request.ts b/testing/cypress/appActions/Request.ts index 5bd987c..0016518 100644 --- a/testing/cypress/appActions/Request.ts +++ b/testing/cypress/appActions/Request.ts @@ -116,7 +116,7 @@ class Request { this.reqPage.startRequest(); // Tab 1: Requester Info - this.reqPage.setProjectName(this.projectName + '@' + this.getDate()); + this.reqPage.setProjectName(this.projectName + '@' + util.getDate()); this.reqPage.setTeam(this.usesTeam); if (this.usesTeam) { if (this.newteam) { @@ -366,7 +366,7 @@ class Request { // Tab 1: Requester Info if (this.projectName !== '') { - this.reqPage.setProjectName(this.projectName + '@' + this.getDate()); + this.reqPage.setProjectName(this.projectName + '@' + util.getDate()); } if (this.reqPage.usesTeam) { this.reqPage.setTeam(this.usesTeam); @@ -523,30 +523,10 @@ class Request { // matching criteria if (regex.test(t)) { cy.get(this.reqPage.integrationsTable).eq(index).scrollIntoView(); - cy.get(this.reqPage.integrationsTableStatus) - .eq(index) - .then(($status) => { - cy.log($status.text()); - - // Wait for the request to complete before deleting - while (!$status.text().includes('Completed')) { - cy.wait(10000); - cy.reload(); - cy.get(this.reqPage.integrationsTableStatus) - .eq(index) - .then(($status) => { - cy.log($status.text()); - }); - } - if ($status.text().includes('Completed')) { - cy.get(this.reqPage.deleteButton).eq(index).click({ force: true }); - cy.wait(3000); - this.reqPage.confirmDeleteIntegration(id); - cy.log('Delete Request: ' + id.toString()); - } else { - cy.log('Request is not in Completed status. Cannot delete.'); - } - }); + cy.get(this.reqPage.deleteButton).eq(index).click({ force: true }); + cy.wait(3000); + this.reqPage.confirmDeleteIntegration(id); + cy.log('Delete Request: ' + id.toString()); } }); } @@ -1121,13 +1101,18 @@ class Request { cy.get('[data-testid="team-name"]') .clear() .type(this.teamName + '-' + myuuid); - cy.get(this.teamPage.userEmail) - .eq(0) + cy.get('#react-select-2-input').focus().clear(); + cy.get('#react-select-2-input') .type('pathfinder.ssotraining2@gov.bc.ca', { force: true, + delay: util.getRandomInt(50, 500), }) - .trigger('input'); - cy.contains('.select-inner__menu', 'pathfinder.ssotraining2@gov.bc.ca').click(); + .trigger('select'); + cy.wait(3000); + cy.realPress('Tab'); + cy.realPress('Tab'); + cy.wait(3000); + cy.get(this.teamPage.userRole).eq(0).select('Admin'); cy.get('[data-testid="send-invitation"]').click({ force: true }); }); @@ -1167,18 +1152,20 @@ class Request { } } - getDate(): string { - let today = new Date(); - let dd: any = today.getDate(); - let mm: any = today.getMonth() + 1; //January is 0! - let yyyy = today.getFullYear(); - if (dd < 10) { - dd = '0' + dd; - } - if (mm < 10) { - mm = '0' + mm; - } - return yyyy + mm + dd; + getID(name: string) { + return cy + .log('Get ID: ' + name) // Start the command chain with a log. + .visit(this.reqPage.path) // Visit the page. + .contains('td', name, { timeout: 10000 }) + .scrollIntoView() // Find the name and scroll into view. + .contains('td', name, { timeout: 10000 }) // Find the name again to ensure visibility. + .prev() // Get the previous element, presumably the ID. + .then(($id) => { + const idText = $id.text(); + Cypress.env('integration_id', idText); + this.id = idText; // Set the ID on your class instance. + cy.log('Found ID: ' + idText); // Log the found ID. + }); } } diff --git a/testing/cypress/appActions/Team.ts b/testing/cypress/appActions/Team.ts index 4bffa86..e8d633a 100644 --- a/testing/cypress/appActions/Team.ts +++ b/testing/cypress/appActions/Team.ts @@ -38,7 +38,11 @@ class Team { if (n > 0) { cy.get(this.teamPage.addUser, { timeout: 10000 }).first().click({ force: true }); } - cy.get(this.teamPage.userEmail, { timeout: 10000 }).eq(n).type(this.userEmail[n]); + cy.get(this.teamPage.userEmail, { timeout: 10000 }).eq(n).type(this.userEmail[n]).trigger('select'); + cy.wait(3000); + cy.realPress('Tab'); + cy.realPress('Tab'); + cy.wait(3000); cy.get(this.teamPage.userRole, { timeout: 10000 }).eq(n).select(this.userRole[n]); n++; } diff --git a/testing/cypress/appActions/Utilities.ts b/testing/cypress/appActions/Utilities.ts index 66c1133..bbe991d 100644 --- a/testing/cypress/appActions/Utilities.ts +++ b/testing/cypress/appActions/Utilities.ts @@ -30,5 +30,23 @@ class Utilities { md5(data: string): string { return MD5(data).toString(); } + getDate(): string { + let today = new Date(); + let dd: any = today.getDate(); + let mm: any = today.getMonth() + 1; //January is 0! + let yyyy = today.getFullYear(); + if (dd < 10) { + dd = '0' + dd; + } + if (mm < 10) { + mm = '0' + mm; + } + return yyyy + mm + dd; + } + getRandomInt(min, max) { + const minCeiled = Math.ceil(min); + const maxFloored = Math.floor(max); + return Math.floor(Math.random() * (maxFloored - minCeiled) + minCeiled); // The maximum is exclusive and the minimum is inclusive + } } export default Utilities; diff --git a/testing/cypress/e2e/disabled-idpstopper-030-github-bcgov-idp.cy.ts b/testing/cypress/e2e/disabled-idpstopper-030-github-bcgov-idp.cy.ts index f32d363..fb77560 100644 --- a/testing/cypress/e2e/disabled-idpstopper-030-github-bcgov-idp.cy.ts +++ b/testing/cypress/e2e/disabled-idpstopper-030-github-bcgov-idp.cy.ts @@ -33,7 +33,7 @@ describe('Github BCGov integration', () => { playground.fillInPlayground( 'https://dev.sandbox.loginproxy.gov.bc.ca/auth', 'standard', - kebabCase(githubBCGovIDP.create.projectname) + '-' + req.getDate() + '-' + Number(Cypress.env('test')), + kebabCase(githubBCGovIDP.create.projectname) + '-' + util.getDate() + '-' + Number(Cypress.env('test')), ); playground.clickLogin(); @@ -48,7 +48,7 @@ describe('Github BCGov integration', () => { playground.fillInPlayground( 'https://dev.sandbox.loginproxy.gov.bc.ca/auth', 'standard', - kebabCase(githubBCGovIDP.create.projectname) + '-' + req.getDate() + '-' + Number(Cypress.env('test')), + kebabCase(githubBCGovIDP.create.projectname) + '-' + util.getDate() + '-' + Number(Cypress.env('test')), ); playground.clickLogin(); @@ -94,7 +94,7 @@ describe('Github public integration', () => { playground.fillInPlayground( 'https://dev.sandbox.loginproxy.gov.bc.ca/auth', 'standard', - kebabCase(githubPublicIDP.create.projectname) + '-' + req.getDate() + '-' + Number(Cypress.env('test')), + kebabCase(githubPublicIDP.create.projectname) + '-' + util.getDate() + '-' + Number(Cypress.env('test')), ); playground.clickLogin(); diff --git a/testing/cypress/e2e/disabled-idpstopper-060-saml.cy.ts b/testing/cypress/e2e/disabled-idpstopper-060-saml.cy.ts index cc11cae..f6a72d1 100644 --- a/testing/cypress/e2e/disabled-idpstopper-060-saml.cy.ts +++ b/testing/cypress/e2e/disabled-idpstopper-060-saml.cy.ts @@ -29,7 +29,7 @@ describe('Run IDP Stopper SAML Test', () => { req.showCreateContent(data); req.populateCreateContent(data); req.createRequest(); - Cypress.env('name', data.create.projectname + '@' + req.getDate()); + Cypress.env('name', data.create.projectname + '@' + util.getDate()); cy.logout(null); cy.clearAllSessionStorage(); }); diff --git a/testing/cypress/e2e/idpstopper-010-test7-8.cy.ts b/testing/cypress/e2e/idpstopper-010-test7-8.cy.ts index a860d24..77c8af4 100644 --- a/testing/cypress/e2e/idpstopper-010-test7-8.cy.ts +++ b/testing/cypress/e2e/idpstopper-010-test7-8.cy.ts @@ -52,7 +52,7 @@ describe('Run IDP Stopper Test', () => { .type( kebabCase(data.create.projectname) + '-' + - req.getDate() + + util.getDate() + '-' + Number(Cypress.env(util.md5(data.create.projectname))) + '{enter}', diff --git a/testing/cypress/e2e/idpstopper-020-test11.cy.ts b/testing/cypress/e2e/idpstopper-020-test11.cy.ts index b82f20a..e96de85 100644 --- a/testing/cypress/e2e/idpstopper-020-test11.cy.ts +++ b/testing/cypress/e2e/idpstopper-020-test11.cy.ts @@ -46,7 +46,7 @@ describe('Run IDP Stopper Test', () => { playground.setClientId( kebabCase(data.create.projectname) + '-' + - req.getDate() + + util.getDate() + '-' + Number(Cypress.env(util.md5(data.create.projectname))), ); diff --git a/testing/cypress/e2e/idpstopper-050-login-page-name-capitalization.cy.ts b/testing/cypress/e2e/idpstopper-050-login-page-name-capitalization.cy.ts index d80ecb4..eda94f9 100644 --- a/testing/cypress/e2e/idpstopper-050-login-page-name-capitalization.cy.ts +++ b/testing/cypress/e2e/idpstopper-050-login-page-name-capitalization.cy.ts @@ -53,7 +53,7 @@ describe('Create Integration Requests For login page capitalization', () => { .type( kebabCase(request.projectname) + '-' + - req.getDate() + + util.getDate() + '-' + Number(Cypress.env(util.md5(request.projectname))) + '{enter}', diff --git a/testing/cypress/e2e/integration-990-deleteAllIntegrations.cy.ts b/testing/cypress/e2e/integration-990-deleteAllIntegrations.cy.ts index 986f8e6..e4b2f1a 100644 --- a/testing/cypress/e2e/integration-990-deleteAllIntegrations.cy.ts +++ b/testing/cypress/e2e/integration-990-deleteAllIntegrations.cy.ts @@ -10,11 +10,12 @@ describe('Delete All Integrations', () => { after(() => { cy.cleanGC(); }); + + let req = new Request(); it('Delete All Requests as default user', function () { cy.setid(null).then(() => { cy.login(null, null, null, null); }); - let req = new Request(); req.deleteAllRequests(); cy.logout(null); }); diff --git a/testing/cypress/e2e/sso-020-sessions.cy.ts b/testing/cypress/e2e/sso-020-sessions.cy.ts new file mode 100644 index 0000000..c3c7a22 --- /dev/null +++ b/testing/cypress/e2e/sso-020-sessions.cy.ts @@ -0,0 +1,102 @@ +import data from '../fixtures/sso-test.json'; // The data file will drive the tests +import Playground from '../pageObjects/playgroundPage'; +import Request from '../appActions/Request'; +import Utilities from '../appActions/Utilities'; +import cypress from 'cypress'; +var kebabCase = require('lodash.kebabcase'); +let util = new Utilities(); +let req = new Request(); + +let testData = data; + +describe('SSO Tests', () => { + beforeEach(() => { + //Establish the session with CSS Sandbox: IDIR + }); + + after(() => { + cy.cleanGC(); + }); + + testData.forEach((data, index) => { + it('Find Integration IDs', function () { + cy.setid(null).then(() => { + cy.login(null, null, null, null); + }); + + req.getID(data.integration_1).then(() => { + Cypress.env('integration_1_id', req.id); + }); + req.getID(data.integration_2).then(() => { + Cypress.env('integration_2_id', req.id); + }); + + cy.logout(null); + cy.clearAllSessionStorage(); + }); + + it(`Test: "${data.id}": ${data.idp_hint_1}/ ${data.idp_hint_2}`, function () { + // In the playground set the IDP hint to bceidbasic and click login + // Different application, different client, different IDP + cy.clearAllSessionStorage(); + cy.cleanGC(); + let playground = new Playground(); + cy.visit(playground.path); + playground.selectConfig(); + playground.setAuthServerUrl(); + playground.setRealm(); + playground.setClientId( + kebabCase(data.integration_1) + '-' + util.getDate() + '-' + Number(Cypress.env('integration_1_id')), + ); + + playground.selectOptions(); + playground.setIDPHint(data.idp_hint_1); + + playground.selectConfig(); + playground.clickUpdate(); + playground.clickLogin(); + + // Log in + if (data.idp_hint_1 === 'idir') { + cy.setid(null).then(() => { + playground.loginIDIR(Cypress.env('username'), Cypress.env('password')); + }); + } else if (data.idp_hint_1 === 'bceidbasic') { + cy.setid(data.idp_hint_1).then(() => { + playground.loginBasicBCeID(Cypress.env('username'), Cypress.env('password')); + }); + } + + // Second Login + cy.visit('http://localhost:3000'); + playground.selectConfig(); + playground.setAuthServerUrl(); + playground.setRealm(); + playground.setClientId( + kebabCase(data.integration_2) + '-' + util.getDate() + '-' + Number(Cypress.env('integration_2_id')), + ); + + /* playground.selectOptions(); + playground.setIDPHint(data.idp_hint_2); */ + + playground.selectConfig(); + playground.clickUpdate(); + playground.clickLogin(); + + // Log in + if (data.idp_hint_2 === 'bceidbasic') { + cy.setid('bceidbasic').then(() => { + playground.loginBasicBCeID(Cypress.env('username'), Cypress.env('password')); + }); + } else if (data.idp_hint_2 === 'idir') { + cy.setid(null).then(() => { + playground.loginIDIR(Cypress.env('username'), Cypress.env('password')); + }); + } + cy.pause(); + // This tells of a succesfull log in and that the session is attached to the user + cy.get('button', { timeout: 10000 }).contains('Logout').should('exist'); + cy.get('button', { timeout: 10000 }).contains('Logout').click({ force: true }); + }); + }); +}); diff --git a/testing/cypress/e2e/teamtest.cy.ts b/testing/cypress/e2e/teamtest.cy.ts new file mode 100644 index 0000000..8cfda4c --- /dev/null +++ b/testing/cypress/e2e/teamtest.cy.ts @@ -0,0 +1,27 @@ +// Update of Integration request variants + +import Request from '../appActions/Request'; + +describe('teamtest', () => { + before(() => { + cy.cleanGC(); + }); + /* after(() => { + cy.cleanGC(); + }); */ + beforeEach(() => { + cy.setid(null).then(() => { + cy.login(null, null, null, null); + }); + }); + + /* afterEach(() => { + cy.logout(null); + }); */ + + // Remove Roles + it(`test`, () => { + cy.visit(''); + cy.pause(); + }); +}); diff --git a/testing/cypress/fixtures/requests copy2.json b/testing/cypress/fixtures/requests copy2.json new file mode 100644 index 0000000..d5852dd --- /dev/null +++ b/testing/cypress/fixtures/requests copy2.json @@ -0,0 +1,474 @@ +[ + { + "id": "", + "create": { + "test_id": "Create Request v1 OIDC ", + "projectname": "Create OIDC 1 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": true, + "identityprovider": ["IDIR", "IDIR - MFA", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 1" + }, + "update": { + "test_id": "Update Request v1 OIDC ", + "projectname": "Update OIDC 1 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": false, + "identityprovider": ["", "", "", ""], + "additionalroleattribute": "", + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://google.com"], + "redirecturitest": ["https://google.com"], + "redirecturiprod": [], + "description": "Edit OIDC 1 Team" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": true, + "localtest": true + }, + { + "id": "", + "create": { + "test_id": "Create Request v1 OIDC Confidential", + "projectname": "Create OIDC 1 Public Team Confidential", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": false, + "identityprovider": ["IDIR", "IDIR - MFA", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 6" + }, + "update": { + "test_id": "Update Request v1 OIDC Confidential", + "projectname": "Update OIDC 1 Public Team Confidential", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "", + "authtype": "", + "publicaccess": true, + "identityprovider": ["", "", "", ""], + "additionalroleattribute": "", + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "Header Shown Dev", + "ssoheadertest": "Header Shown Test", + "ssoheaderprod": "", + "redirecturi": ["https://dev.com"], + "redirecturitest": ["https://test.com"], + "redirecturiprod": [], + "description": "Updates to OIDC 1 Public Team Confidential" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "Create Request v2 OIDC ", + "projectname": "Create OIDC 2 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "service-account", + "publicaccess": false, + "identityprovider": ["", "", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": [""], + "redirecturitest": [""], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 2" + }, + "update": { + "test_id": "Update Request v2 OIDC ", + "projectname": "Update OIDC 2 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "", + "authtype": "", + "publicaccess": null, + "identityprovider": ["", "", "", ""], + "additionalroleattribute": "", + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://dev.com"], + "redirecturitest": ["https://test.com"], + "redirecturiprod": [], + "description": "" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "Create Request v3 OIDC ", + "projectname": "Create OIDC 3 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "both", + "publicaccess": false, + "identityprovider": ["Basic or Business BCeID", "", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 3" + }, + "update": { + "test_id": "Update Request v3 OIDC ", + "projectname": "Update OIDC 3 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "", + "authtype": "", + "publicaccess": null, + "identityprovider": ["Basic or Business BCeID", "IDIR", "", ""], + "additionalroleattribute": "", + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "Header Shown Dev", + "ssoheadertest": "Header Shown Test", + "ssoheaderprod": "", + "redirecturi": ["*", "https://newlyadded.com"], + "redirecturitest": ["*", "https://newlyadded.com"], + "redirecturiprod": [], + "description": "Updates to OIDC 3 Team" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "Create Request v1 SAML", + "projectname": "Create SAML 1 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "saml", + "authtype": "", + "publicaccess": null, + "identityprovider": ["Basic or Business BCeID", "", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 4" + }, + "update": { + "test_id": "Update Request v1 SAML ", + "projectname": "", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "", + "authtype": "", + "publicaccess": null, + "identityprovider": ["Basic BCeID", "", "", ""], + "additionalroleattribute": "", + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://dev.com"], + "redirecturitest": ["https://test.com"], + "redirecturiprod": [], + "description": "" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "Create Request v2 SAML", + "projectname": "Create SAML 2 Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "saml", + "authtype": "", + "publicaccess": null, + "identityprovider": ["Basic or Business BCeID", "", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 5" + }, + "update": { + "test_id": "Update Request v2 SAML ", + "projectname": "", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "", + "authtype": "", + "publicaccess": null, + "identityprovider": ["IDIR", "", "", ""], + "additionalroleattribute": "", + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "Header Shown Dev", + "ssoheadertest": "Header Shown Test", + "ssoheaderprod": "", + "redirecturi": ["https://dev.com", "https://newlyadded.com"], + "redirecturitest": ["https://test.com", "https://newlyadded.com"], + "redirecturiprod": [], + "description": "" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "Create Request OIDC no Team ", + "projectname": "Create OIDC 1 No Team", + "team": false, + "teamname": "", + "newteam": false, + "projectlead": true, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": false, + "identityprovider": ["IDIR", "IDIR - MFA", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "Variant 1" + }, + "update": { + "test_id": "Update Request v1 OIDC no Team ", + "projectname": "Update OIDC 1 No Team to Team", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": false, + "protocol": "oidc", + "authtype": "browser-login", + "publicaccess": false, + "identityprovider": ["", "", "", ""], + "additionalroleattribute": "", + "displayheader": true, + "displayheadertest": true, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["*", "https://google.com"], + "redirecturitest": ["*", "https://google.com"], + "redirecturiprod": [], + "description": "Edit OIDC 1 no Team to Team" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + }, + { + "id": "", + "create": { + "test_id": "Create Request SAML No Team", + "projectname": "Create SAML 1 No Team to Team", + "team": false, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": true, + "protocol": "saml", + "authtype": "", + "publicaccess": null, + "identityprovider": ["Basic or Business BCeID", "", "", ""], + "additionalroleattribute": "tbd", + "environments": ["dev", "test", ""], + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturitest": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturiprod": [], + "agreeWithTermstrue": true, + "submit": true, + "confirm": true, + "description": "SAML No team" + }, + "update": { + "test_id": "Update Request SAML no Team to Team ", + "projectname": "", + "team": true, + "teamname": "Roland and Training Account", + "newteam": false, + "projectlead": null, + "protocol": "", + "authtype": "", + "publicaccess": null, + "identityprovider": ["Basic BCeID", "", "", ""], + "additionalroleattribute": "", + "displayheader": false, + "displayheadertest": false, + "displayheaderprod": null, + "ssoheaderdev": "SSO Header Dev", + "ssoheadertest": "SSO Header Test", + "ssoheaderprod": "", + "redirecturi": ["*", "https://dev.com"], + "redirecturitest": ["*", "https://test.com"], + "redirecturiprod": [], + "description": "SAML No Team to Team" + }, + "devroles": {}, + "testroles": {}, + "prodroles": {}, + "delete": true, + "smoketest": false, + "localtest": false + } +] diff --git a/testing/cypress/fixtures/requests.json b/testing/cypress/fixtures/requests.json index d5852dd..7626a07 100644 --- a/testing/cypress/fixtures/requests.json +++ b/testing/cypress/fixtures/requests.json @@ -32,14 +32,14 @@ "test_id": "Update Request v1 OIDC ", "projectname": "Update OIDC 1 Team", "team": true, - "teamname": "Roland and Training Account", - "newteam": false, + "teamname": "New Team creation", + "newteam": true, "projectlead": null, "protocol": "oidc", "authtype": "browser-login", "publicaccess": false, "identityprovider": ["", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": true, "displayheadertest": true, "displayheaderprod": null, @@ -56,7 +56,7 @@ "prodroles": {}, "delete": true, "smoketest": true, - "localtest": true + "localtest": false }, { "id": "", @@ -91,14 +91,14 @@ "test_id": "Update Request v1 OIDC Confidential", "projectname": "Update OIDC 1 Public Team Confidential", "team": true, - "teamname": "Roland and Training Account", + "teamname": "test-team", "newteam": false, "projectlead": null, "protocol": "", "authtype": "", "publicaccess": true, "identityprovider": ["", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": true, "displayheadertest": true, "displayheaderprod": null, @@ -150,14 +150,14 @@ "test_id": "Update Request v2 OIDC ", "projectname": "Update OIDC 2 Team", "team": true, - "teamname": "Roland and Training Account", + "teamname": "test-team", "newteam": false, "projectlead": null, "protocol": "", "authtype": "", "publicaccess": null, "identityprovider": ["", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": false, "displayheadertest": false, "displayheaderprod": null, @@ -209,7 +209,7 @@ "test_id": "Update Request v3 OIDC ", "projectname": "Update OIDC 3 Team", "team": true, - "teamname": "Roland and Training Account", + "teamname": "test-team", "newteam": false, "projectlead": null, "protocol": "", @@ -268,14 +268,14 @@ "test_id": "Update Request v1 SAML ", "projectname": "", "team": true, - "teamname": "Roland and Training Account", - "newteam": false, + "teamname": "New Team creation", + "newteam": true, "projectlead": null, "protocol": "", "authtype": "", "publicaccess": null, "identityprovider": ["Basic BCeID", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": false, "displayheadertest": false, "displayheaderprod": null, @@ -327,14 +327,14 @@ "test_id": "Update Request v2 SAML ", "projectname": "", "team": true, - "teamname": "Roland and Training Account", + "teamname": "test-team", "newteam": false, "projectlead": null, "protocol": "", "authtype": "", "publicaccess": null, "identityprovider": ["IDIR", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": true, "displayheadertest": true, "displayheaderprod": null, @@ -386,14 +386,14 @@ "test_id": "Update Request v1 OIDC no Team ", "projectname": "Update OIDC 1 No Team to Team", "team": true, - "teamname": "Roland and Training Account", - "newteam": false, + "teamname": "New Team creation", + "newteam": true, "projectlead": false, "protocol": "oidc", "authtype": "browser-login", "publicaccess": false, "identityprovider": ["", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": true, "displayheadertest": true, "displayheaderprod": null, @@ -445,14 +445,14 @@ "test_id": "Update Request SAML no Team to Team ", "projectname": "", "team": true, - "teamname": "Roland and Training Account", - "newteam": false, + "teamname": "New Team creation", + "newteam": true, "projectlead": null, "protocol": "", "authtype": "", "publicaccess": null, "identityprovider": ["Basic BCeID", "", "", ""], - "additionalroleattribute": "", + "additionalroleattribute": "TBD", "displayheader": false, "displayheadertest": false, "displayheaderprod": null, diff --git a/testing/cypress/fixtures/sso-requests.json b/testing/cypress/fixtures/sso-requests.json index 3a28cd2..f262f29 100644 --- a/testing/cypress/fixtures/sso-requests.json +++ b/testing/cypress/fixtures/sso-requests.json @@ -20,7 +20,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -57,7 +57,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -94,7 +94,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -131,7 +131,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -168,7 +168,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -205,7 +205,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -242,87 +242,13 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, "submit": true, "confirm": true, - "description": "Mutliple IDPs except IDIR 8812" - }, - "update": {}, - "devroles": {}, - "testroles": {}, - "prodroles": {}, - "delete": true, - "smoketest": true, - "localtest": false - }, - { - "id": "", - "create": { - "test_id": "SSO-008", - "projectname": "SSO-008", - "team": true, - "teamname": "Roland and Training Account", - "newteam": false, - "projectlead": false, - "protocol": "oidc", - "authtype": "browser-login", - "publicaccess": true, - "identityprovider": ["IDIR - MFA", "Basic or Business BCeID", "GitHub BC Gov"], - "additionalroleattribute": "tbd", - "environments": ["dev", "", ""], - "displayheader": false, - "displayheadertest": false, - "displayheaderprod": null, - "ssoheaderdev": "SSO Header Dev", - "ssoheadertest": "", - "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], - "redirecturitest": [], - "redirecturiprod": [], - "agreeWithTermstrue": true, - "submit": true, - "confirm": true, - "description": "Mutliple IDPs except IDIR 8812" - }, - "update": {}, - "devroles": {}, - "testroles": {}, - "prodroles": {}, - "delete": true, - "smoketest": true, - "localtest": false - }, - { - "id": "", - "create": { - "test_id": "SSO-007", - "projectname": "SSO-007", - "team": true, - "teamname": "Roland and Training Account", - "newteam": false, - "projectlead": false, - "protocol": "oidc", - "authtype": "browser-login", - "publicaccess": true, - "identityprovider": ["IDIR - MFA", "Basic or Business BCeID", "GitHub BC Gov"], - "additionalroleattribute": "tbd", - "environments": ["dev", "", ""], - "displayheader": false, - "displayheadertest": false, - "displayheaderprod": null, - "ssoheaderdev": "SSO Header Dev", - "ssoheadertest": "", - "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], - "redirecturitest": [], - "redirecturiprod": [], - "agreeWithTermstrue": true, - "submit": true, - "confirm": true, - "description": "Mutliple IDPs except IDIR 8812" + "description": "Multiple IDPs except IDIR 8812" }, "update": {}, "devroles": {}, @@ -353,7 +279,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -390,7 +316,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -427,7 +353,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, @@ -464,7 +390,7 @@ "ssoheaderdev": "SSO Header Dev", "ssoheadertest": "", "ssoheaderprod": "", - "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*"], + "redirecturi": ["https://bcgov.github.io/keycloak-example-apps/*", "http://localhost:3000/*", "*"], "redirecturitest": [], "redirecturiprod": [], "agreeWithTermstrue": true, diff --git a/testing/cypress/fixtures/sso-test.json b/testing/cypress/fixtures/sso-test.json index e5000bc..828160c 100644 --- a/testing/cypress/fixtures/sso-test.json +++ b/testing/cypress/fixtures/sso-test.json @@ -1,110 +1,68 @@ [ { "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" + "integration_1": "SSO-001", + "idp_hint_1": "idir", + "integration_2": "SSO-002", + "idp_hint_2": "bceidbasic", + "result_1": "success", + "result_2": "fail", + "error_1": "", + "error_2": "invalidFederatedIdentityActionMessage" }, { - "id": "STS-002", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "8726", - "idp-hint-2": "githubbcgov", - "result-1": "success", - "result-2": "fail" + "id": "STS-013", + "integration_1": "SSO-001", + "idp_hint_1": "idir", + "integration_2": "SSO-010", + "idp_hint_2": "idir", + "result_1": "success", + "result_2": "success", + "error_1": "", + "error_2": "" }, { - "id": "STS-003", - "integration-1": "8726", - "idp-hint-1": "githubbcgov", - "integration-2": "7381", - "idp-hint-2": "idir", - "result-1": "success", - "result-2": "fail" + "id": "STS-015", + "integration_1": "SSO-001", + "idp_hint_1": "idir", + "integration_2": "SSO-006", + "idp_hint_2": "idir", + "result_1": "success", + "result_2": "success", + "error_1": "", + "error_2": "" }, { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" - }, - { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" + "id": "STS-017", + "integration_1": "SSO-006", + "idp_hint_1": "idir", + "integration_2": "SSO-001", + "idp_hint_2": "idir", + "result_1": "success", + "result_2": "success", + "error_1": "", + "error_2": "" }, { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" - }, - { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" - }, - { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" + "id": "STS-019", + "integration_1": "SSO-006", + "idp_hint_1": "idir", + "integration_2": "SSO-008", + "idp_hint_2": "idir", + "result_1": "success", + "result_2": "success", + "error_1": "", + "error_2": "" }, { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" - }, - { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" - }, - { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" - }, - { - "id": "STS-001", - "integration-1": "7381", - "idp-hint-1": "idir", - "integration-2": "7381", - "idp-hint-2": "bceidbasic", - "result-1": "success", - "result-2": "fail" + "id": "STS-031", + "integration_1": "SSO-005", + "idp_hint_1": "bceidbasic", + "integration_2": "SSO-001", + "idp_hint_2": "idir", + "result_1": "success", + "result_2": "fail", + "error_1": "", + "error_2": "invalidFederatedIdentityActionMessage" } ] diff --git a/testing/cypress/fixtures/teams.json b/testing/cypress/fixtures/teams.json index 9d355db..78f14d0 100644 --- a/testing/cypress/fixtures/teams.json +++ b/testing/cypress/fixtures/teams.json @@ -22,16 +22,8 @@ "create": { "test_id": "Create Team 1", "teamname": "Team 1", - "useremail": [ - "pathfinder.ssotraining2@gov.bc.ca", - "pathfinderssotester@gmail.com", - "pathfinderssotester+test1@gmail.com", - "pathfinderssotester+test2@gmail.com", - "pathfinderssotester+test3@gmail.com", - "pathfinderssotester+test4@gmail.com", - "pathfinderssotester+test5@gmail.com" - ], - "userrole": ["admin", "admin", "member", "member", "member", "member", "member"], + "useremail": ["pathfinder.ssotraining2@gov.bc.ca"], + "userrole": ["admin"], "description": "" }, "update": { @@ -39,17 +31,13 @@ "teamname": "Team 1 Updated", "adduser": [ { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Admin" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", + "useremail": "roland.stens@gov.bc.ca", "userrole": "Member" } ], "deleteuser": [ { - "useremail": "pathfinderssotester@gmail.com" + "useremail": "roland.stens@gov.bc.ca" } ], "description": "Update Team 1" @@ -57,227 +45,5 @@ "delete": true, "smoketest": true, "localtest": false - }, - { - "create": { - "test_id": "Create Team 2", - "teamname": "Team 2", - "useremail": ["pathfinder.ssotraining2@gov.bc.ca", "pathfinderssotester@gmail.com"], - "userrole": ["admin", "admin"], - "description": "" - }, - "update": { - "test_id": "Update Team 2", - "teamname": "Team 2 Updated", - "adduser": [ - { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Member" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", - "userrole": "Admin" - } - ], - "deleteuser": [ - { - "useremail": "pathfinderssotester@gmail.com" - } - ], - "description": "Update Team 2" - }, - "delete": true, - "smoketest": false, - "localtest": false - }, - { - "create": { - "test_id": "Create Team 3", - "teamname": "Team 3", - "useremail": [ - "pathfinder.ssotraining2@gov.bc.ca", - "pathfinderssotester@gmail.com", - "pathfinderssotester+test1@gmail.com" - ], - "userrole": ["admin", "member", "member"], - "description": "" - }, - "update": { - "test_id": "Update Team 3", - "teamname": "Team 3 Updated", - "adduser": [ - { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Admin" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", - "userrole": "Member" - } - ], - "deleteuser": [ - { - "useremail": "pathfinderssotester@gmail.com" - } - ], - "description": "Update Team 3" - }, - "delete": true, - "smoketest": false, - "localtest": false - }, - { - "create": { - "test_id": "Create Team 4", - "teamname": "Team 4", - "useremail": [ - "pathfinder.ssotraining2@gov.bc.ca", - "pathfinderssotester@gmail.com", - "pathfinderssotester+test1@gmail.com", - "pathfinderssotester+test2@gmail.com" - ], - "userrole": ["admin", "member", "member", "member"], - "description": "" - }, - "update": { - "test_id": "Update Team 4", - "teamname": "Team 4 Updated", - "adduser": [ - { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Member" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", - "userrole": "Admin" - } - ], - "deleteuser": [ - { - "useremail": "pathfinderssotester@gmail.com" - } - ], - "description": "Update Team 4" - }, - "delete": true, - "smoketest": false, - "localtest": false - }, - { - "create": { - "test_id": "Create Team 5", - "teamname": "Team 5", - "useremail": [ - "pathfinder.ssotraining2@gov.bc.ca", - "pathfinderssotester@gmail.com", - "pathfinderssotester+test1@gmail.com", - "pathfinderssotester+test2@gmail.com", - "pathfinderssotester+test3@gmail.com" - ], - "userrole": ["admin", "member", "member", "member", "member"], - "description": "" - }, - "update": { - "test_id": "Update Team 5", - "teamname": "Team 5 Updated", - "adduser": [ - { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Admin" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", - "userrole": "Member" - } - ], - "deleteuser": [ - { - "useremail": "pathfinderssotester@gmail.com" - } - ], - "description": "Update Team 5" - }, - "delete": true, - "smoketest": false, - "localtest": false - }, - { - "create": { - "test_id": "Create Team 6", - "teamname": "Team 6", - "useremail": [ - "pathfinder.ssotraining2@gov.bc.ca", - "pathfinderssotester@gmail.com", - "pathfinderssotester+test1@gmail.com", - "pathfinderssotester+test2@gmail.com", - "pathfinderssotester+test3@gmail.com", - "pathfinderssotester+test4@gmail.com" - ], - "userrole": ["admin", "member", "member", "member", "member", "member"], - "description": "" - }, - "update": { - "test_id": "Update Team 6", - "teamname": "Team 6 Updated", - "adduser": [ - { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Member" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", - "userrole": "Admin" - } - ], - "deleteuser": [ - { - "useremail": "pathfinderssotester@gmail.com" - } - ], - "description": "Update Team 6" - }, - "delete": true, - "smoketest": false, - "localtest": false - }, - { - "create": { - "test_id": "Create Team 7", - "teamname": "Team 7", - "useremail": [ - "pathfinder.ssotraining2@gov.bc.ca", - "pathfinderssotester@gmail.com", - "pathfinderssotester+test1@gmail.com", - "pathfinderssotester+test2@gmail.com", - "pathfinderssotester+test3@gmail.com", - "pathfinderssotester+test4@gmail.com", - "pathfinderssotester+test5@gmail.com" - ], - "userrole": ["admin", "admin", "member", "member", "member", "member", "member"], - "description": "" - }, - "update": { - "test_id": "Update Team 7", - "teamname": "Team 7 Updated", - "adduser": [ - { - "useremail": "pathfinderssotester+test6@gmail.com", - "userrole": "Admin" - }, - { - "useremail": "pathfinderssotester+test7@gmail.com", - "userrole": "Member" - } - ], - "deleteuser": [ - { - "useremail": "pathfinderssotester@gmail.com" - } - ], - "description": "Update Team 7" - }, - "delete": true, - "smoketest": false, - "localtest": false } ] diff --git a/testing/cypress/pageObjects/playgroundPage.ts b/testing/cypress/pageObjects/playgroundPage.ts index 6d023f3..4bd0cf0 100644 --- a/testing/cypress/pageObjects/playgroundPage.ts +++ b/testing/cypress/pageObjects/playgroundPage.ts @@ -122,6 +122,14 @@ class PlaygroundPage { cy.contains('Verify').click(); } + loginIDIR(username: string, password: string) { + cy.get('#login-to', { timeout: 20000 }).contains('Log in to sfstest7.gov.bc.ca'); + cy.contains('label', 'IDIR Username').should('be.visible'); + cy.get('#user').type(username, { log: false }); + cy.get('#password').type(password, { log: false }); + cy.get('input[type="submit"]', { timeout: 20000 }).click(); + } + loginGithub = (username: string, password: string, secret: string) => { cy.get('input#login_field').type(username, { log: false }); cy.get('input#password').type(password, { log: false }); diff --git a/testing/package-lock.json b/testing/package-lock.json index 6135e6b..f41e51c 100644 --- a/testing/package-lock.json +++ b/testing/package-lock.json @@ -16,7 +16,7 @@ "@testing-library/cypress": "^10.0.1", "@types/crypto-js": "^4.2.2", "@types/uuid": "^9.0.8", - "cypress": "^13.6.6", + "cypress": "^13.7.0", "cypress-plugin-api": "^2.10.3", "dayjs": "^1.11.10", "mochawesome": "^7.1.3", @@ -1076,9 +1076,9 @@ "dev": true }, "node_modules/cypress": { - "version": "13.6.6", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.6.tgz", - "integrity": "sha512-S+2S9S94611hXimH9a3EAYt81QM913ZVA03pUmGDfLTFa5gyp85NJ8dJGSlEAEmyRsYkioS1TtnWtbv/Fzt11A==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.7.0.tgz", + "integrity": "sha512-UimjRSJJYdTlvkChcdcfywKJ6tUYuwYuk/n1uMMglrvi+ZthNhoRYcxnWgTqUtkl17fXrPAsD5XT2rcQYN1xKA==", "hasInstallScript": true, "dependencies": { "@cypress/request": "^3.0.0", @@ -5038,9 +5038,9 @@ "dev": true }, "cypress": { - "version": "13.6.6", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.6.tgz", - "integrity": "sha512-S+2S9S94611hXimH9a3EAYt81QM913ZVA03pUmGDfLTFa5gyp85NJ8dJGSlEAEmyRsYkioS1TtnWtbv/Fzt11A==", + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.7.0.tgz", + "integrity": "sha512-UimjRSJJYdTlvkChcdcfywKJ6tUYuwYuk/n1uMMglrvi+ZthNhoRYcxnWgTqUtkl17fXrPAsD5XT2rcQYN1xKA==", "requires": { "@cypress/request": "^3.0.0", "@cypress/xvfb": "^1.2.4", diff --git a/testing/package.json b/testing/package.json index 0eb9c31..b8a58d8 100644 --- a/testing/package.json +++ b/testing/package.json @@ -4,7 +4,7 @@ "@testing-library/cypress": "^10.0.1", "@types/crypto-js": "^4.2.2", "@types/uuid": "^9.0.8", - "cypress": "^13.6.6", + "cypress": "^13.7.0", "cypress-plugin-api": "^2.10.3", "dayjs": "^1.11.10", "mochawesome": "^7.1.3", From 3d0823bf86758977d70190a44a49d085ea43cd82 Mon Sep 17 00:00:00 2001 From: rstens Date: Fri, 15 Mar 2024 10:25:26 -0700 Subject: [PATCH 3/3] fix: update e2e workflow --- .github/workflows/main-e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-e2e.yml b/.github/workflows/main-e2e.yml index 7ca7e90..7112d10 100644 --- a/.github/workflows/main-e2e.yml +++ b/.github/workflows/main-e2e.yml @@ -67,7 +67,7 @@ jobs: - name: Upload Test Reports uses: actions/upload-artifact@v4 with: - name: smoke-test-results + name: pre-req-results path: testing/mochawesome-report/report.html - name: Rocket.Chat Notification @@ -75,7 +75,7 @@ jobs: if: always() && github.ref == 'refs/heads/main' with: type: ${{ job.status }} - job_name: '*Smoke Test*' + job_name: '*Pre-Reqs*' mention_if: 'failure' channel: '#sso-ops' url: ${{ secrets.ROCKETCHAT_WEBHOOK }}