@cuppet/core
Version:
Core testing framework components for Cuppet - BDD framework based on Cucumber and Puppeteer
153 lines (107 loc) • 4.71 kB
Markdown
Core testing framework components for Cuppet - a BDD framework based on Cucumber and Puppeteer.
```bash
yarn install @cuppet/core
```
```bash
yarn install
```
```bash
yarn test
```
- `elementInteraction` - Element interaction utilities
- `dataStorage` - Data storage and management
- `mainFunctions` - Main testing functions
- `helperFunctions` - Helper utilities
- `apiFunctions` - API testing functions
- `appiumTesting` - Appium mobile testing
- `accessibilityTesting` - Accessibility testing with Pa11y
- `lighthouse` - Performance testing with Lighthouse
- `visualRegression` - Visual regression testing with BackstopJS
- `BrowserManager` - Puppeteer browser management
- `AppiumManager` - 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:
```javascript
// 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
],
},
};
```
```javascript
// 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);
});
```
```javascript
// 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 steps
- `apiSteps` - API testing and validation steps
- `appiumSteps` - Mobile testing with Appium
- `generalSteps` - Common navigation and interaction steps
- `helperSteps` - Utility and helper steps
- `iframeSteps` - Iframe handling steps
- `ifVisibleSteps` - Conditional visibility steps
- `lighthouseSteps` - Performance testing steps
- `pageElements` - Page element testing
- `pageElementsConfig` - Page element testing with values from config
- `pageElementsJson` - Page element testing with values from locally stored JSON file
- `visualRegressionSteps` - 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 application
- `multilingualStrings/` - Multilingual string support for your application
For a detailed configuration and step definitions guide, see [GUIDE.MD](./GUIDE.MD).
This package requires the following peer dependencies:
- `@cucumber/cucumber` ^12.0.0
- `config` ^4.1.0
Make sure to install these in your project:
```bash
yarn install @cucumber/cucumber config
```
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests and our development workflow.
For detailed development setup and publishing information, check out our [Development Guide](developmentGuide.md).
ISC