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

@delta-reporter/delta-playwright-plugin

v1.0.6

Published

Plugin to integrate Playwright with Delta Reporter.

Downloads

10

Readme

Delta Reporter Playwright Service

A Playwright reporter plugin to create Delta reports

Screenshot of Delta reporter

Installation

The easiest way is to keep @delta-reporter/delta-playwright-plugin as a devDependency in your package.json.

{
  "devDependencies": {
    "@delta-reporter/delta-playwright-plugin": "^1.0.0",
  }
}

You can simple do it by:

npm i @delta-reporter/delta-playwright-plugin

Configuration

The use of this plugin is as simple as defining the required config and then setting the reported as this plugin.

const DeltaConfig = {
  'host': 'delta_host',
  'project': 'Project Name',
  'testType': 'Test Type',
  'enabled': true
};

const config: PlaywrightTestConfig = {
  // ...
  reporter: process.env.CI ? [['@delta-reporter/delta-playwright-plugin', DeltaConfig]] : "list",
  // ...
}

Please notice that the example above would use this reporter just on CI mode, and use list reporter when running locally

Usage

For each test run, the plugin is listening for a DELTA_LAUNCH_ID. There are two main cases:

  • Local run: You can just run your tests as usual and DELTA_LAUNCH_ID will be generated automatically for you, so your test results appear in Delta Reporter in real time.

  • CI run: You will have to define DELTA_LAUNCH_ID as a environment variable. You can get it by calling the /api/v1/launch endpoint, then running your tests with DELTA_LAUNCH_ID=${DELTA_LAUNCH_ID} pre-pending. The initialization is done once, so when you are running multiple test types in the same build (say, UI tests, API tests, Unit tests), those tests are gathered under one "Launch" on Delta Reporter.

Below is an example for a Jenkins job:

// ...
  parameters {
      string defaultValue: '', description: 'Launch ID sent by a pipeline, leave it blank', name: 'DELTA_LAUNCH_ID', trim: false
  }

// ...

  stage('Run Playwright tests') {
    environment {
      DELTA_LAUNCH_ID = ""
    }
    steps {
      container('jenkins-node-worker') {
        script {
          try {
            DELTA_LAUNCH_ID=sh(script: "curl -s --header \"Content-Type: application/json\" --request POST --data '{\"name\": \"${JOB_NAME} | ${BUILD_NUMBER} | Wdio Tests\", \"project\": \"Your project\"}' https://delta-core-url/api/v1/launch | python -c 'import sys, json; print(json.load(sys.stdin)[\"id\"])';", returnStdout: true)
          } catch (Exception e) {
              echo 'Couldn\'t start launch on Delta Reporter: ' + e
          }

          sh "DELTA_LAUNCH_ID=${DELTA_LAUNCH_ID} npx playwright test"
        }
      }
    }
  }

Below is an example of code for a Github Action:

// ...
      - name: Create Delta Launch
        id: delta_launch_creation
        env:
          PR_ID: ${{ github.event.pull_request.number }}
        run: |
          CURRENT_TIMESTAMP=$(date -R)
          DELTA_LAUNCH_ID=$(curl -s --header "Content-Type: application/json" --request POST --data '{"name": "PR: '"${PR_ID}"' '"${CURRENT_TIMESTAMP}"'", "project": "<project>" }' <delta_url>/api/v1/launch | jq '.id';)
          echo "DELTA_LAUNCH_ID: $DELTA_LAUNCH_ID"
          echo ::set-output name=delta_launch_id::${DELTA_LAUNCH_ID}
      - name: Notify test results
        uses: actions/github-script@v4
        env:
          DELTA_LAUNCH_ID: ${{ steps.delta_launch_creation.outputs.delta_launch_id }}
        with:
          script: |
            github.issues.createComment({
                  issue_number: context.issue.number,
                  owner: context.repo.owner,
                  repo: context.repo.repo,
                  body: `Regression Tests Launch ${process.env.DELTA_LAUNCH_ID} has started, check tests results in real time [here](<delta_url>/testruns/${process.env.DELTA_LAUNCH_ID})`
                })
      - name: Run Unit Tests
        env:
          DELTA_LAUNCH_ID: ${{ steps.delta_launch_creation.outputs.delta_launch_id }}
        run: |
          npx playwright test -c unit_tests
      - name: Run End to End Tests
        env:
          DELTA_LAUNCH_ID: ${{ steps.delta_launch_creation.outputs.delta_launch_id }}
        run: |
          npx playwright test -c end_to_end