Skip to content

Commit

Permalink
Update Playwright tests to work in CI
Browse files Browse the repository at this point in the history
Parameterize baseURL so we can just work with internal routes
  • Loading branch information
schreiaj committed Sep 12, 2024
1 parent d491bec commit 28c8cf4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 5 additions & 4 deletions OCR/frontend/e2e/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import {Simulate} from "react-dom/test-utils";
import click = Simulate.click;

test('has STLT Name', async ({ page }) => {
await page.goto('http://localhost:5173/');
await page.goto('/');

await expect(page.getByText('Demo STLT')).toBeVisible()
});

test('has new template button', async ({ page }) => {
await page.goto('http://localhost:5173/');
test('has new template button', async ({ page , baseURL}) => {
await page.goto('/');
await expect(page.getByRole('button', { name: '+ New Template' })).toBeVisible()
await page.getByRole('button', { name: '+ New Template' }).click()
expect(page.url()).toEqual("http://localhost:5173/new-template/upload")
expect(page.url()).toEqual(`${baseURL}/new-template/upload`)

});
12 changes: 6 additions & 6 deletions OCR/frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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://127.0.0.1:5173',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
Expand Down Expand Up @@ -70,9 +70,9 @@ export default defineConfig({
],

/* 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: 'npm run dev',
url: 'http://127.0.0.1:5173',
reuseExistingServer: !process.env.CI,
},
});

0 comments on commit 28c8cf4

Please sign in to comment.