From 092ff87b8a8592bce22743a97e39a0de0059f65e Mon Sep 17 00:00:00 2001 From: Steven Murawski Date: Thu, 8 Feb 2024 18:01:55 -0600 Subject: [PATCH] move playwright server config into individual test files to support testing both the store admin and store front --- tests/e2e/add_product.spec.ts | 1 + tests/e2e/example.spec.ts | 2 ++ tests/e2e/products.spec.ts | 1 + tests/playwright.config.ts | 3 --- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/e2e/add_product.spec.ts b/tests/e2e/add_product.spec.ts index f8c0721b..4dff276a 100644 --- a/tests/e2e/add_product.spec.ts +++ b/tests/e2e/add_product.spec.ts @@ -1,5 +1,6 @@ import { test, expect } from '@playwright/test'; +test.use({ baseURL: process.env.STORE_ADMIN_URL }); test('can add product ', async ({ page }) => { await page.goto('/'); diff --git a/tests/e2e/example.spec.ts b/tests/e2e/example.spec.ts index f6dbb89c..4f70fb8d 100644 --- a/tests/e2e/example.spec.ts +++ b/tests/e2e/example.spec.ts @@ -1,5 +1,7 @@ import { test, expect } from '@playwright/test'; +test.use({ baseURL: process.env.STORE_ADMIN_URL }); + test('has title', async ({ page }) => { await page.goto('/'); diff --git a/tests/e2e/products.spec.ts b/tests/e2e/products.spec.ts index bf08ea98..e6020592 100644 --- a/tests/e2e/products.spec.ts +++ b/tests/e2e/products.spec.ts @@ -1,5 +1,6 @@ import { test, expect } from '@playwright/test'; +test.use({ baseURL: process.env.STORE_ADMIN_URL }); test('renders functionally', async ({ page }) => { await page.goto('/'); diff --git a/tests/playwright.config.ts b/tests/playwright.config.ts index db162d15..69fff512 100644 --- a/tests/playwright.config.ts +++ b/tests/playwright.config.ts @@ -23,9 +23,6 @@ export default defineConfig({ reporter: 'html', /* 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: process.env.STORE_ADMIN_URL, - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', },