run-cli-e2e-locally
Run the CLI E2E tests locally using your own user credentials instead of a service principal. Use when: run e2e locally, run cli tests, test with my credentials, local e2e, e2e user auth, run fabric tests locally.
- License 许可
- MIT
- 所属仓库
- microsoft/rayfin
- 最近更新
- 2026-11-12
- Stars
- ★ 657
- Forks
- 73
01 前言 Front Matter
- name
- run-cli-e2e-locally
- license
- MIT
- metadata
- { "author": "rayfin", "version": "2.0" }
- description
- Run the CLI E2E tests locally using your own user credentials instead of a service principal. Use when: run e2e locally, run cli tests, test with my credentials, local e2e, e2e user auth, run fabric tests locally.
02 资源文件 5
- 脚本examples/console_logging.py1.0 KB
- 脚本examples/element_discovery.py1.4 KB
- 脚本examples/static_html_automation.py953 B
- 许可证LICENSE.txt11.1 KB
- 脚本scripts/with_server.py3.6 KB
03 SKILL.md 正文
Help a developer run the CLI E2E tests locally using their own Azure AD credentials.
Prerequisites:
- The repo is cloned and Rush dependencies are installed (
rush update) - The CLI and E2E packages are built (
rush build --to rayfin-cli-e2e) - The user has an Azure AD account with access to the target Fabric workspace
Steps
1. Create the local environment file
Create packages/tools/cli-e2e/.env (this file is gitignored):
E2E_AUTH_MODE=user
E2E_ENVIRONMENT=daily
E2E_TENANT_ID=<your-tenant-id>
E2E_CLI_SOURCE=source
USE_LOCAL_PACKAGES=true
RAYFIN_E2E_WORKSPACE_NAME=DO_NOT_DELETE_AppDev_E2E_Workspace
RAYFIN_TELEMETRY_OPTOUT=1
RAYFIN_ENCRYPTION_FALLBACK_ENABLED=true
Replace <your-tenant-id> with the user's Azure AD tenant ID.
If the user doesn't know their tenant ID, suggest:
rayfin login status
or check the Azure Portal under Microsoft Entra ID → Overview → Tenant ID.
2. Run the tests
From packages/tools/cli-e2e:
rushx test:e2e
Login is automatic.
The test suite includes a globalSetup that checks for an existing user session before tests run.
If no valid user session exists, it automatically runs rayfin login --tenant <E2E_TENANT_ID> which opens the browser for interactive sign-in.
After authenticating once, subsequent test runs reuse the cached session without prompting again.
To run a specific test file:
rushx test:e2e -- src/init/init.test.ts
To run with coverage:
rushx test:e2e:coverage
To run in watch mode during development:
rushx test:e2e:watch
3. Run the Playwright browser E2E tests
First install Playwright browsers (one-time):
npx playwright install chromium
Then run the browser tests:
rushx test:e2e:browser
Note: The browser tests deploy to a Fabric workspace and navigate to the hosted URL.
They require the user's account to have Contributor access to the DO_NOT_DELETE_AppDev_E2E_Workspace workspace.
The Playwright tests do not use the Vitest globalSetup, so the user must have a valid session from a prior rushx test:e2e run or manual rayfin login --tenant <id>.
4. Troubleshooting
| Symptom | Fix |
|---|---|
E2E_AUTH_MODE=user requires E2E_TENANT_ID to be set |
Fill in E2E_TENANT_ID in your .env file |
Interactive login failed + browser did not open |
Run manually: rayfin login --tenant <id> |
Silent token acquisition failed |
Token expired — re-run rayfin login --tenant <id> or delete ~/.rayfin/auth.json and retry |
Workspace not found |
Verify your account has access to DO_NOT_DELETE_AppDev_E2E_Workspace in the daily Fabric environment |
Tests skip with Skipped: authMode === 'user' |
Expected — SP-specific tests are skipped in user mode |
Tests skip with data-client tests require SP credentials |
Expected — data-client tests need SP secrets |
| Keychain errors (WSL/containers) | Set RAYFIN_ENCRYPTION_FALLBACK_ENABLED=true in .env |
| Windows libuv assertion crash during login | Harmless — the globalSetup checks CLI output content, not exit code |
How It Works
- Automatic login via globalSetup: The Vitest config references
src/global-setup.tswhich runs before all tests. WhenE2E_AUTH_MODE=user, it checksrayfin login statusoutput. If not signed in as a user, it triggersrayfin login --tenant <E2E_TENANT_ID>(opens browser). On subsequent runs, the cached session is reused and login is skipped. - Output-based detection: On Windows,
rayfin loginmay crash during process cleanup (libuv assertion) even after success. The setup checks for"Signed in successfully"in stdout rather than relying on exit code. - Auth state sharing: CLI commands in tests inherit the user's auth from
~/.rayfin/auth.json. Direct Fabric API calls acquire a token silently from the MSAL cache via the CLI'sgetAuthenticatedToken()function. - Test skipping: Service principal-specific tests (SP login, SP logout) are automatically skipped via
it.skipIf(authMode === 'user'). - CI isolation: CI always sets
E2E_AUTH_MODE=spwith pipeline secrets. Local.envfiles are gitignored and never affect CI.
04 同仓库更多 Skills
rayfin-getting-started
Use when starting or creating a NEW Rayfin app, or when a Rayfin task comes up and you are not yet inside a Rayfin project. Gets you into a project with the Rayfin CLI, then hands off to the authoritative, version-locked in-project rayfin skill/docs that own all in-project work. Triggers: build a Rayfin app, start a Rayfin project, create a new Rayfin app, create-rayfin, npm create @microsoft/rayfin, rayfin init, scaffold rayfin, rayfin CLI, rayfin template, universal app, awesome-rayfin gallery, get started with Rayfin
visuals
Use when user wants to incorporate charts, graphs, data grid, or other visual representations of data into their project. Use VegaVisual and DataGrid components to create these visuals, utilizing the shared DataTable input, formatting, theme, and interactivity. Covers the onInteraction selection/click events host apps consume, named multi-table data input for layered overlays and reference lines, and Vega-Lite native selections. Triggers: chart, graph, plot, dashboard, KPI, metric, trend, scorecard, data grid, visualize.
schema-discovery
Explore Power BI semantic model schemas using DAX INFO functions. Progressive metadata discovery strategy, scope estimation, and narrowing techniques for tables, columns, measures, and relationships.
query-design
Separates DAX data-fetching from TypeScript presentation. Guides when to use DAX vs. TypeScript vs. Vega-Lite for aggregation, total rows, FORMAT(), SELECTCOLUMNS, BLANK handling, filtering, multi-grain queries, cross-filtering and cross-highlight subset/overlay queries, and format strings.
functions-capability
Apply and build the Universal App functions capability. Use for trusted server-side logic, secrets, external APIs, custom model endpoints, published Fabric data agents, webhooks, or privileged operations.
fabric-sdk
How to query Fabric data from a running app through the Rayfin connectors client. Use getRayfinClient().connectors.<name>.executeQuery to run DAX against a semantic model, and toQueryResult to normalize the response.