Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFlashAccount committed Nov 13, 2024
1 parent a38aae2 commit 44e599b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
19 changes: 14 additions & 5 deletions app/gui/e2e/dashboard/auth.setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import { test as setup } from '@playwright/test'
import path from 'path'
import { existsSync } from 'node:fs'
import path from 'node:path'
import * as actions from './actions'

const __dirname = path.dirname(new URL(import.meta.url).pathname)
const authFile = path.join(__dirname, '../../playwright/.auth/user.json')

setup('authenticate', ({ page }) =>
actions
const isFileExists = () => {
return existsSync(authFile)
}

setup('authenticate', ({ page }) => {
if (isFileExists()) {
return setup.skip()
}

return actions
.mockAll({ page })
.login()
.do(async () => {
await page.context().storageState({ path: authFile })
}),
)
})
})
1 change: 1 addition & 0 deletions app/gui/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ process.env.PLAYWRIGHT_PORT_PV = `${ports.projectView}`

export default defineConfig({
fullyParallel: true,
workers: 2,
forbidOnly: !!process.env.CI,
repeatEach: process.env.CI ? 3 : 1,
reporter: 'html',
Expand Down

0 comments on commit 44e599b

Please sign in to comment.