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

xray-pw-reporter

v0.3.3

Published

A module to integrate Playwright test execution result with Xray

Downloads

45

Readme

Usage/Examples

reporter: [
    ["xray-pw-reporter", {

      // Setting output dir for json file. Default: "/xray-pw-reporter"
      // reportOutDir: "<path here>",

      // Importing type (Mandatory)
      importType: "REST" | "MANUAL",

      // Jira Project ID (Mandatory)
      project: "<PROJECT ID>",

      // Override test details on Jira
      overrideTestDetail: false,

      // Saving video evidence on jira
      saveVideoEvidence: false,

      // Saving trace evidence on jira
      saveTraceEvidence: false,

      // The jira issue execution where to import the results (if jira issue does not exist, a new execution will be created)
      // (used only for "REST" Import)
      // this field takes precedence over testPlanKey. This means that even if the testPlanKey field is defined,
      // the reporter will try to import the execution under the key defined here
      testExecutionKey: "JKEY-100",

      // The test plan where the new jira issue execution will be created 
      // (used only for "REST" Import)
      // The testExecutionKey has pirority over this field. This means that even if this field is defined, 
      // the reporter will try to import the execution into the key defined on testExecutionKey
      testPlanKey: "JKEY-100",

      // This object describes how the new Execution Issue will be created (unlike testExecutionKey, this field allows you to describe all the fields of the new execution)
      // The new execution will be imported and linked to the plan defined in testPlanKey, 
      // if testPlanKey is not defined, it will only be imported as a new execution and will not be linked
      newExecution: {
        "assignee": {
          "id": "712040:aa4a7b1c-ce1b-4114-a079-e7e2bf90afec"
        },
        "issuetype": {
          "name": "Test Execution"
        },
        "summary": `Brand new Execution`,
        "requiredFields": [
          {
            "components": [
              {
                "name": "COMPONENT1"
              }
            ],
            "description": "this is the execution description"
          }
        ]
      },

      // Xray client_id
      // (Mandatory only for "REST" Import)
      xrayClientID: "<CLIENT_ID HERE>",

      // Xray secret
      // (Mandatory only for "REST" Import)
      xraySecret: "<SECRET HERE>"
    }]
]

If some fields are required, you can add them like:

reporter: [
    ["xray-pw-reporter", {
    
    // ...
    newExecution: {
        "assignee": {
          "id": "712040:aa4a7b1c-ce1b-4114-a079-e7e2bf90afec"
        },
        "issuetype": {
          "name": "Test Execution"
        },
        "summary": `Brand new Execution`,
        // Required Fields
        "requiredFields": [
          {
            "components": [
              {
                "name": "COMPONENT1"
              }
            ],
            "description": "this is the execution description"
          }
        ]
      },
    // ...

    }]
]

Normal Tests

For a normal test, you just have to indicate the JiraIssue as a comment above the test:

/**
 * @JiraIssue JKEY-10
 */
test('Test that passes', async ({ page }) => {
    // Steps here
})

If JiraIssue is not defined, test will be marked as ⚡ Excluded.⚡

if test.step have also been defined, the results of the latter will also be included:

/**
 * @JiraIssue JKEY-10
 */
test('Test that passes', async ({ page }) => {
    await test.step('Step 1', async () => {
        // Implementation of step 1
    })
})

⚠️Only steps wrapped into test.step will be included⚠️

Data driven Tests

For data driven tests (which correspond to tests with xray datasets), the matter is a little more complex:

  • A file name: ".dataset.json" have to be created under /data/datasets/
  • Dataset must follow the syntax below:
{
    "dataset": [
        {
            "parameters": [
                {
                    "name": "username",
                    "value": ""
                },
                {
                    "name": "password",
                    "value": "hello"
                },
                {
                    "name": "error",
                    "value": "enter username"
                }
            ]
        },
        {
            "parameters": [
                {
                    "name": "username",
                    "value": "[email protected]"
                },
                {
                    "name": "password",
                    "value": ""
                },
                {
                    "name": "error",
                    "value": "enter password"
                }
            ]
        }
    ]
}
  • @DDTannotation must be specified above the test:
  • ⚠️Test title must follow the syntax: TEST_NAME -> Iteration X⚠️
  • ⚠️the dataset file name must be the same as the @DDT tag⚠️
import { test, expect } from '@playwright/test';
import { dataset as ds110 } from "../data/datasets/jkey-110.dataset.json"

ds110.forEach((item, index) => {
    /**
     * @DDT JKEY-110
     */
    test(`Data-driven test with one step -> Iteration ${index + 1}`, async ({ page }) => {
        await test.step('Step1', async () => {
        })
    })
})

Override Test Details

With option overrideTestDetail set to true, title and steps defined on PW test, will replace title and steps on Xray Issue. So, be carefull on using it :)