Use LWC Testing MCP Tools (Beta)

The LWC testing MCP tools enhances your testing experience by providing helpful guidance and testing best practices.

MCP Tools for LWC is a pilot or beta service that is subject to the Beta Services Terms at Agreements - Salesforce.com or a written Unified Pilot Agreement if executed by Customer, and applicable terms in the Product Terms Directory. Use of this pilot or beta service is at the Customer's sole discretion.

  • orchestrate_lwc_component_testing - Provides comprehensive testing workflow and test generation guidance
  • create_lwc_jest_tests - Generates comprehensive Jest test suites
  • review_lwc_jest_tests - Reviews and validates Jest test implementations
  • run_lwc_accessibility_jest_tests - Provides accessibility testing utilities and Jest integration for LWC

When working with these tools using Agentforce Vibes Extension, you must enable the a4d-general-rules-no-edit.md and a4d-lwc-rules-no-edit.md global rules. The a4d-general-rules-no-edit.md rule is enabled by default. For more information on configuring rules in Agentforce Vibes, see Agentforce Rules in the Agentforce Vibes Extension Developer Guide.

Here are some possible prompts that invoke the LWC testing MCP tools.

Ask about testing workflow for accessibility, Jest tests, and more.

  • Create a test plan covering render states, user events, wires, and errors.
  • Add accessibility tests and guidance on interpreting failures.
  • Generate Jest test examples covering wire adapters, Apex mocks, and DOM assertions.

Ask about generating Jest tests that cover your use cases.

  • Generate Jest tests for this component covering load, success, empty, and error states.
  • Create tests for this component including user interactions, DOM updates, and wire errors.
  • Mock lightning/uiRecordApi (getRecord, getFieldValue) and test events for this component.

Ask about reviewing and validating Jest tests and identifying coverage gaps.

  • Validate that tests for this component follow LWC Jest best practices and proper cleanup.
  • Review tests for this component and suggest missing cases and mocking improvements.
  • Assess tests for this component for async handling and coverage gaps.

Ask about generating or evaluating accessibility tests for a component.

  • Add Jest accessibility tests for this component’s default, error, and interactive states.
  • Generate test cases for focus order, ARIA roles, and keyboard navigation.
  • Diagnose these failing a11y assertions and propose code/test fixes to pass accessibility checks.

See Also