Skip to content

Commit

Permalink
feat(vrt): スクリーンショットのバリエーションの追加
Browse files Browse the repository at this point in the history
- ライト/ダークモード
- 画面サイズ(デスクトップ用)
- 画面向き(モバイル用)
  • Loading branch information
mii288 committed Dec 13, 2024
1 parent 9a7723a commit 9105a3a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
47 changes: 29 additions & 18 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,35 @@ export default defineConfig({
baseURL: 'http://localhost:4321',
trace: 'on-first-retry'
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] }
},
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 6a'] }
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 13 mini'] }
}
],
projects: ['dark', 'light'].flatMap((colorScheme) => [
// PC
...[
{ name: 'Desktop Chrome', device: 'Desktop Chrome' },
{ name: 'Desktop Safari', device: 'Desktop Safari' }
].flatMap(({ name, device }) =>
[640, 768, 1024, 1280, 1536].flatMap((width) => ({
name: `${name}/W${width}px/${colorScheme}`,
use: { ...devices[device], viewport: { width, height: 1080 } },
colorScheme
}))
),
// Mobile
...[
{ name: 'Mobile Chrome', device: 'Pixel 7' },
{ name: 'Mobile Safari', device: 'iPhone 13 Mini' }
].flatMap(({ name, device }) => [
{
name: `${name}/Portrait/${colorScheme}`,
use: devices[device],
colorScheme
},
{
name: `${name}/Landscape/${colorScheme}`,
use: devices[`${device} landscape`],
colorScheme
}
])
]),
webServer: {
command: 'npm run build && npm run preview',
url: 'http://localhost:4321',
Expand Down
1 change: 0 additions & 1 deletion tests/vrt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { test } from '@playwright/test'

test.describe('Capture screenshots', () => {
const workDir = '.reg'
const saveDir = `${workDir}/screenshots`
Expand Down

0 comments on commit 9105a3a

Please sign in to comment.