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

@nightwatch/schematics

v1.2.1

Published

Adds Nightwatch to an existing Angular CLI project

Downloads

1,159

Readme

Nightwatch Schematics

Node CI npm package

Fast and easy installation of Nightwatch into your projects

Framework & Language Supported: Angular

This project is a Schematics implementation that allows you to easily integrate Nightwatch into your Angular projects.

This Schematic will:

🏗️ Install Nightwatch, and it's dependencies
⚙️ Add NPM scripts for running Nightwatch tests
📦 Scaffold base Nightwatch config and test files
❓ Prompt for removal of Protractor files and configuration

Angular

✨ Demo

Nightwatch Schematics Demo

🚀 Usage

Run as one command in an Angular CLI app directory. Note this will add the schematic as a dependency to your project.

ng add @nightwatch/schematics

One can provide following options: | Option | Description | |-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | noBuilder | This will skip the builder addition, leaving the angular.json file unmodified and requiring you to run Nightwatch from the command line or through your IDE. Include --noBuilder in your ng add command. |

With the custom builder installed, you can run Nightwatch with the following commands:

ng e2e
ng run {your-project-name}:nightwatch-run

These two commands do the same thing. They will run nightwatch e2e tests.

Once Nightwatch is added to your project, all Nightwatch CLI options will be available when triggering e2e tests. E.g.: --verbose, --retries etc.

✨ Demo

Nightwatch Schematics Demo

🚀 Usage

Install Schematics CLI globally

npm install -g @angular-devkit/schematics-cli

Install Nightwatch-schematics in your project

npm install @nightwatch/schematics

Run following command to install Nightwatch in your project:

schematics @nightwatch/schematics:ng-add

Once Nightwatch is added to your project, all Nightwatch CLI options will be available when triggering e2e tests. E.g.: --verbose, --retries etc. One can update e2e:test to include cli options.

🐛 Issues

Issues with this schematic can filed here

If you want to contribute (or have contributed in the past), feel free to add yourself to the list of contributors in the package.json before you open a PR!

FAQ

How do I update @nightwatch/schematics package?

This command will update nightwatch schematic package

npm update @nightwatch/schematics

Where can I ask for help and report bugs?

The best way to ask for help and to report bugs is to open an issue.

Gitter is another option.

I created new angular project, how do I remove Protractor and install Nightwatch?

It's very simple, you just have to run ng add @nightwatch/schematics command, and it will prompt you to remove Protractor from angular project.

How do I run on another browser that was initially selected in angular app?

All you have to do is install the relevant drivers, and replace env value (Check the column names in the table below) env-name in angular.json. The config in angular.json will look like this.

  "nightwatch-run": {
    "builder": "@nightwatch/schematics:nightwatch",
    "options": {
      "devServerTarget": "angularapp:serve",
      "tsConfig": "../nightwatch/tsconfig.e2e.json",
      "config": "./nightwatch.conf.js",
      "env": "<env-name>"
    },
    "configurations": {
      "production": {
        "devServerTarget": "angularapp:serve:production"
      }
    }
  },
  "e2e": {
    "builder": "@nightwatch/schematics:nightwatch",
    "options": {
      "devServerTarget": "angularapp:serve",
      "tsConfig": "../nightwatch/tsconfig.e2e.json",
      "config": "./nightwatch.conf.js",
      "env": "<env-name>"
    },
    "configurations": {
      "production": {
        "devServerTarget": "angularapp:serve:production"
      }
    }
  }

How to run e2e tests using npm?

| Projects | command | | ------------------ | ---------------- | | Angular App | npm run e2e | | Typescript Project | npm run e2e:test |

Drivers

Drivers available to install

| Name | driver | command | | --------------- | --------------- | ---------------------------------------- | | chrome | chromedriver | npm install chromedriver --save-dev | | firefox | geckodriver | npm install geckodriver --save-dev | | selenium-server | selenium-server | npm install selenium-server --save-dev |

👩🏽‍💻 Development

Getting Started

🛠️ Node.js and npm are required for the scripts. Make sure it's installed on your machine.

⬇️ Install the dependencies for the schematic and the sandbox application

npm i && cd sandbox && npm i && cd ..

🖇 Link the schematic in the sandbox to run locally

npm run link:sandbox

🏃 Run the schematic

npm run build:clean:launch

🧪 E2E Testing

Execute the schematic against the sandbox. It will add Nightwatch config, tests, and custom builder, then run e2e tests in the sandbox.

npm run test

🧪 Unit Testing

Run the unit tests using Jasmine as a runner and test framework

npm run build:test
npm run test:unit

♻️ Reset the Sandbox

Running the schematic locally performs file system changes. The sandbox is version-controlled so that viewing a diff of the changes is trivial. After the schematic has run locally, reset the sandbox with the following.

npm run clean

These projects: @briebug/cypress-schematic, schuchard/prettier-schematic helped us in development of this project. Thank you!