Skip to content

Commit

Permalink
chore: update cypress
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Aug 27, 2024
1 parent 4939658 commit 74a8f59
Show file tree
Hide file tree
Showing 4 changed files with 1,734 additions and 118 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:

jobs:
init:
runs-on: ubuntu-latest-low
runs-on: ubuntu-latest
outputs:
nodeVersion: ${{ steps.versions.outputs.nodeVersion }}
npmVersion: ${{ steps.versions.outputs.npmVersion }}
Expand Down Expand Up @@ -88,8 +88,11 @@ jobs:
fail-fast: false
matrix:
# Run multiple copies of the current job in parallel
# Please increase the number or runners as your tests suite grows
containers: ['1', '2', '3']
# Please increase the number or runners as your tests suite grows (0 based index for e2e tests)
containers: [0, 1, 2]
# Hack as strategy.job-total includes the component and GitHub does not allow math expressions
# Always aling this number with the total of e2e runners (max. index + 1)
total-containers: [3]

name: runner ${{ matrix.containers }}

Expand Down Expand Up @@ -129,8 +132,8 @@ jobs:
TESTING: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_BUILD_ID: ${{ github.sha }}-${{ github.run_number }}
CYPRESS_GROUP: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }}
SPLIT: ${{ matrix.total-containers }}
SPLIT_INDEX: ${{ matrix.containers == 'component' && 0 || matrix.containers }}

- name: Upload snapshots
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
Expand Down
41 changes: 16 additions & 25 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from './cypress/dockerNode'
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from '@nextcloud/cypress/docker'
import { configureVisualRegression } from 'cypress-visual-regression/dist/plugin'
import { defineConfig } from 'cypress'

import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'
import cypressSplit from 'cypress-split'

export default defineConfig({
projectId: 'xcmgay',
Expand All @@ -14,10 +10,9 @@ export default defineConfig({
viewportWidth: 1280,
viewportHeight: 720,

requestTimeout: 20000,

// Tries again 2 more times on failure
retries: {
runMode: 0,
runMode: 2,
// do not retry in `cypress open`
openMode: 0,
},
Expand All @@ -35,19 +30,20 @@ export default defineConfig({
// Visual regression testing
env: {
failSilently: false,
type: 'actual',
visualRegressionType: 'regression',
},
screenshotsFolder: 'cypress/snapshots/actual',
trashAssetsBeforeRuns: true,

e2e: {
// Disable isolation
// Disable session isolation
testIsolation: false,

// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
async setupNodeEvents(on, config) {
getCompareSnapshotsPlugin(on, config)
cypressSplit(on, config)
configureVisualRegression(on)

// Disable spell checking to prevent rendering differences
on('before:browser:launch', (browser, launchOptions) => {
Expand Down Expand Up @@ -76,17 +72,12 @@ 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(process.env.BRANCH))
.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([]) // pass empty array as WE are already the viewer
return config
},
},
})
})
Loading

0 comments on commit 74a8f59

Please sign in to comment.