Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup
description: pnpm (the version in packageManager), Node 24 and the dependencies, as the lockfile pins them

runs:
using: composite
steps:
# without `version`, it installs the one in package.json's packageManager
- name: Install pnpm
uses: pnpm/action-setup@v6

- name: Use Node.js 24
uses: actions/setup-node@v7
with:
node-version: 24
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile
shell: bash
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI

on:
push:
branches: [main]
# every base, not only main: in a stack each pull request targets the branch below it
pull_request:
# release.yml runs it before publishing
workflow_call:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
# a new push replaces the run of a pull request, never one of main
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

jobs:
verify:
name: Lint, types, unit tests and builds
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup

# `pnpm lint` writes the fixes: here it only checks
- name: Lint and format
run: pnpm exec biome check

- name: Library (types and build)
run: pnpm build.types && pnpm build.lib

- name: Unit tests
run: pnpm test.unit

# the website imports the library built above, as Deno Deploy builds it
- name: Website (types and build)
run: pnpm -C website build.types && pnpm -C website build.client && pnpm -C website build.server

e2e:
name: Playwright (${{ matrix.browser }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
browser: [chromium, webkit]
steps:
- uses: actions/checkout@v7
- uses: ./.github/actions/setup

- name: Playwright version
id: playwright
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"

- name: Cache the browser
id: cache
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ matrix.browser }}-${{ steps.playwright.outputs.version }}

- name: Install the browser and its system dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm exec playwright install --with-deps ${{ matrix.browser }}

- name: Install the system dependencies of the cached browser
if: steps.cache.outputs.cache-hit == 'true'
run: pnpm exec playwright install-deps ${{ matrix.browser }}

# the suite starts its own dev server, which renders the library from src/lib: no build needed
- name: Run the e2e tests
run: pnpm exec playwright test --project=${{ matrix.browser }}

- name: Upload the report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: playwright-report-${{ matrix.browser }}
path: playwright-report/
retention-days: 7
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ bite in this repo:
- Qwik loads each event handler lazily and doesn't order handlers of different elements, nor, while it
loads them and resumes the page, those of consecutive events: wait for one interaction to land before
the next one. The calendar's keys don't need it: their `sync$` handlers queue them for `keys$`.
- WebKit, like Safari, only tabs to elements with an explicit `tabindex`, so tab order differs from
Chromium.
- WebKit on macOS, like Safari, only tabs to elements with an explicit `tabindex`, so tab order differs
from Chromium (and from WebKit on Linux, where the CI runs it): don't count Tab presses per browser.
- The Qwik v2 dev server hangs on an error thrown while rendering, so cover invalid input with unit
tests instead of fixture pages.

Expand All @@ -63,5 +63,8 @@ pnpm exec biome check # lint and format (`pnpm lint` applies the fi
pnpm test
```

The CI (`.github/workflows/ci.yml`) runs the same on every pull request, whatever its base (in a stack,
each one targets the branch below), and builds the website too. It runs on Linux and in UTC.

Commits follow [Conventional Commits](https://www.conventionalcommits.org/) with a gitmoji, like the
history: `fix(styled): 🐛 keep the focus on the month buttons after changing month`.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"packageManager": "[email protected]",
"private": false,
"type": "module",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export default defineConfig({
testDir: './tests/e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
// one retry in CI, for a slow runner: the report marks what only passed on it as flaky, so it doesn't go unseen
retries: process.env.CI ? 1 : 0,
reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL: `http://localhost:${PORT}`,
Expand Down
158 changes: 158 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions tests/e2e/navigation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ test('the header buttons keep the focus, so they can be pressed repeatedly', asy
await expect(calendar.locator('[aria-selected="true"]')).toHaveCount(0);
});

test('after changing month, Tab enters the grid on the 1st', async ({ page, browserName }) => {
test('after changing month, Tab enters the grid on the 1st', async ({ page }) => {
const calendar = calendarIn(page, 'basic');
await prevButton(calendar).focus();
await page.keyboard.press('Enter');
await expect(title(calendar)).toHaveText('July 2024');
await expect(calendar.locator('button[data-value][tabindex="0"]')).toHaveAttribute('data-value', '2024-07-01');
// WebKit, like Safari, only tabs to elements with an explicit tabindex, so it skips the title and ">" buttons
for (let i = 0; i < (browserName === 'webkit' ? 1 : 3); i++) await page.keyboard.press('Tab');
// Tab until the focus enters the grid: how many presses depends on the browser and its platform (WebKit on macOS,
// like Safari, only tabs to elements with an explicit tabindex, so it skips the title and ">" buttons; the CI runs
// it on Linux)
const inGrid = () => page.evaluate(() => !!document.activeElement?.closest('#basic [role="grid"]'));
for (let i = 0; i < 3 && !(await inGrid()); i++) await page.keyboard.press('Tab');
await expect(day(calendar, '2024-07-01')).toBeFocused();
});

Expand Down
Loading