You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@web/test-runner-commands

Package Overview
Dependencies
Maintainers
7
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@web/test-runner-commands

Web test runner commands

0.9.0
latest
Source
npmnpm
Version published
Weekly downloads
150K
-13.36%
Maintainers
7
Weekly downloads
 
Created

What is @web/test-runner-commands?

@web/test-runner-commands is a package that provides a set of commands to facilitate testing in web environments. It allows you to execute commands in the browser context, making it easier to interact with the page and perform various testing tasks.

What are @web/test-runner-commands's main functionalities?

Execute Commands in Browser Context

This feature allows you to execute custom commands in the browser context. The code sample demonstrates how to use the `executeCommand` function to run a command named 'myCommand' with some data, and then log the result.

import { executeCommand } from '@web/test-runner-commands';

(async () => {
  const result = await executeCommand('myCommand', { someData: 123 });
  console.log(result);
})();

Screenshot Testing

This feature enables you to take screenshots of the current page state during tests. The code sample shows how to use the `takeScreenshot` function to capture a screenshot and log the result.

import { takeScreenshot } from '@web/test-runner-commands';

(async () => {
  const screenshot = await takeScreenshot();
  console.log('Screenshot taken:', screenshot);
})();

Evaluate Expressions

This feature allows you to evaluate JavaScript expressions in the browser context. The code sample demonstrates using the `evaluate` function to get the page title and log it.

import { evaluate } from '@web/test-runner-commands';

(async () => {
  const result = await evaluate(() => document.title);
  console.log('Page title:', result);
})();

Other packages similar to @web/test-runner-commands

Keywords

web

FAQs

Package last updated on 01 Nov 2023

Did you know?

Socket

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.

Install

Related posts