New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@currents/playwright

Package Overview
Dependencies
Maintainers
2
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@currents/playwright

Run Playwright tests and get the results reported to the [Currents dashboard](https://currents.dev/)

  • 0.3.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
108K
decreased by-2.9%
Maintainers
2
Weekly downloads
 
Created
Source

@currents/playwright

Run Playwright tests and get the results reported to the Currents dashboard


Install

Make sure you already have Playwright installed, then run:

npm install @currents/playwright

We need to pass three things to run pwc:

  • our record key
  • the project ID, which is created when you create a project in the Current dashboard
  • the CI build ID

The command passes down all the other CLI flags to the Playwright test runner as-is. We can pass these as command line arguments, as environment variables, or a mixture of both.

Command line arguments

pwc --project-id PROJECT_ID --key RECORD_KEY --ci-build-id hello-currents

Environment variables

CURRENTS_RECORD_KEY=RECORD_KEY CURRENTS_PROJECT_ID=PROJECT_ID CURRENTS_CI_BUILD_ID=hello-currents pwc

Reporter Usage

Alternatively, @currents/playwright can be run as a Playwright reporter. In your Playwright config file playwright.config.ts add:

import type { PlaywrightTestConfig } from "@playwright/test";

const config: PlaywrightTestConfig = {
  reporter: "@currents/playwright",
};
export default config;

Then, you can run your tests as usual, just remember to set the three environment variables:

CURRENTS_RECORD_KEY=RECORD_KEY CURRENTS_PROJECT_ID=PROJECT_ID CURRENTS_CI_BUILD_ID=hello-currents npx playwright test

Screenshots

By default Playwright only captures screenshots at the end of a test, according to the provided screenshot option. Manually created screenshots are hidden by default and not attached to any test.

To send additional screenshots to Currents, they have to be attached to the test. For example, you can attach a screenshot to a test like this

const { test, expect } = require("@playwright/test");

test("basic test", async ({ page }, testInfo) => {
  await page.goto("https://playwright.dev");
  const screenshot = await page.screenshot();
  await testInfo.attach("screenshot", {
    body: screenshot,
    contentType: "image/png",
  });
});

For more information see the Playwright test info attachment documentation.

Keywords

FAQs

Package last updated on 10 Apr 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc