Browse Source

fix: support even older node 12 (#9718)

pull/9727/head
Joel Einbinder 3 months ago
committed by GitHub
parent
commit
f2888395a6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .github/workflows/tests_secondary.yml
  2. 2
      install-from-github.js
  3. 2
      packages/playwright-chromium/install.js
  4. 18
      packages/playwright-core/package.json
  5. 2
      packages/playwright-firefox/install.js
  6. 6
      packages/playwright-test/src/cli.ts
  7. 2
      packages/playwright-test/src/dispatcher.ts
  8. 4
      packages/playwright-test/src/index.ts
  9. 2
      packages/playwright-test/src/loader.ts
  10. 4
      packages/playwright-test/src/matchers/matchers.ts
  11. 4
      packages/playwright-test/src/matchers/toMatchText.ts
  12. 4
      packages/playwright-test/src/reporters/html.ts
  13. 4
      packages/playwright-test/src/reporters/raw.ts
  14. 2
      packages/playwright-test/src/runner.ts
  15. 2
      packages/playwright-test/src/util.ts
  16. 4
      packages/playwright-test/src/webServer.ts
  17. 2
      packages/playwright-test/src/workerRunner.ts
  18. 2
      packages/playwright-webkit/install.js
  19. 2
      packages/playwright/install.js
  20. 2
      tests/browsertype-connect.spec.ts
  21. 2
      tests/chromium/chromium.spec.ts
  22. 4
      tests/config/baseTest.ts
  23. 4
      tests/config/browserTest.ts
  24. 2
      tests/global-fetch.spec.ts
  25. 2
      tests/har.spec.ts
  26. 2
      tests/inspector/inspectorTest.ts
  27. 2
      tests/playwright-test/playwright.spec.ts
  28. 2
      tests/playwright-test/reporter-html.spec.ts
  29. 4
      tests/tsconfig.json
  30. 2
      tests/video.spec.ts
  31. 3
      tsconfig.json
  32. 2
      utils/linux-browser-dependencies/inside_docker/list_dependencies.js

1
.github/workflows/tests_secondary.yml

@ -115,6 +115,7 @@ jobs:
fail-fast: false
matrix:
node_version:
- "12.0.0"
- "^12.0.0"
- "^14.1.0" # pre 14.1, zip extraction was broken (https://github.com/microsoft/playwright/issues/1988)
- "^16.0.0"

2
install-from-github.js

@ -31,7 +31,7 @@ try {
}
console.log(`Downloading browsers...`);
const { installDefaultBrowsersForNpmInstall } = require('playwright-core/src/utils/registry');
const { installDefaultBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
installDefaultBrowsersForNpmInstall().catch(e => {
console.error(`Failed to install browsers, caused by\n${e.stack}`);
process.exit(1);

2
packages/playwright-chromium/install.js

@ -14,6 +14,6 @@
* limitations under the License.
*/
const { installBrowsersForNpmInstall } = require('playwright-core/src/utils/registry');
const { installBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
installBrowsersForNpmInstall(['chromium', 'ffmpeg']);

18
packages/playwright-core/package.json

@ -20,15 +20,15 @@
"require": "./index.js"
},
"./cli": "./cli.js",
"./src/grid/gridServer": "./lib/grid/gridServer.js",
"./src/grid/gridClient": "./lib/grid/gridClient.js",
"./src/grid/dockerGridFactory": "./lib/grid/dockerGridFactory.js",
"./src/utils/async": "./lib/utils/async.js",
"./src/utils/httpServer": "./lib/utils/httpServer.js",
"./src/utils/multimap": "./lib/utils/multimap.js",
"./src/utils/processLauncher": "./lib/utils/processLauncher.js",
"./src/utils/registry": "./lib/utils/registry.js",
"./src/utils/utils": "./lib/utils/utils.js"
"./lib/grid/gridServer": "./lib/grid/gridServer.js",
"./lib/grid/gridClient": "./lib/grid/gridClient.js",
"./lib/grid/dockerGridFactory": "./lib/grid/dockerGridFactory.js",
"./lib/utils/async": "./lib/utils/async.js",
"./lib/utils/httpServer": "./lib/utils/httpServer.js",
"./lib/utils/multimap": "./lib/utils/multimap.js",
"./lib/utils/processLauncher": "./lib/utils/processLauncher.js",
"./lib/utils/registry": "./lib/utils/registry.js",
"./lib/utils/utils": "./lib/utils/utils.js"
},
"types": "types/types.d.ts",
"bin": {

2
packages/playwright-firefox/install.js

@ -14,6 +14,6 @@
* limitations under the License.
*/
const { installBrowsersForNpmInstall } = require('playwright-core/src/utils/registry');
const { installBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
installBrowsersForNpmInstall(['firefox']);

6
packages/playwright-test/src/cli.ts

@ -25,9 +25,9 @@ import { stopProfiling, startProfiling } from './profiler';
import { FilePatternFilter } from './util';
import { Loader } from './loader';
import { showHTMLReport } from './reporters/html';
import { GridServer } from 'playwright-core/src/grid/gridServer';
import dockerFactory from 'playwright-core/src/grid/dockerGridFactory';
import { createGuid } from 'playwright-core/src/utils/utils';
import { GridServer } from 'playwright-core/lib/grid/gridServer';
import dockerFactory from 'playwright-core/lib/grid/dockerGridFactory';
import { createGuid } from 'playwright-core/lib/utils/utils';
const defaultTimeout = 30000;
const defaultReporter: BuiltInReporter = process.env.CI ? 'dot' : 'list';

2
packages/playwright-test/src/dispatcher.ts

@ -21,7 +21,7 @@ import { RunPayload, TestBeginPayload, TestEndPayload, DonePayload, TestOutputPa
import type { TestResult, Reporter, TestStep } from '../types/testReporter';
import { Suite, TestCase } from './test';
import { Loader } from './loader';
import { ManualPromise } from 'playwright-core/src/utils/async';
import { ManualPromise } from 'playwright-core/lib/utils/async';
export type TestGroup = {
workerHash: string;

4
packages/playwright-test/src/index.ts

@ -19,8 +19,8 @@ import * as path from 'path';
import type { LaunchOptions, BrowserContextOptions, Page, BrowserContext, BrowserType } from 'playwright-core';
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestInfo } from '../types/test';
import { rootTestType } from './testType';
import { assert, createGuid, removeFolders } from 'playwright-core/src/utils/utils';
import { GridClient } from 'playwright-core/src/grid/gridClient';
import { assert, createGuid, removeFolders } from 'playwright-core/lib/utils/utils';
import { GridClient } from 'playwright-core/lib/grid/gridClient';
import { Browser } from 'playwright-core';
export { expect } from './expect';
export const _baseTest: TestType<{}, {}> = rootTestType.test;

2
packages/playwright-test/src/loader.ts

@ -26,7 +26,7 @@ import * as fs from 'fs';
import { ProjectImpl } from './project';
import { Reporter } from '../types/testReporter';
import { BuiltInReporter, builtInReporters } from './runner';
import { isRegExp } from 'playwright-core/src/utils/utils';
import { isRegExp } from 'playwright-core/lib/utils/utils';
export class Loader {
private _defaultConfig: Config;

4
packages/playwright-test/src/matchers/matchers.ts

@ -15,8 +15,8 @@
*/
import { Locator, Page } from 'playwright-core';
import { FrameExpectOptions } from 'playwright-core/src/client/types';
import { constructURLBasedOnBaseURL } from 'playwright-core/src/utils/utils';
import { FrameExpectOptions } from 'playwright-core/lib/client/types';
import { constructURLBasedOnBaseURL } from 'playwright-core/lib/utils/utils';
import type { Expect } from '../types';
import { toBeTruthy } from './toBeTruthy';
import { toEqual } from './toEqual';

4
packages/playwright-test/src/matchers/toMatchText.ts

@ -16,8 +16,8 @@
import colors from 'colors/safe';
import { ExpectedTextValue } from 'playwright-core/src/protocol/channels';
import { isRegExp, isString } from 'playwright-core/src/utils/utils';
import { ExpectedTextValue } from 'playwright-core/lib/protocol/channels';
import { isRegExp, isString } from 'playwright-core/lib/utils/utils';
import { currentTestInfo } from '../globals';
import type { Expect } from '../types';
import { expectType } from '../util';

4
packages/playwright-test/src/reporters/html.ts

@ -19,8 +19,8 @@ import fs from 'fs';
import open from 'open';
import path from 'path';
import { FullConfig, Suite } from '../../types/testReporter';
import { HttpServer } from 'playwright-core/src/utils/httpServer';
import { calculateSha1, removeFolders } from 'playwright-core/src/utils/utils';
import { HttpServer } from 'playwright-core/lib/utils/httpServer';
import { calculateSha1, removeFolders } from 'playwright-core/lib/utils/utils';
import RawReporter, { JsonReport, JsonSuite, JsonTestCase, JsonTestResult, JsonTestStep, JsonAttachment } from './raw';
import assert from 'assert';

4
packages/playwright-test/src/reporters/raw.ts

@ -17,11 +17,11 @@
import fs from 'fs';
import path from 'path';
import { FullConfig, Location, Suite, TestCase, TestResult, TestStatus, TestStep } from '../../types/testReporter';
import { assert, calculateSha1 } from 'playwright-core/src/utils/utils';
import { assert, calculateSha1 } from 'playwright-core/lib/utils/utils';
import { sanitizeForFilePath } from '../util';
import { formatResultFailure } from './base';
import { toPosixPath, serializePatterns } from './json';
import { MultiMap } from 'playwright-core/src/utils/multimap';
import { MultiMap } from 'playwright-core/lib/utils/multimap';
import { codeFrameColumns } from '@babel/code-frame';
export type JsonLocation = Location;

2
packages/playwright-test/src/runner.ts

@ -38,7 +38,7 @@ import { ProjectImpl } from './project';
import { Minimatch } from 'minimatch';
import { FullConfig } from './types';
import { WebServer } from './webServer';
import { raceAgainstDeadline } from 'playwright-core/src/utils/async';
import { raceAgainstDeadline } from 'playwright-core/lib/utils/async';
const removeFolderAsync = promisify(rimraf);
const readDirAsync = promisify(fs.readdir);

2
packages/playwright-test/src/util.ts

@ -20,7 +20,7 @@ import url from 'url';
import type { TestError, Location } from './types';
import { default as minimatch } from 'minimatch';
import debug from 'debug';
import { isRegExp } from 'playwright-core/src/utils/utils';
import { isRegExp } from 'playwright-core/lib/utils/utils';
export function serializeError(error: Error | any): TestError {
if (error instanceof Error) {

4
packages/playwright-test/src/webServer.ts

@ -18,9 +18,9 @@ import net from 'net';
import os from 'os';
import stream from 'stream';
import { monotonicTime } from './util';
import { raceAgainstDeadline } from 'playwright-core/src/utils/async';
import { raceAgainstDeadline } from 'playwright-core/lib/utils/async';
import { WebServerConfig } from './types';
import { launchProcess } from 'playwright-core/src/utils/processLauncher';
import { launchProcess } from 'playwright-core/lib/utils/processLauncher';
const DEFAULT_ENVIRONMENT_VARIABLES = {
'BROWSER': 'none', // Disable that create-react-app will open the page in the browser

2
packages/playwright-test/src/workerRunner.ts

@ -28,7 +28,7 @@ import { Modifier, Suite, TestCase } from './test';
import { Annotations, TestError, TestInfo, TestInfoImpl, TestStepInternal, WorkerInfo } from './types';
import { ProjectImpl } from './project';
import { FixturePool, FixtureRunner } from './fixtures';
import { DeadlineRunner, raceAgainstDeadline } from 'playwright-core/src/utils/async';
import { DeadlineRunner, raceAgainstDeadline } from 'playwright-core/lib/utils/async';
const removeFolderAsync = util.promisify(rimraf);

2
packages/playwright-webkit/install.js

@ -14,6 +14,6 @@
* limitations under the License.
*/
const { installBrowsersForNpmInstall } = require('playwright-core/src/utils/registry');
const { installBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
installBrowsersForNpmInstall(['webkit']);

2
packages/playwright/install.js

@ -14,6 +14,6 @@
* limitations under the License.
*/
const { installDefaultBrowsersForNpmInstall } = require('playwright-core/src/utils/registry');
const { installDefaultBrowsersForNpmInstall } = require('playwright-core/lib/utils/registry');
installDefaultBrowsersForNpmInstall();

2
tests/browsertype-connect.spec.ts

@ -18,7 +18,7 @@
import { playwrightTest as test, expect } from './config/browserTest';
import fs from 'fs';
import * as path from 'path';
import { getUserAgent } from 'playwright-core/src/utils/utils';
import { getUserAgent } from 'playwright-core/lib/utils/utils';
import WebSocket from 'ws';
import { suppressCertificateWarning } from './config/utils';

2
tests/chromium/chromium.spec.ts

@ -18,7 +18,7 @@
import { contextTest as test, expect } from '../config/browserTest';
import { playwrightTest } from '../config/browserTest';
import http from 'http';
import { getUserAgent } from 'playwright-core/src/utils/utils';
import { getUserAgent } from 'playwright-core/lib/utils/utils';
import { suppressCertificateWarning } from '../config/utils';
test('should create a worker from a service worker', async ({ page, server }) => {

4
tests/config/baseTest.ts

@ -19,7 +19,7 @@ import * as path from 'path';
import * as fs from 'fs';
import { installCoverageHooks } from './coverage';
import { start } from '../../packages/playwright-core/lib/outofprocess';
import { GridClient } from 'playwright-core/src/grid/gridClient';
import { GridClient } from 'playwright-core/lib/grid/gridClient';
import type { LaunchOptions } from 'playwright-core';
import { commonFixtures, CommonFixtures, serverFixtures, ServerFixtures, ServerOptions } from './commonFixtures';
@ -91,7 +91,7 @@ const baseFixtures: Fixtures<{}, BaseOptions & BaseFixtures> = {
service: new ServiceMode(),
driver: new DriverMode(),
}[mode];
require('playwright-core/src/utils/utils').setUnderTest();
require('playwright-core/lib/utils/utils').setUnderTest();
const playwright = await modeImpl.setup(workerInfo.workerIndex);
await run(playwright);
await modeImpl.teardown();

4
tests/config/browserTest.ts

@ -16,7 +16,7 @@
import type { Fixtures } from '@playwright/test';
import type { Browser, BrowserContext, BrowserContextOptions, BrowserType, LaunchOptions, Page } from 'playwright-core';
import { removeFolders } from 'playwright-core/src/utils/utils';
import { removeFolders } from 'playwright-core/lib/utils/utils';
import { ReuseBrowserContextStorage } from '@playwright/test/src/index';
import * as path from 'path';
import * as fs from 'fs';
@ -24,7 +24,7 @@ import * as os from 'os';
import { RemoteServer, RemoteServerOptions } from './remoteServer';
import { baseTest, CommonWorkerFixtures } from './baseTest';
import { CommonFixtures } from './commonFixtures';
import type { ParsedStackTrace } from 'playwright-core/src/utils/stackTrace';
import type { ParsedStackTrace } from 'playwright-core/lib/utils/stackTrace';
type PlaywrightWorkerOptions = {
executablePath: LaunchOptions['executablePath'];

2
tests/global-fetch.spec.ts

@ -15,7 +15,7 @@
*/
import http from 'http';
import { getPlaywrightVersion } from 'playwright-core/src/utils/utils';
import { getPlaywrightVersion } from 'playwright-core/lib/utils/utils';
import { expect, playwrightTest as it } from './config/browserTest';
it.skip(({ mode }) => mode !== 'default');

2
tests/har.spec.ts

@ -21,7 +21,7 @@ import fs from 'fs';
import http2 from 'http2';
import type { BrowserContext, BrowserContextOptions } from 'playwright-core';
import type { AddressInfo } from 'net';
import type { Log } from 'playwright-core/src/server/supplements/har/har';
import type { Log } from 'playwright-core/lib/server/supplements/har/har';
async function pageWithHar(contextFactory: (options?: BrowserContextOptions) => Promise<BrowserContext>, testInfo: any, outputPath: string = 'test.har') {
const harPath = testInfo.outputPath(outputPath);

2
tests/inspector/inspectorTest.ts

@ -17,7 +17,7 @@
import { contextTest } from '../config/browserTest';
import type { Page } from 'playwright-core';
import * as path from 'path';
import type { Source } from 'playwright-core/src/server/supplements/recorder/recorderTypes';
import type { Source } from 'playwright-core/lib/server/supplements/recorder/recorderTypes';
import { CommonFixtures, TestChildProcess } from '../config/commonFixtures';
export { expect } from '@playwright/test';

2
tests/playwright-test/playwright.spec.ts

@ -18,7 +18,7 @@ import { test, expect, stripAscii } from './playwright-test-fixtures';
import fs from 'fs';
import path from 'path';
import { spawnSync } from 'child_process';
import { registry } from 'playwright-core/src/utils/registry';
import { registry } from 'playwright-core/lib/utils/registry';
const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath();

2
tests/playwright-test/reporter-html.spec.ts

@ -17,7 +17,7 @@
import fs from 'fs';
import path from 'path';
import { test as baseTest, expect } from './playwright-test-fixtures';
import { HttpServer } from 'playwright-core/src/utils/httpServer';
import { HttpServer } from 'playwright-core/lib/utils/httpServer';
const test = baseTest.extend<{ showReport: () => Promise<void> }>({
showReport: async ({ page }, use, testInfo) => {

4
tests/tsconfig.json

@ -9,6 +9,10 @@
"strictBindCallApply": true,
"allowSyntheticDefaultImports": true,
"useUnknownInCatchVariables": false,
"baseUrl": ".",
"paths": {
"playwright-core/lib/*": ["../packages/playwright-core/src/*"]
},
},
"include": ["**/*.spec.js", "**/*.ts", "index.d.ts"],
"exclude": ["playwright-test/"]

2
tests/video.spec.ts

@ -19,7 +19,7 @@ import fs from 'fs';
import path from 'path';
import { spawnSync } from 'child_process';
import { PNG } from 'pngjs';
import { registry } from 'playwright-core/src/utils/registry';
import { registry } from 'playwright-core/lib/utils/registry';
const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath();

3
tsconfig.json

@ -5,7 +5,8 @@
"lib": ["esnext", "dom", "DOM.Iterable"],
"baseUrl": ".",
"paths": {
"*": ["./packages/*/"]
"*": ["./packages/*/"],
"playwright-core/lib/*": ["./packages/playwright-core/src/*"]
},
"esModuleInterop": true,
"strict": true,

2
utils/linux-browser-dependencies/inside_docker/list_dependencies.js

@ -4,7 +4,7 @@ const fs = require('fs');
const util = require('util');
const path = require('path');
const {spawn} = require('child_process');
const {registryDirectory} = require('playwright-core/src/utils/registry.js');
const {registryDirectory} = require('playwright-core/lib/utils/registry.js');
const readdirAsync = util.promisify(fs.readdir.bind(fs));
const readFileAsync = util.promisify(fs.readFile.bind(fs));

Loading…
Cancel
Save