@@ -48,7 +48,42 @@ find ./bootstrap -type f -exec sed -i 's|/qit/bootstrap|./bootstrap|g' {} +
4848
4949---
5050
51- ## 2. QIT Helpers Import Changes
51+ ## 2. Bootstrap Test User Creation
52+
53+ ** Why** : Tests expect specific users (from ` config/users.json ` ) to exist. Your bootstrap must create them with matching credentials.
54+
55+ ### bootstrap/setup.sh
56+
57+ Add user creation commands:
58+
59+ ``` bash
60+ # Create test users matching config/users.json
61+ wp user create customer
[email protected] \
62+ --role=customer \
63+ --user_pass=password \
64+ --first_name=" Jane" \
65+ --last_name=" Smith" \
66+ --quiet 2> /dev/null || wp user update customer --user_pass=password --quiet
67+
68+ wp user create subscriptions-customer
[email protected] \
69+ --role=customer \
70+ --user_pass=password \
71+ --quiet 2> /dev/null || wp user update subscriptions-customer --user_pass=password --quiet
72+
73+ wp user create editor
[email protected] \
74+ --role=editor \
75+ --user_pass=password \
76+ --quiet 2> /dev/null || wp user update editor --user_pass=password --quiet
77+ ```
78+
79+ ** Important** :
80+ - Usernames and passwords must match ` config/users.json `
81+ - The ` || wp user update ` fallback handles cases where the user already exists
82+ - Without these users, authentication will fail in tests
83+
84+ ---
85+
86+ ## 3. QIT Helpers Import Changes
5287
5388** Why** : Legacy tests used global ` /qitHelpers ` module. Test packages use local ` @qit/helpers ` package.
5489
@@ -78,7 +113,7 @@ find . -name "*.ts" -o -name "*.js" | xargs sed -i "s|from '/qitHelpers'|from '@
78113
79114---
80115
81- ## 3 . JSON Import Changes
116+ ## 4 . JSON Import Changes
82117
83118** Why** : ES modules require import attributes for JSON files.
84119
@@ -121,7 +156,7 @@ grep -r "from.*\.json" . --include="*.ts" --include="*.js"
121156
122157---
123158
124- ## 4 . ` __dirname ` Shim for ES Modules
159+ ## 5 . ` __dirname ` Shim for ES Modules
125160
126161** Why** : ES modules don't provide ` __dirname ` global like CommonJS does.
127162
@@ -163,7 +198,7 @@ grep -r "__dirname" . --include="*.ts" --include="*.js"
163198
164199---
165200
166- ## 5 . Required Dependencies
201+ ## 6 . Required Dependencies
167202
168203** Why** : ES modules need Node.js type definitions, and QIT requires Allure reports.
169204
@@ -195,7 +230,7 @@ grep -r "__dirname" . --include="*.ts" --include="*.js"
195230
196231---
197232
198- ## 6 . RestAPI Import
233+ ## 7 . RestAPI Import
199234
200235** Why** : ` RestAPI ` class needs to be imported if used in helper functions.
201236
@@ -235,7 +270,7 @@ export const getShopper = async (
235270
236271---
237272
238- ## 7 . Playwright Reporter Configuration
273+ ## 8 . Playwright Reporter Configuration
239274
240275** Why** : QIT requires specific reporters to be configured for test results and Allure reports.
241276
@@ -284,7 +319,7 @@ export default defineConfig({
284319
285320---
286321
287- ## 8 . Test Package Manifest - Allure Directory
322+ ## 9 . Test Package Manifest - Allure Directory
288323
289324** Why** : QIT needs to know where to find Allure results to upload them with test reports.
290325
@@ -318,6 +353,7 @@ Add `allure-dir` to the `results` section:
318353When migrating tests to test packages, check for these code changes:
319354
320355- [ ] Replace ` /qit/bootstrap/ ` with ` ./bootstrap/ ` in all bootstrap scripts
356+ - [ ] Create test users in bootstrap matching ` config/users.json ` (customer, editor, etc.)
321357- [ ] Replace ` /qitHelpers ` with ` @qit/helpers ` in all test files
322358- [ ] Add ` with { type: 'json' } ` to JSON imports
323359- [ ] Use default imports for JSON files
0 commit comments