Skip to content

Commit

Permalink
bcgov#1269 updated PR env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
nimya-aot committed May 27, 2024
1 parent e6e8317 commit 5b335ca
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 22 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/cypress-ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Cypress Tests
on: [push]
on:
workflow_dispatch:
inputs:
pr-number:
description: Pull request number
required: false
type: string

jobs:
cypress-run:
Expand All @@ -17,28 +23,20 @@ jobs:
with:
path: "tests/functional"
key: node-modules-${{ hashFiles('tests/functional/package.json') }}



- name: cypress install
uses: cypress-io/github-action@v6
with:

working-directory: '${{ github.workspace }}/tests/functional'
env:
CYPRESS_keycloakUsername: ${{secrets.keycloakUsername}}
CYPRESS_keycloakPassword: ${{secrets.keycloakPassword}}
CYPRESS_depEnv: ${{secrets.depEnv}}



CYPRESS_depEnv: ${{ github.event.inputs.pr-number }}

- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: '${{ github.workspace }}/tests/functional/screenshots'
# mkdir artifacts
# cp -r cypress/screenshots artifacts/screenshots
# - name: Archive Cypress report
#uses: actions/upload-artifact@v2
#with:
#name: cypress-report
#path: artifacts

2 changes: 1 addition & 1 deletion tests/functional/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { defineConfig } = require('cypress')

module.exports = defineConfig({
env: {
depEnv: 'app',
depEnv: '',
auth_base_url: 'http://localhost:8082',
auth_realm: 'chefs',
auth_client_id: 'chefs-frontend',
Expand Down
15 changes: 13 additions & 2 deletions tests/functional/cypress/e2e/about.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@
const depEnv = Cypress.env('depEnv');
const baseUrl = Cypress.env('baseUrl');


describe('Application About Page', () => {
it('Visits the app about page', () => {
cy.visit(`/${depEnv}`);
cy.contains('h1', 'Create, publish forms, and receive submissions with the Common Hosted Forms Service.');

if(depEnv=="")
{
cy.visit(`/app`);
}
else
{

cy.visit(`/pr-${depEnv}`);
cy.contains('h1', 'Create, publish forms, and receive submissions with the Common Hosted Forms Service.');
}

});
});
14 changes: 9 additions & 5 deletions tests/functional/cypress/support/login.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
export function formsettings(){





const depEnv = Cypress.env('depEnv');
const username=Cypress.env('keycloakUsername');
const password=Cypress.env('keycloakPassword');


if(depEnv=="")
{
cy.visit(`/app`);
}
else
{

cy.visit(`/pr-${depEnv}`);
}

cy.visit(`/${depEnv}`);
cy.get('[data-test="base-auth-btn"] > .v-btn > .v-btn__content > span').click();
cy.get('[data-test="idir"]').click();

Expand Down

0 comments on commit 5b335ca

Please sign in to comment.