
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
cypress-shadow-dom
Advanced tools
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!
The package is distributed via npm should be installed as one of your project's devDependencies
:
npm install --save-dev cypress-shadow-dom
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.
Here's a set of available commands:
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.
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 });
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)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();
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)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)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
A shorthand to trigger a click event:
shadowSubject.shadowClick(options);
{Object?} options
β (optional) contains following properties:
{Boolean?} force
{Boolean?} bubbles
{Boolean?} cancelable
{Boolean?} composed
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)Thanks goes to these wonderful people (emoji key):
tst π | Joshua de Lange π | Lucas SchnΓΌriger π» | Milan Andric π π€ | Ryan Wheale π€ π» |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
Extend Cypress commands with shadow DOM support
The npm package cypress-shadow-dom receives a total of 9,362 weekly downloads. As such, cypress-shadow-dom popularity was classified as popular.
We found that cypress-shadow-dom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.