New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

codeceptjs-lwc-example

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codeceptjs-lwc-example

Salesforce's LWC Recipes Acceptance Tests

  • 5.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-72.73%
Maintainers
1
Weekly downloads
 
Created
Source

Salesforce's LWC E2E Automation Example

This repository automates the LWC Recipes page using Selenium WebDriver thru Codeceptjs-BDD framework. It uses Cucumber BDD Feature files to automate the LWC Features. You can also choose to automate with Mocha styles traditional tests. For more info, take a look at Codeceptjs-BDD Docs.

This example automates the HelloBinding LWC Component on LWC Recipe - https://recipes.lwc.dev/#hello

Pre-requisite

  • Yarn
  • Node > 10

Getting Started

git clone git@github.com:gkushang/codeceptjs-bdd.git
cd codeceptjs-bdd/packages/codeceptjs-lwc-example
yarn

Run Acceptance Tests

yarn acceptance

HTML Report

yarn acceptance:report

Feature

This example automates the Hello Binding component from the LWC Recipes Page.

@hello_binding @lwc_recipes
Feature: HelloBinding from Salesforce LWC Recipes

    As a LWC developer
    I want to be able to automate the LWC Shadow Dom Components
    So that I can quickly create my UI Automated Suite using Selenium

    => LWC Recipe Page: https://recipes.lwc.dev/#hello

    @hello_binding_component
    Scenario: Fred successfully types in and verifies the title in Hello Binding LWC Component

        When Fred types "Kushang Gajjar" into the Hello Binding Component
        Then he sees the title is updated accordingly

Locating LWC Element

The work is still in-progress for the changes to be accepted at CodeceptJS. Here is the proposal on how to select the element when it's chained with custom elements.

In the page object, you can define your locators as a special shadow locator.

    // input field on helloBinding component
    inputField: { shadow: [...parent,'ui-input', 'input.input' ]}

Page Objects

Since it inherits the elements from the host/parent, you can define your Page Objects as a Class and take benefits of inheritance in your page objects. This makes a lot of your code/locators Re-usable across the app.


class HelloBinding extends LightingComponent {

  constructor() {
    
    super();

    // common elements for shadow locators
    const parent =  [...this.host, 'recipe-hello-binding'];

    // locators uses "shadow", and elements are sequentially defined
    this.locators = {
      
      // input field on helloBinding component
      inputField: { shadow: [...parent, 'ui-input', 'input.input' ]},
      
      // card title on helloBinding component
      cardTitle: { shadow: [...parent, 'div p']}

    }
  }

  enterName(name) {
    return I.fillField(this.locators.inputField, name);
  }

  async grabTitle() {
    return await I.grabTextFrom(this.locators.cardTitle);
  }
}

Keywords

FAQs

Package last updated on 22 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc