Rabbi_Gerzi/frontend/rabbi_gerzi/cypress.config.mjs

38 lines
969 B
JavaScript

import { execFileSync } from 'node:child_process'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'cypress'
import createBundler from '@bahmutov/cypress-esbuild-preprocessor'
const configDirectory = dirname(fileURLToPath(import.meta.url))
const backendDirectory = resolve(configDirectory, '../../backend')
function resetDatabase() {
execFileSync(
'php',
['artisan', 'migrate:fresh', '--seed', '--force'],
{
cwd: backendDirectory,
stdio: 'inherit',
},
)
return null
}
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:5173',
specPattern: 'cypress/e2e/**/*.cy.ts',
supportFile: 'cypress/support/e2e.ts',
fixturesFolder: false,
video: false,
screenshotOnRunFailure: false,
setupNodeEvents(onEvent) {
onEvent('file:preprocessor', createBundler())
onEvent('task', {
resetDatabase,
})
},
},
})