Skip to content

Commit

Permalink
Migrate cypress to v10
Browse files Browse the repository at this point in the history
  • Loading branch information
Waseem826 committed Sep 5, 2022
1 parent 2874d2a commit 4579691
Show file tree
Hide file tree
Showing 42 changed files with 318 additions and 3,451 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ parserOptions:
- src/tsconfig.ce.json
- src/tsconfig.ee.json
- src/tsconfig.spec.json
- cypress/tsconfig.e2e.json
- cypress/tsconfig.json
sourceType: module
extends:
- "./node_modules/gts/"
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cypress/screenshots
cypress/videos
cypress/plugins/index.js
cypress/plugins/cy-ts-preprocessor.js
cypress/tsconfig.json

# GO
/vendor
80 changes: 80 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { defineConfig } from 'cypress'
import failFast from 'cypress-fail-fast/plugin';
import {deleteAsync} from 'del';

function runnableTestsRegex(...fileName: string[]): string {
return `cypress/e2e/**/!(${fileName.reduce((prevName, name) => `${prevName}|${name}`)}).spec.ts`;
}

export default defineConfig({
chromeWebSecurity: false,
screenshotOnRunFailure: true,
videoCompression: false,
pageLoadTimeout: 60000,
defaultCommandTimeout: 60000,
responseTimeout: 60000,
requestTimeout: 60000,
viewportHeight: 1080,
viewportWidth: 1920,
projectId: 'mdsuba',
video: true,
e2e: {
setupNodeEvents(on, config) {
const isAPIMocked = config.env.MOCKS === 'true' || config.env.MOCKS === true;
const isEnterpriseEdition = config.env.KUBERMATIC_EDITION === 'ee';
// TODO: Update once more tests are rewritten
// const ignored: string[] = ['cypress/**/!(service-accounts|ssh-keys).spec.ts'];
const ignored: string[] = [
runnableTestsRegex(
'service-accounts',
'ssh-keys',
'edition',
'members',
'defaults',
'dynamic-datacenters'
),
];

// if (isAPIMocked) {
// // TODO: Remove it after configuring mocks.
// ignored = ['cypress/**/e2e/stories/opa.spec.ts'];
// } else {
// // TODO: Remove it after fixing flaky tests.
// ignored = [
// 'cypress/**/e2e/providers/anexia.spec.ts',
// 'cypress/**/e2e/providers/equinix.spec.ts',
// 'cypress/**/e2e/providers/vsphere.spec.ts',
// 'cypress/**/e2e/stories/opa.spec.ts',
// 'cypress/**/e2e/stories/admin-settings/administrators.spec.ts',
// ];
// }

// Test providers only in enterprise edition.
// if (!isEnterpriseEdition) {
// ignored = ['cypress/**/e2e/providers/**', ...ignored];
// }

/* eslint-disable no-console */
console.log('mocks: ' + isAPIMocked);
console.log('enterprise edition: ' + isEnterpriseEdition);
console.log('ignored: ' + ignored);
/* eslint-enable no-console */

config.excludeSpecPattern = ignored;

// Remove videos of successful tests and keep only failed ones.
// @ts-ignore
on('after:spec', (_, results) => {
if (results.stats.failures === 0 && results.video) {
return deleteAsync(results.video);
}
});

failFast(on, config);
return config;
},
baseUrl: 'http://localhost:8000',
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
supportFile: "cypress/support/e2e.ts"
},
})
15 changes: 0 additions & 15 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 0 additions & 43 deletions cypress/plugins/cy-ts-preprocessor.ts

This file was deleted.

78 changes: 0 additions & 78 deletions cypress/plugins/index.ts

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions cypress/tsconfig.e2e.json → cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "ES2019",
"strict": true,
"baseUrl": "./",
"paths": {
Expand Down
Loading

0 comments on commit 4579691

Please sign in to comment.