Skip to content

Commit 334d56a

Browse files
committed
Update docs
1 parent e293364 commit 334d56a

File tree

1 file changed

+70
-6
lines changed

1 file changed

+70
-6
lines changed

docs/test-playwright.md

Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
| `GITHUB_USER_NAME` | Username for the GitHub user configuration |
5757
| `GITHUB_USER_SSH_KEY` | Private SSH key associated with the GitHub user passed as `GITHUB_USER_NAME` |
5858

59-
**Example with configuration parameters:**
59+
## Example with configuration parameters
6060

6161
```yml
6262
name: E2E Testing
@@ -90,7 +90,7 @@ jobs:
9090
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN}}
9191
```
9292

93-
**Example with custom inputs:**
93+
## Example with custom inputs
9494

9595
```yml
9696
name: E2E Testing
@@ -127,11 +127,75 @@ jobs:
127127
NPM_REGISTRY_TOKEN: ${{ secrets.DEPLOYBOT_PACKAGES_READ_ACCESS_TOKEN}}
128128
```
129129

130-
**Example of secrets:**
130+
## Example of secrets
131131

132132
For `ENV_FILE_DATA`:
133133

134-
```SHELL
135-
TEST_EXEC_KEY=YOUR-KEY
136-
WP_BASE_URL=https://example.com
134+
```bash
135+
# playwright-utils config
136+
WP_BASE_URL='http://mywp.site'
137+
WP_USERNAME=admin
138+
WP_PASSWORD=password
139+
WP_BASIC_AUTH_USER=admin
140+
WP_BASIC_AUTH_PASS=password
141+
STORAGE_STATE_PATH='./storage-states'
142+
STORAGE_STATE_PATH_ADMIN='./storage-states/admin.json'
143+
WORDPRESS_DB_USER=root
144+
WORDPRESS_DB_PASSWORD=password
145+
146+
WPCLI_ENV_TYPE= # localhost, vip, wpenv, ddev, ssh
147+
WPCLI_PATH= # for localhost, wpenv
148+
# For WPCLI_ENV_TYPE=ssh
149+
SSH_LOGIN=
150+
SSH_HOST=
151+
SSH_PORT=
152+
SSH_PATH=
153+
# For WPCLI_ENV_TYPE=vip
154+
VIP_APP=
155+
VIP_ENV=
156+
157+
# WooCommerce specific env vars
158+
WC_API_KEY=
159+
WC_API_SECRET=
160+
WC_DEFAULT_COUNTRY=usa
161+
WC_DEFAULT_CURRENCY=USD
162+
163+
# Xray in Jira
164+
XRAY_CLIENT_ID=
165+
XRAY_CLIENT_SECRET=
166+
TEST_EXEC_KEY=
137167
```
168+
169+
## Examples of `PRE_SCRIPT`
170+
171+
### VIP connection
172+
173+
```bash
174+
PRE_SCRIPT: |
175+
npm install -g @automattic/vip
176+
mkdir -p ~/.config/configstore
177+
echo '{"vip-go-cli": "'"$VIP_TOKEN"'"}' > ~/.config/configstore/vip-go-cli.json
178+
```
179+
180+
### Distributing vars per env
181+
182+
In case of several test environments (staging, production, etc.) `PRE_SCRIPT` can be used to setup env-specific vars from `ENV_FILE_DATA`. For example `PERCY_TOKEN`:
183+
184+
```bash
185+
PRE_SCRIPT: |
186+
echo "PERCY_TOKEN=$PERCY_TOKEN_STAGE" >> "$GITHUB_ENV"
187+
```
188+
189+
### Download and zip plugin artifact
190+
191+
For cases when plugin is built within the same workflow:
192+
193+
```bash
194+
PRE_SCRIPT: |
195+
gh run download ${{ github.run_id }} -p "woocommerce-paypal-payments-*" -D tests/qa/resources/files
196+
cd tests/qa/resources/files
197+
mv woocommerce-paypal-payments-*/woocommerce-paypal-payments .
198+
zip -r woocommerce-paypal-payments.zip woocommerce-paypal-payments
199+
rm -rf woocommerce-paypal-payments woocommerce-paypal-payments-*/
200+
```
201+

0 commit comments

Comments
 (0)