Fix broken API tests (#34345)

* Bumped jest to v27

* Used jest in packaged node_modules

* Jest bump

* Removed puppeteer related code

* Updated CHANGELOG

* Added changelog
This commit is contained in:
Jamel Noel Reid 2022-08-17 13:04:41 -05:00 committed by GitHub
parent 5f257ed7d0
commit b85819f2a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 3385 additions and 3204 deletions

View File

@ -2,10 +2,8 @@
* Script to generate the test results summary to be posted as a GitHub Job Summary and as a PR comment. * Script to generate the test results summary to be posted as a GitHub Job Summary and as a PR comment.
*/ */
const { const {
E2E_PLAYWRIGHT,
API_SUMMARY_PATH, API_SUMMARY_PATH,
E2E_PW_SUMMARY_PATH, E2E_PW_SUMMARY_PATH,
E2E_PPTR_SUMMARY_PATH,
SHA, SHA,
PR_NUMBER, PR_NUMBER,
} = process.env; } = process.env;
@ -64,35 +62,7 @@ const getAPIStatsArr = () => {
* @returns Array of E2E test result stats. * @returns Array of E2E test result stats.
*/ */
const getE2EStatsArr = () => { const getE2EStatsArr = () => {
if ( E2E_PLAYWRIGHT === 'true' ) { return getAllureSummaryStats( E2E_PW_SUMMARY_PATH, 'E2E Tests' );
return getAllureSummaryStats( E2E_PW_SUMMARY_PATH, 'E2E Tests' );
} else {
const summary = require( E2E_PPTR_SUMMARY_PATH );
const {
numPassedTests: passed,
numFailedTests: failed,
numTotalTests: total,
numPendingTests: skipped,
numRuntimeErrorTestSuites: broken,
numTodoTests: unknown,
startTime,
testResults,
} = summary;
const endTime = testResults[ testResults.length - 1 ].endTime;
const duration = endTime - startTime;
const durationFormatted = getFormattedDuration( duration );
return [
'E2E Tests',
passed.toString(),
failed.toString(),
broken.toString(),
skipped.toString(),
unknown.toString(),
total.toString(),
durationFormatted,
];
}
}; };
/** /**

View File

@ -1,5 +1,9 @@
# Unreleased # Unreleased
## Changed
- Bumped jest version to v27
- Used the jest packaged bundled in this module to run tests
## Added ## Added
- Shipping Zones API Tests - Shipping Zones API Tests
- Shipping Methods API Tests - Shipping Methods API Tests

View File

@ -51,7 +51,7 @@ cd "$SCRIPTPATH/$(dirname "$REALPATH")/.."
# Run scripts # Run scripts
case $1 in case $1 in
'test') 'test')
jest --group=$2 --runInBand node_modules/.bin/jest --group=$2 --runInBand
TESTRESULT=$? TESTRESULT=$?
report report
;; ;;

View File

@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"allure-commandline": "^2.17.2", "allure-commandline": "^2.17.2",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"jest": "^25.1.0", "jest": "^27.5.1",
"jest-allure": "^0.1.3", "jest-allure": "^0.1.3",
"jest-runner-groups": "^2.1.0", "jest-runner-groups": "^2.1.0",
"postman-collection": "^4.1.0", "postman-collection": "^4.1.0",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Added phpcs:ignore to silence phpstan

View File

@ -158,6 +158,7 @@ class WC_CLI_COM_Command {
} }
} }
// phpcs:ignore
// @todo add URL to application password section // @todo add URL to application password section
if ( empty( $password ) ) { if ( empty( $password ) ) {
$password = self::ask( 'Connection password:' ); $password = self::ask( 'Connection password:' );

File diff suppressed because it is too large Load Diff