@ -0,0 +1,108 @@ |
|||||||
|
import type { PlaywrightTestConfig } from '@playwright/test'; |
||||||
|
import { devices } from '@playwright/test'; |
||||||
|
|
||||||
|
/** |
||||||
|
* Read environment variables from file. |
||||||
|
* https://github.com/motdotla/dotenv
|
||||||
|
*/ |
||||||
|
// require('dotenv').config();
|
||||||
|
|
||||||
|
/** |
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/ |
||||||
|
const config: PlaywrightTestConfig = { |
||||||
|
testDir: './tests', |
||||||
|
/* Maximum time one test can run for. */ |
||||||
|
timeout: 30 * 1000, |
||||||
|
expect: { |
||||||
|
/** |
||||||
|
* Maximum time expect() should wait for the condition to be met. |
||||||
|
* For example in `await expect(locator).toHaveText();` |
||||||
|
*/ |
||||||
|
timeout: 5000, |
||||||
|
}, |
||||||
|
/* Run tests in files in parallel */ |
||||||
|
fullyParallel: true, |
||||||
|
/* Fail the build on CI if you accidentally left test.only in the source code. */ |
||||||
|
forbidOnly: !!process.env.CI, |
||||||
|
/* Retry on CI only */ |
||||||
|
retries: process.env.CI ? 2 : 0, |
||||||
|
/* Opt out of parallel tests on CI. */ |
||||||
|
workers: process.env.CI ? 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. */ |
||||||
|
use: { |
||||||
|
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ |
||||||
|
actionTimeout: 0, |
||||||
|
/* Base URL to use in actions like `await page.goto('/')`. */ |
||||||
|
baseURL: 'http://localhost:3000', |
||||||
|
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
||||||
|
trace: 'on-first-retry', |
||||||
|
}, |
||||||
|
|
||||||
|
/* Configure projects for major browsers */ |
||||||
|
projects: [ |
||||||
|
{ |
||||||
|
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: {
|
||||||
|
// channel: 'msedge',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Google Chrome',
|
||||||
|
// use: {
|
||||||
|
// channel: 'chrome',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
], |
||||||
|
|
||||||
|
/* Folder for test artifacts such as screenshots, videos, traces, etc. */ |
||||||
|
// outputDir: 'test-results/',
|
||||||
|
|
||||||
|
/* Run your local dev server before starting the tests */ |
||||||
|
webServer: { |
||||||
|
command: 'npm run dev', |
||||||
|
url: "http://localhost:3000", |
||||||
|
reuseExistingServer: !process.env.CI, |
||||||
|
}, |
||||||
|
}; |
||||||
|
|
||||||
|
export default config; |
@ -0,0 +1,7 @@ |
|||||||
|
import { test, expect } from '@playwright/test'; |
||||||
|
|
||||||
|
test('homepage test', async ({ page }) => { |
||||||
|
await page.goto('/'); |
||||||
|
|
||||||
|
await expect(page).toHaveScreenshot({ fullPage: true }); |
||||||
|
}); |
After Width: | Height: | Size: 346 KiB |
After Width: | Height: | Size: 359 KiB |
After Width: | Height: | Size: 563 KiB |
@ -0,0 +1,13 @@ |
|||||||
|
import path from 'node:path'; |
||||||
|
import fs from 'node:fs'; |
||||||
|
import { test, expect } from '@playwright/test'; |
||||||
|
|
||||||
|
const roadmapIds = fs.readdirSync(path.join(process.cwd(), 'src/roadmaps')); |
||||||
|
|
||||||
|
for (const roadmapId of roadmapIds) { |
||||||
|
test(`roadmap ${roadmapId}`, async ({ page }) => { |
||||||
|
await page.goto(`/${roadmapId}`); |
||||||
|
|
||||||
|
await expect(page).toHaveScreenshot({ fullPage: true }); |
||||||
|
}); |
||||||
|
} |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 455 KiB |
After Width: | Height: | Size: 690 KiB |
After Width: | Height: | Size: 860 KiB |
After Width: | Height: | Size: 593 KiB |
After Width: | Height: | Size: 685 KiB |
After Width: | Height: | Size: 175 KiB |
After Width: | Height: | Size: 555 KiB |
After Width: | Height: | Size: 745 KiB |
After Width: | Height: | Size: 506 KiB |
After Width: | Height: | Size: 800 KiB |
After Width: | Height: | Size: 379 KiB |
After Width: | Height: | Size: 384 KiB |
After Width: | Height: | Size: 344 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 648 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 311 KiB |
After Width: | Height: | Size: 538 KiB |
After Width: | Height: | Size: 369 KiB |
After Width: | Height: | Size: 175 KiB |
After Width: | Height: | Size: 492 KiB |
After Width: | Height: | Size: 491 KiB |
After Width: | Height: | Size: 330 KiB |
After Width: | Height: | Size: 396 KiB |