Skip to content

Commit

Permalink
platform detection: updated userAgent platform with node.js os
Browse files Browse the repository at this point in the history
updated Playwright platform with node.js os since Playwright browser userAgent string always points to Windows
  • Loading branch information
Feuerstarter committed Jul 5, 2024
1 parent c64dd35 commit fe0433f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zebrunner/javascript-agent-playwright",
"version": "1.0.1",
"version": "1.0.2",
"main": "build/javascript-agent-playwright/index.js",
"license": "Apache-2.0",
"description": "Zebrunner Agent for Playwright",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import UAParser from 'ua-parser-js';
import * as os from 'os';

export const parseBrowserCapabilities = (launchInfo) => {
const parser = new UAParser();
parser.setUA(launchInfo.use.userAgent);

return parser.getResult();
const browserCapabilities = parser.getResult();
// rewrite platform from pw userAgent string with node.js os since pw userAgent string always points to Windows
browserCapabilities.os.name = os.platform();

return browserCapabilities;
};

0 comments on commit fe0433f

Please sign in to comment.