You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The package includes a CLI binary used by CI workflows to build actors, detect changes, and report test results. You can also run it locally for debugging.
310
+
The package includes a CLI binary used by CI workflows to build Actors, detect changes, and report test results. You can also run it locally.
311
311
312
312
### Running locally
313
313
314
-
The main local flow is: **build** affected actors, then **run tests** against those builds.
314
+
Running the testing library locally is useful when you only want to update the testing code in /test because you can iterate on it without pushing new code to the remote.
315
+
316
+
If you don't need to change any source files and only iterate on /test code, you can skip steps 1-4. But if you want to test vs changed /src, you have to push that GitHub branch since it needs to build the Actors with that code.
317
+
318
+
The main local flow is:
319
+
1. Switch to a dummy branch that you will push and can later delete
320
+
2.`npm i apify-test-tools@latest -D`
321
+
3. Push your code (changes you want to test)
322
+
4. Build Actors on Apify (with your new code)
323
+
5. Run tests against those builds. You can change tests and run on the same builds.
315
324
316
325
`cd` into the actor repository you want to work with (or use `--workspace`).
317
326
318
-
#### 1. Build affected actors
327
+
#### 4. Build affected Actors
319
328
320
-
Requires `APIFY_TOKEN_<USERNAME>` for each actor owner. The username is derived from the actor name — uppercased with non-word chars replaced by `_` (e.g. actor `john.doe/my-actor` needs `APIFY_TOKEN_JOHN_DOE`).
329
+
If you want to test vs existing src code, you can skip this and instead construct the output JSON manually from existing builds only for the Actors you need to test.
330
+
331
+
Requires `APIFY_TOKEN_<USERNAME>` for all Apify users that own your Actors (`e.g. `apify`, `compass`, `lukaskrivka` users). The username is derived from the actor name — uppercased with non-word chars replaced by `_` (e.g. Actor `john.doe/my-actor` needs `APIFY_TOKEN_JOHN_DOE`).
321
332
322
333
```bash
323
334
APIFY_TOKEN_JOHN_DOE=<token> \
324
335
GITHUB_WORKSPACE=. \
325
336
npx apify-test-tools build \
326
337
--target-branch origin/master \
327
-
--source-branch HEAD \
338
+
--source-branch origin/my-dummy-branch \
328
339
--dry-run
329
340
```
330
341
331
-
Remove `--dry-run` to actually trigger builds. The command outputs a JSON array of build objects to stdout:
342
+
Remove `--dry-run` to actually trigger builds and update the branch names/ The command outputs a JSON array of build objects to stdout:
Pass the build output as `ACTOR_BUILDS` and provide `TESTER_APIFY_TOKEN`. The token can point to your own account (if you have enough memory) or you can use the testing account (xRGg9iAfJSymqartk).
338
351
339
-
Pass the build output as `ACTOR_BUILDS` and provide `TESTER_APIFY_TOKEN` (the token used to call actors and read results):
352
+
If you want to run only certain tests, change the `test/platform`to be more specific.
0 commit comments