Added: Command to generate HTML report
This commit is contained in:
parent
0be52342b7
commit
b30179f8d2
|
@ -1,2 +1,6 @@
|
|||
# Collection output
|
||||
collection.json
|
||||
|
||||
# Allure directories
|
||||
allure-report
|
||||
allure-results
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
*
|
||||
* Use this configuration file to set certain Allure options.
|
||||
*
|
||||
*/
|
||||
|
||||
// ALLURE_OUTPUT_DIR is the environment variable for the directory where you want the "allure-results" and "allure-report" folders to be generated in.
|
||||
const { ALLURE_OUTPUT_DIR } = process.env;
|
||||
|
||||
// If ALLURE_OUTPUT_DIR was specified, use it as the target for the "allure-results" directory.
|
||||
if ( ALLURE_OUTPUT_DIR ) {
|
||||
reporter.allure.setOptions( {
|
||||
targetDir: `${ ALLURE_OUTPUT_DIR }/allure-results`,
|
||||
} );
|
||||
}
|
|
@ -23,6 +23,26 @@ OLDPATH=$(pwd)
|
|||
# Return value for CI test runs
|
||||
TESTRESULT=0
|
||||
|
||||
# Function to generate report
|
||||
report() {
|
||||
|
||||
# Set the ALLURE_OUTPUT_DIR to $PWD if it wasn't set
|
||||
ALLURE_RESULTS_DIR="${ALLURE_OUTPUT_DIR:-$PWD}/allure-results"
|
||||
ALLURE_REPORT_DIR="${ALLURE_OUTPUT_DIR:-$PWD}/allure-report"
|
||||
|
||||
echo "Generating report..."
|
||||
allure generate --clean "$ALLURE_RESULTS_DIR" --output "$ALLURE_REPORT_DIR"
|
||||
REPORT_EXIT_CODE=$?
|
||||
|
||||
# Suggest opening the report
|
||||
if [ $REPORT_EXIT_CODE -eq 0 ]; then
|
||||
echo "To view the report on your browser, run:"
|
||||
echo ""
|
||||
echo "pnpx allure open \"$ALLURE_REPORT_DIR\""
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Use the script symlink to find and change directory to the root of the package
|
||||
SCRIPTPATH=$(dirname "$0")
|
||||
REALPATH=$(readlink "$0")
|
||||
|
@ -30,17 +50,18 @@ cd "$SCRIPTPATH/$(dirname "$REALPATH")/.."
|
|||
|
||||
# Run scripts
|
||||
case $1 in
|
||||
'test')
|
||||
jest --group=$2 --runInBand
|
||||
TESTRESULT=$?
|
||||
;;
|
||||
'make:collection')
|
||||
node utils/api-collection/build-collection.js $2
|
||||
TESTRESULT=$?
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
'test')
|
||||
jest --group=$2 --runInBand
|
||||
TESTRESULT=$?
|
||||
report
|
||||
;;
|
||||
'make:collection')
|
||||
node utils/api-collection/build-collection.js $2
|
||||
TESTRESULT=$?
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# Restore working path
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require('dotenv').config();
|
||||
require( 'dotenv' ).config();
|
||||
const { BASE_URL, VERBOSE, USE_INDEX_PERMALINKS } = process.env;
|
||||
const verboseOutput = VERBOSE === 'true';
|
||||
|
||||
// Update the API path if the `USE_INDEX_PERMALINKS` flag is set
|
||||
const useIndexPermalinks = USE_INDEX_PERMALINKS === 'true';
|
||||
let apiPath = `${BASE_URL}/?rest_route=/wc/v3/`;
|
||||
let apiPath = `${ BASE_URL }/?rest_route=/wc/v3/`;
|
||||
if ( useIndexPermalinks ) {
|
||||
apiPath = `${BASE_URL}/wp-json/wc/v3/`;
|
||||
apiPath = `${ BASE_URL }/wp-json/wc/v3/`;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -20,4 +20,22 @@ module.exports = {
|
|||
|
||||
// Indicates whether each individual test should be reported during the run
|
||||
verbose: verboseOutput,
|
||||
|
||||
/**
|
||||
* Configure `jest-allure` for Jest v24 and above.
|
||||
*
|
||||
* @see https://www.npmjs.com/package/jest-allure#jest--v-24-
|
||||
*/
|
||||
setupFilesAfterEnv: [
|
||||
'jest-allure/dist/setup',
|
||||
'<rootDir>/allure.config.js',
|
||||
],
|
||||
|
||||
/**
|
||||
* Make sure Jest is using Jasmine as its test runner.
|
||||
* `jest-allure` does not work with the `jest-circus` test runner, which is the default test runner of Jest starting from v27.
|
||||
*
|
||||
* @see https://github.com/zaqqaz/jest-allure#uses-jest-circus-or-jest--v-27-
|
||||
*/
|
||||
testRunner: 'jasmine2',
|
||||
};
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
"test": "jest",
|
||||
"test:api": "jest --group=api",
|
||||
"test:hello": "jest --group=hello",
|
||||
"make:collection": "node utils/api-collection/build-collection.js"
|
||||
"make:collection": "node utils/api-collection/build-collection.js",
|
||||
"report": "allure generate --clean && allure serve"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -19,8 +20,10 @@
|
|||
},
|
||||
"homepage": "https://github.com/woocommerce/woocommerce#readme",
|
||||
"dependencies": {
|
||||
"allure-commandline": "^2.17.2",
|
||||
"dotenv": "^10.0.0",
|
||||
"jest": "^25.1.0",
|
||||
"jest-allure": "^0.1.3",
|
||||
"jest-runner-groups": "^2.1.0",
|
||||
"postman-collection": "^4.1.0",
|
||||
"supertest": "^6.1.4"
|
||||
|
|
|
@ -30,3 +30,7 @@ tests/cli/vendor
|
|||
|
||||
# Language files
|
||||
i18n/languages/woocommerce.pot
|
||||
|
||||
# Allure directories
|
||||
allure-report
|
||||
allure-results
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"docker:down": "pnpx wc-e2e docker:down",
|
||||
"docker:ssh": "pnpx wc-e2e docker:ssh",
|
||||
"docker:up": "pnpx wc-e2e docker:up",
|
||||
"test:api": "pnpx wc-api-tests test api",
|
||||
"test:api": "ALLURE_OUTPUT_DIR=\"$PWD/tests/api\" pnpx wc-api-tests test api",
|
||||
"make:collection": "pnpx wc-api-tests make:collection",
|
||||
"test:e2e": "pnpx wc-e2e test:e2e",
|
||||
"test:e2e-debug": "pnpx wc-e2e test:e2e-debug",
|
||||
|
@ -33,7 +33,6 @@
|
|||
"devDependencies": {
|
||||
"@babel/cli": "7.12.8",
|
||||
"@babel/core": "7.12.9",
|
||||
"babel-eslint": "10.1.0",
|
||||
"@babel/preset-env": "7.12.7",
|
||||
"@babel/register": "7.12.1",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
|
@ -49,7 +48,9 @@
|
|||
"@wordpress/babel-preset-default": "3.0.2",
|
||||
"@wordpress/eslint-plugin": "7.3.0",
|
||||
"@wordpress/stylelint-config": "19.1.0",
|
||||
"allure-commandline": "^2.17.2",
|
||||
"autoprefixer": "9.8.6",
|
||||
"babel-eslint": "10.1.0",
|
||||
"chai": "4.2.0",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"config": "3.3.3",
|
||||
|
|
|
@ -125,14 +125,18 @@ importers:
|
|||
|
||||
packages/js/api-core-tests:
|
||||
specifiers:
|
||||
allure-commandline: ^2.17.2
|
||||
dotenv: ^10.0.0
|
||||
jest: ^25.1.0
|
||||
jest-allure: ^0.1.3
|
||||
jest-runner-groups: ^2.1.0
|
||||
postman-collection: ^4.1.0
|
||||
supertest: ^6.1.4
|
||||
dependencies:
|
||||
allure-commandline: 2.17.2
|
||||
dotenv: 10.0.0
|
||||
jest: 25.5.4
|
||||
jest-allure: 0.1.3
|
||||
jest-runner-groups: 2.1.0
|
||||
postman-collection: 4.1.0
|
||||
supertest: 6.1.6
|
||||
|
@ -1082,6 +1086,7 @@ importers:
|
|||
'@wordpress/babel-preset-default': 3.0.2
|
||||
'@wordpress/eslint-plugin': 7.3.0
|
||||
'@wordpress/stylelint-config': 19.1.0
|
||||
allure-commandline: ^2.17.2
|
||||
autoprefixer: 9.8.6
|
||||
babel-eslint: 10.1.0
|
||||
chai: 4.2.0
|
||||
|
@ -1122,6 +1127,7 @@ importers:
|
|||
'@wordpress/babel-preset-default': 3.0.2
|
||||
'@wordpress/eslint-plugin': 7.3.0_eslint@6.8.0+typescript@3.9.7
|
||||
'@wordpress/stylelint-config': 19.1.0_stylelint@13.13.1
|
||||
allure-commandline: 2.17.2
|
||||
autoprefixer: 9.8.6
|
||||
babel-eslint: 10.1.0_eslint@6.8.0
|
||||
chai: 4.2.0
|
||||
|
@ -7178,7 +7184,7 @@ packages:
|
|||
collect-v8-coverage: 1.0.1
|
||||
exit: 0.1.2
|
||||
glob: 7.2.0
|
||||
graceful-fs: 4.2.8
|
||||
graceful-fs: 4.2.9
|
||||
istanbul-lib-coverage: 3.2.0
|
||||
istanbul-lib-instrument: 4.0.3
|
||||
istanbul-lib-report: 3.0.0
|
||||
|
@ -11998,6 +12004,10 @@ packages:
|
|||
resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==}
|
||||
dev: true
|
||||
|
||||
/@types/allure-js-commons/0.0.0:
|
||||
resolution: {integrity: sha512-LvREMEGmh0oZIQ11d/vt6BSv6CD0w3berVRRFrpgDVkRhAu+UFkreDrRrdl+01PFjf7/J0lJV1UrhVyRS2tOWA==}
|
||||
dev: false
|
||||
|
||||
/@types/aria-query/4.2.2:
|
||||
resolution: {integrity: sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==}
|
||||
|
||||
|
@ -12189,6 +12199,10 @@ packages:
|
|||
dependencies:
|
||||
'@types/istanbul-lib-report': 3.0.0
|
||||
|
||||
/@types/jest/22.2.3:
|
||||
resolution: {integrity: sha512-e74sM9W/4qqWB6D4TWV9FQk0WoHtX1X4FJpbjxucMSVJHtFjbQOH3H6yp+xno4br0AKG0wz/kPtaN599GUOvAg==}
|
||||
dev: false
|
||||
|
||||
/@types/jest/27.0.2:
|
||||
resolution: {integrity: sha512-4dRxkS/AFX0c5XW6IPMNOydLn2tEhNhJV7DnYK+0bjoJZ+QTmfucBlihX7aoEsh/ocYtkLC73UbnBXBXIxsULA==}
|
||||
dependencies:
|
||||
|
@ -12245,6 +12259,10 @@ packages:
|
|||
form-data: 3.0.1
|
||||
dev: true
|
||||
|
||||
/@types/node/10.17.60:
|
||||
resolution: {integrity: sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==}
|
||||
dev: false
|
||||
|
||||
/@types/node/13.13.5:
|
||||
resolution: {integrity: sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==}
|
||||
dev: true
|
||||
|
@ -12399,6 +12417,10 @@ packages:
|
|||
/@types/stack-utils/2.0.1:
|
||||
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
|
||||
|
||||
/@types/strip-ansi/3.0.0:
|
||||
resolution: {integrity: sha1-m2PUU6a1SqhJGCIHcRoIvo7qSK4=}
|
||||
dev: false
|
||||
|
||||
/@types/tapable/1.0.8:
|
||||
resolution: {integrity: sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==}
|
||||
dev: true
|
||||
|
@ -15524,6 +15546,21 @@ packages:
|
|||
require-from-string: 2.0.2
|
||||
uri-js: 4.4.1
|
||||
|
||||
/allure-commandline/2.17.2:
|
||||
resolution: {integrity: sha512-2a0M0nX1KtVrg4y0rWEFn/OQkv7AaQSMBOEtlKfQl3heZoTEo0IdB08Uk5vU390+qPsEv3EO5igjyCrS0gX+FQ==}
|
||||
hasBin: true
|
||||
|
||||
/allure-js-commons/1.3.2:
|
||||
resolution: {integrity: sha512-FTmoqP36ZjHFT4iLdYamyCFhyj1jqD6BIdiZ5pBlyafDJrFRV76XIXNxwRqbHpSw40o1vHzYi4vGpmREnhnHVw==}
|
||||
dependencies:
|
||||
file-type: 7.7.1
|
||||
fs-extra: 6.0.1
|
||||
js2xmlparser: 3.0.0
|
||||
mime: 2.5.2
|
||||
object-assign: 4.1.1
|
||||
uuid: 3.4.0
|
||||
dev: false
|
||||
|
||||
/alphanum-sort/1.0.2:
|
||||
resolution: {integrity: sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=}
|
||||
|
||||
|
@ -22379,6 +22416,11 @@ packages:
|
|||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/file-type/7.7.1:
|
||||
resolution: {integrity: sha512-bTrKkzzZI6wH+NXhyD3SOXtb2zXTw2SbwI2RxUlRcXVsnN7jNL5hJzVQLYv7FOQhxFkK4XWdAflEaWFpaLLWpQ==}
|
||||
engines: {node: '>=4'}
|
||||
dev: false
|
||||
|
||||
/file-uri-to-path/1.0.0:
|
||||
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
|
||||
|
||||
|
@ -22960,10 +23002,9 @@ packages:
|
|||
/fs-extra/6.0.1:
|
||||
resolution: {integrity: sha512-GnyIkKhhzXZUWFCaJzvyDLEEgDkPfb4/TPvJCJVuS8MWZgoSsErf++QpiAlDnKFcqhRlm+tIOcencCjyJE6ZCA==}
|
||||
dependencies:
|
||||
graceful-fs: 4.2.8
|
||||
graceful-fs: 4.2.9
|
||||
jsonfile: 4.0.0
|
||||
universalify: 0.1.2
|
||||
dev: true
|
||||
|
||||
/fs-extra/8.1.0:
|
||||
resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==}
|
||||
|
@ -25831,6 +25872,17 @@ packages:
|
|||
filelist: 1.0.2
|
||||
minimatch: 3.0.4
|
||||
|
||||
/jest-allure/0.1.3:
|
||||
resolution: {integrity: sha512-EkO3LmkPx/a4VDg81JKtdy6kFXI0D1rHRIJ5Sa9MZaGtFYpgiCJFa6XwTgIySaVN+3+QBbIt1558CEkIW7FKFA==}
|
||||
dependencies:
|
||||
'@types/allure-js-commons': 0.0.0
|
||||
'@types/jest': 22.2.3
|
||||
'@types/node': 10.17.60
|
||||
'@types/strip-ansi': 3.0.0
|
||||
allure-js-commons: 1.3.2
|
||||
strip-ansi: 4.0.0
|
||||
dev: false
|
||||
|
||||
/jest-changed-files/24.9.0:
|
||||
resolution: {integrity: sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg==}
|
||||
engines: {node: '>= 6'}
|
||||
|
@ -27878,6 +27930,12 @@ packages:
|
|||
argparse: 2.0.1
|
||||
dev: true
|
||||
|
||||
/js2xmlparser/3.0.0:
|
||||
resolution: {integrity: sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM=}
|
||||
dependencies:
|
||||
xmlcreate: 1.0.2
|
||||
dev: false
|
||||
|
||||
/jsbn/0.1.1:
|
||||
resolution: {integrity: sha1-peZUwuWi3rXyAdls77yoDA7y9RM=}
|
||||
|
||||
|
@ -28084,7 +28142,6 @@ packages:
|
|||
resolution: {integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=}
|
||||
optionalDependencies:
|
||||
graceful-fs: 4.2.9
|
||||
dev: true
|
||||
|
||||
/jsonfile/6.1.0:
|
||||
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
|
||||
|
@ -38007,7 +38064,6 @@ packages:
|
|||
/universalify/0.1.2:
|
||||
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
|
||||
engines: {node: '>= 4.0.0'}
|
||||
dev: true
|
||||
|
||||
/universalify/2.0.0:
|
||||
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
|
||||
|
@ -39515,6 +39571,10 @@ packages:
|
|||
/xmlchars/2.2.0:
|
||||
resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==}
|
||||
|
||||
/xmlcreate/1.0.2:
|
||||
resolution: {integrity: sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=}
|
||||
dev: false
|
||||
|
||||
/xtend/4.0.2:
|
||||
resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==}
|
||||
engines: {node: '>=0.4'}
|
||||
|
|
Loading…
Reference in New Issue