123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- import type { Configuration } from 'webpack'
- import {
- applyChangesToNextcloud,
- configureNextcloud,
- startNextcloud,
- stopNextcloud,
- waitOnNextcloud,
- } from './cypress/dockerNode'
- import { defineConfig } from 'cypress'
- import cypressSplit from 'cypress-split'
- import { removeDirectory } from 'cypress-delete-downloads-folder'
- import webpackPreprocessor from '@cypress/webpack-preprocessor'
- import webpackConfig from './webpack.config.js'
- export default defineConfig({
- projectId: '37xpdh',
-
- viewportWidth: 1280,
- viewportHeight: 720,
-
- retries: {
- runMode: 2,
-
- openMode: 0,
- },
-
- experimentalInteractiveRunEvents: true,
-
- video: !process.env.CI,
- videoCompression: false,
-
-
- scrollBehavior: 'center',
-
- env: {
- failSilently: false,
- type: 'actual',
- },
- screenshotsFolder: 'cypress/snapshots/actual',
- trashAssetsBeforeRuns: true,
- e2e: {
-
- testIsolation: false,
- requestTimeout: 30000,
-
-
- async setupNodeEvents(on, config) {
- cypressSplit(on, config)
- on('file:preprocessor', webpackPreprocessor({ webpackOptions: webpackConfig as Configuration }))
- on('task', { removeDirectory })
-
-
- const data = {}
- on('task', {
- setVariable({ key, value }) {
- data[key] = value
- return null
- },
- getVariable({ key }) {
- return data[key] ?? null
- },
- })
-
- on('before:browser:launch', (browser, launchOptions) => {
- if (browser.family === 'chromium' && browser.name !== 'electron') {
- launchOptions.preferences.default['browser.enable_spellchecking'] = false
- return launchOptions
- }
- if (browser.family === 'firefox') {
- launchOptions.preferences['layout.spellcheckDefault'] = 0
- return launchOptions
- }
- if (browser.name === 'electron') {
- launchOptions.preferences.spellcheck = false
- return launchOptions
- }
- })
-
- on('after:run', () => {
- if (!process.env.CI) {
- stopNextcloud()
- }
- })
-
-
- const ip = await startNextcloud(process.env.BRANCH)
-
- config.baseUrl = `http://${ip}/index.php`
- await waitOnNextcloud(ip)
- await configureNextcloud()
- if (!process.env.CI) {
- await applyChangesToNextcloud()
- }
-
- return config
- },
- },
- component: {
- specPattern: ['core/**/*.cy.ts', 'apps/**/*.cy.ts'],
- devServer: {
- framework: 'vue',
- bundler: 'webpack',
- webpackConfig: async () => {
- process.env.npm_package_name = 'NcCypress'
- process.env.npm_package_version = '1.0.0'
- process.env.NODE_ENV = 'development'
-
- const babel = require('./babel.config.js')
- babel.plugins.push([
- '@babel/plugin-transform-modules-commonjs',
- {
- loose: true,
- },
- ])
- const config = webpackConfig
- config.module.rules.push({
- test: /\.svg$/,
- type: 'asset/source',
- })
- return config
- },
- },
- },
- })
|