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

playwright-trx-reporter

v1.0.10

Published

TRX reporter for playwright

Downloads

11,402

Readme

playwright-trx-reporter

How to use

  1. set your config
const config: PlaywrightTestConfig = {
  ...
  reporter: [
    ['playwright-trx-reporter', { 
      outputFile: "./reporter/output.trx",
      }]
  ],
  ...
}
  1. create a helper could make things easy and get type check
    // create a helper to make it easy
    import { test } from '@playwright/test';
    class TrxHelper{
      static pushAnnotation(type:string,value:string){
        test.info().annotations.push({
          type:type,
          description:value,
        });
      }

      static owner(owner:string){
        this.pushAnnotation('owner', owner);
      }

      static priority(priority:number){
        this.pushAnnotation('priority', priority.toString());
      }
    }

    test('one', async ({}, testInfo) => {
        TrxHelper.owner('Someone');
    });
  1. create a auto fixture so that you do not need to set owner for each case.
    // A auto fixtures:
    const { test as base } = trxReporter;

    const test = base.extend<{ someoneOwner:void }>({
      someoneOwner:[async ()=>{
        TrxHelper.owner('Someone');
      }
      , { auto:true }],
    });

    test('one', async ({}, testInfo) => {
        // Not need to do anything
        // If you want to change the owner, just 
        // trx.owner('someone else')
    });

Single TRX VS Multi TRX

Azure test supports "Rerun failed tests" and "Data driven tests". Reference: https://learn.microsoft.com/en-us/azure/devops/pipelines/test/review-continuous-test-results-after-build?view=azure-devops#view-summarized-test-results

"Data driven tests" is common and powerful, but it's kind of different when it comes to JS. JS is highly dynamic, which allows you to create test cases dynamically. In comparation, C# and Java need you give a centain test name(the method name with specific attribute/annotation). So this feature is encouraged to skip.

"Rerun failed tests" is Charming. However, it's not trivial. To get this feature, we need to generate multi trx file and publish them together. And the test model might not be matched pretty well.

TRX

A list of many test data format: https://help.testspace.com/reference/data-formats/

A detailed description of differnt test file format(however, no trx): https://docs.getxray.app/display/XRAYCLOUD/Integrating+with+Testing+Frameworks

Playwright report docs: https://playwright.dev/docs/test-reporters

Playwright report impls: https://github.com/microsoft/playwright/blob/main/packages/playwright-test/src/reporters/base.ts

Many trx file example: https://github.com/picklesdoc/pickles/

XSD

W3Schools reference: https://www.w3schools.com/xml/schema_elements_ref.asp

The spec is hard to read, you would better to take a look at "W3Schools reference" firstly

Tools

Tools to convert xsd to ts

https://github.com/pocketbitcoin/xsd-tools

https://github.com/charto/cxsd

https://github.com/spreeuwers/xsd2ts

Limitation

Seems like forever

  1. TRX is pretty complex. The xsd file has 2000+ lines, in comparsion, the xsd file of JUnit only has 200 lines including many comments. And there is almost no comments in the xsd file. So it's kind of hard to know the intension clearly for some situations.

  2. Also, there is no open spec for it, this "vstst.xsd" is from VS2022, it might change in the future.

For now

  1. Some property is not filled by default, like platform, and could not be set by now. If you think they are useful, please let me know!

  2. repeat tests. For now each run of test(including retry) will be added as one test individually.

  3. Azure DevOps supports to add Attachment, but we have 9 different ways to do that! I have no idea what the difference really is for some of them. And even they are same, I might only use some of them to simplify. For now, I only attach file that exist.