From d294c5da33dfe60bca2b76ca6893969002cbd62e Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Tue, 6 Dec 2022 15:46:19 -0800 Subject: [PATCH] chore: roll stable-test-runner to 1.28.1 (#19310) This required `allowJs: false` in our `tsconfig.json` due to the following error: ``` Error: Cannot find module './utilsBundleImpl' Require stack: - /packages/playwright-core/src/utilsBundle.ts - /packages/playwright-test/lib/reporters/html.js - /tests/playwright-test/reporter-html.spec.ts - /tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/loader.js - /tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/runner.js - /tests/playwright-test/stable-test-runner/node_modules/@playwright/test/lib/cli.js - /tests/playwright-test/stable-test-runner/node_modules/playwright-core/lib/cli/cli.js - /tests/playwright-test/stable-test-runner/node_modules/playwright-core/cli.js - /tests/playwright-test/stable-test-runner/node_modules/@playwright/test/cli.js at ../../packages/playwright-core/src/utilsBundle.ts:20 18 | import path from 'path'; 19 | > 20 | export const colors: typeof import('../bundles/utils/node_modules/colors/safe') = require('./utilsBundleImpl').colors; | ^ 21 | export const debug: typeof import('../bundles/utils/node_modules/@types/debug') = require('./utilsBundleImpl').debug; 22 | export const getProxyForUrl: typeof import('../bundles/utils/node_modules/@types/proxy-from-env').getProxyForUrl = require('./utilsBundleImpl').getProxyForUrl; 23 | export const HttpsProxyAgent: typeof import('../bundles/utils/node_modules/https-proxy-agent').HttpsProxyAgent = require('./utilsBundleImpl').HttpsProxyAgent; at Object. (/packages/playwright-core/src/utilsBundle.ts:20:83) at Object. (/packages/playwright-test/src/reporters/html.ts:17:1) ``` --- .../src/server/recorder/csharp.ts | 2 +- .../src/server/recorder/java.ts | 2 +- .../src/server/recorder/javascript.ts | 2 +- .../src/server/recorder/python.ts | 2 +- .../playwright-core/src/utils/comparators.ts | 6 ++-- tests/playwright-test/playwright.config.ts | 1 + .../stable-test-runner/package-lock.json | 30 +++++++++---------- .../stable-test-runner/package.json | 2 +- tsconfig.json | 2 +- 9 files changed, 25 insertions(+), 24 deletions(-) diff --git a/packages/playwright-core/src/server/recorder/csharp.ts b/packages/playwright-core/src/server/recorder/csharp.ts index 2cb6a0ef9b..7a374cd136 100644 --- a/packages/playwright-core/src/server/recorder/csharp.ts +++ b/packages/playwright-core/src/server/recorder/csharp.ts @@ -22,7 +22,7 @@ import type { Action } from './recorderActions'; import type { MouseClickOptions } from './utils'; import { toModifiers } from './utils'; import { escapeWithQuotes } from '../../utils/isomorphic/stringUtils'; -import deviceDescriptors from '../deviceDescriptors'; +const deviceDescriptors = require('../deviceDescriptorsSource.json'); import { asLocator } from '../isomorphic/locatorGenerators'; type CSharpLanguageMode = 'library' | 'mstest' | 'nunit'; diff --git a/packages/playwright-core/src/server/recorder/java.ts b/packages/playwright-core/src/server/recorder/java.ts index c6394611f1..eacc24b06a 100644 --- a/packages/playwright-core/src/server/recorder/java.ts +++ b/packages/playwright-core/src/server/recorder/java.ts @@ -21,7 +21,7 @@ import type { ActionInContext } from './codeGenerator'; import type { Action } from './recorderActions'; import type { MouseClickOptions } from './utils'; import { toModifiers } from './utils'; -import deviceDescriptors from '../deviceDescriptors'; +const deviceDescriptors = require('../deviceDescriptorsSource.json'); import { JavaScriptFormatter } from './javascript'; import { escapeWithQuotes } from '../../utils/isomorphic/stringUtils'; import { asLocator } from '../isomorphic/locatorGenerators'; diff --git a/packages/playwright-core/src/server/recorder/javascript.ts b/packages/playwright-core/src/server/recorder/javascript.ts index 719f6a17bd..c919418544 100644 --- a/packages/playwright-core/src/server/recorder/javascript.ts +++ b/packages/playwright-core/src/server/recorder/javascript.ts @@ -21,7 +21,7 @@ import type { ActionInContext } from './codeGenerator'; import type { Action } from './recorderActions'; import type { MouseClickOptions } from './utils'; import { toModifiers } from './utils'; -import deviceDescriptors from '../deviceDescriptors'; +const deviceDescriptors = require('../deviceDescriptorsSource.json'); import { escapeWithQuotes } from '../../utils/isomorphic/stringUtils'; import { asLocator } from '../isomorphic/locatorGenerators'; diff --git a/packages/playwright-core/src/server/recorder/python.ts b/packages/playwright-core/src/server/recorder/python.ts index a0cb10702c..7b3ae576e7 100644 --- a/packages/playwright-core/src/server/recorder/python.ts +++ b/packages/playwright-core/src/server/recorder/python.ts @@ -22,7 +22,7 @@ import type { Action } from './recorderActions'; import type { MouseClickOptions } from './utils'; import { toModifiers } from './utils'; import { escapeWithQuotes, toSnakeCase } from '../../utils/isomorphic/stringUtils'; -import deviceDescriptors from '../deviceDescriptors'; +const deviceDescriptors = require('../deviceDescriptorsSource.json'); import { asLocator } from '../isomorphic/locatorGenerators'; export class PythonLanguageGenerator implements LanguageGenerator { diff --git a/packages/playwright-core/src/utils/comparators.ts b/packages/playwright-core/src/utils/comparators.ts index a1279d6e37..7a03e11f39 100644 --- a/packages/playwright-core/src/utils/comparators.ts +++ b/packages/playwright-core/src/utils/comparators.ts @@ -16,9 +16,9 @@ */ import { colors, jpegjs } from '../utilsBundle'; -import pixelmatch from '../third_party/pixelmatch'; +const pixelmatch = require('../third_party/pixelmatch'); import { compare } from '../image_tools/compare'; -import { diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL } from '../third_party/diff_match_patch'; +const { diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL } = require('../third_party/diff_match_patch'); import { PNG } from '../utilsBundle'; export type ImageComparatorOptions = { threshold?: number, maxDiffPixels?: number, maxDiffPixelRatio?: number, comparator?: string }; @@ -100,7 +100,7 @@ function compareText(actual: Buffer | string, expectedBuffer: Buffer): Comparato }; } -function diff_prettyTerminal(diffs: diff_match_patch.Diff[]) { +function diff_prettyTerminal(diffs: [number, string][]) { const html = []; for (let x = 0; x < diffs.length; x++) { const op = diffs[x][0]; // Operation (insert, delete, equal) diff --git a/tests/playwright-test/playwright.config.ts b/tests/playwright-test/playwright.config.ts index 64570a8f18..8aa62bb688 100644 --- a/tests/playwright-test/playwright.config.ts +++ b/tests/playwright-test/playwright.config.ts @@ -26,6 +26,7 @@ const config: Config = { forbidOnly: !!process.env.CI, workers: process.env.CI ? 2 : undefined, preserveOutput: process.env.CI ? 'failures-only' : 'always', + snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}', projects: [ { name: 'playwright-test', diff --git a/tests/playwright-test/stable-test-runner/package-lock.json b/tests/playwright-test/stable-test-runner/package-lock.json index cbf7c56300..1a09d5b497 100644 --- a/tests/playwright-test/stable-test-runner/package-lock.json +++ b/tests/playwright-test/stable-test-runner/package-lock.json @@ -5,16 +5,16 @@ "packages": { "": { "dependencies": { - "@playwright/test": "1.27.0-alpha-sep-15-2022" + "@playwright/test": "1.28.1" } }, "node_modules/@playwright/test": { - "version": "1.27.0-alpha-sep-15-2022", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.0-alpha-sep-15-2022.tgz", - "integrity": "sha512-8v6zhbFDpjDgSC74vOZKEUPlsFtU+JhZP1l+FjhY7Tz31/ohwBkXWYtbXl/3a4qD8AqdJ+NJ4RHQx4AkwqNFTA==", + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.1.tgz", + "integrity": "sha512-xN6spdqrNlwSn9KabIhqfZR7IWjPpFK1835tFNgjrlysaSezuX8PYUwaz38V/yI8TJLG9PkAMEXoHRXYXlpTPQ==", "dependencies": { "@types/node": "*", - "playwright-core": "1.27.0-alpha-sep-15-2022" + "playwright-core": "1.28.1" }, "bin": { "playwright": "cli.js" @@ -29,9 +29,9 @@ "integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==" }, "node_modules/playwright-core": { - "version": "1.27.0-alpha-sep-15-2022", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.0-alpha-sep-15-2022.tgz", - "integrity": "sha512-QWwYeWoXZaj5cBiR+IE35dXT8QbR6JNftr0yIN9wt0JI7Ju5rnoKJxCCYtIY9drPb+aAXbAC83xV/bt5t6N9fA==", + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.28.1.tgz", + "integrity": "sha512-3PixLnGPno0E8rSBJjtwqTwJe3Yw72QwBBBxNoukIj3lEeBNXwbNiKrNuB1oyQgTBw5QHUhNO3SteEtHaMK6ag==", "bin": { "playwright": "cli.js" }, @@ -42,12 +42,12 @@ }, "dependencies": { "@playwright/test": { - "version": "1.27.0-alpha-sep-15-2022", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.0-alpha-sep-15-2022.tgz", - "integrity": "sha512-8v6zhbFDpjDgSC74vOZKEUPlsFtU+JhZP1l+FjhY7Tz31/ohwBkXWYtbXl/3a4qD8AqdJ+NJ4RHQx4AkwqNFTA==", + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.28.1.tgz", + "integrity": "sha512-xN6spdqrNlwSn9KabIhqfZR7IWjPpFK1835tFNgjrlysaSezuX8PYUwaz38V/yI8TJLG9PkAMEXoHRXYXlpTPQ==", "requires": { "@types/node": "*", - "playwright-core": "1.27.0-alpha-sep-15-2022" + "playwright-core": "1.28.1" } }, "@types/node": { @@ -56,9 +56,9 @@ "integrity": "sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==" }, "playwright-core": { - "version": "1.27.0-alpha-sep-15-2022", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.0-alpha-sep-15-2022.tgz", - "integrity": "sha512-QWwYeWoXZaj5cBiR+IE35dXT8QbR6JNftr0yIN9wt0JI7Ju5rnoKJxCCYtIY9drPb+aAXbAC83xV/bt5t6N9fA==" + "version": "1.28.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.28.1.tgz", + "integrity": "sha512-3PixLnGPno0E8rSBJjtwqTwJe3Yw72QwBBBxNoukIj3lEeBNXwbNiKrNuB1oyQgTBw5QHUhNO3SteEtHaMK6ag==" } } } diff --git a/tests/playwright-test/stable-test-runner/package.json b/tests/playwright-test/stable-test-runner/package.json index b17e2d8e8f..d671de43a0 100644 --- a/tests/playwright-test/stable-test-runner/package.json +++ b/tests/playwright-test/stable-test-runner/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "@playwright/test": "1.27.0-alpha-sep-15-2022" + "@playwright/test": "1.28.1" } } diff --git a/tsconfig.json b/tsconfig.json index ae042f4da4..4dd48cd575 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,7 @@ }, "esModuleInterop": true, "strict": true, - "allowJs": true, + "allowJs": false, "jsx": "react", "resolveJsonModule": true, "noEmit": true,