Skip to content

Commit

Permalink
BC-5468 update main yml and cypress config files
Browse files Browse the repository at this point in the history
  • Loading branch information
UzaeirKhan committed Nov 13, 2023
1 parent a7aef1a commit 0d8d0d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,25 @@ jobs:
echo "$json_output" > ${{ github.workspace }}/e2e-system-tests/env_variables/combined_credentials.env.json
# - name: Set credentials as environment variable
# run: echo "CREDENTIALS_JSON=$(jq -c . ${{ github.workspace }}/e2e-system-tests/env_variables/combined_credentials.env.json)" >> $GITHUB_ENV
- name: Set credentials as environment variable
run: echo "CREDENTIALS_JSON=$(jq -c . ${{ github.workspace }}/e2e-system-tests/env_variables/combined_credentials.env.json)" >> $GITHUB_ENV

- name: Clean up previous report
uses: cypress-io/github-action@v5
with:
working-directory: e2e-system-tests
command: npm run pretest

- name: Debug Environment Variables
run: |
echo "GitHub Actions Environment Variables: $CYPRESS_BRB $CYPRESS_DEFAULT $CYPRESS_NBC"
- name: Cypress run
uses: cypress-io/github-action@v5
with:
working-directory: e2e-system-tests
command: npm run ${{ steps.read_variables.outputs.tag }}
browser: chrome
env:
CYPRESS_BRB: ${{ fromJson(env.CREDENTIALS_JSON).CYPRESS_BRB }}
CYPRESS_DEFAULT: ${{ fromJson(env.CREDENTIALS_JSON).CYPRESS_DEFAULT }}
CYPRESS_NBC: ${{ fromJson(env.CREDENTIALS_JSON).CYPRESS_NBC }}

- name: Generate Report
if: always()
Expand Down
27 changes: 14 additions & 13 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ const webpack = require('@cypress/webpack-preprocessor')
const preprocessor = require('@badeball/cypress-cucumber-preprocessor')

async function setupNodeEvents (on, config) {
let environmentFilename, environmentName
const isCI = config.env.environmentName === 'ci'
if (isCI) {
environmentFilename = `./env_variables/combined_credentials.env.json`
config.env = {
...config.env
}
} else {
environmentName = config.env.environmentName || 'local'
environmentFilename = `./env_variables/${environmentName}.env.json`
}
console.log('loading %s', environmentFilename)
const settings = require(environmentFilename)
const environmentName = config.env.environmentName || 'local'
const environmentFilename = `./env_variables/${environmentName}.env.json`
console.log('loading %s', environmentFilename)
const settings = require(environmentFilename)

if (settings.env) {
config.env = {
...config.env,
...settings.env
if (settings.env) {
config.env = {
...config.env,
...settings.env
}
}
console.log('loaded settings for environment %s', environmentName)
}
console.log(config)
console.log('loaded settings for environment %s', environmentFilename)
console.log(config.env)

// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config)
Expand Down

0 comments on commit 0d8d0d6

Please sign in to comment.