fix(registry): Fix support for generic-linux (#13129)

Fixes https://github.com/microsoft/playwright/issues/13128
This commit is contained in:
Philip Sanetra 2022-03-28 23:50:56 +02:00 committed by GitHub
parent 9420a53939
commit be41c4a35d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -263,7 +263,7 @@ export class Registry {
const descriptors = readDescriptors(browsersJSON); const descriptors = readDescriptors(browsersJSON);
const findExecutablePath = (dir: string, name: keyof typeof EXECUTABLE_PATHS) => { const findExecutablePath = (dir: string, name: keyof typeof EXECUTABLE_PATHS) => {
let tokens = undefined; let tokens = undefined;
if (hostPlatform.startsWith('ubuntu')) if (hostPlatform.startsWith('ubuntu') || hostPlatform.startsWith('generic-linux'))
tokens = EXECUTABLE_PATHS[name]['linux']; tokens = EXECUTABLE_PATHS[name]['linux'];
else if (hostPlatform.startsWith('mac')) else if (hostPlatform.startsWith('mac'))
tokens = EXECUTABLE_PATHS[name]['mac']; tokens = EXECUTABLE_PATHS[name]['mac'];

View file

@ -192,7 +192,9 @@ it('should set playwright as user-agent', async ({ playwright, server, isWindows
if (isWindows) if (isWindows)
expect(userAgentMasked).toBe('Playwright/X.X.X (<ARCH>; windows X.X) node/X.X'); expect(userAgentMasked).toBe('Playwright/X.X.X (<ARCH>; windows X.X) node/X.X');
else if (isLinux) else if (isLinux)
expect(userAgentMasked).toBe('Playwright/X.X.X (<ARCH>; ubuntu X.X) node/X.X'); // on ubuntu: distro is 'ubuntu' and version is 'X.X'
// on manjaro: distro is 'Manjaro' and version is 'unknown'
expect(userAgentMasked.replace(/<ARCH>; \w+ [^)]+/, '<ARCH>; distro version')).toBe('Playwright/X.X.X (<ARCH>; distro version) node/X.X');
else if (isMac) else if (isMac)
expect(userAgentMasked).toBe('Playwright/X.X.X (<ARCH>; macOS X.X) node/X.X'); expect(userAgentMasked).toBe('Playwright/X.X.X (<ARCH>; macOS X.X) node/X.X');
}); });