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

pupest

v0.3.3

Published

The easiest end-to-end test automation using Puppeteer

Downloads

5

Readme

Pupest

The easiest end-to-end test automation using Puppeteer

Installation

npm install pupest
# OR
yarn add pupest
# OR
pnpm add pupest
# OR
bun add pupest

Usage

Pupest CLI automatically detects all files *.pupest.js

// login.pupest.js

import pupest from 'pupest';

pupest()
  .go('https://github.com/login')
  .type('user123', '#login_field')
  .type('pass456', '#password')
  .test('Login into GitHub')

CLI

Run for all *.pupest.js files

pupest --visible --verbose

Run for custom glob

pupest **/auth --visible --verbose

Commands

Handler Props (Type Reference)

type HandlerProps = {
  browser: Browser;
  page: Page;
  scope: Frame;
}

| Command | Params | Description | |--------------------|-----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------| | click | selector: string | Clicks the element matching the selector. | | clickIfExists | selector: string | Clicks the element matching the selector only if exists on DOM. | | command | callback: (pupest: Pupest, ...args: any[]) => Pupest | Executes custom command created previously. | | contains | text: string, selector?: string | Checks if the element matching the selector contains the specified text. | | file | selector: string, ...paths: string[] | Attaches one or more files to the element matching the selector. | | find | selector: string | Returns the first element matching the selector. | | frame | selector?: string | Switches to the frame matching the selector (or to the main frame if no selector is provided). | | go | url: string | Navigates to the specified URL. | | ifElse | condition(HandlerProps), then(HandlerProps), else(HandlerProps) | Executes callback "then" or "else" based on boolean returned from "condition". | | keep | | Keeps the browser open, having to be closed manually. | | press | key: KeyInput | Presses the specified key. | | puppeteer | handler(HandlerProps) | Executes a custom handler function that receives an object with instances of the browser, page, and current frame. | | screenshot | path?: string | Captures a screenshot of the current page and saves it to the specified path (or in the test file directory). | | scroll | selector: string | Scrolls the page until the element matching the selector is visible. | | select | selector: string, ...values: string[] | Selects the specified options on the element matching the selector. | | type | text: string | Types the specified text. | | wait | milliseconds: number | Waits for the specified number of milliseconds before continuing. | | waitAnimationEnd | selector: string | Waits for the animation or transition of the given selector to finish. | | waitResponseURL | url: string | Waits for a response from a specified URL before proceeding. * may be used at the beginning and end of the URL |

Options

bail

CLI: --bail or -b

If set to true, stops the test run on the first failure.


changed

CLI: --changed

Runs tests only on the files that have been changed. It is useful for quickly testing changes without having to run the entire test suite.


height

CLI: --height or -h

The height of the browser window in pixels. Defaults to 1080.


keep

CLI: --keep or -k

If set to true, keeps the browser open, having to be closed manually


speed

CLI: --speed or -s

The speed at which the tests are run. Can be set to 'slow', 'medium', or 'fast'. Defaults to 'fast'.


timeout

CLI: --timoeut or -t

The amount of time in milliseconds to wait for a test to complete before timing out. Defaults to 15000.


userAgent

CLI: --userAgent or -u

The user agent string to use when making requests. Defaults to a random user agent.


verbose

CLI: --verbose

If set to true, logs more information about the test run.


visible

CLI: --visible or -v

If set to true, runs the tests in a visible browser window.


width

CLI: --width or -w

The width of the browser window in pixels. Defaults to 1920.