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

@lullabot/nightwatch-drupal-commands

v1.0.1

Published

Provides Nightwatch commands and page objects for use with Drupal.

Downloads

1,976

Readme

nightwatch-drupal-commands

Provides Nightwatch commands and page objects for use with Drupal.

Setup

Include the commands and page objects in your nightwatch.conf.js file:

let drupalCommandsPath;
let yarn2 = false;
try {
  const { resolveToUnqualified } = require('pnpapi');
  drupalCommandsPath = resolveToUnqualified('@lullabot/nightwatch-drupal-commands', __filename).replace(/\/$/, '');
  yarn2 = true;
} catch(e) {
  drupalCommandsPath = './node_modules/@lullabot/nightwatch-drupal-commands';
}

module.exports = {
  // See https://nightwatchjs.org/guide/working-with-page-objects/
  page_objects_path: [`${drupalCommandsPath}/page_objects`],

  // See https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands
  custom_commands_path:  [`${drupalCommandsPath}/commands`],
.
.
.

Globals

Globals are set within your Nightwatch configuration.

drupalUrl (required)

The base URL of your Drupal installation. If you're running tests inside a container then it may be e.g. http://web. This should not have a trailing slash.

drushCommand (optional)

The command used to run drush e.g. ./vendor/bin/drush or ddev drush. Defaults to ./vendor/bin/drush.

Commands

.drupalUrl(url) Goes to a URL in your Drupal install e.g. .drupalUrl('/user/login)`

drush(command) Runs a drush command and provides the response in a callback. This is very useful for logging in:

.drush('user:login', (url) => {
  browser
    .url(url)
    .assert.titleContains('admin');
});

Page Objects

NodeForm

'Demo test' : function(browser) {
  const nodeForm = browser.page.NodeForm();
  nodeForm
    .add('page')
    .setTitle('Hello, world!')
    .setPublishedStatus(true)
    .save();
}

add(string contentType)

Navigates to the node/add page for a specific content type.

setTitle(string value)

Clears the existing value of the title property and sets it to value

save()

Saves the node, verifies that a system message is shown, and the browser is no longer on an admin page.

setPublishedStatus(bool status)

Sets the node to either published or unpublished (when not using the Workflow module).

setWorkflowStatus(sting status)

If Workflow is enabled, set the status to the provided value.

setAutocomplete(string element, string searchText, int autocompleteId = 1)

Given an element path to locate, or a page object element, this will set the value to the first item retrieved by the search text.

The autocomplete ID can optionally be provided to distinguish which element to target if multiple autocompletes are on the same page. To find this you will need to check the source HTML of the page to determine which autocomplete widget corresponds to which field. It can be found near the bottom and looks like this:

<ul id="ui-id-1" tabindex="0" class="ui-menu ui-widget ui-widget-content ui-autocomplete ui-front" style="display: none;"></ul>