-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkbox-list): shift event checkbox was broken (#4619)
* feat(playwright): add playwright e2e on checkbox list * fix(checkbox-list): event click * fix(checkbox-list): event click Signed-off-by: Alexandre Philibeaux <[email protected]> * feat(list): use list context on Table component Signed-off-by: Alexandre Philibeaux <[email protected]> * fix(checkbox-list): range click checkbox event trigger Signed-off-by: Alexandre Philibeaux <[email protected]> --------- Signed-off-by: Alexandre Philibeaux <[email protected]>
- Loading branch information
Showing
30 changed files
with
807 additions
and
639 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@ultraviolet/ui": patch | ||
--- | ||
|
||
fix checkbox event on List & Table component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
|
@@ -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" | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,3 +49,7 @@ tools/*/.turbo | |
|
||
# next | ||
next-env.d.ts* | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* eslint-disable eslint-comments/disable-enable-pair */ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
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', | ||
fullyParallel: true, | ||
forbidOnly: !!isCI, | ||
retries: isCI ? 2 : 0, | ||
workers: isCI ? 1 : undefined, | ||
reporter: 'html', | ||
globalTimeout: isCI ? 5 * times['1min'] : undefined, | ||
timeout: isCI ? 1 * times['1min'] : undefined, | ||
use: { | ||
baseURL, | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
const defaultLocator = 'iframe[title="storybook-preview-iframe"]' | ||
|
||
const defaultURL = `/?path=/story/components-data-entry-checkbox--playground` | ||
|
||
test.describe('List', () => { | ||
test('Checkbox Row', async ({ page, baseURL }) => { | ||
const url = `${baseURL}${defaultURL}` | ||
|
||
await page.goto(url) | ||
|
||
const rootLocator = page.locator(defaultLocator).contentFrame() | ||
await rootLocator.getByRole('checkbox').click() | ||
|
||
const checkbox = rootLocator.locator(`input[type='checkbox']`) | ||
|
||
await expect(checkbox).toBeChecked({ | ||
checked: true, | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { expect, test } from '@playwright/test' | ||
|
||
const defaultLocator = 'iframe[title="storybook-preview-iframe"]' | ||
const defaultURL = `/?path=/story/components-data-display-list--selectable` | ||
|
||
test.describe('List', () => { | ||
test('Checkbox Row', async ({ page, baseURL }) => { | ||
const url = `${baseURL}${defaultURL}` | ||
|
||
await page.goto(url) | ||
|
||
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({ | ||
checked: true, | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.