Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@creately/pluto
Advanced tools
"Don't forget your e2e tests"
Pluto is an e2e testing framework that uses Selenium to execute test cases. It includes interfaces for tests that can be written for specific cases, a set of asserts, and types that define specs and tests.
-g
)$ npm install -g @creately/pluto
Note: When installing the package globally, your $NODE_PATH environment variable should be set to the global package directory.
Linux / Mac
If it isn't set already, add the following to .bashrc
or .zshrc
:
$ export NODE_PATH=$(npm root --quiet -g)
Windows
Add an environment variable named NODE_PATH
and set it to %USERPROFILE%\Application Data\npm\node_modules
(Windows XP) or %AppData%\npm\node_modules
(Windows 7/8/10), or whichever path NPM uses to install modules in your environment.
See Loading from the global folders for more configuration information.
Webdrivers should be downloaded and installed for the browser versions available in the environment. Webdrivers and installation instructions can be found on the Official Selenium Docs.
An action will be a class with a single method named execute
which performs one specific action. The framework executes the action instance's execute
method when the action is run.
A Selenium WebDriver instance will be loaded into the context
object which is passed as the second argument to the execute
method, having been initialised with the arguments provided to Pluto (if any) when running the package.
See the Action Interface for more information.
Using Selenium in actions
You may install TypeScript definitions for Selenium Webdriver in your project to write actions using Selenium.
$ npm install @types/selenium-webdriver
Example Action
// go-to.action.ts
import { By, until, WebDriver } from 'selenium-webdriver';
/**
* Navigates to the specified URL.
*/
export default class GoTo {
async execute(args: string[], context: any): Promise<string[]> {
// Get the WebDriver instance
const driver: WebDriver = context.driver;
// Get the first arg, which is the URL in this case
const url = args[0];
// Navigate the page to the given URL
await driver.get(url);
// Return an empty string array as this action has no result
return [''];
}
}
Tests can be written in JavaScript or TypeScript (which will be compiled by Pluto at runtime), and have the extension *.test.js
or *.test.ts
respectively. They should contain a series of specs for that particular test.
A single spec is defined by a title, an action
or assert
to be run, and an array of args
and/or outs
. Any output expected from an action should be assigned to meaningful keys in the outs
array, so that that they may be used in future actions or asserts. This way, specs can be chained to form a test, as they will be run sequentially.
See the Spec Type for more information.
Example Test
// simple.test.ts
const pluto = require('@creately/pluto');
import GoTo from '../go-to.action';
import GetUrl from '../get-url.action';
pluto.registerActions(GoTo);
pluto.addTest('simple test', [
{
title: 'goes to creately demo start page',
action: GoTo,
args: ['https://creately.com/demo-start']
},
{
title: 'gets the current URL',
action: GetUrl,
outs: ['$url']
},
{
title: 'checks URL has changed',
assert: pluto.Equals,
args: ['$url', 'https://app.creately.com/diagram/create']
},
]);
Run pluto
in the directory containing test files or pass the relative or absolute path to the directory or file with the --path
argument. Below is a list of other arguments that can be passed. By default, tests run on Chrome in headless mode using the Chromium webdriver, with the default window size set by Selenium.
Argument | Description |
---|---|
--path=\Users\... | The path to look for test files in |
--help, -h | Show help |
--show, -s | Show browser instead of running in headless mode |
--keep-open, -o | Keep browser open after tests are complete |
--devtools, -d | Show devtools on open |
--firefox, -f | Use Firefox instead of Chrome |
--maximise, -m | Maximise browser window on open |
FAQs
An end-to-end testing framework.
The npm package @creately/pluto receives a total of 1 weekly downloads. As such, @creately/pluto popularity was classified as not popular.
We found that @creately/pluto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.