test: each test case for browser (#3100)

This commit is contained in:
Mohammad Bagher Abiat 2023-04-08 15:23:35 +03:30 committed by GitHub
parent 430b4ecbab
commit ddbda102d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 2 deletions

View File

@ -140,6 +140,43 @@ jobs:
env:
BROWSER: ${{ matrix.browser[1] }}
test-browser-windows:
runs-on: windows-latest
strategy:
matrix:
browser: [[chrome, chromium], [edge, webkit]]
timeout-minutes: 10
env:
BROWSER: ${{ matrix.browser[0] }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-and-cache
with:
node-version: 18
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-edge@v1
- name: Install
run: pnpm i
- name: Install Playwright Dependencies
run: pnpx playwright install-deps
- name: Build
run: pnpm run build
- name: Test Browser (webdriverio)
run: pnpm run test:browser:webdriverio
- name: Test Browser (playwright)
run: pnpm run test:browser:playwright
env:
BROWSER: ${{ matrix.browser[1] }}
test-browser-safari:
runs-on: macos-latest
timeout-minutes: 10

View File

@ -29,8 +29,8 @@
"ui:build": "vite build packages/ui",
"ui:dev": "vite packages/ui",
"ui:test": "npm -C packages/ui run test:run",
"test:browser:webdriverio": "npm -C test/browser run test:webdriverio",
"test:browser:playwright": "npm -C test/browser run test:playwright"
"test:browser:webdriverio": "pnpm -C test/browser run test:webdriverio",
"test:browser:playwright": "pnpm -C test/browser run test:playwright"
},
"devDependencies": {
"@antfu/eslint-config": "^0.38.4",

View File

@ -42,6 +42,7 @@ export async function createBrowserServer(ctx: Vitest, options: UserConfig) {
}
config.server = server
config.server.fs = { strict: false }
config.optimizeDeps ??= {}
config.optimizeDeps.entries ??= []

View File

@ -7,3 +7,10 @@ it('basic', async () => {
it('basic 2', () => {
expect(globalThis.window).toBeDefined()
})
it.each([
['x', true],
['y', false],
])('%s is x', (val, expectedResult) => {
expect(val === 'x').toBe(expectedResult)
})