Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 15259b9

Browse files
authored
Add fixtures data for all entities. (#2548)
* change entrypoint setup and install wc-rest-api * enable pretty links in docker * create fixtures functions * create and load global setup and teardown files * support multiple shipping zones * use env values * refactor command * fix typo in command * more to import instead of require * add docs * refactor test data to its own file and refactor shipping methods * revert to commonJS require * rename function name * rename global variable * update fixture functions to accept fixture as param * document fixture data * pin wc rest api * update package-lock * remove forgetten test line
1 parent 799e15f commit 15259b9

File tree

11 files changed

+751
-79
lines changed

11 files changed

+751
-79
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ WORDPRESS_DB_PASSWORD=wordpress
66

77
# WordPress CLI environment
88
WORDPRESS_PORT=8084
9+
WORDPRESS_BASE_URL=http://localhost
910
WORDPRESS_HOST=wordpress-www:80
1011
WORDPRESS_TITLE=WooCommerce Core E2E Test Suite
1112
WORDPRESS_LOGIN=admin

bin/docker/wordpress/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
FROM wordpress:5.3
1+
FROM wordpress:5.4

bin/docker/wp-cli/entrypoint.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ else
4646
--admin_email=${WORDPRESS_EMAIL} \
4747
--skip-email
4848
fi
49-
49+
# WC Rest API needs pretty links to work
50+
wp rewrite structure "/%postname%/" --hard
51+
# we cannot create API keys for the API, so we using basic auth, this plugin allows that.
52+
wp plugin install https://github.com/WP-API/Basic-Auth/archive/master.zip --activate
5053
wp plugin install woocommerce --activate
5154
wp plugin activate woocommerce-gutenberg-products-block
52-
wp theme install twentynineteen --activate
55+
wp theme install storefront --activate
5356
wp user create customer [email protected] --user_pass=password --role=customer --path=/var/www/html
5457
wp post create --post_type=page --post_status=publish --post_title='Ready' --post_content='E2E-tests.'
5558

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"@types/react": "16.9.35",
8484
"@types/wordpress__data": "4.6.7",
8585
"@types/wordpress__element": "2.4.1",
86+
"@woocommerce/woocommerce-rest-api": "1.0.1",
8687
"@wordpress/babel-preset-default": "4.10.0",
8788
"@wordpress/base-styles": "1.4.0",
8889
"@wordpress/blocks": "6.12.0",
Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
11
{
2-
"url": "http://localhost:8084/",
3-
"users": {
4-
"admin": {
5-
"username": "admin",
6-
"password": "password"
7-
},
8-
"customer": {
9-
"username": "customer",
10-
"password": "password"
11-
}
12-
},
13-
"products": {
14-
"simple": {
15-
"name": "Simple product"
16-
},
17-
"variable": {
18-
"name": "Variable Product with Three Variations"
19-
}
20-
},
21-
"addresses": {
22-
"admin": {
23-
"store": {
24-
"firstname": "John",
25-
"lastname": "Doe",
26-
"company": "Automattic",
27-
"country": "United States (US)",
28-
"addressfirstline": "addr 1",
29-
"addresssecondline": "addr 2",
30-
"city": "San Francisco",
31-
"state": "CA",
32-
"postcode": "94107"
33-
}
34-
},
35-
"customer": {
36-
"billing": {
37-
"firstname": "John",
38-
"lastname": "Doe",
39-
"company": "Automattic",
40-
"country": "United States (US)",
41-
"addressfirstline": "addr 1",
42-
"addresssecondline": "addr 2",
43-
"city": "San Francisco",
44-
"state": "CA",
45-
"postcode": "94107",
46-
"phone": "123456789",
47-
"email": "[email protected]"
48-
},
49-
"shipping": {
50-
"firstname": "John",
51-
"lastname": "Doe",
52-
"company": "Automattic",
53-
"country": "United States (US)",
54-
"addressfirstline": "addr 1",
55-
"addresssecondline": "addr 2",
56-
"city": "San Francisco",
57-
"state": "CA",
58-
"postcode": "94107"
59-
}
60-
}
61-
}
2+
"url": "http://localhost:8084/",
3+
"users": {
4+
"admin": {
5+
"username": "admin",
6+
"password": "password"
7+
},
8+
"customer": {
9+
"username": "customer",
10+
"password": "password"
11+
}
12+
},
13+
"products": {
14+
"simple": {
15+
"name": "Simple product"
16+
},
17+
"variable": {
18+
"name": "Variable Product with Three Variations"
19+
}
20+
},
21+
"addresses": {
22+
"admin": {
23+
"store": {
24+
"firstname": "John",
25+
"lastname": "Doe",
26+
"company": "Automattic",
27+
"country": "United States (US)",
28+
"addressfirstline": "addr 1",
29+
"addresssecondline": "addr 2",
30+
"city": "San Francisco",
31+
"state": "CA",
32+
"postcode": "94107"
33+
}
34+
},
35+
"customer": {
36+
"billing": {
37+
"firstname": "John",
38+
"lastname": "Doe",
39+
"company": "Automattic",
40+
"country": "United States (US)",
41+
"addressfirstline": "addr 1",
42+
"addresssecondline": "addr 2",
43+
"city": "San Francisco",
44+
"state": "CA",
45+
"postcode": "94107",
46+
"phone": "123456789",
47+
"email": "[email protected]"
48+
},
49+
"shipping": {
50+
"firstname": "John",
51+
"lastname": "Doe",
52+
"company": "Automattic",
53+
"country": "United States (US)",
54+
"addressfirstline": "addr 1",
55+
"addresssecondline": "addr 2",
56+
"city": "San Francisco",
57+
"state": "CA",
58+
"postcode": "94107"
59+
}
60+
}
61+
}
6262
}

tests/e2e-tests/config/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ module.exports = {
1414

1515
// Where to look for test files
1616
roots: [ '<rootDir>/tests/e2e-tests/specs' ],
17-
17+
globalSetup: '<rootDir>/tests/e2e-tests/config/setup.js',
18+
globalTeardown: '<rootDir>/tests/e2e-tests/config/teardown.js',
1819
setupFiles: [ '<rootDir>/tests/e2e-tests/config/env.setup.js' ],
1920
// A list of paths to modules that run some code to configure or set up the testing framework
2021
// before each test

0 commit comments

Comments
 (0)