Skip to content

Commit

Permalink
Merge pull request #98 from bcgov/feat--ssoteam-1369-sso-tests
Browse files Browse the repository at this point in the history
Feat  ssoteam 1369 sso tests
  • Loading branch information
rstens authored Feb 28, 2024
2 parents 63e9f59 + df338d5 commit bfa78e0
Show file tree
Hide file tree
Showing 10 changed files with 375 additions and 41 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/main-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ jobs:
browser: chrome
# project: ./e2e
ci-build-id: ${{ github.event.number }}
env:
NODE_OPTIONS: '--max-old-space-size=4096'

- name: Roles tests
uses: cypress-io/github-action@v6
Expand All @@ -138,6 +140,8 @@ jobs:
browser: chrome
# project: ./e2e
ci-build-id: ${{ github.event.number }}
env:
NODE_OPTIONS: '--max-old-space-size=4096'

- name: Delete All Integrations
uses: cypress-io/github-action@v6
Expand All @@ -153,9 +157,11 @@ jobs:
spec: |
cypress/e2e/**/integration-990-deleteAllIntegrations.cy.ts
# cypress/e2e/**/integration-900-*.cy.ts
browser: chrome
browser: electron
# project: ./e2e
ci-build-id: ${{ github.event.number }}
env:
NODE_OPTIONS: '--max-old-space-size=4096'

- name: Search Users
uses: cypress-io/github-action@v6
Expand All @@ -174,6 +180,8 @@ jobs:
browser: chrome
# project: ./e2e
ci-build-id: ${{ github.event.number }}
env:
NODE_OPTIONS: '--max-old-space-size=4096'

- name: Run the reports
run: |
Expand All @@ -191,8 +199,7 @@ jobs:
if: always() && github.ref == 'refs/heads/main'
with:
type: ${{ job.status }}
job_name: '*Full End-To-End Test*'
mention: 'all'
job_name: '*End-To-End Test*'
mention_if: 'failure'
channel: '#sso-ops'
url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ dist
**/cypress/fixtures/requests-rolesafter.json
**/cypress/fixtures/rolesusersafter.json
**/cypress/fixtures/createdrequest.json
**/cypress/fixtures/ssorequestsafter.json
**/client.json
**/token.json
**/local-dev/**
Expand Down
55 changes: 55 additions & 0 deletions docs/Assess impact on TA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
## Checklist for Assessing Impact on Automated End-to-End Tests in Cypress

### 1. **UI Changes**

- [ ] **Visual Changes:** Have any visual elements (e.g., buttons, links, layouts) been modified, added, or removed?
- [ ] **CSS Changes:** Are there updates to styles that could affect element visibility or position?
- [ ] **Responsive Design Adjustments:** Have there been changes to how the application looks or behaves at different screen sizes?

### 2. **Functionality Updates**

- [ ] **New Features:** Are there any new functionalities that require additional tests?
- [ ] **Modified Features:** Have existing features been altered in a way that changes their workflow or output?
- [ ] **Deprecated Features:** Have any features or functionalities been removed from the application?

### 3. **Navigation Changes**

- [ ] **URL Changes:** Have there been updates to the URLs of any pages (e.g., changes in routing)?
- [ ] **Navigation Flow:** Is there a change in how users navigate through the application (e.g., new menu items, changes in page hierarchy)?

### 4. **Backend Changes**

- [ ] **API Modifications:** Are there changes to the APIs (endpoints, request/response structure) that the frontend interacts with?
- [ ] **Database Changes:** Have there been modifications to the database schema or the data that might affect the frontend?

### 5. **Performance Optimizations**

- [ ] **Loading Times:** Have there been changes that significantly alter the loading times of pages or resources?
- [ ] **Asynchronous Operations:** Are there updates to how asynchronous operations (e.g., AJAX calls) are handled?

### 6. **Security Updates**

- [ ] **Authentication/Authorization Changes:** Have there been updates to the login/logout flow, session management, or access controls?
- [ ] **Input Validation/Sanitization:** Are there changes in how user input is validated or sanitized?

### 7. **Third-party Integrations**

- [ ] **New Integrations:** Have new third-party services or libraries been integrated?
- [ ] **Updated Integrations:** Have existing integrations been updated or modified?

### 8. **Testing Environment**

- [ ] **Configuration Changes:** Are there changes to the Cypress configuration, test data, or environment variables?
- [ ] **Cypress Version Update:** Has the version of Cypress or any plugins been updated?

### 9. **Code Refactoring**

- [ ] **Refactored Code:** Has there been significant refactoring of the codebase that could affect the selectors or logic used in tests?
- [ ] **Selector Changes:** Have the selectors (e.g., IDs, classes, attributes) used to target elements in tests been changed?

### Communication Tips

- **Detail Specific Changes:** When communicating changes, be specific about what has been altered, added, or removed.
- **Prioritize Impact:** Highlight changes that are likely to have a high impact on existing tests.
- **Collaborate Early:** Engage with test automation specialists early in the development cycle to discuss potential impacts.
- **Share Documentation:** Provide access to updated documentation, API schemas, and design mockups to help in adjusting tests accordingly.
5 changes: 3 additions & 2 deletions testing/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import fs from 'fs';

export default defineConfig({
chromeWebSecurity: false,
defaultCommandTimeout: 4000,
defaultCommandTimeout: 40000,
includeShadowDom: true,
responseTimeout: 4000,
responseTimeout: 40000,
redirectionLimit: 100,
experimentalStudio: true,
experimentalMemoryManagement: true,
numTestsKeptInMemory: 0,
viewportHeight: 1080,
viewportWidth: 1920,
reporter: 'mochawesome',
Expand Down
12 changes: 9 additions & 3 deletions testing/cypress/appActions/Request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ class Request {
}

this.reqPage.setEnvironment(this.environments);
this.reqPage.setadditionalRoleAttribute(this.additionalRoleAttribute);
if (this.protocol === 'oidc') {
this.reqPage.setadditionalRoleAttribute(this.additionalRoleAttribute);
}
cy.get('p').contains('Last saved at').wait(2000);
this.reqPage.pageNext();

Expand Down Expand Up @@ -271,7 +273,9 @@ class Request {

// Check the Additional Role Attribute
if (this.additionalRoleAttribute) {
cy.get(this.reqPage.prev_AddRoleAttribute).contains(this.additionalRoleAttribute);
if (this.protocol === 'oidc') {
cy.get(this.reqPage.prev_AddRoleAttribute).contains(this.additionalRoleAttribute);
}
}

// Check the identity providers
Expand Down Expand Up @@ -396,7 +400,9 @@ class Request {
}

if (this.additionalRoleAttribute) {
this.reqPage.setadditionalRoleAttribute(this.additionalRoleAttribute);
if (this.protocol === 'oidc') {
this.reqPage.setadditionalRoleAttribute(this.additionalRoleAttribute);
}
}
cy.wait(2000);
this.reqPage.pageNext();
Expand Down
12 changes: 1 addition & 11 deletions testing/cypress/e2e/integration-990-deleteAllIntegrations.cy.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import Request from '../appActions/Request';

describe('Delete All Integrations', () => {
let req = new Request();
it('Delete All Requests as admin', function () {
cy.setid('admin').then(() => {
cy.login(null, null, null, null);
});
req.deleteAllRequests();
cy.logout(null);
cy.clearAllSessionStorage();
});

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);
cy.clearAllSessionStorage();
});
});
39 changes: 39 additions & 0 deletions testing/cypress/e2e/sso-010-createIntegration.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Creation of Integration request variants

import data from '../fixtures/sso-requests.json'; // The data file will drive the tests
import Request from '../appActions/Request';
import Utilities from '../appActions/Utilities';
let testData = data;
let tempData = data;
let util = new Utilities();

describe('Create SSO Integration Requests', () => {
beforeEach(() => {
cy.setid(null).then(() => {
cy.login(null, null, null, null);
});
});

afterEach(() => {
cy.logout(null);
});

after(() => {
cy.writeFile('cypress/fixtures/ssorequestsafter.json', tempData);
});

// Iterate through the JSON file and create a team for each entry
// The set up below allows for reporting on each test case
testData.forEach((data, index) => {
if (util.runOk(data)) {
it(`Create ${data.create.projectname} (Test ID: ${data.create.test_id}) - ${data.create.description}`, () => {
let req = new Request();
req.showCreateContent(data);
req.populateCreateContent(data);
cy.wrap(req.createRequest()).then(() => {
tempData[index].id = Cypress.env('test');
});
});
}
});
});
38 changes: 19 additions & 19 deletions testing/cypress/fixtures/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
"test_id": "Update Request v1 OIDC ",
"projectname": "Update OIDC 1 Team",
"team": true,
"teamname": "New Team creation",
"newteam": true,
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "oidc",
"authtype": "browser-login",
"publicaccess": false,
"identityprovider": ["", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": true,
"displayheadertest": true,
"displayheaderprod": null,
Expand Down Expand Up @@ -91,14 +91,14 @@
"test_id": "Update Request v1 OIDC Confidential",
"projectname": "Update OIDC 1 Public Team Confidential",
"team": true,
"teamname": "test-team",
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "",
"authtype": "",
"publicaccess": true,
"identityprovider": ["", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": true,
"displayheadertest": true,
"displayheaderprod": null,
Expand Down Expand Up @@ -150,14 +150,14 @@
"test_id": "Update Request v2 OIDC ",
"projectname": "Update OIDC 2 Team",
"team": true,
"teamname": "test-team",
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "",
"authtype": "",
"publicaccess": null,
"identityprovider": ["", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": false,
"displayheadertest": false,
"displayheaderprod": null,
Expand Down Expand Up @@ -209,7 +209,7 @@
"test_id": "Update Request v3 OIDC ",
"projectname": "Update OIDC 3 Team",
"team": true,
"teamname": "test-team",
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "",
Expand Down Expand Up @@ -268,14 +268,14 @@
"test_id": "Update Request v1 SAML ",
"projectname": "",
"team": true,
"teamname": "New Team creation",
"newteam": true,
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "",
"authtype": "",
"publicaccess": null,
"identityprovider": ["Basic BCeID", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": false,
"displayheadertest": false,
"displayheaderprod": null,
Expand Down Expand Up @@ -327,14 +327,14 @@
"test_id": "Update Request v2 SAML ",
"projectname": "",
"team": true,
"teamname": "test-team",
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "",
"authtype": "",
"publicaccess": null,
"identityprovider": ["IDIR", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": true,
"displayheadertest": true,
"displayheaderprod": null,
Expand Down Expand Up @@ -386,14 +386,14 @@
"test_id": "Update Request v1 OIDC no Team ",
"projectname": "Update OIDC 1 No Team to Team",
"team": true,
"teamname": "New Team creation",
"newteam": true,
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": false,
"protocol": "oidc",
"authtype": "browser-login",
"publicaccess": false,
"identityprovider": ["", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": true,
"displayheadertest": true,
"displayheaderprod": null,
Expand Down Expand Up @@ -445,14 +445,14 @@
"test_id": "Update Request SAML no Team to Team ",
"projectname": "",
"team": true,
"teamname": "New Team creation",
"newteam": true,
"teamname": "Roland and Training Account",
"newteam": false,
"projectlead": null,
"protocol": "",
"authtype": "",
"publicaccess": null,
"identityprovider": ["Basic BCeID", "", "", ""],
"additionalroleattribute": "TBD",
"additionalroleattribute": "",
"displayheader": false,
"displayheadertest": false,
"displayheaderprod": null,
Expand Down
Loading

0 comments on commit bfa78e0

Please sign in to comment.