cenfun / monocart-reporter

A playwright test reporter (Node.js)
https://cenfun.github.io/monocart-reporter/
MIT License
200 stars 12 forks source link

[BUG] Incorrect OS when running the Playwright tests in a docker container #83

Closed edumserrano closed 9 months ago

edumserrano commented 10 months ago

Hi @cenfun,

Bug

When you run the Playwright tests in a docker container, the OS displayed in the monocart-reporter html report is weird. For instance, when running on the mcr.microsoft.com/playwright:v1.40.1-jammy I get this:

image

Note that the OS is set to #1 SMP PREEMPT_DYNAMIC Thu Nov 16 10:55:59 UTC 2023 (x64).

How to reproduce

You can use the docker demo in the edumserrano/playwright-adventures repo to replicate the bug.

1) Clone the edumserrano/playwright-adventures repo. 2) Using your favorite shell go to /demos/docker. 3) Install the required npm packages with:

    npm install

4) Install the playwright browsers with:

    npx playwright install

5) Run the tests with:

    npm test
This will start a docker container which will run the app and then run the [playwright tests](/demos/docker/tests/example.spec.ts) against it.

6) After running the tests with npm test you can view test results with:

    npm run test:show-report

Other notes

This is a very minor bug of course but perhaps it's also easy to fix. I believe the OS should display the fact that it ran in an Ubuntu Linux OS. For example:

cenfun commented 10 months ago

It can be reproduced to Github Actions, see report here

How does the current OS work: 1, OS = ${system.version} (${system.arch}) 2, system.version = os.version() and system.arch = os.arch() see Node.js os API os.version() and os.arch(), both are native Node.js API that fast, compatible and no need to load dependencies. I found that there is a lib systeminformation very popular, seems that its osInfo.distro is what we want, but it should be slow, see implementation:

A stackoverflow quesion

any better idea?

edumserrano commented 10 months ago

Unfortunately I can't help you much here. My expertise is not on Node.js. What I can say is that I don't think this is a big issue. If you feel that you haven't found a good solution yet then you can leave the OS as is and close this issue until you find a good solution. I reported it because I thought at least it should be on your radar.

You mentioned that systeminformation library but you seem to be afraid that it's going to slow down the report. Have you tested it somehow?

cenfun commented 10 months ago

yes, I previously used systeminformation in another Node.js project, it is slow and large even slow down the main process.