Skip to content

Commit

Permalink
chore: run test in isolation
Browse files Browse the repository at this point in the history
run the search users test in isolation
  • Loading branch information
jlangy committed Jan 27, 2025
1 parent ee48eaa commit d52203c
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 165 deletions.
216 changes: 108 additions & 108 deletions .github/workflows/e2e-keycloak.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,43 @@ jobs:
path: app/cypress/videos/**/*
if-no-files-found: ignore

# idp-stopper:
# runs-on: ubuntu-latest
# needs: [pre-reqs, search-users, roles-tests]
# strategy:
# 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
# continue-on-error: false
# with:
# summary-title: 'E2E tests'
# wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
# wait-on-timeout: 360
# install-command: yarn
# working-directory: app
# spec: |
# cypress/e2e/external/idpstopper-*.cy.ts
# browser: electron

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-screenshots
# path: app/cypress/screenshots/**/*
# if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore
idp-stopper:
runs-on: ubuntu-latest
needs: [pre-reqs, search-users, roles-tests]
strategy:
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
continue-on-error: false
with:
summary-title: 'E2E tests'
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/external/idpstopper-*.cy.ts
browser: electron

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: app/cypress/videos/**/*
if-no-files-found: ignore

search-users:
runs-on: ubuntu-latest
Expand All @@ -115,85 +115,85 @@ jobs:
browser: electron

- uses: actions/upload-artifact@v4
# if: failure()
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

- uses: actions/upload-artifact@v4
# if: failure()
if: failure()
with:
name: cypress-videos
path: app/cypress/videos/**/*
if-no-files-found: ignore

# roles-tests:
# runs-on: ubuntu-latest
# needs: [pre-reqs]
# strategy:
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - name: E2E Tests
# uses: cypress-io/github-action@v6
# id: smoke
# continue-on-error: false
# with:
# summary-title: 'E2E tests'
# wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
# wait-on-timeout: 360
# install-command: yarn
# working-directory: app
# spec: |
# cypress/e2e/external/integration-roles.cy.ts
# browser: electron

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-screenshots
# path: app/cypress/screenshots/**/*
# if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore

# integration-tests:
# runs-on: ubuntu-latest
# needs: [pre-reqs]
# strategy:
# fail-fast: false
# steps:
# - uses: actions/checkout@v4
# - name: E2E Tests
# uses: cypress-io/github-action@v6
# id: smoke
# continue-on-error: false
# with:
# summary-title: 'E2E tests'
# wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
# wait-on-timeout: 360
# install-command: yarn
# working-directory: app
# spec: |
# cypress/e2e/ci/integrations-crud.cy.ts
# browser: electron

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-screenshots
# path: app/cypress/screenshots/**/*
# if-no-files-found: ignore

# - uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: cypress-videos
# path: app/cypress/videos/**/*
# if-no-files-found: ignore
roles-tests:
runs-on: ubuntu-latest
needs: [pre-reqs]
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: E2E Tests
uses: cypress-io/github-action@v6
id: smoke
continue-on-error: false
with:
summary-title: 'E2E tests'
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/external/integration-roles.cy.ts
browser: electron

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: app/cypress/videos/**/*
if-no-files-found: ignore

integration-tests:
runs-on: ubuntu-latest
needs: [pre-reqs]
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: E2E Tests
uses: cypress-io/github-action@v6
id: smoke
continue-on-error: false
with:
summary-title: 'E2E tests'
wait-on: 'https://bcgov.github.io/sso-requests-sandbox/'
wait-on-timeout: 360
install-command: yarn
working-directory: app
spec: |
cypress/e2e/ci/integrations-crud.cy.ts
browser: electron

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: app/cypress/screenshots/**/*
if-no-files-found: ignore

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
path: app/cypress/videos/**/*
if-no-files-found: ignore
114 changes: 57 additions & 57 deletions app/cypress/e2e/external/search-users.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,63 +70,63 @@ describe('Create Integration Requests', () => {
cy.logout();
});

// it(`Login with bceidbasic`, () => {
// cy.session('bceidbasic', () => {
// cy.visit(playground.path);
// const clientName = kebabCase(`${req.projectName}@$${req.uid} ${Number(req.id)}`);
// playground.fillInPlayground(null, null, clientName, 'bceidbasic');

// playground.clickLogin();
// cy.wait(2000);

// cy.setid('bceidbasic').then(() => {
// playground.loginBasicBCeID(Cypress.env('username'), Cypress.env('password'));
// });

// cy.get('button', { timeout: 10000 }).contains('Logout').should('exist');
// playground.clickLogout();
// });
// });

// it(`Login with bceidbusiness`, () => {
// cy.session('bceidbusiness', () => {
// cy.visit(playground.path);
// const clientName = kebabCase(`${req.projectName}@$${req.uid} ${Number(req.id)}`);
// playground.fillInPlayground(null, null, clientName, 'bceidbusiness');

// playground.clickLogin();
// cy.wait(2000);

// cy.setid('bceidbusiness').then(() => {
// playground.loginBusinesBCeID(Cypress.env('username'), Cypress.env('password'));
// });

// cy.get('button', { timeout: 10000 }).contains('Logout').should('exist');
// playground.clickLogout();
// });
// });
it(`Login with bceidbasic`, () => {
cy.session('bceidbasic', () => {
cy.visit(playground.path);
const clientName = kebabCase(`${req.projectName}@$${req.uid} ${Number(req.id)}`);
playground.fillInPlayground(null, null, clientName, 'bceidbasic');

playground.clickLogin();
cy.wait(2000);

cy.setid('bceidbasic').then(() => {
playground.loginBasicBCeID(Cypress.env('username'), Cypress.env('password'));
});

cy.get('button', { timeout: 10000 }).contains('Logout').should('exist');
playground.clickLogout();
});
});

it(`Login with bceidbusiness`, () => {
cy.session('bceidbusiness', () => {
cy.visit(playground.path);
const clientName = kebabCase(`${req.projectName}@$${req.uid} ${Number(req.id)}`);
playground.fillInPlayground(null, null, clientName, 'bceidbusiness');

playground.clickLogin();
cy.wait(2000);

cy.setid('bceidbusiness').then(() => {
playground.loginBusinesBCeID(Cypress.env('username'), Cypress.env('password'));
});

cy.get('button', { timeout: 10000 }).contains('Logout').should('exist');
playground.clickLogout();
});
});
}

// rolesData.forEach((value) => {
// // Only run the test if the smoketest flag is set and the test is a smoketest
// if (util.runOk(value)) {
// it(`Search for user: "${value.id + '@' + util.getDate()}": ${value.environment} - ${value.idp} - ${
// value.criterion
// }`, () => {
// cy.setid(null).then(() => {
// cy.login();
// });

// let searchValue = value.search_value;
// if (value.criterion === 'IDP GUID') {
// // Get the IDP GUID from the environment, we need to store these as secrets in github
// // In our datafile, we store the email address instead of the GUID and we use it for lookup
// const guidObject = Cypress.env('guid');
// searchValue = guidObject[value.search_value];
// }

// req.searchUser(req.id, value.environment, value.idp, value.criterion, value.error, searchValue);
// });
// }
// });
rolesData.forEach((value) => {
// Only run the test if the smoketest flag is set and the test is a smoketest
if (util.runOk(value)) {
it(`Search for user: "${value.id + '@' + util.getDate()}": ${value.environment} - ${value.idp} - ${
value.criterion
}`, () => {
cy.setid(null).then(() => {
cy.login();
});

let searchValue = value.search_value;
if (value.criterion === 'IDP GUID') {
// Get the IDP GUID from the environment, we need to store these as secrets in github
// In our datafile, we store the email address instead of the GUID and we use it for lookup
const guidObject = Cypress.env('guid');
searchValue = guidObject[value.search_value];
}

req.searchUser(req.id, value.environment, value.idp, value.criterion, value.error, searchValue);
});
}
});
});

0 comments on commit d52203c

Please sign in to comment.