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

@optimumqa/cypress-setup-utilities

v1.7.0

Published

Populates your Cypress config and adds some helpers.

Downloads

395

Readme

Cypress plugin for use with cypress-boilerplate.

Read more about the boilerplate project here

Installation

npm install cypress-setup-utilities

Usage

Cypress version >= 10

import { defineConfig } from 'cypress'

const finalConfig = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      // Setup plugins
      config = import('@optimumqa/cypress-setup-utilities')(on, config)

      return config
    },
  },
})

Lower versions than v10 are not supported.

What is inside?

Stores

Enables you to create stores while running your spec files.

Can be useful if you need to save a token inside one spec, and re-use it inside another.

You can have infinite stores.

Example of setting a new item into 'CommonStore'.

If the store does not exist, it will be created:

cy.task('setItem', {
  storeId: 'CommonStore',
  item: {
    name: 'token',
    value: 'foo',
  },
})

Example of getting an item from a store:

cy.task('getItem', {
  storeId: 'CommonStore',
  item: {
    name: 'token',
  },
}).then((item) => {
  console.log(item)
})

Config

This part takes your environment variables passed in CLI, and saves them to your config.

This particular project looks for following arguments: [product, env, type]

| name | type | default | | --------- | -------- | --------- | | product | String | undefined | | env | String | staging | | type | String | default |

type can be excluded

You can access these arguments from the config using

Cypress.env('PRODUCT')
Cypress.env('ENV')
Cypress.env('TYPE')

// Or get the original config from CLI(where some values are not set to default)
Cypress.env('originalConfig')

specPattern

Test files are set depending on the product argument.

specPattern inside the config will be populated with all spec files from ./cypress/e2e/product/**/*.

This will only happen if you have not specified specPattern already.

So when you run

$ cypress run --env product=yourProductName

It will give you only the spec files from ./cypress/e2e/yourProductname/.

Type based configs

If you have the need to specify different config types for any reason. You can do that by creating them inside ./cypress/configs/your-product-name/.

For example:

  • Create daily.ts where we have the need to specify only 3 spec files
export default {
  e2e: {
    specPattern: ['**/your-product-name/spec1.ts', '**/your-product-name/spec2.ts', '**/your-product-name/spec3.ts'],
  },
}

Then you create a command in package.json inside scripts:

{
  "scripts": {
    "yourProductName-staging-daily": "cypress run -e product=yourProductName,env=staging,type=daily"
  }
}

Local config

Create a file cypress.local.ts inside ./cypress/configs/. Your local config will be then merged with the global config and product config.

Here you can place your overrides.

If you need to temporarily disable this file, just rename it. Example: cypress.local.ts -> cypress.local-tmp.ts

It is ignored by GIT.

baseUrl

By default, in the parent boilerplate, three environments are created: [staging, release, production] inside the ./cypress/fixtures/yourProductName/ populated with the baseUrl per environment.

When you run cypress, this plugin will take the baseUrl of the current product and environment, and set it to the final cypress config if you have the need to get the baseUrl from there, and not from the fixtures routes.json file.

Therefor, you can have multiple products inside the parent boilerplate, as this plugin sets up your config depending on the parameters you've given it.

Keeps the package.json clutter free and gives it intuitive commands to run.

Delete passed video

Deletes videos from passed test cases.

Summary

  • Project is dynamically set up based on the four arguments above
  • If you specify baseUrl or specPattern in configs, they will not be overwritten.

🤝 Contributing

Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.

Show your support

Please ⭐️ this repository if this project helped you!

📝 License

This project is MIT licensed.