Skip to content

Commit

Permalink
chore: adjust to playwright 1.42.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ruifigueira committed Feb 28, 2024
1 parent a0dde00 commit 53e569d
Show file tree
Hide file tree
Showing 6 changed files with 2,184 additions and 443 deletions.
2 changes: 1 addition & 1 deletion src/server/crx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type * as channels from '@protocol/channels';
import { RecentLogsCollector } from 'playwright-core/lib/common/debugLogger';
import { RecentLogsCollector } from 'playwright-core/lib/utils/debugLogger';
import type { BrowserOptions, BrowserProcess } from 'playwright-core/lib/server/browser';
import { CRBrowser } from 'playwright-core/lib/server/chromium/crBrowser';
import type { CRPage } from 'playwright-core/lib/server/chromium/crPage';
Expand Down
10 changes: 2 additions & 8 deletions src/server/recorder/crxPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,10 @@ import { FrameExpectParams } from '@protocol/channels';

type Location = CallMetadata['location'];

type FrameDescription = {
url: string;
name?: string;
selectorsChain?: string[];
};

export type ActionWithContext = (actions.Action | { name: 'pause' }) & {
pageAlias: string;
location?: Location;
frame?: FrameDescription;
frame?: actions.FrameDescription & { url: string; name?: string };
};

class Stopped extends Error {}
Expand Down Expand Up @@ -252,7 +246,7 @@ export default class Player extends EventEmitter {

if (!action.frame) return [page.mainFrame(), selector];

if (action.frame.selectorsChain && action.name !== 'navigate') {
if (!action.frame.isMainFrame && action.name !== 'navigate') {
const chainedSelector = [...action.frame.selectorsChain, selector].join(' >> internal:control=enter-frame >> ');
return [page.mainFrame(), chainedSelector];
}
Expand Down
6 changes: 4 additions & 2 deletions src/server/recorder/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { JavaScriptLanguageGenerator } from "playwright-core/lib/server/recorder
import { Language, LanguageGeneratorOptions } from "playwright-core/lib/server/recorder/language";
import { PythonLanguageGenerator } from "playwright-core/lib/server/recorder/python";
import { ActionWithContext } from "./crxPlayer";
import type { FrameDescription } from "playwright-core/lib/server/recorder/recorderActions";

export type Script = {
filename: string;
Expand All @@ -31,7 +32,8 @@ export type Script = {
}

const languages = new Map([
new JavaLanguageGenerator(),
new JavaLanguageGenerator('junit'),
new JavaLanguageGenerator('library'),
new JavaScriptLanguageGenerator(/* isPlaywrightTest */false),
new JavaScriptLanguageGenerator(/* isPlaywrightTest */true),
new PythonLanguageGenerator(/* isAsync */false, /* isPytest */true),
Expand All @@ -51,7 +53,7 @@ export function toSource(script: Script): Source {

const actionInContext: ActionInContext = {
action,
frame: { url: '', pageAlias, isMainFrame: !frame, ...frame },
frame: { url: '', pageAlias, isMainFrame: !frame, ...frame } as FrameDescription,
committed: true
}
return langGenerator.generateAction(actionInContext);
Expand Down
2 changes: 1 addition & 1 deletion src/server/transport/crxTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { LogName, debugLogger } from 'playwright-core/lib/common/debugLogger';
import { LogName, debugLogger } from 'playwright-core/lib/utils/debugLogger';
import type { Protocol } from 'playwright-core/lib/server/chromium/protocol';
import type { Progress } from 'playwright-core/lib/server/progress';
import type { ConnectionTransport, ProtocolRequest, ProtocolResponse } from 'playwright-core/lib/server/transport';
Expand Down
Loading

0 comments on commit 53e569d

Please sign in to comment.