Skip to content

Commit

Permalink
BC-4968 changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
UzaeirKhan committed Sep 13, 2023
1 parent 0cfc33e commit d51ea29
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automatic-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push]

jobs:
e2e-system-tests:
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- name: Setup Node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
configure-load-secrets-and-run_tests:
runs-on: ubuntu-latest
runs-on: windows-latest
outputs:
tag: ${{ steps.setting_url.outputs.TAG }}

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ secrets
.zshrc
test-run-details.json
cypress/fixtures/test-run-details.json
configs
!configs/template.env.json
env_variables/*.env.json
!env_variables/template.env.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Install or make sure Chrome browser (at least) have it in your development machi
### How to setup/run Cypress tests locally

1) Clone the project
2) Rename [`template.env.json`](configs/template.env.json) to `local.env.json` in the configs folder with credentials available in 1Password. (Remember add all instances as in 1Password we have different vaults available)
2) Duplicate [`template.env.json`](env_variables/template.env.json) file and rename the duplicated file to `local.env.json` in the env_variables folder with credentials available in 1Password. (Remember add all instances as in 1Password we have different vaults available)
3) Execute the following command in terminal `npm install` or `npm i` for installing the required packages
4) Execute the following command in terminal to run the tests in Cypress runner (UI) `npm run cy:open`
5) Execute the following command in terminal to run the tests in headless mode `npm run cy:run`
Expand All @@ -37,7 +37,7 @@ Install or make sure Chrome browser (at least) have it in your development machi
| |____ manual-trigger.yml
| |____ scheduled-trigger.yml
|---- .vscode (setting for VS code extensions)
|---- configs
|---- env_variables
| |____ template.env.json (credentials & environment variables - rename the file as mentioned above)
|---- cypress
| |___ downloads
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function setupNodeEvents (on, config) {
}
} else {
const environmentName = config.env.environmentName || 'local'
const environmentFilename = `./configs/${environmentName}.env.json`
const environmentFilename = `./env_variables/${environmentName}.env.json`
console.log('loading %s', environmentFilename)
const settings = require(environmentFilename)

Expand Down
26 changes: 0 additions & 26 deletions cypress.env.template.json

This file was deleted.

8 changes: 6 additions & 2 deletions configs/template.env.json → env_variables/template.env.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"env": {
"BRB": "",
"NBC": "",
"DEFAULT": "",
"TEACHER_1_BRB_EMAIL": "",
"TEACHER_1_BRB_PASSWORD": "",
"TEACHER_1_BRB_FIRST_NAME": "",
Expand Down Expand Up @@ -62,5 +66,5 @@
"STUDENT_NBC_PASSWORD_CHANGE_EMAIL": "",
"STUDENT_NBC_PASSWORD_CHANGE_OLD_PWD": "",
"STUDENT_NBC_PASSWORD_CHANGE_NEW_PWD": ""

}
}
}
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
"description": "e2e testing",
"main": "index.js",
"scripts": {
"pretest": "scripts/script.sh pretest",
"generate:report": "scripts/script.sh generate:report",
"cy:open:local": "scripts/script.sh cy:open local",
"tag:stable:local": "scripts/script.sh tag:stable local",
"tag:stable:pr:local": "scripts/script.sh tag:stable:pr local",
"tag:stable:release:local": "scripts/script.sh tag:stable:release local",
"tag:only:local": "scripts/script.sh tag:only local",
"tag:unstable:local": "scripts/script.sh tag:unstable local",
"cy:open:ci": "scripts/script.sh cy:open ci",
"tag:stable:ci": "scripts/script.sh tag:stable ci",
"tag:stable:pr:ci": "scripts/script.sh tag:stable:pr ci",
"tag:stable:release:ci": "scripts/script.sh tag:stable:release ci",
"tag:only:ci": "scripts/script.sh tag:only ci",
"tag:unstable:ci": "scripts/script.sh tag:unstable ci"
"pretest": "node run-script.js pretest",
"generate:report": "node run-script.js generate:report",
"cy:open:local": "node run-script.js cy:open local",
"tag:stable:local": "node run-script.js tag:stable local",
"tag:stable:pr:local": "node run-script.js tag:stable:pr local",
"tag:stable:release:local": "node run-script.js tag:stable:release local",
"tag:only:local": "node run-script.js tag:only local",
"tag:unstable:local": "node run-script.js tag:unstable local",
"cy:open:ci": "node run-script.js cy:open ci",
"tag:stable:ci": "node run-script.js tag:stable ci",
"tag:stable:pr:ci": "node run-script.js tag:stable:pr ci",
"tag:stable:release:ci": "node run-script.js tag:stable:release ci",
"tag:only:ci": "node run-script.js tag:only ci",
"tag:unstable:ci": "node run-script.js tag:unstable ci"
},
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions run-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { exec } = require('child_process')
const isWindows = process.platform === 'win32'

const scriptPath = './scripts/script.sh'
const args = process.argv.slice(2).join(' ')

if (isWindows) {
// On Windows, use the "bash" command to run the script
exec(`bash ${scriptPath} ${args}`)
} else {
// On non-Windows platforms, execute the script directly
exec(`bash ${scriptPath} ${args}`)
}

0 comments on commit d51ea29

Please sign in to comment.