From 5b335ca42186d5ce62d8b0d715a44b216af27b3c Mon Sep 17 00:00:00 2001 From: nimya-aot Date: Mon, 27 May 2024 09:49:57 -0700 Subject: [PATCH] #1269 updated PR env variable --- .github/workflows/cypress-ci.yaml | 26 +++++++++++------------ tests/functional/cypress.config.js | 2 +- tests/functional/cypress/e2e/about.cy.js | 15 +++++++++++-- tests/functional/cypress/support/login.js | 14 +++++++----- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cypress-ci.yaml b/.github/workflows/cypress-ci.yaml index 0f506c210..340849817 100644 --- a/.github/workflows/cypress-ci.yaml +++ b/.github/workflows/cypress-ci.yaml @@ -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: @@ -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 + diff --git a/tests/functional/cypress.config.js b/tests/functional/cypress.config.js index f2fccdbea..fa44fa817 100644 --- a/tests/functional/cypress.config.js +++ b/tests/functional/cypress.config.js @@ -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', diff --git a/tests/functional/cypress/e2e/about.cy.js b/tests/functional/cypress/e2e/about.cy.js index bb5d49ed7..5ea73956a 100644 --- a/tests/functional/cypress/e2e/about.cy.js +++ b/tests/functional/cypress/e2e/about.cy.js @@ -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.'); + } + }); }); diff --git a/tests/functional/cypress/support/login.js b/tests/functional/cypress/support/login.js index e6d4a14e4..79f770e4e 100644 --- a/tests/functional/cypress/support/login.js +++ b/tests/functional/cypress/support/login.js @@ -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();