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

cypress-shadow-dom

v1.4.1

Published

Extend Cypress commands with shadow DOM support

Downloads

39,884

Readme

(deprecated) cypress-shadow-dom

GitHub license npm version All Contributors

Extend Cypress commands with shadow DOM support

This package adds a custom Cypress command that allows you to make an abstraction on how exactly you upload files through you HTML controls and focus on testing the functionality.

Project reached its dead end because of [recent feature introduced by @43081j][https://github.com/cypress-io/cypress/pull/7469] (and reference issue [cypress/issues/144][https://github.com/cypress-io/cypress/issues/144]).

Please consider using this experimental built-in feature as well as submitting issues and code contributions there.

Warmest thanks for all the contributors that helped this project evolve!

Table of Contents

Installation

The package is distributed via npm should be installed as one of your project's devDependencies:

npm install --save-dev cypress-shadow-dom

Usage

cypress-shadow-dom extends Cypress' cy command. Add this line to your project's cypress/support/commands.js:

import 'cypress-shadow-dom';

Here is a basic example:

cy.shadowGet('todo-list')
  .shadowFind('todo-list-item')
  .its('length')
  .should('eq', 4);

See more usage guidelines in example. It also contains all the available commands in their natural use case.

API

Here's a set of available commands:

shadowGet

Querying shadow DOM elements is made with:

cy.shadowGet(selector, options);
  • {String} selector – a single selector which usually represents root shadow DOM elements you want to start with

  • {Object?} options – (optional) contains following properties:

    • {Number?} timeout – (optional) time, in milliseconds, to wait until most DOM based commands are considered timed out (defaults to 4000)

This command returns shadowSubject that is a valid subject to execute any command below.

shadowFind

Additional querying within found shadow DOM elements:

shadowSubject.shadowFind(selector, options);
  • {String} selector – a single selector which helps to get nested shadow DOM element under the root element

  • {Object?} options – (optional) contains following properties:

    • {Number?} timeout – (optional) time, in milliseconds, to wait until most DOM based commands are considered timed out (defaults to 4000)

Example:

cy.shadowGet('todo-list').shadowFind('todo-form');

This command returns shadowSubject that is a valid subject to execute any command below.

In order to set a custom timeout for dynamically loaded elements that appear later than 4 seconds after render, use custom timeout:

cy.shadowGet('todo-list').shadowFind('todo-form', { timeout: 8500 });

shadowEq

To take the nth element from found shadow DOM collection:

shadowSubject.shadowEq(index, options);
  • {Number} index – a positive or negative number within given collection range

  • {Object?} options – (optional) contains following properties:

    • {Number?} timeout – (optional) time, in milliseconds, to wait until most DOM based commands are considered timed out (defaults to 4000)

shadowFirst

To take the first element from found shadow DOM collection:

shadowSubject.shadowFirst(options);
  • {Object?} options – (optional) contains following properties:

    • {Number?} timeout – (optional) time, in milliseconds, to wait until most DOM based commands are considered timed out (defaults to 4000)

So, simply:

cy.shadowGet('todo-list')
  .shadowFind('todo-form')
  .shadowFirst();

shadowLast

To take the last element from found shadow DOM collection:

shadowSubject.shadowLast(options);
  • {Object?} options – (optional) contains following properties:

    • {Number?} timeout – (optional) time, in milliseconds, to wait until most DOM based commands are considered timed out (defaults to 4000)

shadowContains

To validate some element's text content:

shadowSubject.shadowContains(content, options);
  • {String} content – a string containing any text for lookup

  • {Object?} options – (optional) contains following properties:

    • {Number?} timeout – (optional) time, in milliseconds, to wait until most DOM based commands are considered timed out (defaults to 4000)

shadowTrigger

To trigger any event:

shadowSubject.shadowTrigger(eventName, options);
  • {String} eventName – a string containing any text for lookup

  • {Object?} options – (optional) contains following properties:

    • {Boolean?} force
    • {Boolean?} bubbles
    • {Boolean?} cancelable
    • {Boolean?} composed

shadowClick

A shorthand to trigger a click event:

shadowSubject.shadowClick(options);
  • {Object?} options – (optional) contains following properties:

    • {Boolean?} force
    • {Boolean?} bubbles
    • {Boolean?} cancelable
    • {Boolean?} composed

shadowType

Types some text content inside given shadow DOM input control:

shadowSubject.shadowType(content, options);
  • {String} content – a string containing any text

  • {Object?} options – (optional) contains following properties:

    • {Number?} delay – (optional) time, in milliseconds, between adding each letter/char (defaults to 10)

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT