Core testing framework components for Cuppet - a BDD framework based on Cucumber and Puppeteer.
yarn install @cuppet/coreyarn installThere is a predefined structure in place made available for testing changes. To execute the example test run:
yarn testelementInteraction- Element interaction utilitiesdataStorage- Data storage and managementmainFunctions- Main testing functionshelperFunctions- Helper utilitiesapiFunctions- API testing functionsappiumTesting- Appium mobile testingaccessibilityTesting- Accessibility testing with Pa11ylighthouse- Performance testing with LighthousevisualRegression- Visual regression testing with BackstopJS
BrowserManager- Puppeteer browser managementAppiumManager- Appium mobile testing management
stepDefinitions- Pre-built Cucumber step definitions for common testing scenarios
The cuppet-core package includes pre-built step definitions that you can use in your main project. Here are several ways to integrate them:
Make sure your Cucumber configuration includes the step definition paths:
// cucumber.js
module.exports = {
default: {
requireModule: ['@cuppet/core'],
require: [
'node_modules/@cuppet/core/features/app/stepDefinitions/*.js',
'features/step-definitions/**/*.js', // Your project's step definitions
],
},
};// Import step definitions directly
const stepDefinitions = require('@cuppet/core/stepDefinitions');
// Or import specific step definition modules
const generalSteps = require('@cuppet/core/features/app/stepDefinitions/generalSteps');
const apiSteps = require('@cuppet/core/features/app/stepDefinitions/apiSteps');
const { Then } = require('@cucumber/cucumber');
Then('the response should be an {string}', async function (type) {
console.log('Add your new custom logic', type);
});// In your project's step definition file
const { Given, When, Then } = require('@cucumber/cucumber');
const generalSteps = require('@cuppet/core/features/app/stepDefinitions/generalSteps');
// Extend the base step definitions with your custom logic
Given('I am logged in as {string}', async function (userName) {
// Your custom login logic
await this.page.goto('https://your-app.com/login');
await this.page.fill('[data-testid="username"]', userName);
await this.page.fill('[data-testid="password"]', 'password');
await this.page.click('[data-testid="login-button"]');
// Then use a base step definition
await generalSteps.['I follow {string}'].call(this,userName);
});accessibilitySteps- Accessibility testing stepsapiSteps- API testing and validation stepsappiumSteps- Mobile testing with AppiumgeneralSteps- Common navigation and interaction stepshelperSteps- Utility and helper stepsiframeSteps- Iframe handling stepsifVisibleSteps- Conditional visibility stepslighthouseSteps- Performance testing stepspageElements- Page element testingpageElementsConfig- Page element testing with values from configpageElementsJson- Page element testing with values from locally stored JSON filevisualRegressionSteps- Visual regression testing steps
The following components should be created in your project as they are specific to your application:
commonComponents/- Common form fields and page paths for your applicationmultilingualStrings/- Multilingual string support for your application
For a detailed configuration and step definitions guide, see GUIDE.MD.
This package requires the following peer dependencies:
@cucumber/cucumber^12.0.0config^4.1.0
Make sure to install these in your project:
yarn install @cucumber/cucumber configWe welcome contributions! Please see our Contributing Guide for details on how to submit pull requests and our development workflow.
For detailed development setup and publishing information, check out our Development Guide.
ISC