set up cypress to utilize cucumber and for tests in typescript

This commit is contained in:
mahula 2022-08-03 23:17:34 +02:00
parent 37c6a36a7a
commit 153b2a2c4e
4 changed files with 3228 additions and 54 deletions

View File

@ -0,0 +1,43 @@
import { defineConfig } from "cypress";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import browserify from "@badeball/cypress-cucumber-preprocessor/browserify";
async function setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
await addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
browserify(config, {
typescript: require.resolve("typescript"),
})
);
on('after:run', (results) => {
if (results) {
// results will be undefined in interactive mode
console.log(results.status)
}
});
return config;
}
export default defineConfig({
e2e: {
specPattern: "**/*.feature",
excludeSpecPattern: "*.js",
baseUrl: 'http://localhost:3000',
chromeWebSecurity: false,
supportFile: false,
viewportHeight: 720,
viewportWidth: 1280,
retries: {
runMode: 2,
openMode: 0
},
setupNodeEvents
}
})

View File

@ -7,12 +7,21 @@
"author": "Mathias Lenz",
"license": "Apache-2.0",
"private": false,
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"json": {
"enabled": true
}
},
"scripts": {
"cypress-e2e-tests": "yarn run cypress run",
"cypress-e2e-tests": "yarn run cypress run -e \"TAGS=not @skip\"",
"lint": "eslint --max-warnings=0 --ext .js,.ts ."
},
"dependencies": {
"cypress": "^10.3.0",
"eslint": "^8.19.0"
"@badeball/cypress-cucumber-preprocessor": "^12.0.0",
"@cypress/browserify-preprocessor": "^3.0.2",
"cypress": "^10.4.0",
"eslint": "^8.19.0",
"typescript": "^4.7.4"
}
}

View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "es2016",
"lib": ["es6", "dom"],
"baseUrl": "../node_modules",
"types": ["cypress", "node"],
"strict": true
},
"include": ["**/*.ts"]
}

File diff suppressed because it is too large Load Diff