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 24, 2024
1 parent 056f82f commit 7513814
Show file tree
Hide file tree
Showing 8 changed files with 413 additions and 422 deletions.
35 changes: 34 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,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]
# 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 +299,33 @@ 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_REMOTE_ONLY: true
BASE_URL: ${{needs.deploy.outputs.base_url}}
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- name: instanll
run: |
pnpm install --frozen-lockfile
pnpm exec playwright install --with-deps
- name: Test
run: pnpm run test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 5

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')
})
})
30 changes: 18 additions & 12 deletions e2e/tests/list-checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ 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()
})
})
9 changes: 0 additions & 9 deletions e2e/tests/list.spec.ts

This file was deleted.

Loading

0 comments on commit 7513814

Please sign in to comment.