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

@nascentdigital/wdio-extend

v2.3.0

Published

A set WebdriverIO extensions for creating powerful responsive E2E tests using a simple Page Object Model API.

Downloads

5

Readme

wdio-extend

A set of WebdriverIO extensions to help build E2E tests that validate your user interface using a combination of Chai extensions and a Page Object modeling language.

NPM version downloads Node version Build Status Code Coverage Known Vulnerabilities

Installation

This package should be used with node >= 10. We highly recommend using Node Version Manager if you need to update your node version.

Quick Start

The quickest way to get started is through our command-line interface, create-e2e-tests to generates a sample project after prompting for project options:

> npx @nascentdigital/create-e2e-tests my-e2e-project

Verify the project is installed correctly by running the sample E2E tests against the nascentdigital.com website (requires Google Chrome to be installed):

> cd my-e2e-project && npm run test

View the report to see the build results (hopefully showing a successful build).

Manual Installation

You can add the library directly to an existing WebdriverIO project by directly installing the package to your project:

npm i -s @nascentdigital/wdio-extend

And registering the extension library as a before hook in your WebdriverIO config file:

// wdio.conf.js
before: function() {
    require("ts-node").register({files: true});
    require("@nascentdigital/wdio-extend").NascentExtensions.register();
}

Defining Comnponents and Pages

Component and Page objects are key concepts of the wdio-extend framework. They provide a simple way to implement the Page Object Model design pattern within WebdriverIO.

Components

A Component is the most basic building block of a test. It encapsulates the specification and expected behavior of a widget on a web page, allowing it to be testing independently in a reusable way.

Components provide a way to define the expected structure, layout, and styling of a component in a responsive manner.

The definition for a Card component might look something like this:

/// Card.ts

class Card extends Component {

    constructor(parent: Container) {
        // CSS selector demarcating the component root
        super(parent, `*[data-component="Card"]`);
    }


    public get title() {
        return Component.create(this, `.title`, "title")
            .withStyle(HeadlineStyle);
    }

    public get caption() {
        return Component.create(this, `.caption`, "caption")
            .withStyle(BodyStyle);
    }

    public get image() {
        return new Component(this, `img`, "image");
    }

    protected declareLayout(): Layout | null {
        return Layout
            .xs()
                .layout(this.title).above(this.caption)
                .layout(this.caption).above(this.image)
            .md()
                .layout(this.title).leftOf(this.caption)
                .layout(this.caption).leftOf(this.image)
            .done();
    }
}

Pages

A Page is a top-level object that has similar functionality to a Component but exists as a singleton which maps to a specific web page within a website. A Page will be composed of Component objects.

Here is an example of a typical homepage:

// HomePage.ts
class HomePage extends Page {

    public constructor() {
        super("/");
    }

    public get header() {
        return new Header(this);
    }

    public get card() {
        return new Card(this);
    }

    public get footer() {
        return new Footer(this);
    }
}


// exports
export const homePage = new HomePage();

License

MIT © Nascent Digital