Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[oysters.dev v2] 軽微な修正 #196

Merged
merged 4 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

| Name | Link |
|----|----|
| :hammer: Latest commit | ${{ github.sha }} |
| :hammer: Latest commit | ${{ github.event.pull_request.head.sha }} |
| :sunglasses: Deploy Preview | ${{ steps.netlify.outputs.netlify-url }} |
comment_tag: deploy-preview

Expand Down
6 changes: 3 additions & 3 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/** @type {import('lint-staged').Config} */
export default {
'*.{css,scss,astro}': ['npm run fix:css', 'npm run fix:format'],
'*.{js,cjs,mjs,ts,jsx,tsx,astro}': [
'**.{css,scss,astro}': ['npm run fix:css', 'npm run fix:format'],
'**.{js,cjs,mjs,ts,jsx,tsx,astro}': [
'npm run fix:js',
'npm run fix:format',
() => 'npm run type-check'
],
'*.{md,html,json,yaml,yml}': ['npm run fix:format']
'**.{md,html,json,yaml,yml}': ['npm run fix:format']
}
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
13 changes: 12 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 actualDir = `${workDir}/actual`
Expand All @@ -10,6 +9,18 @@ test.describe('Capture screenshots', () => {
const isExpectedDir = expectedDir === dir

await page.goto(isExpectedDir ? 'https://oysters.dev' : '/')

// loading='lazy'が指定されている画像を読み込む
await page.evaluate(async () => {
const browserHeight = window.innerHeight
const pageHeight = document.body.scrollHeight

for (let i = 0; i < pageHeight; i += browserHeight) {
window.scrollTo(0, i)
await new Promise((r) => window.setTimeout(r, 100))
}
})

await page.screenshot({
path: `${dir}/${info.title}/${info.project.name}.png`,
fullPage: true,
Expand Down
Loading