Salesforce Lightning Web Component (LWC) Locator Support
We’ve been working hard to deliver solutions that support Lightning Web Component (LWC) testing, and we also have improvements in the pipeline designed to enhance this capability in the future. The following includes information about the unique challenges associated with testing Lightning Web Components and your options for testing Lightning Web Components using Provar.
The limitations of XPath and CSS locators
Sometimes, you may attempt to test web components within a web app and find that traditional XPath and CSS locators cannot locate an element. This is because the Shadow DOM encapsulates web components. Within the Shadow DOM, the elements within a web component are private, which means that XPath and CSS locators cannot access their elements – causing tests to fail.
Using Provar to Test Lighting Web Components
If you’ve started to build and use Lightning Web Components in your Salesforce Lightning Experience enabled org, Provar can help. We provide the ability to test Lightning Web Components using two methods. You can use our ProvarX™ locator or the By Javascript option. Both of these automatically interpret the page structure and generate a unique locator path to locate elements that aren’t possible with standard XPath and CSS locators.
Both options simplify testing by providing the capability to locate elements within a Lightning Web Component by generating Shadow DOM-compliant locators. This enables you to set, read, and assert the element’s value.
In general, we recommend that you use ProvarX™ when testing Lightning Web Components. ProvarX™ provides a robust and seamless testing experience since it is built to natively adapt to Provar. ProvarX™ is our proprietary implementation of XPath that uniquely navigates the complexities of the Shadow DOM compared to other tools, which still use the limited functionality of traditional XPath libraries.
However, you may need to use Javascript in some situations. For example, if you are integrating Provar with DevOps platforms and tools that use JavaScript, you can still take advantage of those JavaScript locators within Provar.
Testing Lightning Web Components with ProvarX™
The ProvarX™ locator can also locate a Lightning Web Component on a Salesforce page by constructing a custom page object within Provar and locating the relevant element. Please refer to this support article for detailed information about using ProvarX.
Testing Lightning Web Components with the By Javascript locator
The By Javascript locator can also locate the Lightning Web Component on a Salesforce page by constructing a custom page object within Provar and locating the relevant element. Please refer to this support article for detailed information about using By Javascript.
Currently, you can use Provar to test the following Lightning Web Components:
Elements | Interaction |
Text Input Field | Read/assert, Set |
Labels | Read/assert |
Checkbox | Check, Uncheck, toggle |
Picklist | Set, Set by Index |
Lightning-buttons | Click, Read Assert |
Hyperlink | Click, Read Assert |
Date field | Set |
Time field | Set |
If you want to learn more about using the Provar to test Lightning Web Components, please contact us to discuss your testing strategy and requirements at support@provartesting.com.
- Provar Automation
- Installing Provar Automation
- Updating Provar Automation
- Using Provar Automation
- API Testing
- Behavior-Driven Development
- Creating and Importing Projects
- Creating Test Cases
- Custom Table Mapping
- Functions
- Debugging Tests
- Defining a Namespace Prefix on a Connection
- Defining Proxy Settings
- Environment Management
- Exporting Test Cases into a PDF
- Exporting Test Projects
- Override Auto-Retry for Test Step
- Managing Test Steps
- Namespace Org Testing
- NitroX
- Provar Automation
- Provar Test Builder
- Refresh and Recompile
- Reintroduction of CLI License Check
- Reload Org Cache
- Reporting
- Running Tests
- Searching Provar with Find Usages
- Secrets Management and Encryption
- Setup and Teardown Test Cases
- Tags and Service Level Agreements (SLAs)
- Test Cycles
- Test Plans
- Testing Browser Options
- Tooltip Testing
- Using the Test Palette
- Using Custom APIs
- Callable Tests
- Data-Driven Testing
- Page Objects
- Block Locator Strategies
- Introduction to XPaths
- Creating an XPath
- JavaScript Locator Support
- Label Locator Strategies
- Maintaining Page Objects
- Mapping Non-Salesforce fields
- Page Object Operations
- ProvarX™
- Refresh and Reselect Field Locators in Test Builder
- Using Java Method Annotations for Custom Objects
- Applications Testing
- Provar Manager
- Provar Manager Setup and User Guide
- Installing Provar Manager
- Configuring Provar Manager
- How to Use Provar Manager
- Managing Your Testing Life Cycle
- Provar Manager Test Execution
- Test Executions and Defect Management
- Provar Manager Test Coverage
- How to Integrate Provar Manager
- Setting Up a Connection to Provar Manager
- Object Mapping Between Automation and Manager
- How to Upload Test Plans, Test Plan Folders, Test Plan Instances, and Test Cases
- Provar Manager Filters
- Uploading Callable Test Cases in Provar Manager
- Uploading Test Steps in Provar Manager
- How to Know if a File in Automation is Linked in Test Manager
- Test Execution Reporting
- Provar Manager Plugins
- Uploading Existing Manual Test Cases to Provar Manager with DataLoader.Io
- Provar Grid
- DevOps
- Introduction to Test Scheduling
- Apache Ant
- Configuration for Sending Emails via the Automation Command Line Interface
- Continuous Integration
- AutoRABIT Salesforce DevOps in Provar Test
- Azure DevOps
- Running a Provar CI Task in Azure DevOps Pipelines
- Configuring the Automation secrets password in Microsoft Azure Pipelines
- Parallel Execution in Microsoft Azure Pipelines using Multiple build.xml Files
- Parallel Execution in Microsoft Azure Pipelines using Targets
- Parallel execution in Microsoft Azure Pipelines using Test Plans
- Bitbucket Pipelines
- CircleCI
- Copado
- Docker
- Flosum
- Gearset DevOps CI/CD
- GitHub Actions
- Integrating GitHub Actions CI to Run Automation CI Task
- Remote Trigger in GitHub Actions
- Parameterization using Environment Variables in GitHub Actions
- Parallel Execution in GitHub Actions using Multiple build.xml Files
- Parallel Execution in GitHub Actions using Targets
- Parallel Execution in GitHub Actions using Test Plan
- Parallel Execution in GitHub Actions using Job Matrix
- GitLab Continuous Integration
- Travis CI
- Jenkins
- Execution Environment Security Configuration
- Provar Jenkins Plugin
- Parallel Execution
- Running Provar on Linux
- Reporting
- Salesforce DX
- Git
- Team Foundation Server
- Version Control
- Salesforce Testing
- Best Practices
- Troubleshooting
- Release Notes