Merge pull request #31726 from woocommerce/update/31615

update test-result.json handling to copy the file to the local folder
This commit is contained in:
Jamel Noel Reid 2022-01-25 15:09:43 -05:00 committed by GitHub
commit 27eba955dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -5,7 +5,7 @@
- Added `post-results-to-github-pr.js` to post smoke test results to a GitHub PR.
- Added jest flags to generate a json test report
- Added more entries to `default.json`
- Print the full path to `test-results.json` when the tests ends to make it easier to find the test results file.
- Save `test-results.json` from test runs to the `tests/e2e` folder.
- Added `await` for every call to `shopper.logout`
- Updated `getLatestReleaseZipUrl()` to allow passing in an authorization token and simplified arguments to just the repository name
- Added `upload.ini` which increases the limits for uploading files (such as for plugins) in the Docker environment

View File

@ -114,6 +114,10 @@ await takeScreenshotFor( 'name of current step' );
Screenshots will be saved to `tests/e2e/screenshots`. This folder is cleared at the beginning of each test run.
#### Test results
The test results are saved in `json` format in `tests/e2e/test-results.json`.
### Override default test timeout
To override the default timeout for the tests, you can use the `DEFAULT_TIMEOUT_OVERRIDE` flag and pass in a maximum timeout in milliseconds. For example, you can pass it in when running the tests from the command line:

View File

@ -76,7 +76,7 @@ if ( program.args.length == 1 ) {
}
let jestCommand = 'jest';
let outputFile = resolveLocalE2ePath('/test-results.json');
let outputFile = 'test-results.json';
const jestArgs = [
'--maxWorkers=1',
'--rootDir=./',
@ -111,7 +111,11 @@ const jestProcess = spawnSync( jestCommand, jestArgs, {
env: envVars,
} );
console.log( 'Test result file path: ' + outputFile );
let results = resolvePackagePath( outputFile );
if ( fs.existsSync( results ) ) {
let localResults = resolveLocalE2ePath( outputFile );
fs.copyFileSync( results, localResults );
}
console.log( 'Jest exit code: ' + jestProcess.status );
// Pass Jest exit code to npm