aboutsummaryrefslogtreecommitdiffstats
path: root/cypress.config.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cypress.config.ts')
-rw-r--r--cypress.config.ts34
1 files changed, 22 insertions, 12 deletions
diff --git a/cypress.config.ts b/cypress.config.ts
index 4f15c9a2a23..d4896fd8d02 100644
--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -1,3 +1,7 @@
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
import {
applyChangesToNextcloud,
configureNextcloud,
@@ -6,6 +10,7 @@ import {
waitOnNextcloud,
} from './cypress/dockerNode'
import { defineConfig } from 'cypress'
+import cypressSplit from 'cypress-split'
import webpackPreprocessor from '@cypress/webpack-preprocessor'
import type { Configuration } from 'webpack'
@@ -29,8 +34,13 @@ export default defineConfig({
experimentalInteractiveRunEvents: true,
// faster video processing
+ video: !process.env.CI,
videoCompression: false,
+ // Prevent elements to be scrolled under a top bar during actions (click, clear, type, etc). Default is 'top'.
+ // https://github.com/cypress-io/cypress/issues/871
+ scrollBehavior: 'center',
+
// Visual regression testing
env: {
failSilently: false,
@@ -47,6 +57,8 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
async setupNodeEvents(on, config) {
+ cypressSplit(on, config)
+
on('file:preprocessor', webpackPreprocessor({ webpackOptions: webpackConfig as Configuration }))
// Disable spell checking to prevent rendering differences
@@ -76,18 +88,16 @@ export default defineConfig({
// Before the browser launches
// starting Nextcloud testing container
- return startNextcloud(process.env.BRANCH)
- .then((ip) => {
- // Setting container's IP as base Url
- config.baseUrl = `http://${ip}/index.php`
- return ip
- })
- .then(waitOnNextcloud)
- .then(configureNextcloud)
- .then(applyChangesToNextcloud)
- .then(() => {
- return config
- })
+ const ip = await startNextcloud(process.env.BRANCH)
+
+ // Setting container's IP as base Url
+ config.baseUrl = `http://${ip}/index.php`
+ await waitOnNextcloud(ip)
+ await configureNextcloud()
+ await applyChangesToNextcloud()
+
+ // IMPORTANT: return the config otherwise cypress-split will not work
+ return config
},
},