Skip to content

Commit

Permalink
Mer playwright oppsett og mocking
Browse files Browse the repository at this point in the history
#deploy-test-dolly-backend
  • Loading branch information
stigus committed Jun 4, 2024
1 parent 9edad99 commit 3ee33b8
Show file tree
Hide file tree
Showing 7 changed files with 1,711 additions and 78 deletions.
64 changes: 32 additions & 32 deletions apps/dolly-frontend/src/main/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion apps/dolly-frontend/src/main/js/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { defineConfig, devices } from '@playwright/test'
*/
export default defineConfig({
testDir: './playwright/tests',
/* Run tests in files in parallel */
fullyParallel: true,
globalSetup: require.resolve('./playwright/globalSetup'),

/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
Expand Down
17 changes: 17 additions & 0 deletions apps/dolly-frontend/src/main/js/playwright/globalSetup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { test as base } from '@playwright/test'

export const test = base.extend({
page: async ({ baseURL, page }, use) => {
await page.routeFromHAR('playwright/mocks/BaseMocks.har', {
url: '**/api/**',
update: false,
notFound: 'fallback',
})
await page.route('**/api**', async (route) => {
await route.fulfill({ body: '[]' })
})

use(page)
},
})
export { expect } from '@playwright/test'
Loading

0 comments on commit 3ee33b8

Please sign in to comment.