chore: move sever/isomorphic to utils/ to use it in client (#21445)
This commit is contained in:
Родитель
bdefaa9f9e
Коммит
cffb6ac269
|
@ -20,11 +20,12 @@ import { maybeFindValidator, ValidationError, type ValidatorContext } from '../p
|
|||
import { debugLogger } from '../common/debugLogger';
|
||||
import type { ExpectZone, ParsedStackTrace } from '../utils/stackTrace';
|
||||
import { captureRawStack, captureLibraryStackTrace } from '../utils/stackTrace';
|
||||
import { isUnderTest } from '../utils';
|
||||
import { isString, isUnderTest } from '../utils';
|
||||
import { zones } from '../utils/zones';
|
||||
import type { ClientInstrumentation } from './clientInstrumentation';
|
||||
import type { Connection } from './connection';
|
||||
import type { Logger } from './types';
|
||||
import { asLocator } from '../utils/isomorphic/locatorGenerators';
|
||||
|
||||
type Listener = (...args: any[]) => void;
|
||||
|
||||
|
@ -228,8 +229,18 @@ function renderCallWithParams(apiName: string, params: any) {
|
|||
const paramsArray = [];
|
||||
if (params) {
|
||||
for (const name of paramsToRender) {
|
||||
if (params[name])
|
||||
paramsArray.push(params[name]);
|
||||
if (!(name in params))
|
||||
continue;
|
||||
let value;
|
||||
if (name === 'selector' && isString(params[name]) && params[name].startsWith('internal:')) {
|
||||
const getter = asLocator('javascript', params[name], false, true);
|
||||
apiName = apiName.replace(/^locator\./, 'locator.' + getter + '.');
|
||||
apiName = apiName.replace(/^page\./, 'page.' + getter + '.');
|
||||
apiName = apiName.replace(/^frame\./, 'frame.' + getter + '.');
|
||||
} else {
|
||||
value = params[name];
|
||||
paramsArray.push(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
const paramsText = paramsArray.length ? '(' + paramsArray.join(', ') + ')' : '';
|
||||
|
|
|
@ -19,7 +19,7 @@ import { createPlaywright, DispatcherConnection, RootDispatcher, PlaywrightDispa
|
|||
import { Connection } from './client/connection';
|
||||
import { BrowserServerLauncherImpl } from './browserServerImpl';
|
||||
import { AndroidServerLauncherImpl } from './androidServerImpl';
|
||||
import type { Language } from './server/isomorphic/locatorGenerators';
|
||||
import type { Language } from './utils/isomorphic/locatorGenerators';
|
||||
|
||||
export function createInProcessPlaywright(): PlaywrightAPI {
|
||||
const playwright = createPlaywright((process.env.PW_LANG_NAME as Language | undefined) || 'javascript');
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
../generated/
|
||||
../protocol/
|
||||
../utils/
|
||||
../utils/isomorphic/
|
||||
../utilsBundle.ts
|
||||
../zipBundle.ts
|
||||
./
|
||||
|
|
|
@ -26,7 +26,7 @@ import type { CallMetadata } from './instrumentation';
|
|||
import { SdkObject } from './instrumentation';
|
||||
import { Artifact } from './artifact';
|
||||
import type { Selectors } from './selectors';
|
||||
import type { Language } from './isomorphic/locatorGenerators';
|
||||
import type { Language } from '../utils/isomorphic/locatorGenerators';
|
||||
|
||||
export interface BrowserProcess {
|
||||
onclose?: ((exitCode: number | null, signal: string | null) => void);
|
||||
|
|
|
@ -23,8 +23,8 @@ import type { InstrumentationListener } from './instrumentation';
|
|||
import type { Playwright } from './playwright';
|
||||
import { Recorder } from './recorder';
|
||||
import { EmptyRecorderApp } from './recorder/recorderApp';
|
||||
import { asLocator } from './isomorphic/locatorGenerators';
|
||||
import type { Language } from './isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../utils/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../utils/isomorphic/locatorGenerators';
|
||||
|
||||
const internalMetadata = serverSideCallMetadata();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
import { type Frame } from './frames';
|
||||
import type * as types from './types';
|
||||
import { stringifySelector, type ParsedSelector, splitSelectorByFrame } from './isomorphic/selectorParser';
|
||||
import { stringifySelector, type ParsedSelector, splitSelectorByFrame } from '../utils/isomorphic/selectorParser';
|
||||
import { type FrameExecutionContext, type ElementHandle } from './dom';
|
||||
import { type JSHandle } from './javascript';
|
||||
import { type InjectedScript } from './injected/injectedScript';
|
||||
|
|
|
@ -36,10 +36,10 @@ import type { CallMetadata } from './instrumentation';
|
|||
import { serverSideCallMetadata, SdkObject } from './instrumentation';
|
||||
import type { InjectedScript, ElementStateWithoutStable, FrameExpectParams, InjectedScriptPoll, InjectedScriptProgress } from './injected/injectedScript';
|
||||
import { isSessionClosedError } from './protocolError';
|
||||
import { type ParsedSelector, isInvalidSelectorError } from './isomorphic/selectorParser';
|
||||
import { type ParsedSelector, isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
|
||||
import type { ScreenshotOptions } from './screenshotter';
|
||||
import type { InputFilesItems } from './dom';
|
||||
import { asLocator } from './isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../utils/isomorphic/locatorGenerators';
|
||||
import { FrameSelectors } from './frameSelectors';
|
||||
|
||||
type ContextData = {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
import type { ByRoleOptions } from '../../utils/isomorphic/locatorUtils';
|
||||
import { getByAltTextSelector, getByLabelSelector, getByPlaceholderSelector, getByRoleSelector, getByTestIdSelector, getByTextSelector, getByTitleSelector } from '../../utils/isomorphic/locatorUtils';
|
||||
import { escapeForTextSelector } from '../../utils/isomorphic/stringUtils';
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import type { Language } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../utils/isomorphic/locatorGenerators';
|
||||
import { type InjectedScript } from './injectedScript';
|
||||
import { generateSelector } from './selectorGenerator';
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { stringifySelector } from '../isomorphic/selectorParser';
|
||||
import type { ParsedSelector } from '../isomorphic/selectorParser';
|
||||
import { stringifySelector } from '../../utils/isomorphic/selectorParser';
|
||||
import type { ParsedSelector } from '../../utils/isomorphic/selectorParser';
|
||||
import type { InjectedScript } from './injectedScript';
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import type { Language } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../utils/isomorphic/locatorGenerators';
|
||||
|
||||
type HighlightEntry = {
|
||||
targetElement: Element,
|
||||
|
|
|
@ -19,20 +19,20 @@ import { XPathEngine } from './xpathSelectorEngine';
|
|||
import { ReactEngine } from './reactSelectorEngine';
|
||||
import { VueEngine } from './vueSelectorEngine';
|
||||
import { createRoleEngine } from './roleSelectorEngine';
|
||||
import { parseAttributeSelector } from '../isomorphic/selectorParser';
|
||||
import type { NestedSelectorBody, ParsedSelector, ParsedSelectorPart } from '../isomorphic/selectorParser';
|
||||
import { allEngineNames, parseSelector, stringifySelector } from '../isomorphic/selectorParser';
|
||||
import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
|
||||
import type { NestedSelectorBody, ParsedSelector, ParsedSelectorPart } from '../../utils/isomorphic/selectorParser';
|
||||
import { allEngineNames, parseSelector, stringifySelector } from '../../utils/isomorphic/selectorParser';
|
||||
import { type TextMatcher, elementMatchesText, elementText, type ElementText } from './selectorUtils';
|
||||
import { SelectorEvaluatorImpl } from './selectorEvaluator';
|
||||
import { enclosingShadowRootOrDocument, isElementVisible, parentElementOrShadowHost } from './domUtils';
|
||||
import type { CSSComplexSelectorList } from '../isomorphic/cssParser';
|
||||
import type { CSSComplexSelectorList } from '../../utils/isomorphic/cssParser';
|
||||
import { generateSelector } from './selectorGenerator';
|
||||
import type * as channels from '@protocol/channels';
|
||||
import { Highlight } from './highlight';
|
||||
import { getChecked, getAriaDisabled, getAriaLabelledByElements, getAriaRole, getElementAccessibleName } from './roleUtils';
|
||||
import { kLayoutSelectorNames, type LayoutSelectorName, layoutSelectorScore } from './layoutSelectorUtils';
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import type { Language } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../utils/isomorphic/locatorGenerators';
|
||||
import { normalizeWhiteSpace } from '../../utils/isomorphic/stringUtils';
|
||||
|
||||
type Predicate<T> = (progress: InjectedScriptProgress) => T | symbol;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import type { SelectorEngine, SelectorRoot } from './selectorEngine';
|
||||
import { isInsideScope } from './domUtils';
|
||||
import { matchesComponentAttribute } from './selectorUtils';
|
||||
import { parseAttributeSelector } from '../isomorphic/selectorParser';
|
||||
import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
|
||||
|
||||
type ComponentNode = {
|
||||
key?: any,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import type { SelectorEngine, SelectorRoot } from './selectorEngine';
|
||||
import { matchesAttributePart } from './selectorUtils';
|
||||
import { getAriaChecked, getAriaDisabled, getAriaExpanded, getAriaLevel, getAriaPressed, getAriaRole, getAriaSelected, getElementAccessibleName, isElementHiddenForAria, kAriaCheckedRoles, kAriaExpandedRoles, kAriaLevelRoles, kAriaPressedRoles, kAriaSelectedRoles } from './roleUtils';
|
||||
import { parseAttributeSelector, type AttributeSelectorPart, type AttributeSelectorOperator } from '../isomorphic/selectorParser';
|
||||
import { parseAttributeSelector, type AttributeSelectorPart, type AttributeSelectorOperator } from '../../utils/isomorphic/selectorParser';
|
||||
import { normalizeWhiteSpace } from '../../utils/isomorphic/stringUtils';
|
||||
|
||||
type RoleEngineOptions = {
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../isomorphic/cssParser';
|
||||
import { customCSSNames } from '../isomorphic/selectorParser';
|
||||
import type { CSSComplexSelector, CSSSimpleSelector, CSSComplexSelectorList, CSSFunctionArgument } from '../../utils/isomorphic/cssParser';
|
||||
import { customCSSNames } from '../../utils/isomorphic/selectorParser';
|
||||
import { isElementVisible, parentElementOrShadowHost } from './domUtils';
|
||||
import { type LayoutSelectorName, layoutSelectorScore } from './layoutSelectorUtils';
|
||||
import { elementMatchesText, elementText, shouldSkipForTextMatching, type ElementText } from './selectorUtils';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { type AttributeSelectorPart } from '../isomorphic/selectorParser';
|
||||
import { type AttributeSelectorPart } from '../../utils/isomorphic/selectorParser';
|
||||
|
||||
export function matchesComponentAttribute(obj: any, attr: AttributeSelectorPart) {
|
||||
for (const token of attr.jsonPath) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import type { SelectorEngine, SelectorRoot } from './selectorEngine';
|
||||
import { isInsideScope } from './domUtils';
|
||||
import { matchesComponentAttribute } from './selectorUtils';
|
||||
import { parseAttributeSelector } from '../isomorphic/selectorParser';
|
||||
import { parseAttributeSelector } from '../../utils/isomorphic/selectorParser';
|
||||
|
||||
type ComponentNode = {
|
||||
name: string,
|
||||
|
|
|
@ -40,7 +40,7 @@ import type { CallMetadata } from './instrumentation';
|
|||
import { SdkObject } from './instrumentation';
|
||||
import type { Artifact } from './artifact';
|
||||
import type { TimeoutOptions } from '../common/types';
|
||||
import { isInvalidSelectorError } from './isomorphic/selectorParser';
|
||||
import { isInvalidSelectorError } from '../utils/isomorphic/selectorParser';
|
||||
import { parseEvaluationResultValue, source } from './isomorphic/utilityScriptSerializers';
|
||||
import type { SerializedValue } from './isomorphic/utilityScriptSerializers';
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import { createInstrumentation, SdkObject } from './instrumentation';
|
|||
import { debugLogger } from '../common/debugLogger';
|
||||
import type { Page } from './page';
|
||||
import { DebugController } from './debugController';
|
||||
import type { Language } from './isomorphic/locatorGenerators';
|
||||
import type { Language } from '../utils/isomorphic/locatorGenerators';
|
||||
|
||||
export class Playwright extends SdkObject {
|
||||
readonly selectors: Selectors;
|
||||
|
|
|
@ -41,7 +41,7 @@ import { Debugger } from './debugger';
|
|||
import { EventEmitter } from 'events';
|
||||
import { raceAgainstTimeout } from '../utils/timeoutRunner';
|
||||
import type { Language, LanguageGenerator } from './recorder/language';
|
||||
import { locatorOrSelectorAsSelector } from './isomorphic/locatorParser';
|
||||
import { locatorOrSelectorAsSelector } from '../utils/isomorphic/locatorParser';
|
||||
|
||||
type BindingSource = { frame: Frame, page: Page };
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import type { MouseClickOptions } from './utils';
|
|||
import { toModifiers } from './utils';
|
||||
import { escapeWithQuotes } from '../../utils/isomorphic/stringUtils';
|
||||
const deviceDescriptors = require('../deviceDescriptorsSource.json');
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
|
||||
type CSharpLanguageMode = 'library' | 'mstest' | 'nunit';
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import { toModifiers } from './utils';
|
|||
const deviceDescriptors = require('../deviceDescriptorsSource.json');
|
||||
import { JavaScriptFormatter } from './javascript';
|
||||
import { escapeWithQuotes } from '../../utils/isomorphic/stringUtils';
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
|
||||
export class JavaLanguageGenerator implements LanguageGenerator {
|
||||
id = 'java';
|
||||
|
|
|
@ -23,7 +23,7 @@ import type { MouseClickOptions } from './utils';
|
|||
import { toModifiers } from './utils';
|
||||
const deviceDescriptors = require('../deviceDescriptorsSource.json');
|
||||
import { escapeWithQuotes } from '../../utils/isomorphic/stringUtils';
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
|
||||
export class JavaScriptLanguageGenerator implements LanguageGenerator {
|
||||
id: string;
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
*/
|
||||
|
||||
import type { BrowserContextOptions, LaunchOptions } from '../../..';
|
||||
import type { Language } from '../isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../utils/isomorphic/locatorGenerators';
|
||||
import type { ActionInContext } from './codeGenerator';
|
||||
import type { Action, DialogSignal, DownloadSignal, PopupSignal } from './recorderActions';
|
||||
export type { Language } from '../isomorphic/locatorGenerators';
|
||||
export type { Language } from '../../utils/isomorphic/locatorGenerators';
|
||||
|
||||
export type LanguageGeneratorOptions = {
|
||||
browserName: string;
|
||||
|
|
|
@ -23,7 +23,7 @@ import type { MouseClickOptions } from './utils';
|
|||
import { toModifiers } from './utils';
|
||||
import { escapeWithQuotes, toSnakeCase } from '../../utils/isomorphic/stringUtils';
|
||||
const deviceDescriptors = require('../deviceDescriptorsSource.json');
|
||||
import { asLocator } from '../isomorphic/locatorGenerators';
|
||||
import { asLocator } from '../../utils/isomorphic/locatorGenerators';
|
||||
|
||||
export class PythonLanguageGenerator implements LanguageGenerator {
|
||||
id: string;
|
||||
|
|
|
@ -20,7 +20,7 @@ import type { Rect } from '../common/types';
|
|||
import { helper } from './helper';
|
||||
import type { Page } from './page';
|
||||
import type { Frame } from './frames';
|
||||
import type { ParsedSelector } from './isomorphic/selectorParser';
|
||||
import type { ParsedSelector } from '../utils/isomorphic/selectorParser';
|
||||
import type * as types from './types';
|
||||
import type { Progress } from './progress';
|
||||
import { assert } from '../utils';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { allEngineNames, InvalidSelectorError, type ParsedSelector, parseSelector, stringifySelector } from './isomorphic/selectorParser';
|
||||
import { allEngineNames, InvalidSelectorError, type ParsedSelector, parseSelector, stringifySelector } from '../utils/isomorphic/selectorParser';
|
||||
import { createGuid } from '../utils';
|
||||
|
||||
export class Selectors {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { escapeWithQuotes, toSnakeCase, toTitleCase } from '../../utils/isomorphic/stringUtils';
|
||||
import { type NestedSelectorBody, parseAttributeSelector, parseSelector, stringifySelector } from '../isomorphic/selectorParser';
|
||||
import type { ParsedSelector } from '../isomorphic/selectorParser';
|
||||
import { escapeWithQuotes, toSnakeCase, toTitleCase } from './stringUtils';
|
||||
import { type NestedSelectorBody, parseAttributeSelector, parseSelector, stringifySelector } from './selectorParser';
|
||||
import type { ParsedSelector } from './selectorParser';
|
||||
|
||||
export type Language = 'javascript' | 'python' | 'java' | 'csharp';
|
||||
export type LocatorType = 'default' | 'role' | 'text' | 'label' | 'placeholder' | 'alt' | 'title' | 'test-id' | 'nth' | 'first' | 'last' | 'has-text' | 'has' | 'frame';
|
||||
|
@ -27,8 +27,17 @@ export interface LocatorFactory {
|
|||
generateLocator(base: LocatorBase, kind: LocatorType, body: string | RegExp, options?: LocatorOptions): string;
|
||||
}
|
||||
|
||||
export function asLocator(lang: Language, selector: string, isFrameLocator: boolean = false): string {
|
||||
return innerAsLocator(generators[lang], parseSelector(selector), isFrameLocator);
|
||||
export function asLocator(lang: Language, selector: string, isFrameLocator: boolean = false, playSafe: boolean = false): string {
|
||||
if (playSafe) {
|
||||
try {
|
||||
return innerAsLocator(generators[lang], parseSelector(selector), isFrameLocator);
|
||||
} catch (e) {
|
||||
// Tolerate invalid input.
|
||||
return selector;
|
||||
}
|
||||
} else {
|
||||
return innerAsLocator(generators[lang], parseSelector(selector), isFrameLocator);
|
||||
}
|
||||
}
|
||||
|
||||
function innerAsLocator(factory: LocatorFactory, parsed: ParsedSelector, isFrameLocator: boolean = false): string {
|
|
@ -14,7 +14,7 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Language } from '../../playwright-core/src/server/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../playwright-core/src/utils/isomorphic/locatorGenerators';
|
||||
|
||||
export type Point = { x: number, y: number };
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"baseUrl": ".",
|
||||
"useUnknownInCatchVariables": false,
|
||||
"paths": {
|
||||
"@isomorphic/*": ["../playwright-core/src/server/isomorphic/*"],
|
||||
"@isomorphic/*": ["../playwright-core/src/utils/isomorphic/*"],
|
||||
"@protocol/*": ["../protocol/src/*"],
|
||||
"@web/*": ["../web/src/*"],
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ export default defineConfig({
|
|||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/server/isomorphic'),
|
||||
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/utils/isomorphic'),
|
||||
'@protocol': path.resolve(__dirname, '../protocol/src'),
|
||||
'@web': path.resolve(__dirname, '../web/src'),
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Language } from '../../playwright-core/src/server/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../playwright-core/src/utils/isomorphic/locatorGenerators';
|
||||
import type { ResourceSnapshot } from '@trace/snapshot';
|
||||
import type * as trace from '@trace/trace';
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@injected/*": ["../playwright-core/src/server/injected/*"],
|
||||
"@isomorphic/*": ["../playwright-core/src/server/isomorphic/*"],
|
||||
"@isomorphic/*": ["../playwright-core/src/utils/isomorphic/*"],
|
||||
"@protocol/*": ["../protocol/src/*"],
|
||||
"@recorder/*": ["../recorder/src/*"],
|
||||
"@trace/*": ["../trace/src/*"],
|
||||
|
|
|
@ -30,7 +30,7 @@ export default defineConfig({
|
|||
resolve: {
|
||||
alias: {
|
||||
'@injected': path.resolve(__dirname, '../playwright-core/src/server/injected'),
|
||||
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/server/isomorphic'),
|
||||
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/utils/isomorphic'),
|
||||
'@protocol': path.resolve(__dirname, '../protocol/src'),
|
||||
'@trace': path.resolve(__dirname, '../trace/src'),
|
||||
'@web': path.resolve(__dirname, '../web/src'),
|
||||
|
|
|
@ -29,7 +29,7 @@ export default defineConfig({
|
|||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/server/isomorphic'),
|
||||
'@isomorphic': path.resolve(__dirname, '../playwright-core/src/utils/isomorphic'),
|
||||
'@protocol': path.resolve(__dirname, '../protocol/src'),
|
||||
'@trace': path.resolve(__dirname, '../trace/src'),
|
||||
'@web': path.resolve(__dirname, '../web/src'),
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import type { Point, SerializedError, StackFrame } from '@protocol/channels';
|
||||
import type { Language } from '../../playwright-core/src/server/isomorphic/locatorGenerators';
|
||||
import type { Language } from '../../playwright-core/src/utils/isomorphic/locatorGenerators';
|
||||
import type { FrameSnapshot, ResourceSnapshot } from './snapshot';
|
||||
|
||||
export type Size = { width: number, height: number };
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
import { playwrightTest as it, expect } from '../config/browserTest';
|
||||
import type { AttributeSelector } from '../../packages/playwright-core/src/server/isomorphic/selectorParser';
|
||||
import { parseAttributeSelector } from '../../packages/playwright-core/lib/server/isomorphic/selectorParser';
|
||||
import type { AttributeSelector } from '../../packages/playwright-core/src/utils/isomorphic/selectorParser';
|
||||
import { parseAttributeSelector } from '../../packages/playwright-core/lib/utils/isomorphic/selectorParser';
|
||||
|
||||
const parse = (selector: string) => parseAttributeSelector(selector, false);
|
||||
const serialize = (parsed: AttributeSelector) => {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { playwrightTest as it, expect } from '../config/browserTest';
|
||||
import { parseCSS, serializeSelector as serialize } from '../../packages/playwright-core/lib/server/isomorphic/cssParser';
|
||||
import { parseCSS, serializeSelector as serialize } from '../../packages/playwright-core/lib/utils/isomorphic/cssParser';
|
||||
|
||||
const parse = (selector: string) => {
|
||||
return parseCSS(selector, new Set(['text', 'not', 'has', 'react', 'scope', 'right-of', 'is'])).selector;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
import { contextTest as it, expect } from '../config/browserTest';
|
||||
import { asLocator } from '../../packages/playwright-core/lib/server/isomorphic/locatorGenerators';
|
||||
import { locatorOrSelectorAsSelector as parseLocator } from '../../packages/playwright-core/lib/server/isomorphic/locatorParser';
|
||||
import { asLocator } from '../../packages/playwright-core/lib/utils/isomorphic/locatorGenerators';
|
||||
import { locatorOrSelectorAsSelector as parseLocator } from '../../packages/playwright-core/lib/utils/isomorphic/locatorParser';
|
||||
import type { Page, Frame, Locator, FrameLocator } from 'playwright-core';
|
||||
|
||||
it.skip(({ mode }) => mode !== 'default');
|
||||
|
|
|
@ -295,6 +295,7 @@ test('should report api steps', async ({ runInlineTest }) => {
|
|||
page.goto('data:text/html,<button></button>'),
|
||||
]);
|
||||
await page.click('button');
|
||||
await page.getByRole('button').click();
|
||||
await page.request.get('http://localhost2').catch(() => {});
|
||||
await request.get('http://localhost2').catch(() => {});
|
||||
});
|
||||
|
@ -332,6 +333,8 @@ test('should report api steps', async ({ runInlineTest }) => {
|
|||
`end {\"title\":\"page.goto(data:text/html,<button></button>)\",\"category\":\"pw:api\"}`,
|
||||
`begin {\"title\":\"page.click(button)\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"page.click(button)\",\"category\":\"pw:api\"}`,
|
||||
`begin {\"title\":\"locator.getByRole('button').click\",\"category\":\"pw:api\"}`,
|
||||
`end {\"title\":\"locator.getByRole('button').click\",\"category\":\"pw:api\"}`,
|
||||
`begin {"title":"apiRequestContext.get(http://localhost2)","category":"pw:api"}`,
|
||||
`end {"title":"apiRequestContext.get(http://localhost2)","category":"pw:api","error":{"message":"<message>","stack":"<stack>"}}`,
|
||||
`begin {"title":"apiRequestContext.get(http://localhost2)","category":"pw:api"}`,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
"@html-reporter/*": ["./packages/html-reporter/src/*"],
|
||||
"@injected/*": ["./packages/playwright-core/src/server/injected/*"],
|
||||
"@isomorphic/*": ["./packages/playwright-core/src/server/isomorphic/*"],
|
||||
"@isomorphic/*": ["./packages/playwright-core/src/utils/isomorphic/*"],
|
||||
"@protocol/*": ["./packages/protocol/src/*"],
|
||||
"@recorder/*": ["./packages/recorder/src/*"],
|
||||
"@trace/*": ["./packages/trace/src/*"],
|
||||
|
|
|
@ -283,7 +283,7 @@ steps.push({
|
|||
onChanges.push({
|
||||
inputs: [
|
||||
'packages/playwright-core/src/server/injected/**',
|
||||
'packages/playwright-core/src/server/isomorphic/**',
|
||||
'packages/playwright-core/src/utils/isomorphic/**',
|
||||
'utils/generate_injected.js',
|
||||
],
|
||||
script: 'utils/generate_injected.js',
|
||||
|
|
|
@ -28,7 +28,7 @@ const packages = new Map();
|
|||
for (const package of fs.readdirSync(packagesDir))
|
||||
packages.set(package, packagesDir + '/' + package + '/src/');
|
||||
packages.set('injected', packagesDir + '/playwright-core/src/server/injected/');
|
||||
packages.set('isomorphic', packagesDir + '/playwright-core/src/server/isomorphic/');
|
||||
packages.set('isomorphic', packagesDir + '/playwright-core/src/utils/isomorphic/');
|
||||
|
||||
const peerDependencies = ['electron', 'react', 'react-dom', '@zip.js/zip.js'];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче