Skip to content

Commit 3846588

Browse files
committed
Fix pages and product creation
1 parent 9c5362d commit 3846588

File tree

5 files changed

+202
-18
lines changed

5 files changed

+202
-18
lines changed

package-lock.json

Lines changed: 160 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"devDependencies": {
33
"@playwright/test": "^1.53.0",
44
"@types/node": "^24.0.0",
5+
"@woocommerce/e2e-utils-playwright": "^0.3.1",
56
"@wordpress/scripts": "^29.0.0",
67
"dotenv": "^16.5.0"
78
},
@@ -20,5 +21,8 @@
2021
"start": "wp-scripts start",
2122
"test:e2e": "wp-scripts test-e2e",
2223
"test:unit": "wp-scripts test-unit-js"
24+
},
25+
"dependencies": {
26+
"@woocommerce/woocommerce-rest-api": "^1.0.1"
2327
}
2428
}

tests/fixtures/product-types.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,46 @@ export const PRODUCT_TYPES: Record<string, ProductType> = {
4444
short_description: 'Simple test product'
4545
}
4646
},
47+
BIZUM_SUCCESS: {
48+
id: 'bizum_success',
49+
sku: 'TEST-BIZUM-01',
50+
name: 'Bizum Success Simple Product',
51+
isSubscription: false,
52+
sampleProductId: 64,
53+
sampleProductSlug: 'bizum_success',
54+
price: 1.00,
55+
woocommerce: {
56+
type: 'simple',
57+
status: 'publish',
58+
catalog_visibility: 'visible',
59+
description: 'A simple test product for automated testing',
60+
short_description: 'Simple test product'
61+
}
62+
},
63+
BIZUM_FAILS: {
64+
id: 'bizum_fails',
65+
sku: 'TEST-BIZUM-02',
66+
name: 'Bizum Fails Simple Product',
67+
isSubscription: false,
68+
sampleProductId: 65,
69+
sampleProductSlug: 'bizum_fails',
70+
price: 10.00,
71+
woocommerce: {
72+
type: 'simple',
73+
status: 'publish',
74+
catalog_visibility: 'visible',
75+
description: 'A simple test product for automated testing',
76+
short_description: 'Simple test product'
77+
}
78+
},
4779

4880
// Variable product
4981
VARIABLE: {
5082
id: 'variable',
5183
sku: 'TEST-VARIABLE-01',
5284
name: 'Variable Product',
5385
isSubscription: false,
54-
sampleProductId: 64,
86+
sampleProductId: 66,
5587
sampleProductSlug: 'variable',
5688
price: 29.99,
5789
woocommerce: {

tests/setup/global-setup.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@ async function globalSetup(config: FullConfig) {
2424
// test api client
2525
await apiClient.healthCheck();
2626

27-
28-
2927
// Setup test data
30-
await testDataManager.setupTestProducts();
31-
32-
// await testDataManager.setupTestProducts(['SIMPLE', 'VARIABLE']);
28+
await testDataManager.setupTestProducts();
3329
// await testDataManager.setupProductsByType('simple');
3430
// await testDataManager.setupSubscriptionProducts('woocommerce');
35-
await testDataManager.setupTestPages();
36-
await testDataManager.setupMoneiPaymentMethods();
31+
//await testDataManager.setupTestPages();
32+
//await testDataManager.setupMoneiPaymentMethods();
3733

3834
await browser.close();
3935
}

tests/setup/test-data-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ export class TestDataManager {
9191
async setupTestPages() {
9292
const requiredPages = [
9393
{
94-
slug: 'checkout-classic',
94+
slug: 'checkout-short-code',
9595
title: 'Classic Checkout',
9696
content: '[woocommerce_checkout]',
9797
template: 'page'
9898
},
9999
{
100-
slug: 'checkout-block',
100+
slug: 'checkout',
101101
title: 'Block Checkout',
102102
content: '<!-- wp:woocommerce/checkout --><div class="wp-block-woocommerce-checkout"></div><!-- /wp:woocommerce/checkout -->',
103103
template: 'page'

0 commit comments

Comments
 (0)