All Projects → abramenal → Cypress Shadow Dom

abramenal / Cypress Shadow Dom

Licence: mit
Extend Cypress commands with shadow DOM support

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Cypress Shadow Dom

focus-trap
A lightweight web component that traps focus within a DOM node
Stars: ✭ 44 (-8.33%)
Mutual labels:  shadow-dom
cease
Simple, isolated CSS-in-JS for React components
Stars: ✭ 21 (-56.25%)
Mutual labels:  shadow-dom
Xy Ui
🎨面向未来的原生 web components UI组件库
Stars: ✭ 603 (+1156.25%)
Mutual labels:  shadow-dom
codeceptjs-bdd
Javascript BDD UI Automation Framework. Exclusive LWC Shadow DOM Support. Playwright, Webdriver.io, Appium, Saucelabs.
Stars: ✭ 35 (-27.08%)
Mutual labels:  shadow-dom
ionic-custom-components
🌈 Ionic Tutorial: Mastering Web Components in Ionic Framework. This repo is an Ionic project showcasing Angular custom components and Stencil custom web components.
Stars: ✭ 30 (-37.5%)
Mutual labels:  shadow-dom
Reshadow
Markup and styles that feel right
Stars: ✭ 343 (+614.58%)
Mutual labels:  shadow-dom
shadow
Shadow dom support for Vue
Stars: ✭ 46 (-4.17%)
Mutual labels:  shadow-dom
Dna
Progressive Web Components.
Stars: ✭ 22 (-54.17%)
Mutual labels:  shadow-dom
svelte-webcomponents
A ready-to-use project template to build custom elements (web components) with Svelte 3 with support and examples for web components, jest, sass, nested components with props, eslinting, stylelinting, Github actions, propagating custom events from shadow-DOM to real-DOM etc.
Stars: ✭ 22 (-54.17%)
Mutual labels:  shadow-dom
Remount
Mount React components to the DOM using custom elements
Stars: ✭ 522 (+987.5%)
Mutual labels:  shadow-dom
ember-shadow-dom
Write templates for your components inside of a Shadow DOM root.
Stars: ✭ 26 (-45.83%)
Mutual labels:  shadow-dom
web-components-tutorial
HTML Web Component using Vanilla JavaScript
Stars: ✭ 38 (-20.83%)
Mutual labels:  shadow-dom
Pickr
🎨 Flat, simple, multi-themed, responsive and hackable Color-Picker library. No dependencies, no jQuery. Compatible with all CSS Frameworks e.g. Bootstrap, Materialize. Supports alpha channel, rgba, hsla, hsva and more!
Stars: ✭ 3,759 (+7731.25%)
Mutual labels:  shadow-dom
nuxt-custom-elements
Publish your components as a custom-element standalone build.
Stars: ✭ 48 (+0%)
Mutual labels:  shadow-dom
Styled Jsx
Full CSS support for JSX without compromises
Stars: ✭ 6,768 (+14000%)
Mutual labels:  shadow-dom
element
Fast and simple custom elements.
Stars: ✭ 65 (+35.42%)
Mutual labels:  shadow-dom
Switzerland
🇨🇭Switzerland takes a functional approach to Web Components by applying middleware to your components. Supports Redux, attribute mutations, CSS variables, React-esque setState/state, etc… out-of-the-box, along with Shadow DOM for style encapsulation and Custom Elements for interoperability.
Stars: ✭ 261 (+443.75%)
Mutual labels:  shadow-dom
Reactshadow
🔰 Utilise Shadow DOM in React with all the benefits of style encapsulation.
Stars: ✭ 948 (+1875%)
Mutual labels:  shadow-dom
Crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (-54.17%)
Mutual labels:  shadow-dom
Atomico
Atomico a micro-library for creating webcomponents using only functions, hooks and virtual-dom.
Stars: ✭ 481 (+902.08%)
Mutual labels:  shadow-dom

(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 (and reference issue 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):


tst

🐛

Joshua de Lange

🐛

Lucas Schnüriger

💻

Milan Andric

📖 🤔

Ryan Wheale

🤔 💻

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

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].