Skip to content

Commit c203bfa

Browse files
authored
🧪 Fix SDK E2E tests to work with vizzly tdd run (#183)
## Summary This PR fixes SDK E2E tests to work properly with both `vizzly tdd run` (local TDD mode) and `vizzly run` (cloud mode), and reorganizes CI workflows for better maintainability. ## Changes ### CI Workflow Reorganization - Split monolithic `ci.yml` into focused workflow files: - `sdk-e2e.yml` - E2E tests for all SDKs (runs on every PR) - `sdk-unit.yml` - Unit tests with matrix testing (runs when SDK files change) - `reporter.yml` - Reporter UI tests - `tui.yml` - TUI tests - E2E tests now run in both TDD and cloud modes for each SDK ### Ruby SDK Fixes - Add `cloud_mode?` helper to detect when running with `VIZZLY_TOKEN` - Add `assert_screenshot_success` helper for mode-aware assertions - TDD mode: asserts status is `'new'` or `'match'` - Cloud mode: asserts `success` is `true` (no local comparison happens) - Fixed in both `integration_test.rb` and `e2e_test.rb` ### Vitest SDK Fixes - Refactored to use shared test-site for consistency with other SDKs - Test the actual SDK functionality (`toMatchScreenshot` matcher) - Load test-site CSS for consistent styling - Removed custom commands that were for full-page navigation, not SDK testing ### All SDKs - Detect `VIZZLY_SERVER_URL` env var to skip starting own TDD server when running under `vizzly tdd run` or `vizzly run` - Fix assertions to handle both TDD mode (returns `status` field) and cloud mode (returns `success: true`) ## Test plan - [x] All SDK E2E tests pass in TDD mode (`vizzly tdd run`) - [x] All SDK E2E tests pass in cloud mode (`vizzly run`) - [x] Ruby lint passes (`bundle exec rubocop`) - [x] CI workflow YAML is valid
1 parent 8dd5b65 commit c203bfa

File tree

19 files changed

+3166
-1980
lines changed

19 files changed

+3166
-1980
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 719 deletions
Large diffs are not rendered by default.

.github/workflows/reporter.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Reporter Visual Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
visual:
11+
name: Visual Tests
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 8
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Use Node.js 22
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Build
28+
run: npm run build
29+
30+
- name: Get installed Playwright version
31+
id: playwright-version
32+
run: echo "version=$(npx playwright --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
33+
34+
- name: Cache Playwright browsers
35+
uses: actions/cache@v4
36+
id: playwright-cache
37+
with:
38+
path: ~/.cache/ms-playwright
39+
key: playwright-browsers-${{ steps.playwright-version.outputs.version }}-firefox
40+
41+
- name: Install Playwright browsers
42+
if: steps.playwright-cache.outputs.cache-hit != 'true'
43+
run: npx playwright install firefox --with-deps
44+
45+
- name: Run reporter visual tests
46+
run: npm run test:reporter:visual
47+
env:
48+
CI: true
49+
VIZZLY_TOKEN: ${{ secrets.VIZZLY_REPORTER_TOKEN }}
50+
VIZZLY_COMMIT_MESSAGE: ${{ github.event.pull_request.head.commit.message || github.event.head_commit.message }}
51+
VIZZLY_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.event.head_commit.id }}

0 commit comments

Comments
 (0)