feat: 添加 headless 测试支持和修复接口请求页面的路径
This commit is contained in:
@ -18,6 +18,7 @@
|
|||||||
"lint:eslint": "eslint . --fix",
|
"lint:eslint": "eslint . --fix",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"playwright": "playwright test",
|
"playwright": "playwright test",
|
||||||
|
"playwright:headless": "HEADLESS=true playwright test",
|
||||||
"playwright:ui": "playwright test --ui",
|
"playwright:ui": "playwright test --ui",
|
||||||
"playwright:chromium": "playwright test --project=chromium",
|
"playwright:chromium": "playwright test --project=chromium",
|
||||||
"dep:dedupe": "pnpm dedupe",
|
"dep:dedupe": "pnpm dedupe",
|
||||||
|
@ -69,7 +69,7 @@ export default defineConfig({
|
|||||||
baseURL: process.env.BASE_URL || 'https://vue-ts-example.oo1.dev',
|
baseURL: process.env.BASE_URL || 'https://vue-ts-example.oo1.dev',
|
||||||
|
|
||||||
/* Only on CI systems run the tests headless */
|
/* Only on CI systems run the tests headless */
|
||||||
headless: !!process.env.CI,
|
headless: !!process.env.CI || process.env.HEADLESS === 'true',
|
||||||
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { expect, test } from '@playwright/test';
|
import { expect, test } from '@playwright/test';
|
||||||
|
|
||||||
test('接口请求页面', async ({ page }) => {
|
test('接口请求页面', async ({ page }) => {
|
||||||
await page.goto('/Tool/API');
|
await page.goto('/Page/API');
|
||||||
// /fake-api 正常返回。
|
// /fake-api 正常返回。
|
||||||
await expect(page.locator('pre')).toContainText('http://dummyimage.com/200x200');
|
await expect(page.locator('pre')).toContainText('http://dummyimage.com/200x200');
|
||||||
// // /npm-registry-api 正常返回。
|
// // /npm-registry-api 正常返回。
|
||||||
|
Reference in New Issue
Block a user