diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 0a958b24..6e77665b 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -23,10 +23,10 @@ jobs: run: npm install -g pnpm && pnpm install - name: Install Playwright Browsers - run: pnpm exec playwright install --with-deps + run: pnpm e2e:install - name: Build post - run: pnpm deploy-blog:ci + run: pnpm e2e:build - name: Run Playwright tests run: pnpm e2e diff --git a/e2e/404.spec.ts b/e2e/404.spec.ts index e72bf4a9..ff9d50c6 100644 --- a/e2e/404.spec.ts +++ b/e2e/404.spec.ts @@ -1,4 +1,5 @@ import { expect, test } from '@playwright/test'; +import { screenshotFullPage } from './utils'; test.describe('404', () => { test('should redirect 404', async ({ page }) => { @@ -7,12 +8,12 @@ test.describe('404', () => { }); test(`screen`, async ({ page }) => { - await page.goto(`/404`); - await expect(page).toHaveScreenshot([`404.png`], { fullPage: true }); + await screenshotFullPage({ page, url: `/404`, arg: [`404.png`] }); }); test(`dom`, async ({ page }) => { await page.goto(`/404`); + await page.waitForTimeout(1000); const body = await page.locator('#__next').innerHTML(); expect(body).toMatchSnapshot([`404.html`]); }); diff --git a/e2e/__snapshots__/404.spec.ts/desktop/404.png b/e2e/__snapshots__/404.spec.ts/desktop/404.png index 1a5a28f4..1768751e 100644 Binary files a/e2e/__snapshots__/404.spec.ts/desktop/404.png and b/e2e/__snapshots__/404.spec.ts/desktop/404.png differ diff --git a/e2e/__snapshots__/404.spec.ts/mobile/404.png b/e2e/__snapshots__/404.spec.ts/mobile/404.png index 5bae79c9..0b247f35 100644 Binary files a/e2e/__snapshots__/404.spec.ts/mobile/404.png and b/e2e/__snapshots__/404.spec.ts/mobile/404.png differ diff --git a/e2e/__snapshots__/about.spec.ts/desktop/about.png b/e2e/__snapshots__/about.spec.ts/desktop/about.png index 26a40f5a..8de8e1e2 100644 Binary files a/e2e/__snapshots__/about.spec.ts/desktop/about.png and b/e2e/__snapshots__/about.spec.ts/desktop/about.png differ diff --git a/e2e/__snapshots__/about.spec.ts/mobile/about.png b/e2e/__snapshots__/about.spec.ts/mobile/about.png index 62d5ca4d..d442fbcf 100644 Binary files a/e2e/__snapshots__/about.spec.ts/mobile/about.png and b/e2e/__snapshots__/about.spec.ts/mobile/about.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/2023.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/2023.png index 6826bb60..12c54b98 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/2023.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/2023.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/2024-01.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/2024-01.png index 0d24be5b..8caab076 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/2024-01.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/2024-01.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/array-prototype-sort.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/array-prototype-sort.png index 49dc8a9b..7c2255a1 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/array-prototype-sort.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/array-prototype-sort.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/bali-remote-work.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/bali-remote-work.png index 2c26b3d7..693c5891 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/bali-remote-work.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/bali-remote-work.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/deploy-eslint-plugin.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/deploy-eslint-plugin.png index 5a0f5db7..bec9bf36 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/deploy-eslint-plugin.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/deploy-eslint-plugin.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/geultto8-open-source-seminar.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/geultto8-open-source-seminar.png index 0c8d7596..cbfdbcd6 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/geultto8-open-source-seminar.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/geultto8-open-source-seminar.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195687.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195687.png index 84971ae0..58898f59 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195687.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195687.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195692.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195692.png index b5f6499c..eed8602c 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195692.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195692.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195693.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195693.png index e9e00ae9..ac1b229b 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195693.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195693.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195696.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195696.png index cfc25c3d..267cade5 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195696.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195696.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195698.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195698.png index 253020ce..f3dc5650 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195698.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/goorm-195698.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/implicit-coercion.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/implicit-coercion.png index 48de0e75..b9f5abbf 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/implicit-coercion.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/implicit-coercion.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/jeju-remote-work.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/jeju-remote-work.png index 70acad2d..bee8b709 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/jeju-remote-work.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/jeju-remote-work.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/junction2023.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/junction2023.png index 5265542b..aa643234 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/junction2023.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/junction2023.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-easy-2727.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-easy-2727.png index e16f5b13..f7a35276 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-easy-2727.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-easy-2727.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-hard-42.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-hard-42.png index 01e94fc6..53bbb237 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-hard-42.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-hard-42.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-medium-238.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-medium-238.png index 5a497e27..812b34b8 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-medium-238.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/leetcode-medium-238.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/mac-init-apps.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/mac-init-apps.png index 2e3c6f9a..cf82d408 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/mac-init-apps.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/mac-init-apps.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/mdn-ko-organizer.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/mdn-ko-organizer.png index 418696bb..3bb0daa8 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/mdn-ko-organizer.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/mdn-ko-organizer.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/micro-state-management-review.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/micro-state-management-review.png index ad52597c..4d7a3ae8 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/micro-state-management-review.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/micro-state-management-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/prettier3.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/prettier3.png index d931d3d7..a6d7a40e 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/prettier3.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/prettier3.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/proving-ground-review.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/proving-ground-review.png index 5ba1fb8e..f3499b0c 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/proving-ground-review.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/proving-ground-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/quality-of-job-review.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/quality-of-job-review.png index 9fd7ae8b..9cc45ea5 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/quality-of-job-review.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/quality-of-job-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/renovate.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/renovate.png index 1838d9e7..a078e13d 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/renovate.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/renovate.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/storybook7.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/storybook7.png index 0ae5e58c..fbeff4f7 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/storybook7.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/storybook7.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/turborepo.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/turborepo.png index 106fc1b7..848e711b 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/turborepo.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/turborepo.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/typescript5.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/typescript5.png index 45ddc661..5efe2bbe 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/typescript5.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/typescript5.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/udemy-rust-programming.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/udemy-rust-programming.png index bffc7acb..1a9955f4 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/udemy-rust-programming.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/udemy-rust-programming.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/use-prevent-leave.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/use-prevent-leave.png index 07109235..032b35b0 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/use-prevent-leave.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/use-prevent-leave.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/use-transition.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/use-transition.png index 288e8f98..46139151 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/use-transition.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/use-transition.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/vite-dev-server.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/vite-dev-server.png index 4c22094f..7320dc02 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/vite-dev-server.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/vite-dev-server.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/desktop/woowa-type-review.png b/e2e/__snapshots__/post/screen.spec.ts/desktop/woowa-type-review.png index 6b2a5b64..5dfbeebf 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/desktop/woowa-type-review.png and b/e2e/__snapshots__/post/screen.spec.ts/desktop/woowa-type-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/2023.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/2023.png index 5808863f..d33b4142 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/2023.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/2023.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/2024-01.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/2024-01.png index 62701f48..2ac7e050 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/2024-01.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/2024-01.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/array-prototype-sort.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/array-prototype-sort.png index dd5d5730..5cfd3d20 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/array-prototype-sort.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/array-prototype-sort.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/bali-remote-work.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/bali-remote-work.png index ae10fffd..39eaf205 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/bali-remote-work.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/bali-remote-work.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/deploy-eslint-plugin.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/deploy-eslint-plugin.png index 7e3c054c..d94995a0 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/deploy-eslint-plugin.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/deploy-eslint-plugin.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/geultto8-open-source-seminar.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/geultto8-open-source-seminar.png index 7152118d..fa6a3fae 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/geultto8-open-source-seminar.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/geultto8-open-source-seminar.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195687.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195687.png index d7b8f542..962f94b6 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195687.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195687.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195692.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195692.png index 90ba17ef..664354b4 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195692.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195692.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195693.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195693.png index 489b0014..fa943fa6 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195693.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195693.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195696.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195696.png index f6b6583a..692ea584 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195696.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195696.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195698.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195698.png index 15a474e3..7368f6b2 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195698.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/goorm-195698.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/implicit-coercion.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/implicit-coercion.png index 25936209..54bda7f2 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/implicit-coercion.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/implicit-coercion.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/jeju-remote-work.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/jeju-remote-work.png index 67422f62..4d024721 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/jeju-remote-work.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/jeju-remote-work.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/junction2023.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/junction2023.png index b370ed59..1938531f 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/junction2023.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/junction2023.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-easy-2727.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-easy-2727.png index a3c0b20e..98837685 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-easy-2727.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-easy-2727.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-hard-42.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-hard-42.png index 22192db0..93482574 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-hard-42.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-hard-42.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-medium-238.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-medium-238.png index 37801fdb..cf27f92f 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-medium-238.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/leetcode-medium-238.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/mac-init-apps.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/mac-init-apps.png index bf00f5c7..967b968f 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/mac-init-apps.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/mac-init-apps.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/mdn-ko-organizer.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/mdn-ko-organizer.png index dc6203ed..daff663e 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/mdn-ko-organizer.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/mdn-ko-organizer.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/micro-state-management-review.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/micro-state-management-review.png index d9aa4758..2303ff96 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/micro-state-management-review.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/micro-state-management-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/prettier3.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/prettier3.png index c0fd70e9..7ed2f4b2 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/prettier3.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/prettier3.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/proving-ground-review.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/proving-ground-review.png index 3c061f26..c5faaed2 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/proving-ground-review.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/proving-ground-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/quality-of-job-review.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/quality-of-job-review.png index 2d7fe10e..83b2f6ad 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/quality-of-job-review.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/quality-of-job-review.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/renovate.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/renovate.png index e8813204..dc38ad7d 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/renovate.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/renovate.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/storybook7.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/storybook7.png index e789451b..642b4ef1 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/storybook7.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/storybook7.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/turborepo.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/turborepo.png index d643423f..3c634965 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/turborepo.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/turborepo.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/typescript5.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/typescript5.png index 3b324418..2158d1c6 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/typescript5.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/typescript5.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/udemy-rust-programming.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/udemy-rust-programming.png index 0476ffe1..eaf70de1 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/udemy-rust-programming.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/udemy-rust-programming.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/use-prevent-leave.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/use-prevent-leave.png index 9ec60d5c..e5fce9a5 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/use-prevent-leave.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/use-prevent-leave.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/use-transition.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/use-transition.png index 1be5bae1..1f1f9e9b 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/use-transition.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/use-transition.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/vite-dev-server.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/vite-dev-server.png index bda85f37..3c1da1ff 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/vite-dev-server.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/vite-dev-server.png differ diff --git a/e2e/__snapshots__/post/screen.spec.ts/mobile/woowa-type-review.png b/e2e/__snapshots__/post/screen.spec.ts/mobile/woowa-type-review.png index b912d94a..d0d24886 100644 Binary files a/e2e/__snapshots__/post/screen.spec.ts/mobile/woowa-type-review.png and b/e2e/__snapshots__/post/screen.spec.ts/mobile/woowa-type-review.png differ diff --git a/e2e/about.spec.ts b/e2e/about.spec.ts index 7758ef51..7a068db9 100644 --- a/e2e/about.spec.ts +++ b/e2e/about.spec.ts @@ -1,9 +1,9 @@ import { expect, test } from '@playwright/test'; +import { screenshotFullPage } from './utils'; test.describe('about', () => { test(`screen`, async ({ page }) => { - await page.goto(`/about`); - await expect(page).toHaveScreenshot([`about.png`], { fullPage: true }); + await screenshotFullPage({ page, url: `/about`, arg: [`about.png`] }); }); test(`dom`, async ({ page }) => { diff --git a/e2e/post/dom.spec.ts b/e2e/post/dom.spec.ts index 9b6b6bb1..bb3c932a 100644 --- a/e2e/post/dom.spec.ts +++ b/e2e/post/dom.spec.ts @@ -7,6 +7,7 @@ test.describe('dom', () => { test(`${url}`, async ({ page }) => { await page.goto(`/posts/${url}`); + await page.waitForTimeout(1000); const body = await page.locator('#__next').innerHTML(); expect(body).toMatchSnapshot([`${url}.html`]); }); diff --git a/e2e/post/screen.spec.ts b/e2e/post/screen.spec.ts index b8163a24..8dc55749 100644 --- a/e2e/post/screen.spec.ts +++ b/e2e/post/screen.spec.ts @@ -1,14 +1,16 @@ -import { expect, test } from '@playwright/test'; +import { test } from '@playwright/test'; import { urls } from './utils'; +import { screenshotFullPage } from 'e2e/utils'; test.describe(`screen`, () => { - for (let i = 0; i < 10; i++) { + for (let i = 0; i < urls.length; i++) { const url = urls[i]; test(`${url}`, async ({ page }) => { - await page.goto(`/posts/${url}`); - await expect(page).toHaveScreenshot([`${url}.png`], { - fullPage: true, + await screenshotFullPage({ + page, + url: `/posts/${url}`, + arg: [`${url}.png`], timeout: 10 * 1000, }); }); diff --git a/e2e/posts.spec.ts b/e2e/posts.spec.ts index 7bd6c66b..af7c91f9 100644 --- a/e2e/posts.spec.ts +++ b/e2e/posts.spec.ts @@ -3,6 +3,7 @@ import { expect, test } from '@playwright/test'; test.describe('posts', () => { test(`dom`, async ({ page }) => { await page.goto(`/posts`); + await page.waitForTimeout(1000); const body = await page.locator('#__next').innerHTML(); expect(body).toMatchSnapshot([`posts.html`]); }); diff --git a/e2e/utils.ts b/e2e/utils.ts new file mode 100644 index 00000000..e5834066 --- /dev/null +++ b/e2e/utils.ts @@ -0,0 +1,40 @@ +import { expect, type Page } from '@playwright/test'; + +type ScreenshotOptions = { + fullPage: boolean; + timeout?: number; + clip?: { x: number; y: number; width: number; height: number }; +}; + +export const screenshotFullPage = async ({ + page, + url, + arg, + timeout, +}: { + page: Page; + url: string; + arg: string[]; + timeout?: number; +}) => { + await page.goto(url); + await page.evaluate(() => document.fonts.ready); + // https://github.com/microsoft/playwright/issues/18827#issuecomment-2031261562 + await page.locator('#__next').scrollIntoViewIfNeeded(); + await page.waitForTimeout(1000); + + // const { width } = page.viewportSize(); + // const height = await page.evaluate( + // () => document.scrollingElement.scrollHeight, + // ); + + const options: ScreenshotOptions = { + fullPage: true, + // clip: { x: 0, y: 0, width, height }, + }; + if (timeout >= 0) { + options.timeout = timeout; + } + + await expect(page).toHaveScreenshot([...arg], options); +}; diff --git a/package.json b/package.json index 37daa165..8c2e1005 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "build": "next build", "start": "next start", "export": "next export", - "deploy-blog:ci": "NEXT_PUBLIC_CI=true next build && next export", "deploy-blog": "next build && next export", "lint:stylelint": "stylelint --config './.stylelintrc.cjs' './src/**/*.scss'", "lint:prettier": "prettier --list-different './src/**/*.{json,html,yml,tsx,ts,js,jsx,scss}'", @@ -20,9 +19,10 @@ "lint:markdown": "markdownlint --config './.markdownlint.cjs' './_posts/**/*.{md,mdx}'", "lint:typeCheck": "tsc --pretty", "lint": "pnpm run '/^lint:.*/'", + "e2e:build": "NEXT_PUBLIC_CI=true next build && next export", "e2e:update": "pnpm playwright test --update-snapshots", "e2e:report": "pnpm exec playwright show-report", - "e2e:install": "pnpm exec playwright install", + "e2e:install": "pnpm exec playwright install --with-deps", "e2e": "pnpm playwright test", "clean": "rm -rf .next out node_modules", "knip": "knip", diff --git a/playwright.config.ts b/playwright.config.ts index 10b01167..81571248 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -30,9 +30,10 @@ export default defineConfig({ use: { /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: 'http://127.0.0.1:3000', - browserName: 'chromium', + browserName: 'webkit', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'off', + timezoneId: 'Asia/Seoul', }, /* Configure projects for major browsers */ @@ -40,13 +41,13 @@ export default defineConfig({ { name: 'desktop', use: { - ...devices['Desktop Chrome'], + ...devices['Desktop Safari'], viewport: { width: 1321, height: 1080 }, }, }, { name: 'mobile', - use: { ...devices['Pixel 5'] }, + use: { ...devices['iPhone 14'] }, }, ], @@ -61,7 +62,7 @@ export default defineConfig({ /* For global expect settings */ expect: { toHaveScreenshot: { - maxDiffPixelRatio: 0.2, + maxDiffPixelRatio: 0.1, }, }, });