From bdb9335d3a712e2e22edf594c418c18ee78ddfb9 Mon Sep 17 00:00:00 2001 From: Jon Lane Date: Tue, 22 Aug 2023 13:47:57 -0700 Subject: [PATCH] Update shipping zone tests --- .../tests/shipping/shipping-zones.test.js | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/plugins/woocommerce/tests/api-core-tests/tests/shipping/shipping-zones.test.js b/plugins/woocommerce/tests/api-core-tests/tests/shipping/shipping-zones.test.js index 5e5767f0709..2b22b70fa14 100644 --- a/plugins/woocommerce/tests/api-core-tests/tests/shipping/shipping-zones.test.js +++ b/plugins/woocommerce/tests/api-core-tests/tests/shipping/shipping-zones.test.js @@ -2,26 +2,12 @@ const { test, expect } = require('@playwright/test'); const { getShippingZoneExample } = require( '../../data' ); const { API_BASE_URL } = process.env; - -const skipTestIfCI = () => { - const skipMessage = 'Skipping this test because running on CI'; - // !FIXME This test fails on CI because of differences in environment. - test.skip( () => { - const shouldSkip = API_BASE_URL != undefined; - - if ( shouldSkip ) { - console.log( skipMessage ); - } - - return shouldSkip; - }, skipMessage ); -}; +const shouldSkip = API_BASE_URL != undefined; /** * Tests for the WooCommerce Shipping zones API. * @group api * @group shipping */ -skipTestIfCI(); test.describe( 'Shipping zones API tests', () => { @@ -184,8 +170,13 @@ test.describe( 'Shipping zones API tests', () => { const putResponseStateOnlyJSON = await putResponseStateOnly.json(); expect( putResponseStateOnly.status() ).toEqual( 200 ); - expect( putResponseStateOnlyJSON).toHaveLength(0); + // external host starts with default shipping region + if ( ! shouldSkip ) { + expect( putResponseStateOnlyJSON).toHaveLength(0); + } else { + expect( putResponseStateOnlyJSON ).toHaveLength(1); + } } ); test( 'can delete a shipping zone', async ({request}) => {