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-test-helper

v1.0.10

Published

Cypress test helper

Downloads

23

Readme

Benefits of Using cypress-test-helper library

  • Enhanced Readability: Custom commands improve test code readability by replacing repetitive code with concise and self-explanatory functions.

  • Reduced Code Duplication: Custom commands eliminate the need to duplicate code in different test scenarios, reducing redundancy and improving code maintainability.

  • Encapsulated Complex Logic: Custom commands allow complex test logic to be encapsulated, making it easier to understand and reuse throughout the test suite.

  • Simplified Cypress Tests: These utility functions simplify Cypress tests by providing concise and reusable methods for locating and interacting with DOM elements.

Available Custom Commands

Custom commands available in this library:

shouldExist

  • Description: Asserts that an element exists in the DOM.

  • Example:

cy.get("selector").shouldExist();

shouldBeVisible

  • Description: Asserts that an element is visible in the viewport.

  • Example:

cy.get("selector").shouldBeVisible();

shouldBeHidden

  • Description: Asserts that an element is hidden in the viewport.

  • Example:

cy.get("selector").shouldBeHidden();

shouldBeEnabled

  • Description: Asserts that an element is enabled in the viewport.

  • Example:

cy.get("selector").shouldBeEnabled();

shouldBeDisabled

  • Description: Asserts that an element is disabled in the viewport.

  • Example:

cy.get("selector").shouldBeDisabled();

shouldBeChecked

  • Description: Asserts that an element is checked in the viewport.

  • Example:

cy.get("selector").shouldBeChecked();

shouldBeUnChecked

  • Description: Asserts that an element is unchecked in the viewport.

  • Example:

cy.get("selector").shouldBeUnChecked();

shouldHaveText

  • Description: Asserts that an element contains the specified text.

  • Example:

cy.get("#elementWithText").shouldHaveText("Expected Text");

shouldHaveHref

  • Description: Asserts that an element has the specified href attribute.

  • Example:

cy.get("#link").shouldHaveHref("/about");

verifyTextDisplayed

  • Description: Asserts that an element is visible and contains the specified text.

  • Example:

cy.verifyTextDisplayed("Welcome to Cypress Custom Commands!");

verifyTextboxValue

  • Description: Asserts that a textbox has the specified value.

  • Example:

cy.verifyTextboxValue("Default Text");

verifyElementDoesNotExist

  • Description: Asserts that an element does not exist in the DOM.

  • Example:

cy.verifyElementDoesNotExist("#nonExistentElement");

shouldHavePlaceHolder

  • Description: Asserts that an input element has the specified placeholder text.

  • Example:

cy.get("#inputWithPlaceholder").shouldHavePlaceHolder("Enter your text");

Cypress Utility Functions

Documentation for a set of utility functions that can be used in Cypress tests to locate and interact with DOM elements:

textboxByLabel:

  • Description: Locates a textbox by its associated label text.
  • Usage:
cy.textboxByLabel("Email Address").type("[email protected]");

textboxByRoleName:

  • Description: Locates a textbox by its aria-label attribute.
  • Usage:
cy.textboxByRoleName("Search Field").type("Search Query");

dropdownByRoleName:

  • Description: Locates a dropdown by its aria-label attribute.
  • Usage:
cy.dropdownByRoleName("Select Category").select("Electronics");

linkByText:

  • Description: Locates a link by its visible text content.
  • Usage:
cy.linkByText("Learn More").click();

buttonByText:

  • Description: Locates a button by its visible text content.
  • Usage:
cy.buttonByText("Submit").click();

buttonByRoleName:

  • Description: Locates a button by its aria-label attribute.
  • Usage:
cy.buttonByRoleName("Add to Cart").click();

byLabel:

  • Description: Locates an element by its associated label text.
  • Usage:
cy.byLabel("Username").type("johndoe");

byText:

  • Description: Locates an element by its visible text content.
  • Usage:
cy.byText("Welcome to the Dashboard").should("be.visible");

byDataCy:

  • Description: Locates an element by its data-cy attribute.
  • Usage:
cy.byDataCy("login-button").click();