Skip to content

1065 add end to end e2e tests for apify cli#1077

Open
l2ysho wants to merge 9 commits intomasterfrom
1065-add-end-to-end-e2e-tests-for-apify-cli
Open

1065 add end to end e2e tests for apify cli#1077
l2ysho wants to merge 9 commits intomasterfrom
1065-add-end-to-end-e2e-tests-for-apify-cli

Conversation

@l2ysho
Copy link
Copy Markdown
Contributor

@l2ysho l2ysho commented Apr 9, 2026

  • runCli() helper with auto-detected dist/npx/global modes + 6 help tests
  • test-actor helper + basic-actor fixture + 8 local tests (invalid-config, actor-run-input)
  • 8 builds tests with auth, platform push, and remote cleanup
  • e2e.yaml CI workflow — triggers after beta publish, daily, manual dispatch with version override
  • Deleted cucumber infrastructure

Commands tested:

  • apify help, actor help, apify help help, apify help -h, apify help run, apify run --help — help output and entrypoints
  • apify run — with --input (inline JSON), -i (alias), --input-file (from file, missing file, stdin via -), implicit stdin, invalid actor.json
  • apify builds create — with invalid ID, unpublished actor, published actor, --json
  • apify builds info — with invalid ID, valid build ID, --json
  • apify builds ls --json

closes #1065

l2ysho and others added 6 commits April 9, 2026 16:44
Replace cucumber's subprocess approach with a simpler runCli() helper
that spawns the real built CLI binary. Auto-detects environment via
is-ci: uses dist mode locally, npx mode in CI.

- Add runCli() helper (test/e2e/__helpers__/run-cli.ts)
- Add 6 help command e2e tests (test/e2e/help.test.ts)
- Add test:e2e and test:e2e:local scripts
- Exclude test/e2e from test:local
Migrate invalid-config and actor-run-input cucumber features to Vitest.
Refactor runCli() to accept array args instead of string command parsing.

- Add test-actor helper (create, cleanup, corrupt, read results)
- Add basic-actor.js fixture
- Add invalid-config.test.ts (1 test)
- Add actor-run-input.test.ts (7 tests)
- Refactor runCli(binary, args) array API — no shell quoting issues
When an exit code assertion fails, the error message now includes
stderr output for easier debugging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Migrate builds-namespace cucumber feature to Vitest. Tests auth via
CLI subprocess, push to platform, and exercise builds create/info/ls.

- Add builds.test.ts (8 tests, requires TEST_USER_TOKEN)
- Use getApifyClientOptions for correct client config
- Share build ID via beforeAll in builds info describe block
New workflow runs e2e tests after every beta publish (workflow_run),
daily at 06:00 UTC (schedule), and on manual dispatch with optional
version override. Temporary pull_request trigger for validation.

- Auto-detects CI → npx apify-cli@beta mode
- Manual dispatch supports global mode with specific versions
- Repo guard prevents fork execution
- Command injection protection via env var indirection
- 30min timeout, concurrency control
- Fix || vs ?? for empty APIFY_CLI_E2E_MODE handling

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
All 22 cucumber scenarios have been migrated to Vitest e2e tests.

- Delete /features/ directory (4 feature files, 6 implementation files)
- Delete cucumber.json
- Delete .github/workflows/cucumber.yaml
- Remove @cucumber/cucumber from devDependencies
- Remove test:cucumber script
- Remove features from lint paths
- Update stale cucumber reference in call.test.ts
@l2ysho l2ysho linked an issue Apr 9, 2026 that may be closed by this pull request
2 tasks
@github-actions github-actions bot added this to the 138th sprint - Tooling team milestone Apr 9, 2026
@github-actions github-actions bot added t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics. labels Apr 9, 2026
l2ysho and others added 3 commits April 10, 2026 00:34
On a fresh clone, test/tmp is gitignored and doesn't exist, causing
e2e tests to fail with ENOENT when execa tries to use it as cwd.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@l2ysho l2ysho marked this pull request as ready for review April 10, 2026 07:44
@l2ysho l2ysho requested a review from vladfrangu as a code owner April 10, 2026 07:44
@l2ysho l2ysho requested a review from B4nan April 10, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add end-to-end (e2e) tests for Apify CLI

2 participants