automated-regression-testing

Use when building or maintaining automated end-to-end regression tests for Salesforce UI (Lightning, LWC, Aura, Flows), selecting a testing framework (UTAM, Provar, Selenium), handling Shadow DOM challenges, or scheduling regression suites against pre-release orgs. Triggers: 'UTAM page objects', 'Shadow DOM testing', 'Salesforce E2E regression', 'Provar test automation', 'pre-release regression window'. NOT for Apex unit testing, LWC Jest component testing, manual UAT planning, or Agentforce conversational testing.

Best use case

automated-regression-testing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when building or maintaining automated end-to-end regression tests for Salesforce UI (Lightning, LWC, Aura, Flows), selecting a testing framework (UTAM, Provar, Selenium), handling Shadow DOM challenges, or scheduling regression suites against pre-release orgs. Triggers: 'UTAM page objects', 'Shadow DOM testing', 'Salesforce E2E regression', 'Provar test automation', 'pre-release regression window'. NOT for Apex unit testing, LWC Jest component testing, manual UAT planning, or Agentforce conversational testing.

Teams using automated-regression-testing should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/automated-regression-testing/SKILL.md --create-dirs "https://raw.githubusercontent.com/PranavNagrecha/AwesomeSalesforceSkills/main/skills/devops/automated-regression-testing/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/automated-regression-testing/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How automated-regression-testing Compares

Feature / Agentautomated-regression-testingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when building or maintaining automated end-to-end regression tests for Salesforce UI (Lightning, LWC, Aura, Flows), selecting a testing framework (UTAM, Provar, Selenium), handling Shadow DOM challenges, or scheduling regression suites against pre-release orgs. Triggers: 'UTAM page objects', 'Shadow DOM testing', 'Salesforce E2E regression', 'Provar test automation', 'pre-release regression window'. NOT for Apex unit testing, LWC Jest component testing, manual UAT planning, or Agentforce conversational testing.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Automated Regression Testing

Use this skill when Salesforce UI changes, tri-annual platform releases, or deployment pipelines require automated browser-based regression testing rather than manual click-through verification. The objective is a sustainable regression suite that survives Shadow DOM encapsulation, adapts to Salesforce's three-release-per-year cadence, and integrates into CI/CD pipelines for continuous confidence.

---

## Before Starting

Gather this context before working on anything in this domain:

- **What UI technology dominates the org?** Lightning Web Components use native Shadow DOM, Aura uses a synthetic shadow polyfill (being deprecated), and Visualforce uses standard HTML. Each requires a fundamentally different locator strategy — mixing them in one suite without abstraction causes mass test breakage.
- **Is the team already invested in a commercial tool?** Provar and Copado Robotic Testing have Salesforce-native metadata awareness that eliminates Shadow DOM piercing work. Switching mid-project is expensive. If there is no existing investment, UTAM (open-source, Salesforce-maintained) is the recommended starting point.
- **What is the Salesforce release cadence impact?** Salesforce ships three major releases per year (Spring, Summer, Winter). Pre-release sandboxes open roughly 5 weeks before GA. Teams that do not run regression suites against pre-release orgs discover breakage in production.

---

## Core Concepts

### Shadow DOM and Locator Fragility

Lightning Web Components render inside native Shadow DOM boundaries. Standard Selenium `By.cssSelector` and `By.xpath` locators cannot penetrate these boundaries — `document.querySelector` returns `null` for elements inside a shadow root. This is the single most common reason Salesforce UI automation projects fail in their first month.

UTAM (UI Test Automation Model) solves this by generating page objects from JSON descriptors that understand shadow root traversal. Each page object knows how to pierce into the correct shadow host, locate the target element, and expose it as a typed method. Salesforce publishes 727+ pre-built UTAM page objects covering standard Lightning components.

For teams using raw Selenium or Playwright, the alternative is manual `shadowRoot` traversal chains like `driver.executeScript("return document.querySelector('one-app-nav-bar').shadowRoot.querySelector('...')")` — brittle, unreadable, and unmaintainable beyond a handful of tests.

### Page Object Model for Salesforce

The Page Object Model (POM) pattern is non-negotiable for Salesforce UI automation at scale. Without POM, locator changes from a single Salesforce release can require updating hundreds of test methods.

UTAM enforces POM by design: each page object is a JSON file that compiles to a Java or JavaScript class. The JSON declares the component's shadow root structure, child elements, and actions. Tests interact with page object methods (`loginPage.setUsername(...)`) rather than raw selectors.

For Provar, page objects are auto-generated from org metadata — Provar reads the object model, page layouts, and component tree to build its locator abstractions. This metadata-awareness is Provar's primary advantage over generic Selenium approaches.

### Tri-Annual Release Regression Windows

Salesforce's release cycle creates a predictable but firm regression testing cadence. The critical timeline is:

1. **Pre-release sandbox signup** opens roughly 5 weeks before GA (exact dates published on the Salesforce Trust site).
2. **Sandbox preview** window: the pre-release sandbox runs the upcoming version while production remains on the current version.
3. **GA cutover**: all instances upgrade on a rolling schedule over a release weekend.

Teams must run their full regression suite against a pre-release sandbox during the preview window. Tests that fail in preview but pass in the current sandbox indicate release-specific regressions that need workarounds before GA day.

---

## Common Patterns

### Mode 1: UTAM-Based Open-Source Regression Suite

**When to use:** Greenfield automation project, LWC-heavy org, team comfortable with Java or JavaScript, budget-constrained.

**How it works:**

1. Install UTAM compiler (`@salesforce/utam-compiler` for JS or Maven dependency for Java).
2. Add Salesforce's pre-built page object dependencies (`salesforce-pageobjects` NPM package or Maven artifact).
3. Write custom page objects for org-specific custom LWC components using UTAM JSON grammar.
4. Compose test methods that chain page object actions: navigate to record, fill fields, save, assert toast message.
5. Execute in CI with headless Chrome via WebDriverManager or Playwright launcher.

**Why not the alternative:** Raw Selenium without UTAM requires manual shadow root traversal that breaks every time Salesforce restructures component internals (which happens frequently during major releases).

### Mode 2: Provar or Commercial Metadata-Aware Suite

**When to use:** Enterprise teams with license budget, existing Provar investment, complex page layouts with many custom objects, Visualforce/Aura/LWC hybrid orgs.

**How it works:**

1. Connect Provar to the target Salesforce org via OAuth.
2. Provar reads org metadata (objects, fields, page layouts, record types) and auto-generates locator abstractions.
3. Record or author test cases using Provar's IDE — each step maps to a metadata-backed element rather than a CSS path.
4. Export test results as JUnit XML for CI integration.
5. Schedule nightly runs against pre-release sandboxes during preview windows.

**Why not the alternative:** Provar's metadata connection means locator updates for layout changes are often automatic. With UTAM, you maintain page objects manually for every custom component.

### Mode 3: Hybrid Playwright/UTAM for Modern Stacks

**When to use:** Teams already using Playwright for non-Salesforce testing, want a single framework, willing to write custom shadow DOM piercing utilities.

**How it works:**

1. Use Playwright's `page.evaluateHandle` to traverse shadow roots programmatically.
2. Wrap traversal in page object classes that mirror UTAM's abstraction.
3. Import UTAM's published locator data (available in JSON) as reference for standard component selectors.
4. Run with Playwright Test runner; benefit from auto-wait, tracing, and parallel execution.

---

## Decision Guidance

| Situation | Recommended Approach | Reason |
|---|---|---|
| LWC-heavy org, no existing automation investment | UTAM + Selenium/WebDriver (Mode 1) | Salesforce-maintained, free, Shadow DOM solved natively |
| Enterprise with budget, hybrid Aura/LWC/VF org | Provar (Mode 2) | Metadata-aware locators handle mixed tech stack automatically |
| Team already using Playwright for other web apps | Playwright + custom shadow piercing (Mode 3) | Unified framework reduces maintenance, but requires custom shadow work |
| Only Apex/API testing needed, no UI | Do NOT use this skill | Use continuous-integration-testing skill instead |
| Testing Agentforce conversational agents | Do NOT use this skill | Use agent-testing-and-evaluation skill instead |

---

## Recommended Workflow

Step-by-step instructions for an AI agent or practitioner building a regression suite:

1. **Inventory the UI technology stack** — Determine the ratio of LWC vs Aura vs Visualforce pages in the critical business processes. Shadow DOM strategy depends entirely on this.
2. **Select the framework** — Use the Decision Guidance table. If LWC-dominant and budget-constrained, default to UTAM. If hybrid or enterprise, evaluate Provar.
3. **Establish page object architecture** — Create a page object for each screen in the critical path. For UTAM, write JSON descriptors; for Provar, connect to the org and let metadata auto-generate. Never put raw locators in test methods.
4. **Build smoke-level regression suite first** — Automate the 5-10 most critical happy-path business processes (login, create record, edit, approval, report). Prove the framework works before scaling.
5. **Integrate into CI pipeline** — Configure headless browser execution (Chrome headless via WebDriverManager or Playwright). Produce JUnit XML output. Fail the build on regression failures.
6. **Schedule pre-release runs** — When Salesforce announces each release, sign up for a pre-release sandbox and schedule nightly regression runs during the preview window. Log failures and triage before GA.
7. **Maintain page objects per release** — After each Salesforce release, review failed tests, update page objects for changed component structures, and re-run until green.

---

## Review Checklist

Run through these before marking work in this area complete:

- [ ] Page objects exist for every screen in the critical regression path — no raw selectors in test methods
- [ ] Shadow DOM traversal is handled by the framework (UTAM page objects or Provar metadata), not by inline JavaScript hacks
- [ ] Tests produce JUnit XML or equivalent machine-readable output for CI consumption
- [ ] Headless browser execution is confirmed working (not just headed/local)
- [ ] Pre-release sandbox regression schedule is documented and calendar-blocked for the next Salesforce release
- [ ] Test data setup is independent — tests create their own data or use a seeded dataset, not production data copies
- [ ] Flaky test quarantine process exists — intermittent failures are isolated, not ignored or force-retried indefinitely

---

## Salesforce-Specific Gotchas

Non-obvious platform behaviors that cause real production problems:

1. **Aura shadow polyfill deprecation** — Salesforce is migrating from synthetic shadow (Aura polyfill) to native Shadow DOM for LWC. Tests built against the polyfill's quirks (e.g., `document.querySelector` penetrating synthetic shadow) will break when the org flips to native shadow. Check the org's LWC Shadow DOM configuration in Setup and test against native mode proactively.
2. **Lightning Experience URL instability** — Salesforce Lightning URLs contain instance-specific hashes and state tokens that change between sessions. Hard-coding URLs like `/lightning/r/Account/001.../view` works, but navigation via `lightning/o/Account/list` may redirect through intermediate states. Use page object navigation methods (e.g., UTAM's `NavigationMixin` patterns) instead of `driver.get(url)`.
3. **Sandbox refresh resets test configuration** — Full sandbox refreshes overwrite Connected App configurations, named credentials, and custom settings used by automation frameworks to authenticate. Post-refresh runbooks must include re-provisioning automation service accounts and re-authorizing OAuth flows.

---

## Output Artifacts

| Artifact | Description |
|---|---|
| Regression test framework setup guide | Framework selection rationale, installation steps, and initial page object scaffold |
| Pre-release regression schedule | Calendar-aligned plan mapping Salesforce release dates to sandbox signup, test execution, and triage windows |
| CI pipeline regression stage | Pipeline configuration (YAML or equivalent) for headless browser test execution with JUnit output |
| Page object inventory | Catalog of page objects covering critical business process screens with maintenance ownership |

---

## Related Skills

- continuous-integration-testing — Use alongside when integrating Apex test execution into the same CI pipeline as UI regression tests
- destructive-changes-deployment — Use when deployment pipelines must handle metadata removal that can break UI regression targets
- org-shape-and-scratch-definition — Use when scratch orgs serve as regression test targets and need consistent shape configuration

Related Skills

omnistudio-testing-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when testing or validating OmniStudio components — OmniScript preview, Integration Procedure step debugging, DataRaptor field-mapping validation, and end-to-end UTAM-based automation. NOT for Apex unit testing or standard Flow debugging.

lwc-testing

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when setting up or reviewing Lightning Web Component unit tests with Jest, including `@salesforce/sfdx-lwc-jest`, wire adapter mocks, imperative Apex mocks, async rerender handling, and accessibility smoke checks. Triggers: 'how do I test @wire in LWC', 'Jest test is flaky', 'mock Apex in LWC test', 'flushPromises pattern'. NOT for Apex unit tests, browser end-to-end automation, or performance testing.

lwc-jest-testing-with-accessibility

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when authoring or reviewing Jest unit tests for Lightning Web Components and the test plan must include explicit accessibility assertions — covers `@salesforce/sfdx-lwc-jest` setup, `createElement` / `document.body.appendChild` render harness, wire-service mocks via `@salesforce/wire-service-jest-util`, imperative Apex mocks via `jest.fn()`, simulated user interactions (`click`, `keydown`, `focus`), ARIA attribute and accessible-name assertions, focus-management tests, keyboard-navigation tests, and optional `axe-core` integration via `jest-axe`. Triggers: 'add a11y assertions to my LWC jest tests', 'how do I test focus management in LWC', 'jest test for keyboard navigation', 'integrate axe-core into sfdx-lwc-jest', 'assert ARIA attributes after interaction', 'how do I prove the LWC is accessible in CI'. NOT for general LWC jest setup without an a11y angle (use lwc/lwc-testing — this skill is the accessibility-deep-dive sibling), NOT for accessibility-pattern authoring inside the component itself (use lwc/lwc-accessibility-patterns), NOT for end-to-end UI automation via UTAM, NOT for manual screen-reader QA workflows.

flow-testing

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when defining or reviewing test strategy for Salesforce Flow, including Flow Tests, debug runs, path coverage, test data, and explicit validation of fault paths and custom component behavior. Triggers: 'flow test tool', 'how do i test a flow', 'flow fault path testing', 'flow debug interview'. NOT for Apex unit testing or manual QA planning that is unrelated to Flow behavior.

performance-testing-salesforce

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when planning or executing load tests, stress tests, or performance benchmarks against a Salesforce org. Covers Salesforce Scale Test, third-party tools (JMeter, BlazeMeter, k6), API throughput testing, Experience Page Time (EPT) measurement, and sandbox sizing for performance work. Triggers: 'load test Salesforce org', 'Scale Test Full Copy sandbox', 'EPT optimization', 'API concurrency limits', 'JMeter Salesforce performance'. NOT for Apex unit test performance assertions, LWC Jest tests, query optimization (see data/soql-query-optimization), or NFR definition (see architect/nfr-definition-for-salesforce).

data-seeding-for-testing

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when creating test data for scratch orgs, sandboxes, or CI pipelines: Apex @testSetup factories, sf data import tree plans, CumulusCI datasets, Snowfakery. NOT for production data migration or ETL pipelines.

continuous-integration-testing

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when configuring Apex test execution in CI/CD pipelines, choosing test levels for deployments, parsing test results, or troubleshooting code coverage in automated builds. Triggers: 'RunLocalTests', 'RunSpecifiedTests', 'sf project deploy', 'code coverage CI', 'JUnit test results'. NOT for Apex test class design patterns, test data factory architecture, or LWC Jest testing.

agentforce-testing-strategy

8
from PranavNagrecha/AwesomeSalesforceSkills

Design Agentforce testing: topic coverage, action unit tests, deterministic golden sets, adversarial prompts, and regression harness. Trigger keywords: agentforce testing, agent eval, agent regression suite, prompt golden set, action unit test agentforce. Does NOT cover: generic LLM evaluation academia, human-labeled RLHF pipelines, or Einstein Classify accuracy.

agent-testing-and-evaluation

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when testing, evaluating, or building regression suites for Agentforce agents: conversation testing in Agent Builder, topic coverage and utterance testing, Testing API and AiEvaluationDefinition metadata, evaluation metrics (containment rate, escalation rate, CSAT, topic activation accuracy), and post-deploy analytics via Enhanced Event Logs. Triggers: 'how do I test my Agentforce agent', 'agent routes to wrong topic', 'write utterance tests', 'regression test after topic change', 'measure agent quality', 'agent containment rate'. NOT for agent creation, topic design, or action contract design — use agentforce/agentforce-agent-creation, agentforce/agent-topic-design, or agentforce/agent-actions respectively.

xss-and-injection-prevention

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when writing or reviewing Visualforce pages, Apex controllers, or LWC components that output user-supplied data, build dynamic queries, or construct HTTP responses. Triggers: 'XSS in Visualforce', 'SOQL injection vulnerability', 'how to encode output in Apex', 'JSENCODE Visualforce', 'open redirect prevention'. NOT for Apex CRUD/FLS enforcement (use soql-security or apex-crud-and-fls), NOT for Shield encryption (use shield-encryption-key-management), NOT for AppExchange security review process (use secure-coding-review-checklist).

visualforce-security-and-modernization

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when hardening or modernizing legacy Visualforce pages — covers the platform CSRF token model and when disabling it is a security regression, view state encryption guarantees and the 170 KB ceiling, FLS/CRUD enforcement gaps on `<apex:outputField>` and on getters that return sObjects, `<apex:includeScript>` interaction with the org Content Security Policy, hosting LWC inside a VF page via `lightning:container` / `lightning-out`, and the retire-vs-harden-vs-leave-alone decision for an inventory of legacy pages. Triggers: 'should I rewrite this Visualforce page in LWC', 'CSRF protection disabled on Visualforce page is that safe', 'community user sees a field they should not on a Visualforce page', 'view state encryption is that enough for sensitive data', 'how do I host an LWC inside a Visualforce page', 'apex:dynamicComponent and apex:actionFunction safe to keep'. NOT for greenfield Visualforce architecture (use apex/visualforce-fundamentals — controller types, view state pattern selection, PDF rendering); NOT for Visualforce email template authoring (use apex/visualforce-email-templates if/when that skill is authored); NOT for general Apex security review across triggers and async (use apex/soql-security and security/secure-coding-review-checklist).

transaction-security-policies

8
from PranavNagrecha/AwesomeSalesforceSkills

Transaction Security policy creation and configuration: condition builder, enhanced policies, enforcement actions (block, MFA, notification, end session), real-time monitoring mode, and policy troubleshooting. NOT for Event Monitoring log analysis or Shield Event Monitoring setup (use event-monitoring). NOT for Apex testing or debug-log analysis.