chore: remove Cypress component testing

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2025-10-14 13:53:20 +02:00
parent 1f72fd3085
commit eb2475e047
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
8 changed files with 8 additions and 139 deletions

View file

@ -102,8 +102,8 @@ jobs:
matrix:
# Run multiple copies of the current job in parallel
# Please increase the number or runners as your tests suite grows (0 based index for e2e tests)
containers: ['component', 'setup', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# Hack as strategy.job-total includes the component and GitHub does not allow math expressions
containers: ['setup', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# Hack as strategy.job-total includes the "setup" and GitHub does not allow math expressions
# Always align this number with the total of e2e runners (max. index + 1)
total-containers: [10]

View file

@ -133,39 +133,4 @@ export default defineConfig({
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'
/**
* Needed for cypress stubbing
*
* @see https://github.com/sinonjs/sinon/issues/1121
* @see https://github.com/cypress-io/cypress/issues/18662
*/
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
},
},
},
})

View file

@ -1,16 +0,0 @@
<!DOCTYPE html>
<!--
- SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View file

@ -1,45 +0,0 @@
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import '@testing-library/cypress/add-commands'
import 'cypress-axe'
// styles
import '../../apps/theming/css/default.css'
import '../../core/css/server.css'
/* eslint-disable */
import { mount } from '@cypress/vue2'
Cypress.Commands.add('mount', (component, options = {}) => {
// Setup options object
options.extensions = options.extensions || {}
options.extensions.plugins = options.extensions.plugins || []
options.extensions.components = options.extensions.components || {}
return mount(component, options)
})
Cypress.Commands.add('mockInitialState', (app: string, key: string, value: unknown) => {
cy.document().then(($document) => {
const input = $document.createElement('input')
input.setAttribute('type', 'hidden')
input.setAttribute('id', `initial-state-${app}-${key}`)
input.setAttribute('value', btoa(JSON.stringify(value)))
$document.body.appendChild(input)
})
})
Cypress.Commands.add('unmockInitialState', (app?: string, key?: string) => {
cy.window().then(($window) => {
// @ts-expect-error internal value
delete $window._nc_initial_state
})
cy.document().then(($document) => {
$document.querySelectorAll('body > input[type="hidden"]' + (app ? `[id="initial-state-${app}-${key}"]` : ''))
.forEach((node) => $document.body.removeChild(node))
})
})

View file

@ -1,17 +0,0 @@
/*!
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import type { mount } from '@cypress/vue2'
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
mount: typeof mount
mockInitialState: (app: string, key: string, value: unknown) => Cypress.Chainable<void>
unmockInitialState: (app?: string, key?: string) => Cypress.Chainable<void>
}
}
}

View file

@ -1,6 +1,6 @@
{
"extends": "../tsconfig.json",
"include": ["./**/*.ts", "../**/*.cy.ts", "./cypress-e2e.d.ts", "./cypress-component.d.ts"],
"include": ["./**/*.ts", "./cypress-e2e.d.ts", "./cypress-component.d.ts"],
"exclude": [],
"compilerOptions": {
"types": [

23
package-lock.json generated
View file

@ -91,7 +91,6 @@
"@babel/node": "^7.28.0",
"@babel/plugin-transform-private-methods": "^7.27.1",
"@babel/preset-typescript": "^7.28.5",
"@cypress/vue2": "^2.1.1",
"@cypress/webpack-preprocessor": "^7.0.2",
"@nextcloud/babel-config": "^1.3.0",
"@nextcloud/cypress": "^1.0.0-beta.15",
@ -2281,21 +2280,6 @@
"uuid": "dist/bin/uuid"
}
},
"node_modules/@cypress/vue2": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@cypress/vue2/-/vue2-2.1.1.tgz",
"integrity": "sha512-8/1Z6XrSdJWU9ybniGKyUe5iztVIi/Y5PwWg6mtsa8IMdtK2ZA8Vrv/ZIZ8jT3XAEUSaMhPBEh6TgUbq03kr8w==",
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
},
"peerDependencies": {
"cypress": ">=4.5.0",
"vue": "^2.0.0"
}
},
"node_modules/@cypress/webpack-preprocessor": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@cypress/webpack-preprocessor/-/webpack-preprocessor-7.0.2.tgz",
@ -8939,9 +8923,10 @@
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.8.16",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.16.tgz",
"integrity": "sha512-OMu3BGQ4E7P1ErFsIPpbJh0qvDudM/UuJeHgkAvfWe+0HFJCXh+t/l8L6fVLR55RI/UbKrVLnAXZSVwd9ysWYw==",
"version": "2.9.9",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.9.tgz",
"integrity": "sha512-V8fbOCSeOFvlDj7LLChUcqbZrdKD9RU/VR260piF1790vT0mfLSwGc/Qzxv3IqiTukOpNtItePa0HBpMAj7MDg==",
"license": "Apache-2.0",
"bin": {
"baseline-browser-mapping": "dist/cli.js"
}

View file

@ -25,9 +25,7 @@
"sass": "sass --style compressed --load-path core/css core/css/ $(for cssdir in $(find apps -mindepth 2 -maxdepth 2 -name \"css\"); do if ! $(git check-ignore -q $cssdir); then printf \"$cssdir \"; fi; done)",
"sass:watch": "sass --watch --load-path core/css core/css/ $(for cssdir in $(find apps -mindepth 2 -maxdepth 2 -name \"css\"); do if ! $(git check-ignore -q $cssdir); then printf \"$cssdir \"; fi; done)",
"sass:icons": "babel-node core/src/icons.js",
"cypress": "npm run cypress:component && npm run cypress:e2e",
"cypress:component": "cypress run --component",
"cypress:e2e": "cypress run --e2e",
"cypress": "cypress run --e2e",
"cypress:gui": "cypress open",
"cypress:version": "cypress version"
},
@ -122,7 +120,6 @@
"@babel/node": "^7.28.0",
"@babel/plugin-transform-private-methods": "^7.27.1",
"@babel/preset-typescript": "^7.28.5",
"@cypress/vue2": "^2.1.1",
"@cypress/webpack-preprocessor": "^7.0.2",
"@nextcloud/babel-config": "^1.3.0",
"@nextcloud/cypress": "^1.0.0-beta.15",