chore: remove Cypress component testing
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
4
.github/workflows/cypress.yml
vendored
4
.github/workflows/cypress.yml
vendored
@@ -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]
|
||||
|
||||
|
||||
@@ -134,40 +134,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
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
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
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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>
|
||||
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { mount } from '@cypress/vue2'
|
||||
|
||||
import '@testing-library/cypress/add-commands'
|
||||
import 'cypress-axe'
|
||||
// styles
|
||||
import '../../apps/theming/css/default.css'
|
||||
import '../../core/css/server.css'
|
||||
|
||||
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))
|
||||
})
|
||||
})
|
||||
17
cypress/support/cypress-component.d.ts
vendored
17
cypress/support/cypress-component.d.ts
vendored
@@ -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 {
|
||||
|
||||
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>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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": [
|
||||
|
||||
16
package-lock.json
generated
16
package-lock.json
generated
@@ -92,7 +92,6 @@
|
||||
"@babel/plugin-transform-private-methods": "^7.27.1",
|
||||
"@babel/preset-typescript": "^7.27.1",
|
||||
"@codecov/webpack-plugin": "^1.9.1",
|
||||
"@cypress/vue2": "^2.1.1",
|
||||
"@cypress/webpack-preprocessor": "^7.0.0",
|
||||
"@nextcloud/babel-config": "^1.2.0",
|
||||
"@nextcloud/cypress": "^1.0.0-beta.15",
|
||||
@@ -2268,21 +2267,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.1",
|
||||
"resolved": "https://registry.npmjs.org/@cypress/webpack-preprocessor/-/webpack-preprocessor-7.0.1.tgz",
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
"scripts": {
|
||||
"build": "webpack --node-env production --progress",
|
||||
"postbuild": "build/npm-post-build.sh",
|
||||
"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",
|
||||
"dev": "webpack --node-env development --progress",
|
||||
@@ -128,7 +126,6 @@
|
||||
"@babel/plugin-transform-private-methods": "^7.27.1",
|
||||
"@babel/preset-typescript": "^7.27.1",
|
||||
"@codecov/webpack-plugin": "^1.9.1",
|
||||
"@cypress/vue2": "^2.1.1",
|
||||
"@cypress/webpack-preprocessor": "^7.0.0",
|
||||
"@nextcloud/babel-config": "^1.2.0",
|
||||
"@nextcloud/cypress": "^1.0.0-beta.15",
|
||||
|
||||
Reference in New Issue
Block a user