Commit 10a625d725 for woocommerce

commit 10a625d7257efa79ff58130ef05e4c435278a44d
Author: theAverageDev (Luca Tumedei) <luca@theaveragedev.com>
Date:   Thu Feb 19 11:31:16 2026 +0100

    Convert e2e-pw API tests to TypeScript (#63314)

diff --git a/plugins/woocommerce/changelog/e2e-pw-ts-conversion-07 b/plugins/woocommerce/changelog/e2e-pw-ts-conversion-07
new file mode 100644
index 0000000000..6e3587c69c
--- /dev/null
+++ b/plugins/woocommerce/changelog/e2e-pw-ts-conversion-07
@@ -0,0 +1,4 @@
+Significance: patch
+Type: dev
+
+Convert e2e-pw API test files to TypeScript.
diff --git a/plugins/woocommerce/tests/e2e-pw/fixtures/api-tests-fixtures.js b/plugins/woocommerce/tests/e2e-pw/fixtures/api-tests-fixtures.js
deleted file mode 100644
index 9cac5be892..0000000000
--- a/plugins/woocommerce/tests/e2e-pw/fixtures/api-tests-fixtures.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const base = require( '@playwright/test' );
-const { admin } = require( '../test-data/data' );
-const { tags } = require( './fixtures' );
-
-exports.test = base.test.extend( {
-	extraHTTPHeaders: {
-		// Add authorization token to all requests.
-		Authorization: `Basic ${ btoa(
-			`${ admin.username }:${ admin.password }`
-		) }`,
-	},
-} );
-
-exports.expect = base.expect;
-exports.tags = tags;
-exports.request = base.request;
diff --git a/plugins/woocommerce/tests/e2e-pw/fixtures/api-tests-fixtures.ts b/plugins/woocommerce/tests/e2e-pw/fixtures/api-tests-fixtures.ts
new file mode 100644
index 0000000000..e482d71f3f
--- /dev/null
+++ b/plugins/woocommerce/tests/e2e-pw/fixtures/api-tests-fixtures.ts
@@ -0,0 +1,23 @@
+/**
+ * External dependencies
+ */
+import { test as base, expect, request } from '@playwright/test';
+
+/**
+ * Internal dependencies
+ */
+import { admin } from '../test-data/data';
+import { encodeCredentials } from '../utils/plugin-utils';
+import { tags } from './fixtures';
+
+export const test = base.extend( {
+	extraHTTPHeaders: {
+		// Add authorization token to all requests.
+		Authorization: `Basic ${ encodeCredentials(
+			admin.username,
+			admin.password
+		) }`,
+	},
+} );
+
+export { expect, tags, request };
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/coupons/coupons.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/coupons/coupons.test.ts
similarity index 98%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/coupons/coupons.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/coupons/coupons.test.ts
index 81a878abf3..07d94a75dc 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/coupons/coupons.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/coupons/coupons.test.ts
@@ -1,9 +1,12 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { coupon, order } = require( '../../../data' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { coupon, order } from '../../../data';

 test.describe( 'Coupons API tests', () => {
 	//create variable to store the coupon id we will be using
-	let couponId;
+	let couponId: number;

 	test( 'can create a coupon', async ( { request } ) => {
 		//create testCoupon
@@ -336,7 +339,7 @@ test.describe( 'Add coupon to order', () => {
 		discount_type: 'percent',
 		amount: '10',
 	};
-	let orderId;
+	let orderId: number;

 	test.beforeAll( async ( { request } ) => {
 		// Create a coupon
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/customers/customers-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/customers/customers-crud.test.ts
similarity index 98%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/customers/customers-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/customers/customers-crud.test.ts
index 3665ca4bba..a64c5042ac 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/customers/customers-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/customers/customers-crud.test.ts
@@ -1,10 +1,13 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { admin } = require( '../../../test-data/data' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { admin } from '../../../test-data/data';

 test.describe( 'Customers API tests: CRUD', () => {
-	let adminId;
-	let customerId;
-	let subscriberUserId;
+	let adminId: number;
+	let customerId: number;
+	let subscriberUserId: number;
 	let subscriberUserCreatedDuringTests = false;

 	test.beforeAll( async ( { request } ) => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/data/data-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/data/data-crud.test.ts
similarity index 99%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/data/data-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/data/data-crud.test.ts
index c6dc9006aa..dcd7fefb89 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/data/data-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/data/data-crud.test.ts
@@ -1,4 +1,13 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
+/**
+ * External dependencies
+ */
+import fs from 'fs';
+import path from 'path';
+
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

 // 259 countries total
 const countryCodes = [
@@ -3992,7 +4001,15 @@ test.describe( 'Data API tests', () => {

 		// loop through all the countries and validate against the expected data
 		for ( const country of countryCodes ) {
-			const countryData = require( `../../../data/countries/${ country }.json` );
+			const countryData = JSON.parse(
+				fs.readFileSync(
+					path.resolve(
+						__dirname,
+						`../../../data/countries/${ country }.json`
+					),
+					'utf-8'
+				)
+			);
 			expect( responseJSON, `Checking country ${ country }` ).toEqual(
 				expect.arrayContaining( [
 					expect.objectContaining( {
@@ -6322,7 +6339,6 @@ test.describe( 'Data API tests', () => {
 				expect.objectContaining( {
 					code: 'LYD',
 					name: 'Libyan dinar',
-					//"symbol": "&#x62f;.&#x644;",
 					symbol: expect.stringContaining( '&#x62f' ),
 					_links: {
 						self: [
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/hello/hello.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/hello/hello.test.ts
similarity index 81%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/hello/hello.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/hello/hello.test.ts
index 82dc53eed2..0450544103 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/hello/hello.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/hello/hello.test.ts
@@ -1,4 +1,7 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

 test.describe( 'Test API connectivity', () => {
 	test( 'can access a non-authenticated endpoint', async ( { request } ) => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-complex.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-complex.test.ts
similarity index 95%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-complex.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-complex.test.ts
index 1d0fcf8638..65e8b33f21 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-complex.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-complex.test.ts
@@ -1,13 +1,16 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const {
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import {
 	getOrderExample,
 	getTaxRateExamples,
 	getVariationExample,
-	simpleProduct: defaultSimpleProduct,
-	variableProduct: defaultVariableProduct,
-	groupedProduct: defaultGroupedProduct,
-	externalProduct: defaultExternalProduct,
-} = require( '../../../data' );
+	simpleProduct as defaultSimpleProduct,
+	variableProduct as defaultVariableProduct,
+	groupedProduct as defaultGroupedProduct,
+	externalProduct as defaultExternalProduct,
+} from '../../../data';

 /**
  * Simple product with Standard tax rate
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-search.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-search.test.ts
similarity index 91%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-search.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-search.test.ts
index 0eebb50060..836ca9a774 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-search.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/order-search.test.ts
@@ -1,10 +1,10 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-
-const { getOrderExampleSearchTest } = require( '../../../data/order' );
-const {
-	customerShippingSearchTest,
-} = require( '../../../data/shared/customer' );
-const { simpleProduct } = require( '../../../data/products-crud' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { getOrderExampleSearchTest } from '../../../data/order';
+import { customerShippingSearchTest } from '../../../data/shared/customer';
+import { simpleProduct } from '../../../data/products-crud';

 /**
  * Order to be searched
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders-crud.test.ts
similarity index 98%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders-crud.test.ts
index d969ca59dc..e592966273 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders-crud.test.ts
@@ -1,5 +1,8 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { order } = require( '../../../data' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { order } from '../../../data';
 const { API_BASE_URL } = process.env;
 const shouldSkip = API_BASE_URL !== undefined;

@@ -58,7 +61,7 @@ const simpleProduct = {
 };

 test.describe.serial( 'Orders API tests: CRUD', () => {
-	let orderId;
+	let orderId: number;

 	test.describe( 'Create an order', () => {
 		test( 'can create a pending order by default', async ( {
@@ -115,7 +118,7 @@ test.describe.serial( 'Orders API tests: CRUD', () => {
 		}

 		test.describe( 'Order Notes tests', () => {
-			let orderNoteId;
+			let orderNoteId: number;
 			test( 'can create a order note', async ( { request } ) => {
 				// call API to create an order note on the previously created order
 				const response = await request.post(
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders.test.ts
similarity index 99%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders.test.ts
index a133dc819b..7c7bd500ec 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/orders/orders.test.ts
@@ -1,6 +1,13 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { order } = require( '../../../data' );
-const { faker } = require( '@faker-js/faker' );
+/**
+ * External dependencies
+ */
+import { faker } from '@faker-js/faker';
+
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { order } from '../../../data';

 const RAND_STRING = faker.string.alphanumeric( 8 ).toLowerCase();
 const COUPON_CODE = `coupon-${ faker.string.alphanumeric( 4 ).toLowerCase() }`;
@@ -39,7 +46,8 @@ const updatedCustomerShipping = {
 };

 test.describe.serial( 'Orders API tests', () => {
-	let orderId, sampleData;
+	// eslint-disable-next-line @typescript-eslint/no-explicit-any
+	let orderId: number, sampleData: any;

 	test.beforeAll( async ( { request } ) => {
 		const createSampleCategories = async () => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/payment-gateways/payment-gateways-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/payment-gateways/payment-gateways-crud.test.ts
similarity index 97%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/payment-gateways/payment-gateways-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/payment-gateways/payment-gateways-crud.test.ts
index 912c11eb5f..9883c55588 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/payment-gateways/payment-gateways-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/payment-gateways/payment-gateways-crud.test.ts
@@ -1,5 +1,8 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { resetGatewayOrder } = require( '../../../utils/payments-settings' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { resetGatewayOrder } from '../../../utils/payments-settings';

 const { BASE_URL } = process.env;

diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/product-list.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/product-list.test.ts
similarity index 99%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/product-list.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/product-list.test.ts
index 1711710784..020c5524c5 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/product-list.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/product-list.test.ts
@@ -1,10 +1,18 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { faker } = require( '@faker-js/faker' );
+/**
+ * External dependencies
+ */
+import { faker } from '@faker-js/faker';
+
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

 test.describe( 'Products API tests: List All Products', () => {
 	const PRODUCTS_COUNT = 20;
 	const RAND_NUM = faker.number.int( { min: 1000, max: 9999 } );
-	let sampleData;
+	// eslint-disable-next-line @typescript-eslint/no-explicit-any
+	let sampleData: any;

 	test.beforeAll( async ( { request } ) => {
 		const createSampleCategories = async () => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/products-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/products-crud.test.ts
similarity index 98%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/products-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/products-crud.test.ts
index 16f472089e..0a98d5ad89 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/products-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/products/products-crud.test.ts
@@ -1,19 +1,13 @@
-const {
-	test: baseTest,
-	expect,
-} = require( '../../../fixtures/api-tests-fixtures' );
-const { BASE_URL } = process.env;
-const { admin } = require( '../../../test-data/data' );
-const shouldSkip = BASE_URL !== undefined;
-
 /**
  * Internal dependencies
  */
-const {
-	virtualProduct,
-	variableProduct,
-} = require( '../../../data/products-crud' );
-const { batch } = require( '../../../data/shared/batch-update' );
+import { test as baseTest, expect } from '../../../fixtures/api-tests-fixtures';
+import { admin } from '../../../test-data/data';
+import { virtualProduct, variableProduct } from '../../../data/products-crud';
+import { batch } from '../../../data/shared/batch-update';
+
+const { BASE_URL } = process.env;
+const shouldSkip = BASE_URL !== undefined;

 const test = baseTest.extend( {
 	extraHTTPHeaders: {
@@ -69,7 +63,7 @@ test.describe( 'Products API tests: CRUD', () => {
 	} );

 	test.describe( 'Product attributes tests: CRUD', () => {
-		let productAttributeId;
+		let productAttributeId: number;

 		test( 'can add a product attribute', async ( { request } ) => {
 			const response = await request.post(
@@ -97,7 +91,7 @@ test.describe( 'Products API tests: CRUD', () => {
 		} );

 		test.describe( 'Product attribute terms tests: CRUD', () => {
-			let productAttributeTermId;
+			let productAttributeTermId: number;

 			test( 'can add a product attribute term', async ( { request } ) => {
 				const response = await request.post(
@@ -415,7 +409,7 @@ test.describe( 'Products API tests: CRUD', () => {
 	} );

 	test.describe( 'Product categories tests: CRUD', () => {
-		let productCategoryId;
+		let productCategoryId: number;

 		test( 'can add a product category', async ( { request } ) => {
 			const response = await request.post(
@@ -590,8 +584,9 @@ test.describe( 'Products API tests: CRUD', () => {
 	} );

 	test.describe( 'Product review tests: CRUD', () => {
-		let productReviewId;
-		let reviewsTestProduct;
+		let productReviewId: number;
+		// eslint-disable-next-line @typescript-eslint/no-explicit-any
+		let reviewsTestProduct: any;

 		test.beforeAll( async ( { simpleTestProduct } ) => {
 			reviewsTestProduct = simpleTestProduct;
@@ -863,7 +858,7 @@ test.describe( 'Products API tests: CRUD', () => {
 	} );

 	test.describe( 'Product shipping classes tests: CRUD', () => {
-		let productShippingClassId;
+		let productShippingClassId: number;

 		test( 'can add a product shipping class', async ( { request } ) => {
 			const response = await request.post(
@@ -1048,7 +1043,7 @@ test.describe( 'Products API tests: CRUD', () => {
 	} );

 	test.describe( 'Product tags tests: CRUD', () => {
-		let productTagId;
+		let productTagId: number;

 		test( 'can add a product tag', async ( { request } ) => {
 			const response = await request.post(
@@ -1239,8 +1234,8 @@ test.describe( 'Products API tests: CRUD', () => {
 	} );

 	test.describe( 'Product variation tests: CRUD', () => {
-		let variableProductId;
-		let productVariationId;
+		let variableProductId: number;
+		let productVariationId: number;

 		test( 'can add a variable product', async ( { request } ) => {
 			const response = await request.post( 'wp-json/wc/v3/products', {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/refunds/refunds.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/refunds/refunds.test.ts
similarity index 94%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/refunds/refunds.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/refunds/refunds.test.ts
index f1482a472d..fe52568edd 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/refunds/refunds.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/refunds/refunds.test.ts
@@ -1,9 +1,13 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { refund } = require( '../../../data' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { refund } from '../../../data';

-let productId;
-let expectedRefund;
-let orderId;
+let productId: number;
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+let expectedRefund: any;
+let orderId: number;

 test.describe( 'Refunds API tests', () => {
 	test.beforeAll( async ( { request } ) => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/reports/reports-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/reports/reports-crud.test.ts
similarity index 99%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/reports/reports-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/reports/reports-crud.test.ts
index 1422716257..6feb082ab0 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/reports/reports-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/reports/reports-crud.test.ts
@@ -1,4 +1,7 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

 test.describe( 'Reports API tests', () => {
 	test( 'can view all reports', async ( { request } ) => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/settings/settings-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/settings/settings-crud.test.ts
similarity index 99%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/settings/settings-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/settings/settings-crud.test.ts
index 7ffb3601d1..57ab0ab356 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/settings/settings-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/settings/settings-crud.test.ts
@@ -1,19 +1,17 @@
-const {
+/**
+ * Internal dependencies
+ */
+import {
 	test,
 	expect,
-	request: apiRequest,
+	request as apiRequest,
 	tags,
-} = require( '../../../fixtures/api-tests-fixtures' );
-const { setOption } = require( '../../../utils/options' );
+} from '../../../fixtures/api-tests-fixtures';
+import { setOption } from '../../../utils/options';
+import { countries, currencies, stateOptions } from '../../../data/settings';

 const { BASE_URL } = process.env;

-const {
-	countries,
-	currencies,
-	stateOptions,
-} = require( '../../../data/settings' );
-
 const enableEmailImprovementsFeature = async () => {
 	await setOption(
 		apiRequest,
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-method.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-method.test.ts
similarity index 97%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-method.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-method.test.ts
index da4fce103c..d65e75836f 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-method.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-method.test.ts
@@ -1,9 +1,9 @@
 /* eslint-disable */
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

-const {
+import {
 	getShippingMethodExample
-} = require('../../../data');
+} from '../../../data';

 /**
  * Shipping zone id for "Locations not covered by your other zones".
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-zones.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-zones.test.ts
similarity index 98%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-zones.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-zones.test.ts
index b2500eacd4..31890a7d02 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-zones.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/shipping/shipping-zones.test.ts
@@ -1,6 +1,6 @@
 /* eslint-disable */
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { getShippingZoneExample } = require( '../../../data' );
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { getShippingZoneExample } from '../../../data';
 const { BASE_URL } = process.env;
 const shouldSkip = BASE_URL !== undefined;
 /**
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/system-status/system-status-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/system-status/system-status-crud.test.ts
similarity index 98%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/system-status/system-status-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/system-status/system-status-crud.test.ts
index 77149ab151..c81bc1dace 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/system-status/system-status-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/system-status/system-status-crud.test.ts
@@ -1,18 +1,22 @@
-const {
+/**
+ * Internal dependencies
+ */
+import {
 	test,
-	expect: baseExpect,
-} = require( '../../../fixtures/api-tests-fixtures' );
+	expect as baseExpect,
+} from '../../../fixtures/api-tests-fixtures';
 const expect = baseExpect.extend( {
 	/**
 	 * Custom matcher for matching an object with multiple possible types.
 	 *
-	 * @param {*} received
+	 * @param {*}        received
 	 * @param {string[]} expectedTypes
 	 */
 	anyOf( received, expectedTypes ) {
 		const assertionName = 'anyOf';
-		let pass;
-		let matcherResult;
+		let pass: boolean;
+		// eslint-disable-next-line @typescript-eslint/no-explicit-any
+		let matcherResult: any;

 		try {
 			baseExpect( expectedTypes ).toContain( typeof received );
@@ -254,7 +258,8 @@ const getExpectedWooCommerceTables = ( dbPrefix ) => {
 /* eslint-disable playwright/no-nested-step */
 test.describe( 'System Status API tests', () => {
 	test( 'can view all system status items', async ( { request } ) => {
-		let responseJSON,
+		// eslint-disable-next-line @typescript-eslint/no-explicit-any
+		let responseJSON: any,
 			databasePrefix,
 			databaseSize,
 			databaseTables,
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-classes-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-classes-crud.test.ts
similarity index 96%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-classes-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-classes-crud.test.ts
index 7541173f19..026af3d8e3 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-classes-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-classes-crud.test.ts
@@ -1,7 +1,10 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

 test.describe( 'Tax Classes API tests: CRUD', () => {
-	let taxClassSlug;
+	let taxClassSlug: string;

 	test.describe( 'Create a tax class', () => {
 		test( 'can enable tax calculations', async ( { request } ) => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-rates-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-rates-crud.test.ts
similarity index 97%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-rates-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-rates-crud.test.ts
index 0275094164..774fdf855d 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-rates-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/taxes/tax-rates-crud.test.ts
@@ -1,10 +1,13 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
-const { allUSTaxesExample } = require( '../../../data' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';
+import { allUSTaxesExample } from '../../../data';
 const { BASE_URL } = process.env;
 const shouldSkip = BASE_URL !== undefined;

 test.describe.serial( 'Tax Rates API tests: CRUD', () => {
-	let taxRateId;
+	let taxRateId: number;

 	test.describe( 'Create a tax rate', () => {
 		test( 'can create a tax rate', async ( { request } ) => {
diff --git a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/webhooks/webhooks-crud.test.js b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/webhooks/webhooks-crud.test.ts
similarity index 96%
rename from plugins/woocommerce/tests/e2e-pw/tests/api-tests/webhooks/webhooks-crud.test.js
rename to plugins/woocommerce/tests/e2e-pw/tests/api-tests/webhooks/webhooks-crud.test.ts
index 13b77b301d..42e31e36a2 100644
--- a/plugins/woocommerce/tests/e2e-pw/tests/api-tests/webhooks/webhooks-crud.test.js
+++ b/plugins/woocommerce/tests/e2e-pw/tests/api-tests/webhooks/webhooks-crud.test.ts
@@ -1,7 +1,10 @@
-const { test, expect } = require( '../../../fixtures/api-tests-fixtures' );
+/**
+ * Internal dependencies
+ */
+import { test, expect } from '../../../fixtures/api-tests-fixtures';

 test.describe( 'Webhooks API tests', () => {
-	let webhookId;
+	let webhookId: number;

 	test.describe( 'Create a webhook', () => {
 		test( 'can create a webhook', async ( { request } ) => {
@@ -107,9 +110,9 @@ test.describe( 'Webhooks API tests', () => {
 	} );

 	test.describe( 'Batch webhook operations', () => {
-		let webhookId1;
-		let webhookId2;
-		let webhookId3;
+		let webhookId1: number;
+		let webhookId2: number;
+		let webhookId3: number;
 		test( 'can batch create webhooks', async ( { request } ) => {
 			// Batch create webhooks
 			// call API to batch create a webhook