initial setup and config

This commit is contained in:
mahula 2023-11-20 22:18:02 +01:00
parent 7c04c8fb52
commit 77d244570b
7 changed files with 10973 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

74
cypress.config.ts Normal file
View File

@ -0,0 +1,74 @@
import { defineConfig } from "cypress";
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import webpack from '@cypress/webpack-preprocessor';
// async function setupNodeEvents(
// on: Cypress.PluginEvents,
// config: Cypress.PluginConfigOptions
// ): Promise<Cypress.PluginConfigOptions> {
// await addCucumberPreprocessorPlugin(on, config);
// on(
// "file:preprocessor",
// preprocessor(config, {
// typescript: require.resolve("typescript"),
// })
// );
// return config;
// }
const setupNodeEvents = async (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) => {
await addCucumberPreprocessorPlugin(on, config, {
omitAfterRunHandler: true,
});
on(
'file:preprocessor',
webpack({
webpackOptions: {
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: 'ts-loader',
},
],
},
{
test: /\.feature$/,
use: [
{
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
options: config,
},
],
},
],
},
},
}),
);
return config;
};
export default defineConfig({
e2e: {
defaultCommandTimeout: 60000,
pageLoadTimeout:180000,
chromeWebSecurity: false,
baseUrl: "http://localhost:3000",
specPattern: "cypress/e2e/**/*.feature",
supportFile: "cypress/support/e2e.ts",
retries: 0,
video: false,
setupNodeEvents,
experimentalInteractiveRunEvents: true,
}
});

15
cypress/support/e2e.ts Normal file
View File

@ -0,0 +1,15 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
import './commands/commands'

8
cypress/tsconfig.json Normal file
View File

@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}

10814
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

50
package.json Normal file
View File

@ -0,0 +1,50 @@
{
"name": "boilerplate-e2e-cypress-cucumber",
"version": "1.0.0",
"description": "A boilerplate for end-to-end testing with Cypress and Cucumber in Typescript",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/IT4Change/boilerplate-e2e-cypress-cucumber.git"
},
"bugs": {
"url": "https://github.com/IT4Change/boilerplate-e2e-cypress-cucumber/issues"
},
"homepage": "https://github.com/IT4Change/boilerplate-e2e-cypress-cucumber#readme",
"keywords": [
"BDD",
"cypress",
"cucumber",
"docker",
"eslint",
"npm",
"nodejs",
"typescript"
],
"author": "mahula",
"license": "Apache-2.0",
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run"
},
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "^19.1.1",
"@cypress/webpack-preprocessor": "^6.0.0",
"cypress": "^13.5.1",
"multiple-cucumber-html-reporter": "^3.5.0",
"ts-loader": "^9.5.1",
"typescript": "^5.3.2"
},
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": true,
"stepDefinitions": "cypress/e2e/step_definitions/**/*.{js,ts}",
"json": {
"enabled": true,
"output": "cypress/reports/json/cucumber-report.json"
},
"messages": {
"enabled": true,
"output": "cypress/reports/messages/cucumber-messages.ndjson"
}
}
}

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
"lib": ["ES2022", "dom"],
"strict": true,
"types": ["cypress", "node"]
},
"include": ["**/*.ts"],
"exclude": ["node_modules"]
}