enso/app/gui/e2e/dashboard/auth.setup.ts
Sergei Garin 58512e701e
Show docs on Dashboard (#11391)
Closes: https://github.com/enso-org/cloud-v2/issues/1445

PR is more or less ready for feedback,CR, and QA.

# Read before looking into:

**Known issues:**
- [x] Need to adjust timings for the animations (they're a bit out of sync).
- [x] After the latest rebase, the side panel might expand while clicking on the sidebar toggle.
- [ ] Images no longer display. 🤦
- [x] Need to restore the functionality around spotlighting a component


Demo:

https://github.com/user-attachments/assets/8cec9ec0-4753-482e-8637-f3857b4396a5
2024-11-15 12:12:55 +00:00

30 lines
683 B
TypeScript

import { test as setup } from '@playwright/test'
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')
const isProd = process.env.NODE_ENV === 'production'
const isFileExists = () => {
if (isProd) {
return false
}
return existsSync(authFile)
}
setup('authenticate', ({ page }) => {
if (isFileExists()) {
return setup.skip()
}
return actions
.mockAll({ page })
.login()
.do(async () => {
await page.context().storageState({ path: authFile })
})
})