Skip to content

Commit

Permalink
fix(checkbox-list): event click
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Philibeaux <[email protected]>
  • Loading branch information
philibea committed Dec 25, 2024
1 parent 056f82f commit 2a5326a
Show file tree
Hide file tree
Showing 13 changed files with 506 additions and 508 deletions.
126 changes: 78 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,85 +9,104 @@ on:
- main

jobs:
build:
strategy:
matrix:
node: ["22"]
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4 # v4.1.4
- uses: pnpm/[email protected]
- uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: build
run: |
pnpm install --frozen-lockfile
pnpm run build
manypkg:
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- run: |
- name: manypkg
run: |
pnpm install --frozen-lockfile
pnpm exec manypkg check
typecheck:
runs-on: ubuntu-24.04
needs: [build]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- run: |
- name: typecheck
run: |
pnpm install --frozen-lockfile
pnpm typecheck
oxlint:
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- run: |
- name: oxlint
run: |
pnpm install --frozen-lockfile
pnpm build
pnpm oxlint -c .oxlintrc.json --quiet
lint:
runs-on: ubuntu-24.04
needs: [build]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- run: |
- name: lint
run: |
pnpm install --frozen-lockfile
pnpm build
pnpm run build
pnpm run lint
format:
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
Expand All @@ -99,18 +118,17 @@ jobs:
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
needs: [typecheck, format]
strategy:
matrix:
node: ["22"]
node: ["20", "22"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 10
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
cache: "pnpm"
Expand Down Expand Up @@ -139,35 +157,16 @@ jobs:
# - run: pnpm run build
# - run: pnpm install
# - run: pnpm run test:a11y
build:
strategy:
matrix:
node: ["22"]
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
needs: [typecheck, format]
steps:
- uses: actions/checkout@v4 # v4.1.4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- run: |
pnpm install --frozen-lockfile
pnpm run build

publint:
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
TURBO_CACHE: "remote:rw"
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
- name: publint
uses: actions/[email protected]
with:
node-version: 22
Expand All @@ -178,12 +177,15 @@ jobs:
deploy:
runs-on: ubuntu-24.04
needs: [publint, typecheck, build]
env:
IMAGE_NAME: rg.fr-par.scw.cloud/ultraviolet/storybook
DEPLOYMENT_NAME: "storybook"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
needs: [publint, typecheck, build]
TURBO_CACHE: "remote:rw"
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#example-usage-of-the-jobs-context
outputs:
base_url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v4
- name: Inject slug/short variables
Expand Down Expand Up @@ -296,3 +298,31 @@ jobs:
run: |
rm -rf /tmp/docs/.buildx-cache
mv /tmp/docs/.buildx-cache-new /tmp/docs/.buildx-cache
e2e:
timeout-minutes: 5
runs-on: ubuntu-latest
needs: [deploy]
env:
CI: true
TURBO_CACHE: "remote:rw"
BASE_URL: ${{ needs.deploy.outputs.base_url }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- name: install pnpm deps
run: |
pnpm install --frozen-lockfile
pnpm exec playwright install --with-deps
- name: run e2e
run: pnpm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 5
27 changes: 0 additions & 27 deletions .github/workflows/playwright.yml

This file was deleted.

60 changes: 15 additions & 45 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ const isCI = process.env['CI']

const baseURL = process.env['BASE_URL'] ?? 'http://localhost:6006'

const times = {
'1min': 60 * 1000,
'3min': 3 * 60 * 1000,
}

export default defineConfig({
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!isCI,
/* Retry on CI only */
retries: isCI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: isCI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
globalTimeout: isCI ? 5 * times['1min'] : undefined,
timeout: isCI ? 1 * times['1min'] : undefined,
use: {
baseURL,

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

Expand All @@ -32,42 +31,13 @@ export default defineConfig({
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },

// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
})
9 changes: 9 additions & 0 deletions e2e/tests/default.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { expect, test } from '@playwright/test'

test.describe('Default', () => {
test('title', async ({ page, baseURL }) => {
await page.goto(`${baseURL}`)

await expect(page).toHaveTitle('Get started - Docs ⋅ Storybook')
})
})
29 changes: 17 additions & 12 deletions e2e/tests/list-checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ import { expect, test } from '@playwright/test'

const defaultLocator = 'iframe[title="storybook-preview-iframe"]'

test('checkbox list', async ({ page, baseURL }) => {
const url = `${baseURL}/?path=/story/components-data-display-list--selectable`
await page.goto(url)
const defaultURL = `/?path=/story/components-data-display-list--selectable`

const rootLocator = page.locator(defaultLocator).contentFrame()
test.describe('List', () => {
test('Checkbox Row', async ({ page, baseURL }) => {
const url = `${baseURL}${defaultURL}`

await rootLocator
.getByRole('row', { name: 'select Venus 0.718AU 0.728AU' })
.getByLabel('select')
.check()
await page.goto(url)

const checkbox = rootLocator.locator(
`input[type='checkbox'][name='list-select-checkbox'][value="venus"]`,
)
await expect(checkbox).toBeChecked()
const rootLocator = page.locator(defaultLocator).contentFrame()
await rootLocator
.getByRole('row', { name: 'select Venus 0.718AU 0.728AU' })
.getByLabel('select')
.check()

const checkbox = rootLocator.locator(
`input[type='checkbox'][name='list-select-checkbox'][value="venus"]`,
)

await expect(checkbox).toBeChecked()
})
})
Loading

0 comments on commit 2a5326a

Please sign in to comment.