testing-e2e
E2E: Playwright browser automation/visual regression, Cypress, Selenium. POM, trace viewer, CI
What this skill does
# testing-e2e
## Purpose
This skill enables end-to-end (E2E) testing using tools like Playwright, Cypress, and Selenium for browser automation, visual regression testing, and integration with CI/CD pipelines. It focuses on reliable test automation for web applications.
## When to Use
Use this skill for full-stack testing of web apps, such as verifying user flows, UI interactions, or visual changes. Apply it in scenarios like regression testing before deployments, cross-browser compatibility checks, or when debugging UI issues in production-like environments.
## Key Capabilities
- Automate browser interactions with Playwright: Supports headless mode, tracing, and visual comparisons via `expect.toHaveScreenshot()`.
- Run Cypress tests: Includes real-time reloading, automatic waiting, and custom commands for assertions.
- Implement Selenium for legacy setups: Use WebDriver to control browsers and handle dynamic content.
- Page Object Model (POM): Structure tests with reusable page classes, e.g., define locators in a separate file.
- Visual regression: Capture and compare screenshots using Playwright's trace viewer or Cypress plugins.
- CI integration: Generate reports and artifacts for tools like GitHub Actions or Jenkins.
## Usage Patterns
To set up E2E tests, initialize a project with the chosen tool and write tests in a dedicated directory. Always use environment variables for sensitive data, like `$PLAYWRIGHT_BROWSER` for browser selection.
**Example 1: Playwright test for login flow**
- Create a test file: `tests/login.spec.js`
- Code snippet:
```javascript
const { test } = require('@playwright/test');
test('login success', async ({ page }) => {
await page.goto('https://app.example.com');
await page.fill('#username', 'user');
await page.click('#login');
});
```
- Run with: `npx playwright test --headed --project=chromium`
**Example 2: Cypress test for form submission**
- Add to `cypress/integration/form.spec.js`
- Code snippet:
```javascript
describe('Form Submission', () => {
it('submits correctly', () => {
cy.visit('/form');
cy.get('#name').type('Test User');
cy.get('button[type=submit]').click();
cy.url().should('include', '/success');
});
});
```
- Execute via: `npx cypress run --browser chrome --spec cypress/integration/form.spec.js`
For Selenium, use WebDriver with POM: Define a page class and call methods in tests.
## Common Commands/API
- Playwright CLI: `npx playwright install` to setup browsers; `npx playwright test --trace on` for tracing; API: `page.locator('selector').click()` for interactions.
- Cypress CLI: `npx cypress open` for interactive mode; `npx cypress run --config video=true` to enable videos; API: `cy.get('selector').should('be.visible')` for assertions.
- Selenium setup: Use `webdriverio` or similar; Command: `node selenium-test.js` with script like `driver.get('https://example.com')`; Config: JSON file for WebDriver options, e.g., `{ "browserName": "chrome" }`.
- Visual regression: Playwright's `npx playwright show-trace trace.zip` to view traces; Cypress via plugins like `cypress-image-snapshot`.
## Integration Notes
Integrate this skill into your workflow by adding it to package.json scripts, e.g., `"test:e2e": "npx playwright test"`. For CI, use GitHub Actions with a step: `run: npx cypress run --reporter junit`. If API keys are needed (e.g., for cloud services), set env vars like `$SELENIUM_GRID_URL` or `$CYPRESS_API_KEY`. Ensure browsers are installed via tools like `playwright install --with-deps`. For multi-tool setups, use a config file like `playwright.config.ts` with exports for projects.
## Error Handling
When tests fail, check logs first: Use Playwright's `--trace` flag to generate traces and debug with the trace viewer. For Cypress, enable `--config video=true` to capture videos. Handle common errors by adding retries, e.g., in Playwright: `test('retry', { retries: 2 }, async () => { ... })`. For Selenium, wrap code in try-catch blocks:
```javascript
try {
await driver.findElement(By.id('element')).click();
} catch (error) {
console.error('Element not found:', error);
}
```
Assert conditions explicitly to avoid flaky tests, and use env vars for dynamic configs to prevent setup errors.
## Graph Relationships
- Cluster: Connected to "testing" cluster for related skills like unit testing or integration testing.
- Tags: Links to skills with tags "e2e", "playwright", "cypress", and "testing".
- Dependencies: Relates to CI/CD skills for pipeline integration and browser automation tools for execution environments.
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.