skip k6 api order RUD tests on non-existant order when C test fails (#37739)

This commit is contained in:
nigeljamesstevenson 2023-04-18 16:58:44 +01:00 committed by GitHub
commit 4a6b5ac0cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 47 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
skip k6 api order RUD tests on non-existant order when C test fails

View File

@ -92,6 +92,7 @@ export function ordersAPI() {
} );
group( 'API Retrieve Order', function () {
if ( post_id ) {
response = http.get(
`${ base_url }/wp-json/wc/v3/orders/${ post_id }`,
{
@ -104,9 +105,11 @@ export function ordersAPI() {
'body contains: Order ID': ( response ) =>
response.body.includes( `"id":${ post_id }` ),
} );
}
} );
group( 'API List Orders', function () {
if ( post_id ) {
response = http.get( `${ base_url }/wp-json/wc/v3/orders`, {
headers: requestHeaders,
tags: { name: 'API - List Orders' },
@ -116,9 +119,11 @@ export function ordersAPI() {
'body contains: Order ID': ( response ) =>
response.body.includes( '[{"id":' ),
} );
}
} );
group( 'API Update Order', function () {
if ( post_id ) {
response = http.put(
`${ base_url }/wp-json/wc/v3/orders/${ post_id }`,
JSON.stringify( updateData ),
@ -132,9 +137,11 @@ export function ordersAPI() {
"body contains: 'Completed' Status": ( response ) =>
response.body.includes( '"status":"completed"' ),
} );
}
} );
group( 'API Delete Order', function () {
if ( post_id ) {
response = http.del(
`${ base_url }/wp-json/wc/v3/orders/${ post_id }`,
JSON.stringify( { force: true } ),
@ -148,6 +155,7 @@ export function ordersAPI() {
'body contains: Order ID': ( response ) =>
response.body.includes( `"id":${ post_id }` ),
} );
}
} );
group( 'API Batch Create Orders', function () {