-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: added simple smoke test for preview environment (CMC-NA) (#15)
- Loading branch information
1 parent
cd5cba3
commit 4a53d0e
Showing
14 changed files
with
3,096 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
"plugins": [ | ||
"codeceptjs" | ||
], | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"es2020": true, | ||
"codeceptjs/codeceptjs": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 11 | ||
}, | ||
"rules": { | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
service_base_urls=${@} | ||
|
||
max_health_check_attempts=30 | ||
|
||
function checkHealth { | ||
for service_base_url in ${service_base_urls}; do | ||
curl -k --fail --silent --output /dev/null --head ${service_base_url}/health | ||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
until $(checkHealth); do | ||
current_health_check_attempt=$((${current_health_check_attempt:-1} + 1)) | ||
|
||
if [ ${current_health_check_attempt} -gt ${max_health_check_attempts} ]; then | ||
echo -e "\nMax number of attempts reached" | ||
exit 1 | ||
fi | ||
|
||
if [ ${current_health_check_attempt} -eq 2 ]; then | ||
printf 'Awaiting healthy services' | ||
else | ||
printf '.' | ||
fi | ||
|
||
sleep 10 | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* global process */ | ||
|
||
exports.config = { | ||
tests: './e2e/tests/*_test.js', | ||
output: './output', | ||
helpers: { | ||
Puppeteer: { | ||
show: process.env.SHOW_BROWSER_WINDOW || false, | ||
windowSize: '1200x900', | ||
waitForTimeout: 20000, | ||
chrome: { | ||
ignoreHTTPSErrors: true, | ||
args: process.env.PROXY_SERVER ? [`--proxy-server=${process.env.PROXY_SERVER}`,] : [], | ||
}, | ||
}, | ||
}, | ||
include: { | ||
I: './e2e/steps_file.js', | ||
loginPage: './e2e/pages/login.page.js' | ||
}, | ||
mocha: { | ||
reporterOptions: { | ||
'codeceptjs-cli-reporter': { | ||
stdout: '-', | ||
options: { | ||
steps: false, | ||
}, | ||
}, | ||
'mocha-junit-reporter': { | ||
stdout: '-', | ||
options: { | ||
mochaFile: 'test-results/result.xml', | ||
}, | ||
}, | ||
'mochawesome': { | ||
stdout: '-', | ||
options: { | ||
reportDir: './output', | ||
inlineAssets: true, | ||
json: false, | ||
}, | ||
}, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const defaultPassword = 'Password12'; | ||
|
||
module.exports = { | ||
solicitorUser: { | ||
password: defaultPassword, | ||
email: '[email protected]' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const { I } = inject(); | ||
|
||
module.exports = { | ||
|
||
fields: { | ||
username: '#username', | ||
password: '#password', | ||
}, | ||
submitButton: 'input[value="Sign in"]', | ||
|
||
signIn(user) { | ||
I.waitForElement(this.submitButton); | ||
I.fillField(this.fields.username, user.email); | ||
I.fillField(this.fields.password, user.password); | ||
I.click(this.submitButton); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference types='codeceptjs' /> | ||
type steps_file = typeof import('./steps_file.js'); | ||
|
||
declare namespace CodeceptJS { | ||
interface SupportObject { I: CodeceptJS.I } | ||
interface CallbackOrder { [0]: CodeceptJS.I } | ||
interface Methods extends CodeceptJS.Puppeteer {} | ||
interface I extends ReturnType<steps_file> {} | ||
namespace Translation { | ||
interface Actions {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// in this file you can append custom step methods to 'I' object | ||
|
||
module.exports = function() { | ||
return actor({ | ||
|
||
// Define custom steps here, use 'this' to access default methods of I. | ||
// It is recommended to place a general 'login' function here. | ||
|
||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* global process */ | ||
const config = require('../config.js'); | ||
const baseUrl = process.env.URL || 'http://localhost:3333'; | ||
|
||
Feature('Smoke tests @smoke-tests'); | ||
|
||
Scenario('Sign in as solicitor user', (I, loginPage) => { | ||
I.amOnPage(baseUrl); | ||
loginPage.signIn(config.solicitorUser); | ||
I.see('Case List'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "ucmc-service", | ||
"version": "1.0.0", | ||
"description": "Civil Unspecified e2e tests", | ||
"scripts": { | ||
"lint": "eslint e2e", | ||
"test": "npx codeceptjs run --steps", | ||
"test:smoke": "MOCHAWESOME_REPORTFILENAME=smoke npx codeceptjs run --grep @smoke-tests --reporter mocha-multi" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn lint" | ||
} | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"codeceptjs": "^2.6.6", | ||
"eslint": "^7.3.1", | ||
"eslint-plugin-codeceptjs": "^1.3.0", | ||
"husky": "^4.2.5", | ||
"mocha-multi": "^1.1.3", | ||
"mochawesome": "^6.1.1", | ||
"puppeteer": "^4.0.1" | ||
} | ||
} |
Oops, something went wrong.