Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove siteminder idir from e2e test creations #1367

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ffee86a
chore: upload videos
jlangy Jan 14, 2025
2da85b1
chore: videos
jlangy Jan 14, 2025
dff1ccb
chore: timeouts
jlangy Jan 14, 2025
e06beb6
Merge branch 'dev' into e2e-debug
jlangy Jan 24, 2025
462b3ad
chore: e2e idir
jlangy Jan 24, 2025
0cb9eb6
chore: trigger test
jlangy Jan 24, 2025
a4719b7
chore: trigger test
jlangy Jan 24, 2025
d669846
chore: remove waits
jlangy Jan 25, 2025
c1057da
chore: tf provider
jlangy Jan 27, 2025
8618055
chore: remove test branch
jlangy Jan 27, 2025
c426f18
chore: unused regex
jlangy Jan 27, 2025
de91fc9
chore: variable saved message
jlangy Jan 27, 2025
23d3b9b
chore: update kc tests
jlangy Jan 27, 2025
51e3120
chore: timeouts
jlangy Jan 27, 2025
057e20c
chore: fix deletion
jlangy Jan 27, 2025
69c8ed1
chore: videos
jlangy Jan 27, 2025
287fc22
chore: wait for completion
jlangy Jan 27, 2025
df05108
chore: force click
jlangy Jan 27, 2025
77d28ad
chore: case sensitivity
jlangy Jan 27, 2025
63bf5bf
chore: remove idir tests
jlangy Jan 27, 2025
00e47ca
chore: idir tests
jlangy Jan 27, 2025
2f359f5
chore: add back requests
jlangy Jan 27, 2025
2840fb3
chore: run test in isolation
jlangy Jan 27, 2025
82d23c6
chore: run tests together
jlangy Jan 27, 2025
aa83a3b
chore: run test in isolation
jlangy Jan 27, 2025
58a604c
chore: run test in isolation
jlangy Jan 27, 2025
38b3011
chore: run test in isolation
jlangy Jan 27, 2025
d47842a
chore: run test in isolation
jlangy Jan 27, 2025
ee48eaa
chore: run test in isolation
jlangy Jan 27, 2025
d52203c
chore: run test in isolation
jlangy Jan 27, 2025
b18a2be
chore: reduce timeout
jlangy Jan 28, 2025
3e85da2
chore: remove compose
jlangy Jan 28, 2025
e884804
chore: email case
jlangy Jan 28, 2025
8595646
chore: idp stopper
jlangy Jan 28, 2025
19dc414
run roles solo
jlangy Jan 28, 2025
d52bf7e
chore: timeouts
jlangy Jan 28, 2025
14667c2
chore: cleanup action
jlangy Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/e2e-keycloak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: isbang/compose-action@v1.5.1
with:
compose-file: './docker-compose.yml'
- name: E2E Tests
uses: cypress-io/github-action@v6
id: smoke
Expand Down Expand Up @@ -103,7 +100,7 @@ jobs:
- name: E2E Tests
uses: cypress-io/github-action@v6
id: smoke
continue-on-error: false
continue-on-error: true
with:
summary-title: 'E2E tests'
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
Expand Down
6 changes: 4 additions & 2 deletions app/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import { defineConfig } from 'cypress';

export default defineConfig({
chromeWebSecurity: false,
defaultCommandTimeout: 40000,
defaultCommandTimeout: 80000,
includeShadowDom: true,
responseTimeout: 40000,
responseTimeout: 80000,
redirectionLimit: 100,
experimentalStudio: true,
experimentalMemoryManagement: true,
// See here: https://github.com/cypress-io/cypress/issues/21307. experimentalModifyObstructiveThirdPartyCode is necessary to prevent microsoft from removing test frame.
experimentalModifyObstructiveThirdPartyCode: true,
numTestsKeptInMemory: 0,
viewportHeight: 1080,
viewportWidth: 1920,
Expand Down
71 changes: 21 additions & 50 deletions app/cypress/appActions/Request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ let util = new Utilities();

const regex = new RegExp('@[0-9]{17}');

// IDP Mapping
const idpMap: any = {
IDIR: 'idir',
'IDIR - MFA': 'azureidir',
'Basic BCeID': 'bceidbasic',
'Business BCeID': 'bceidbusiness',
'Basic or Business BCeID': 'bceidboth',
'GitHub BC Gov': 'githubbcgov',
GitHub: 'githubpublic',
};

// Dealing with tracking file
const filePath = 'cypress/fixtures/createdrequest.json';
// The content to write to the file if it doesn't exist
Expand Down Expand Up @@ -172,10 +161,8 @@ class Request {
return;
}
}
cy.wait(1000);
this.reqPage.pageNext();
cy.wait(2000);

cy.contains('Choose providers');
// Tab 2: Basic Info
this.reqPage.setClientProtocol(this.protocol);
if (this.protocol === 'oidc') {
Expand All @@ -190,7 +177,7 @@ class Request {
this.reqPage.setIdentityProvider(this.identityProvider);
}

if (this.identityProvider.includes('BCSC')) {
if (this.identityProvider.includes(this.reqPage.idpLabels.bcscLabel)) {
this.reqPage.selectPrivacyZone(this.privacyZone);
this.reqPage.selectBCSCAttributes(this.bcscattributes);
}
Expand All @@ -199,7 +186,7 @@ class Request {
if (this.protocol === 'oidc') {
this.reqPage.setadditionalRoleAttribute(this.additionalRoleAttribute);
}
cy.get('p').contains('Last saved at').wait(2000);
cy.get('p').contains(this.reqPage.savedMessage).wait(2000);
this.reqPage.pageNext();

// Tab 3: Development
Expand All @@ -209,11 +196,11 @@ class Request {
this.setDevUri(this.devValidRedirectUris);
}

if (this.identityProvider.includes('BCSC')) {
if (this.identityProvider.includes(this.reqPage.idpLabels.bcscLabel)) {
this.setDevHomePageURL(this.devHomePageURL);
}

cy.get('p').contains('Last saved at').wait(2000);
cy.get('p').contains(this.reqPage.savedMessage);
this.reqPage.pageNext();

// Tab 3: Test
Expand All @@ -223,10 +210,10 @@ class Request {
this.reqPage.setHeaderTitleTest(this.testDisplayHeaderTitle);
this.setTestUri(this.testValidRedirectUris);
}
if (this.identityProvider.includes('BCSC')) {
if (this.identityProvider.includes(this.reqPage.idpLabels.bcscLabel)) {
this.setTestHomePageURL(this.testHomePageURL);
}
cy.get('p').contains('Last saved at').wait(2000);
cy.get('p').contains(this.reqPage.savedMessage);
this.reqPage.pageNext();
}

Expand All @@ -237,47 +224,37 @@ class Request {
this.reqPage.setHeaderTitleProd(this.prodDisplayHeaderTitle);
this.setProdUri(this.prodValidRedirectUris);
}
if (this.identityProvider.includes('BCSC')) {
if (this.identityProvider.includes(this.reqPage.idpLabels.bcscLabel)) {
this.setProdHomePageURL(this.prodHomePageURL);
}
cy.get('p').contains('Last saved at').wait(2000);
cy.get('p').contains(this.reqPage.savedMessage);
this.reqPage.pageNext();
}

this.reqPage.agreeWithTrms(this.agreeWithTerms);
cy.get('p').contains('Last saved at').wait(2000);
cy.get('p').contains(this.reqPage.savedMessage);
this.reqPage.pageNext();

this.reqPage.submitRequest(this.subMit);
cy.wait(3000);
cy.get('p').contains(this.reqPage.savedMessage);
this.reqPage.confirmDelete(this.conFirm);
cy.wait(3000);

// Navigate to the page if not there already (e.g for admins)
cy.visit(this.reqPage.path);

// Make sure the commit has been done.
cy.get(this.reqPage.integrationsTable, { timeout: 20000 });

// cy.task('checkFileExists', filePath).then((exists) => {
// if (!exists) {
// // File doesn't exist, so create it
// cy.writeFile(filePath, fileContent);
// }
// });

cy.get(this.reqPage.integrationsTableStatus).contains('Completed');

// The role management tabs should not exist for BCSC only integrations
const nonEmptyIDPs = this.identityProvider.filter((str) => str !== '');
if (nonEmptyIDPs.length == 1 && nonEmptyIDPs[0] == 'BCSC') {
if (nonEmptyIDPs.length == 1 && nonEmptyIDPs[0] == this.reqPage.idpLabels.bcscLabel) {
cy.get('[id$=-tab-tech-details]');
cy.get('[id$=-tab-role-management]', { timeout: 1000 }).should('not.exist');
cy.get('[id$=-tab-user-role-management]', { timeout: 1000 }).should('not.exist');
}

// Get the ID of the request just created make it available to the class
// and write it to a file, so that it can be deleted later.
return this.getID(this.projectName);
}

Expand Down Expand Up @@ -440,9 +417,7 @@ class Request {
}
}
}

this.reqPage.pageNext();
cy.wait(2000);

// Tab 2: Basic Info

Expand Down Expand Up @@ -525,7 +500,6 @@ class Request {
}

cy.get(this.reqPage.stageReviewSubmit).click();
cy.wait(2000);

this.reqPage.updateRequest(this.subMit);
this.reqPage.confirmDelete(this.conFirm);
Expand Down Expand Up @@ -579,13 +553,12 @@ class Request {
// identify first column
cy.get(this.reqPage.integrationsTableName).each(($elm, index) => {
// text captured from column1
let t = $elm.text();
let id = $elm.prev().text();
const projectName = $elm.text();
// matching criteria
if (regex.test(t)) {
cy.get(this.reqPage.integrationsTable).eq(index).scrollIntoView();
cy.get(this.reqPage.deleteButton).eq(index).scrollIntoView().click({ force: true });
if (regex.test(projectName)) {
cy.contains(projectName).scrollIntoView();
cy.contains(projectName).parent().find(this.reqPage.deleteButton).click({ force: true });
cy.wait(1000);
this.reqPage.confirmDeleteIntegration(id, projectName);
cy.wait(5000);
Expand Down Expand Up @@ -1110,17 +1083,15 @@ class Request {
this.teamFullName = this.teamName + '-' + myuuid;

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('select');
cy.wait(3000);
cy.get('#react-select-2-input').type('pathfinder.ssotraining2', {
force: true,
delay: 20,
});

cy.contains('Pathfinder.SSOTraining2').click({ force: true });

cy.realPress('Tab');
cy.realPress('Tab');
cy.wait(3000);

cy.get(this.teamPage.userRole).eq(0).select('Admin');
cy.get('[data-testid="send-invitation"]').scrollIntoView().click({ force: true });
Expand Down
8 changes: 5 additions & 3 deletions app/cypress/e2e/external/idpstopper-010-test7-8.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ describe('Run IDP Stopper Test', () => {

playground.clickLogin();

// Only go here when there is more than one IDP Specified
// For multiple IDPs, check all are displayed to user as login options
if (data.create.identityprovider.length > 1) {
// On the IDP Select Page, select/test the IDP
cy.get('#kc-social-providers').within(() => {
let n = 0;
while (n < data.create.identityprovider.length) {
Expand All @@ -62,7 +61,10 @@ describe('Run IDP Stopper Test', () => {
}
});
} else {
cy.get('#login-to').should('contain', 'Log in to sfstest7.gov.bc.ca');
// For a single IDP, check redirects directly to the IDPs url
cy.url().then((url) => {
expect(url.startsWith(data.idpUrl)).to.be.true;
});
}
});

Expand Down
15 changes: 0 additions & 15 deletions app/cypress/e2e/external/search-users.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import searchIntegration from '../../fixtures/search-test-integration.json';
import rolesData from '../../fixtures/rolesusers.json';
import idimData from '../../fixtures/idim-search.json';
import Request from '../../appActions/Request';
import Playground from '../../pageObjects/playgroundPage';
import Utilities from '../../appActions/Utilities';
Expand Down Expand Up @@ -130,18 +129,4 @@ describe('Create Integration Requests', () => {
});
}
});

idimData.forEach((value, index) => {
// Only run the test if the smoketest flag is set and the test is a smoketest
if (util.runOk(value)) {
it(`Search IDIM: "${value.id + '@' + util.getDate()}": ${value.environment} - ${value.idp} - ${
value.criterion
}`, () => {
cy.setid(null).then(() => {
cy.login();
});
req.searchIdim(req.id, value.environment, value.idp, value.criterion, value.error, value.search_value);
});
}
});
});
2 changes: 1 addition & 1 deletion app/cypress/fixtures/capitalization-fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"protocol": "oidc",
"authtype": "browser-login",
"publicaccess": true,
"identityprovider": ["IDIR", "IDIR - MFA", "", ""],
"identityprovider": ["Basic BCeID", "IDIR - MFA"],
"additionalroleattribute": "tbd",
"environments": ["dev", "test", ""],
"displayheader": true,
Expand Down
42 changes: 0 additions & 42 deletions app/cypress/fixtures/idim-search.json

This file was deleted.

5 changes: 3 additions & 2 deletions app/cypress/fixtures/idpstopper.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"protocol": "oidc",
"authtype": "browser-login",
"publicaccess": true,
"identityprovider": ["IDIR", "IDIR - MFA"],
"identityprovider": ["IDIR - MFA", "Basic BCeID"],
"additionalroleattribute": "tbd",
"environments": ["dev", "", ""],
"displayheader": false,
Expand Down Expand Up @@ -48,7 +48,7 @@
"protocol": "oidc",
"authtype": "browser-login",
"publicaccess": true,
"identityprovider": ["IDIR"],
"identityprovider": ["IDIR - MFA"],
"additionalroleattribute": "tbd",
"environments": ["dev", "", ""],
"displayheader": false,
Expand All @@ -65,6 +65,7 @@
"confirm": true,
"description": "Test idp-stopper-form custom extension that when only one IDP the login form shows up directly"
},
"idpUrl": "https://login.microsoftonline.com",
"update": {},
"devroles": {},
"testroles": {},
Expand Down
6 changes: 3 additions & 3 deletions app/cypress/fixtures/requests-roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"protocol": "oidc",
"authtype": "browser-login",
"publicaccess": "true",
"identityprovider": ["IDIR"],
"identityprovider": ["IDIR - MFA"],
"additionalroleattribute": "tbd",
"environments": ["dev", "test"],
"displayheader": false,
Expand Down Expand Up @@ -556,7 +556,7 @@
"protocol": "oidc",
"authtype": "service-account",
"publicaccess": null,
"identityprovider": ["IDIR"],
"identityprovider": ["IDIR - MFA"],
"additionalroleattribute": "tbd",
"environments": ["dev", "test"],
"displayheader": false,
Expand Down Expand Up @@ -892,7 +892,7 @@
"protocol": "saml",
"authtype": "browser-login",
"publicaccess": "true",
"identityprovider": ["IDIR"],
"identityprovider": ["IDIR - MFA"],
"additionalroleattribute": "tbd",
"environments": ["dev", "test"],
"displayheader": false,
Expand Down
Loading
Loading