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

@prestashopcorp/tests-framework

v4.1.0

Published

Base framework for new tests project

Downloads

437

Readme

Tests Base Framework

This repository has the role of a base framework to use on all tests projects.

Stack

  • Playwright as a node library to automate interaction with Chromium, Firefox and WebKit.

Browser Helper

Used as a wrapper for Playwright functions, it aims to simplify launching browsers, context and opening new tabs using environment parameters.

Here are some functions wrapped on this helper :

  • getBrowserOptions: Each browser type use different options to start, this function use the env var BROWSER to select the options to use.
  • createBrowser: When the browser type is chosen and its options are defined, this function attempt to launch the browser 3 times before throwing an error. Sometimes the browser fail or crash when started, that's why multiple attempts are done.
  • closeBrowser: After finishing the run, this function is called to destroy all browser instances or temporary files used on the run.
  • createContext: A browser could have different contexts depending on the platform to test on, this function simplify the use.
  • closeContext: After finishing a scenario, this function is called to destroy all instances created by the context.
  • addTab: To test on a browser instance, we need a tab to perform action on, this function add a new tab and return it on the test.
  • closeTab: After finishing work on a tab (and we have more than one tab), this function could used to close it.

Environment parameters

To properly use the helper, you should use the environment parameters to set the global ones.

Browser options

| Parameter | Description | |---------------------|----------------------------------------------------- | | PLATFORM | Platform to run tests on desktop or mobile (default to desktop) | | BROWSER | Specific browser to launch for tests (default to chromium) | | HEADLESS | Boolean to run tests in headless mode or not (default to true) | | SLOW_MO | Integer to slow down Playwright operations by the specified amount of milliseconds (default to 5 milliseconds) | | ACCEPT_DOWNLOADS | Boolean to accept downloads on a run (default to true) |

Context options

| Parameter | Description | |---------------------|----------------------------------------------------- | | WIDTH | Width size of the browser interface to open (default to 1680) | | HEIGHT | Height size of the browser interface to open (default to 900) | | LOCALE | Specific language of the browser language (default to fr-FR) | | DEVICE | Device to run test on if using mobile platform (default to null) |

Tests parameters

| Parameter | Description | |---------------------|----------------------------------------------------- | | URL | Url to open for tests (default to null) |

Examples

A small example was done to test the browser helper, the scenario of the test is:

  • Go to Addons page
  • Go to First Visit page using the menu

Before running examples, dependencies must be installed.

npm ci

To run tests :

npm run example