From 45fc4b35ef48660692fb10b6b242554b7590ed48 Mon Sep 17 00:00:00 2001 From: nakjun <111031253+nakjun12@users.noreply.github.com> Date: Thu, 2 May 2024 09:25:16 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20baseUrl=20=ED=99=95=EC=9D=B8=EC=9A=A9?= =?UTF-8?q?=20=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playwright.config.js | 14 +++++++------- playwright/base-url.spec.js | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 playwright/base-url.spec.js diff --git a/playwright.config.js b/playwright.config.js index b4341be..744688b 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -26,7 +26,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://127.0.0.1:3000', + baseURL: "http://localhost:5173", /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry" @@ -68,12 +68,12 @@ export default defineConfig({ // name: 'Google Chrome', // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // }, - ] + ], /* Run your local dev server before starting the tests */ - // webServer: { - // command: 'npm run start', - // url: 'http://127.0.0.1:3000', - // reuseExistingServer: !process.env.CI, - // }, + webServer: { + command: "pnpm dev", + url: "http://localhost:5173", + reuseExistingServer: !process.env.CI + } }); diff --git a/playwright/base-url.spec.js b/playwright/base-url.spec.js new file mode 100644 index 0000000..815e5ca --- /dev/null +++ b/playwright/base-url.spec.js @@ -0,0 +1,18 @@ +import { test } from "@playwright/test"; + +test("Example test", async ({ page }) => { + // baseUrl에 정의된 URL로 이동합니다. + await page.goto("/"); + + // 예상 결과를 확인합니다. + // await expect(page.title()).resolves.toMatch("Expected Title"); +}); + +test("Another test", async ({ page }) => { + // baseUrl에 정의된 URL로 이동합니다. + await page.goto("/"); + + // 특정 요소를 찾고 상태를 확인합니다. + // const text = await page.textContent(".selector"); + // expect(text).toBe("Expected Text"); +});