npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

codeceptjs-lwc-example

v5.1.4

Published

Salesforce's LWC Recipes Acceptance Tests

Downloads

8

Readme

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 [email protected]: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);
  }
}