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(recorder): make sure initial language is set correctly for ports (#38659)
Dmitry Gozman1359b5fbf708
diff --git a/packages/playwright-core/src/server/recorder/recorderApp.ts b/packages/playwright-core/src/server/recorder/recorderApp.tsindex 23c2d4c0eb..8b55289730 100644--- a/packages/playwright-core/src/server/recorder/recorderApp.ts+++ b/packages/playwright-core/src/server/recorder/recorderApp.ts@@ -72,6 +72,10 @@ export class RecorderApp {this._throttledOutputFile = params.outputFile ? new ThrottledFile(params.outputFile) : null;this._primaryGeneratorId = process.env.TEST_INSPECTOR_LANGUAGE || params.language || determinePrimaryGeneratorId(params.sdkLanguage);this._selectedGeneratorId = this._primaryGeneratorId;+ for (const languageGenerator of languageSet()) {+ if (languageGenerator.id === this._primaryGeneratorId)+ this._recorder.setLanguage(languageGenerator.highlighter);+ }}private async _init(inspectedContext: BrowserContext) {diff --git a/tests/library/inspector/pause.spec.ts b/tests/library/inspector/pause.spec.tsindex dc2362546d..5f91d7638b 100644--- a/tests/library/inspector/pause.spec.ts+++ b/tests/library/inspector/pause.spec.ts@@ -474,30 +474,23 @@ it.describe('pause', () => {await scriptPromise;});- it('should highlight on explore (csharp)', async ({ page, recorderPageGetter }) => {+ it('should highlight on explore (csharp)', async ({ openRecorder }) => {process.env.TEST_INSPECTOR_LANGUAGE = 'csharp';try {+ const { page, recorder } = await openRecorder();await page.setContent('<button>Submit</button>');- const scriptPromise = (async () => {- // @ts-ignore- await page.pause({ __testHookKeepTestTimeout: true });- })();- const recorderPage = await recorderPageGetter();- await recorderPage.getByRole('combobox', { name: 'Source chooser' }).selectOption('csharp');const box1Promise = waitForTestLog<BoundingBox>(page, 'Highlight box for test: ');- await recorderPage.getByText('Locator', { exact: true }).click();- await recorderPage.locator('.tabbed-pane .CodeMirror').click();- await recorderPage.keyboard.press('ControlOrMeta+A');- await recorderPage.keyboard.press('Backspace');- await recorderPage.keyboard.type('GetByText("Submit")');+ await recorder.recorderPage.getByText('Locator', { exact: true }).click();+ await recorder.recorderPage.locator('.tabbed-pane .CodeMirror').click();+ await recorder.recorderPage.keyboard.press('ControlOrMeta+A');+ await recorder.recorderPage.keyboard.press('Backspace');+ await recorder.recorderPage.keyboard.type('GetByText("Submit")');const box1 = await box1Promise;const button = await page.$('text=Submit');const box2 = await button.boundingBox();expect(roundBox(box1)).toEqual(roundBox(box2));- await recorderPage.click('[title="Resume (F8)"]');- await scriptPromise;} finally {delete process.env.TEST_INSPECTOR_LANGUAGE;}