Commit Graph
10 Commits
Author SHA1 Message Date
gigglewang0417 56ba8f421a ci(cli-e2e): parallel job workflow + provision script + test fixes
Workflow (cli-e2e.yml):
- Plan B: split into parallel jobs after a shared provision step
- provision job: mints token + provisions DSL apps, outputs IDs to downstream jobs
- suite-run: matrix of 5 parallel jobs (basic/streaming/conversation/file/hitl)
- suite-last: serial, waits for all parallel jobs; runs use/devices/logout/agent
- Add DIFY_E2E_NO_KEYRING=1 globally (Linux CI has no keychain)
- timeout-minutes: 30 → 60; smoke filter: --testNamePattern → -t

New script (cli/scripts/e2e-provision.ts):
- Standalone Bun script: login + mint token + discover workspaces + provision apps
- Outputs to GITHUB_OUTPUT + .provision-output.json

Test fixes:
- run-app-streaming: DIFY_E2E_NO_KEYRING=1 in spawn-based tests
- run-app-basic: fix cache test (DIFY_CACHE_DIR + app-info.yml path)
- run-app-conversation/file: SSO injectAuth uses new hosts.yml format
- get-app-list: tag filter auto-provisions e2e-test tag
- vitest.e2e.config.ts: DIFY_E2E_SINGLE_FILE override + agent suite
2026-06-07 16:35:31 +08:00
gigglewang0417 3cc20de830 test(cli-e2e): add full e2e suite — auth/config/discovery/run/output/error-handling/framework/help
New suites:
- auth/login.e2e.ts
- config/config-init.e2e.ts, config-rw.e2e.ts
- error-handling/error-messages.e2e.ts, exit-codes.e2e.ts
- framework/global-flags.e2e.ts, help.e2e.ts
- output/json-yaml-output.e2e.ts, table-output.e2e.ts

Updated suites:
- auth: devices / logout / status / use / whoami
- discovery: describe-app / get-app-all-workspaces / get-app-list / get-app-single
- run: run-app-basic / conversation / file / hitl / streaming

Infra:
- fixtures/apps: 9 DSL files for app provisioning
- setup/global-setup.ts: multi-token provisioning + workspace discovery
- setup/env.ts: capability injection
- helpers/skip.ts: conditional skip helper
- vitest.e2e.config.ts: include help.e2e.ts in both local and staging modes
2026-06-04 17:47:13 +08:00
gigglewang0417 4649e52384 fix(cli-e2e): use @ts-expect-error to suppress TS2345 for inject/provide
Both augmentation approaches fail under tsgo in the Main CI pipeline:
  - 'vitest' augmentation → TS2300 (re-exported ProvidedContext in @0.1.22)
  - '@voidzero-dev/vite-plus-test' augmentation → TS2664 (module not found;
    tsgo scans cli/ tree but cannot resolve pnpm virtual-store symlinks)

Use @ts-expect-error at the three call sites (global-setup, devices, logout)
as the only option that satisfies both tsgo and the ESLint ban-ts-comment
rule (which requires @ts-expect-error over @ts-ignore).
2026-06-01 15:22:17 +08:00
gigglewang0417 c045e0b635 fix(cli-e2e): fix ProvidedContext augmentation for [email protected]
Root cause: keyof ProvidedContext = never in @0.1.22 because the interface
is empty. inject() / project.provide() have T extends keyof ProvidedContext,
so any string literal — including 'as any' casts — is TS2345 under tsgo
which scans the whole cli/ tree (not just the src/ include in tsconfig.json).

Fix: augment '@voidzero-dev/vite-plus-test' directly (where ProvidedContext
is defined as an empty interface meant for user extension via declaration
merging) instead of 'vitest'. This avoids TS2300 duplicate identifier in
@0.1.22 and restores full type safety for inject/provide without any cast.

Revert all previous workaround casts ('as any', 'as unknown as') now that
the augmentation path is correct.
2026-06-01 15:14:17 +08:00
gigglewang0417 cf7859cbf9 fix(cli-e2e): fix 4 smoke test failures on console-platform-dev
run-app-basic:
  Widen stderr pattern for non-existent app test — new env returns
  'server_5xx: Internal Server Error' (HTTP 500) instead of 404/not-found.

describe-app:
  Wrap ANSI colour test with withRetry(3) to handle transient 500s on
  cold-start against console-platform-dev.

run-app-streaming:
  Workflow streaming test was passing only x='wf-stream-val'; the workflow
  app requires num, enum_var and paragraph as required fields too.
  Add all four required inputs to the --inputs payload.

cli.ts (mintFreshToken):
  Increase console/api/login timeout from 10s to 20s — the dev environment
  was timing out during the devices revoke test on CI.
2026-06-01 15:01:14 +08:00
gigglewang0417 69923a16e1 fix(cli-e2e): remove ProvidedContext augmentation to fix TS2300 on CI
[email protected] exports ProvidedContext from its own module, making
any 'declare module vitest { ProvidedContext }' augmentation produce a
TS2300 duplicate identifier error and collapse the type to 'never'.

Fix: remove the module augmentation from vitest-context.ts entirely.
Callers (devices.e2e.ts, logout.e2e.ts) now cast inject() results with
'as E2ECapabilities' directly at the call site — no global type magic needed.
2026-06-01 14:37:41 +08:00
gigglewang0417 7114415cfd fix(cli-e2e): fix TS errors caused by [email protected] upgrade
skip.ts:
  - Return SuiteAPI/TestAPI with 'as unknown as' cast to bridge the
    ChainableSuiteAPI incompatibility across vite-plus-test versions
    (TS2322 / TS4058). Uses unknown intermediate to satisfy no-explicit-any.

vitest-context.ts:
  - Change 'export type ProvidedContext' to 'interface ProvidedContext'
    augmentation to avoid TS2300 duplicate identifier now that
    [email protected] re-exports ProvidedContext from its own module.
2026-06-01 14:32:24 +08:00
gigglewang0417 6c8ec0b1c8 fix(cli-e2e): add explicit return types to optionalDescribe/optionalIt
TS4058: exported functions in skip.ts return vitest-internal types that
cannot be named by the CI type-checker ([email protected]).
Annotate with 'typeof describe' and 'typeof it' — both are stable,
publicly addressable types — to satisfy the type-check pipeline.
2026-06-01 14:23:22 +08:00
gigglewang0417 bc3b1c0c81 fix(ci): fix pnpm version conflict in cli-e2e workflow; refine e2e suite
- Override pnpm to v11 (packageManager field) before CLI install step to
  resolve ERR_PNPM_BAD_PM_VERSION conflict with setup-web's pnpm@9
- Add per-suite dedicated tokens (logoutToken / devicesToken) in global-setup
  via device flow to prevent token cross-contamination between suites
- Translate all Chinese comments and test names to English across e2e suites
- Fix injectAuth: add tokenId field so devices revoke correctly detects selfHit
- Fix HITL test: read action id dynamically from pause response instead of
  hardcoding 'submit'
2026-05-27 17:23:46 +08:00
gigglewang0417 5646bda88e test(e2e): add E2E test suite for CLI v1.0
Covers auth, config, run, and CLI framework scenarios against a live
staging server using vitest + real difyctl binary.

Suite layout:
  test/e2e/
  ├── helpers/
  │   ├── cli.ts          — run(), withAuthFixture(), mintFreshToken()
  │   ├── assert.ts       — assertExitCode, assertJson, assertErrorEnvelope
  │   ├── cleanup-registry.ts — staging data teardown
  │   └── retry.ts        — withRetry() for flaky network assertions
  ├── setup/
  │   ├── global-setup.ts — health-check, disposable token mint
  │   └── global-teardown.ts — conversation cleanup
  └── suites/
      ├── auth/           — status, use, whoami, devices, logout
      ├── config/         — path, get/set/unset/view, env override
      └── run/            — basic, streaming, conversation, file, HITL

Key design decisions:
- Each test uses an isolated temp configDir via withAuthFixture()
- Logout and devices-revoke tests run last to avoid invalidating
  the shared E.token used by all other suites
- mintFreshToken() mints a disposable dfoa_ token on demand via the
  device flow API so revoke tests never touch the primary session
- Global retry is 0; flaky network calls use withRetry() locally
- test:e2e:smoke script filters to [P0] cases via testNamePattern

package.json: add test:e2e / test:e2e:smoke / test:e2e:local scripts
.gitignore: exclude .env.e2e, oclif.manifest.json, tmp/
.env.e2e.example: credential template for local setup
2026-05-27 10:07:28 +08:00