Testing Modules
Comprehensive testing modules for web, mobile, accessibility, performance, and messaging systems.
🎭 Browser Testing (BrowserManager)
Purpose: Manage Puppeteer browser instances for web automation testing.
Features
-
Automatic browser lifecycle management with
@browsertag - Configurable viewport sizes and browser arguments
- Basic authentication support
- Cookie consent handling
- Screenshot capture on test failure
Configuration
{
"browserOptions": {
"args": ["--no-sandbox", "--disable-setuid-sandbox"],
"viewport": {
"default": { "width": 1920, "height": 1080 },
"mobile": { "width": 375, "height": 667 }
}
},
"basicAuth": {
"authUser": "username",
"authPass": "password"
}
}
Usage
const { BrowserManager } = require('@cuppet/core');
const browserManager = new BrowserManager(viewport, args, credentials);
await browserManager.initialize();
// Access browser and page
const browser = browserManager.browser;
const page = browserManager.page;
// Cleanup
await browserManager.stop();
📱 Appium Testing (AppiumManager)
Purpose: Mobile app testing for iOS and Android using Appium.
Features
-
Automatic Appium session management with
@appiumtag - Support for iOS and Android platforms
- Configurable capabilities and device settings
- Element interaction and gestures
- Screenshot capture on failure
Configuration
{
"appiumCapabilities": {
"platformName": "Android",
"deviceName": "emulator-5554",
"app": "/path/to/app.apk",
"automationName": "UiAutomator2"
}
}
Usage
const { AppiumManager } = require('@cuppet/core');
const appiumManager = new AppiumManager(capabilities);
await appiumManager.initialize();
// Access driver
const driver = appiumManager.appiumDriver;
// Cleanup
await appiumManager.stop();
♿ Accessibility Testing
Purpose: Automated accessibility testing using Pa11y integration.
Features
- WCAG 2.1 compliance testing (Level A, AA, AAA)
- Automated accessibility audits
- Detailed violation reports
- HTML report generation
- Integration with CI/CD pipelines
Usage
@accessibility
Scenario: Check homepage accessibility
Given I go to "/"
When I run accessibility tests
Then there should be no accessibility violations
Configuration
{
"accessibility": {
"standard": "WCAG2AA",
"runners": ["axe", "htmlcs"],
"ignore": ["color-contrast"]
}
}
🚀 Lighthouse Performance Testing
Purpose: Google Lighthouse integration for performance, SEO, and best practices auditing.
Features
- Performance metrics (FCP, LCP, TTI, CLS)
- SEO auditing
- Best practices validation
- PWA compliance checking
- JSON and HTML report generation
Usage
Scenario: Check page performance
Given I go to "/"
When I run Lighthouse audit
Then the performance score should be above 90
And the accessibility score should be above 90
Configuration
{
"lighthouse": {
"categories": ["performance", "accessibility", "seo"],
"formFactor": "desktop",
"throttling": "simulated3G"
}
}
📡 MQTT Testing (MqttManager)
Purpose: IoT and message broker testing with MQTT protocol support.
Features
-
Automatic connection management with
@mqtttag - Topic subscriptions with wildcard support
- Message publishing (text and JSON)
- QoS levels (0, 1, 2)
- Message validation and buffering
🔄 Kafka Testing (KafkaManager)
Purpose: Event-driven architecture testing with Apache Kafka streaming platform.
Features
-
Automatic connection management with
@kafkatag - Topic subscriptions (single and multiple)
- Message publishing with keys
- JSON message validation
- SASL authentication and SSL/TLS support