Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(android): use isRegExp for a more robust check in different execution contexts (#11359)
William Bergeron-Drouina70f4e641069
diff --git a/packages/playwright-core/src/client/android.ts b/packages/playwright-core/src/client/android.tsindex 8dae7ccb82..4928cf5bfe 100644--- a/packages/playwright-core/src/client/android.ts+++ b/packages/playwright-core/src/client/android.ts@@ -15,7 +15,7 @@*/import fs from 'fs';-import { isString } from '../utils/utils';+import { isString, isRegExp } from '../utils/utils';import * as channels from '../protocol/channels';import { Events } from './events';import { BrowserContext, prepareBrowserContextParams } from './browserContext';@@ -289,7 +289,7 @@ function toSelectorChannel(selector: api.AndroidSelector): channels.AndroidSelecconst toRegex = (value: RegExp | string | undefined): string | undefined => {if (value === undefined)return undefined;- if (value instanceof RegExp)+ if (isRegExp(value))return value.source;return '^' + value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d') + '$';};