Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
DudaGod committed Nov 20, 2024
1 parent 89673f3 commit 1f95fab
Show file tree
Hide file tree
Showing 77 changed files with 3,035 additions and 8,938 deletions.
11,338 changes: 2,706 additions & 8,632 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "tsc --build && npm run copy-static && npm run build-bundles",
"copy-static": "copyfiles 'src/browser/client-scripts/*' build",
"build-node-bundle": "esbuild ./src/bundle/index.ts --outdir=./build/src/bundle --bundle --format=cjs --platform=node --target=ES2021",
"build-node-bundle": "esbuild ./src/bundle/cjs/index.ts --outdir=./build/src/bundle/cjs --bundle --format=cjs --platform=node --target=ES2021",
"build-browser-bundle": "node ./src/browser/client-scripts/build.js",
"build-bundles": "concurrently -c 'auto' 'npm:build-browser-bundle' 'npm:build-node-bundle --minify'",
"check-types": "tsc --project tsconfig.spec.json",
Expand Down Expand Up @@ -54,14 +54,9 @@
"@babel/code-frame": "7.24.2",
"@gemini-testing/commander": "2.15.4",
"@jspm/core": "2.0.1",
"@types/debug": "4.1.12",
"@types/yallist": "4.0.4",
"@vitest/spy": "2.1.4",
"@wdio/globals": "8.39.0",
"@wdio/protocols": "8.38.0",
"@wdio/types": "8.39.0",
"@wdio/utils": "8.39.0",
"@wdio/utils-cjs": "npm:@wdio/[email protected]",
"bluebird": "3.5.1",
"chalk": "2.4.2",
"clear-require": "1.0.1",
Expand All @@ -73,10 +68,8 @@
"fs-extra": "5.0.0",
"gemini-configparser": "1.4.1",
"get-port": "5.1.1",
"glob-extra": "5.0.2",
"import-meta-resolve": "4.0.0",
"local-pkg": "0.4.3",
"lodash": "4.17.21",
"looks-same": "9.0.1",
"micromatch": "4.0.5",
"mocha": "10.2.0",
Expand Down Expand Up @@ -110,14 +103,15 @@
"@commitlint/config-conventional": "^19.0.3",
"@cspotcode/source-map-support": "0.8.0",
"@sinonjs/fake-timers": "10.3.0",
"@swc/core": "1.3.40",
"@swc/core": "1.9.2",
"@types/babel__code-frame": "7.0.6",
"@types/babel__core": "7.20.5",
"@types/bluebird": "3.5.38",
"@types/browserify": "12.0.40",
"@types/chai": "4.3.4",
"@types/chai-as-promised": "7.1.5",
"@types/clear-require": "3.2.1",
"@types/debug": "4.1.12",
"@types/escape-string-regexp": "2.0.1",
"@types/fs-extra": "11.0.4",
"@types/lodash": "4.14.191",
Expand All @@ -130,8 +124,11 @@
"@types/sinonjs__fake-timers": "8.1.2",
"@types/urijs": "1.19.25",
"@types/url-join": "4.0.3",
"@types/yallist": "4.0.4",
"@typescript-eslint/eslint-plugin": "6.12.0",
"@typescript-eslint/parser": "6.12.0",
"@wdio/types": "8.39.0",
"@wdio/utils-cjs": "npm:@wdio/[email protected]",
"aliasify": "1.9.0",
"app-module-path": "2.2.0",
"browserify": "13.3.0",
Expand All @@ -144,9 +141,11 @@
"eslint": "8.25.0",
"eslint-config-gemini-testing": "2.8.0",
"eslint-config-prettier": "8.7.0",
"glob-extra": "5.0.2",
"husky": "0.11.4",
"jsdom": "^24.0.0",
"jsdom-global": "3.0.2",
"lodash": "4.17.21",
"onchange": "7.1.0",
"pirates": "4.0.6",
"prettier": "2.8.4",
Expand Down
2 changes: 1 addition & 1 deletion src/base-testplane.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "./bundle/lodash";
import pluginsLoader from "plugins-loader";
import { Config } from "./config";
import {
Expand Down
3 changes: 1 addition & 2 deletions src/browser-pool/basic-pool.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import debug from "debug";
import _ from "lodash";

import _ from "../bundle/lodash";
import { NewBrowser } from "../browser/new-browser";
import { CancelledError } from "./cancelled-error";
import { AsyncEmitter, MasterEvents } from "../events";
Expand Down
2 changes: 1 addition & 1 deletion src/browser-pool/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "../bundle/lodash";
import { BasicPool } from "./basic-pool";
import { LimitedPool } from "./limited-pool";
import { PerBrowserLimitedPool } from "./per-browser-limited-pool";
Expand Down
2 changes: 1 addition & 1 deletion src/browser-pool/limited-pool.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import debug from "debug";
import _ from "lodash";
import yallist from "yallist";

import _ from "../bundle/lodash";
import { BrowserOpts, Pool } from "./types";
import { CancelledError } from "./cancelled-error";
import { buildCompositeBrowserId } from "./utils";
Expand Down
2 changes: 1 addition & 1 deletion src/browser-pool/limited-use-set.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from "lodash";
import debug from "debug";
import _ from "../bundle/lodash";

/**
* Set implementation which allows to get and put an object
Expand Down
6 changes: 3 additions & 3 deletions src/browser-pool/per-browser-limited-pool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from "debug";
import { zipObject, forEach } from "lodash";
import _ from "../bundle/lodash";

import { Pool } from "./types";
import { Config } from "../config";
Expand All @@ -14,7 +14,7 @@ export class PerBrowserLimitedPool implements Pool {
this.log = debug("testplane:pool:per-browser-limited");

const ids = config.getBrowserIds();
this._browserPools = zipObject(
this._browserPools = _.zipObject(
ids,
ids.map(id =>
LimitedPool.create(underlyingPool, {
Expand All @@ -38,6 +38,6 @@ export class PerBrowserLimitedPool implements Pool {

cancel(): void {
this.log("cancel");
forEach(this._browserPools, pool => pool.cancel());
_.forEach(this._browserPools, pool => pool.cancel());
}
}
8 changes: 4 additions & 4 deletions src/browser/browser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import crypto from "crypto";
import { RequestOptions } from "https";

import { RemoteCapability } from "@wdio/types/build/Capabilities";
import _ from "lodash";

import _ from "../bundle/lodash";
import { SAVE_HISTORY_MODE } from "../constants/config";
import { X_REQUEST_ID_DELIMITER } from "../constants/browser";
import history from "./history";
Expand All @@ -15,6 +13,8 @@ import { AsyncEmitter } from "../events";
import { BrowserConfig } from "../config/browser-config";
import Callstack from "./history/callstack";

import type { Capabilities } from "@wdio/types";

const CUSTOM_SESSION_OPTS = [
"outputDir",
"agent",
Expand Down Expand Up @@ -178,7 +178,7 @@ export class Browser {
return this._state;
}

get capabilities(): RemoteCapability {
get capabilities(): Capabilities.RemoteCapability {
return this.publicAPI.capabilities;
}

Expand Down
2 changes: 1 addition & 1 deletion src/browser/calibrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
const fs = require("fs");
const path = require("path");
const Promise = require("bluebird");
const _ = require("lodash");
const looksSame = require("looks-same");
const _ = require("../bundle/lodash").default;
const { CoreError } = require("./core-error");

const DIRECTION = { FORWARD: "forward", REVERSE: "reverse" };
Expand Down
2 changes: 1 addition & 1 deletion src/browser/camera/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

const Image = require("../../image");
const _ = require("lodash");
const _ = require("../../bundle/lodash").default;
const utils = require("./utils");

module.exports = class Camera {
Expand Down
2 changes: 1 addition & 1 deletion src/browser/commands/assert-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

const fs = require("fs-extra");
const path = require("path");
const _ = require("lodash");
const Promise = require("bluebird");
const { pngValidator: validatePng } = require("png-validator");
const _ = require("../../../bundle/lodash").default;
const Image = require("../../../image");
const ScreenShooter = require("../../screen-shooter");
const temp = require("../../../temp");
Expand Down
2 changes: 1 addition & 1 deletion src/browser/commands/openAndWait.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from "lodash";
import { Matches } from "webdriverio";
import _ from "../../bundle/lodash";
import PageLoader from "../../utils/page-loader";
import type { Browser } from "../types";
import { BrowserConfig } from "../../config/browser-config";
Expand Down
2 changes: 1 addition & 1 deletion src/browser/commands/runStep.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from "lodash";
import _ from "../../bundle/lodash";
import { Browser } from "../browser";

const addRunStepCommand = (browser: Browser): void => {
Expand Down
4 changes: 2 additions & 2 deletions src/browser/existing-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

const url = require("url");
const Promise = require("bluebird");
const _ = require("lodash");
const webdriverio = require("webdriverio");
const { sessionEnvironmentDetector } = require("@wdio/utils-cjs");
const _ = require("../bundle/lodash").default;
const { sessionEnvironmentDetector } = require("../bundle/@wdio-utils");
const { Browser } = require("./browser");
const commandsList = require("./commands");
const Camera = require("./camera");
Expand Down
2 changes: 1 addition & 1 deletion src/browser/history/callstack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const _ = require("lodash");
const _ = require("../../bundle/lodash").default;
const { TestStepKey } = require("../../types");

module.exports = class Callstack {
Expand Down
2 changes: 1 addition & 1 deletion src/browser/history/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const _ = require("lodash");
const _ = require("../../bundle/lodash").default;
const { TestStepKey } = require("../../types");

const MAX_STRING_LENGTH = 50;
Expand Down
8 changes: 4 additions & 4 deletions src/browser/new-browser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { URLSearchParams } from "url";

import URI from "urijs";
import { isBoolean, assign, isEmpty } from "lodash";
import { remote, RemoteOptions } from "webdriverio";

import _ from "../bundle/lodash";
import { Browser, BrowserOpts } from "./browser";
import signalHandler from "../signal-handler";
import { runGroup } from "./history";
Expand All @@ -27,7 +27,7 @@ const headlessBrowserOptions: HeadlessBrowserOptions = {
chrome: {
capabilityName: "goog:chromeOptions",
getArgs: (headlessMode: BrowserConfig["headless"]): string[] => {
const headlessValue = isBoolean(headlessMode) ? "headless" : `headless=${headlessMode}`;
const headlessValue = _.isBoolean(headlessMode) ? "headless" : `headless=${headlessMode}`;

return [headlessValue, "disable-gpu"];
},
Expand Down Expand Up @@ -172,7 +172,7 @@ export class NewBrowser extends Browser {
const versionKeyName =
desiredCapabilities!.browserVersion || sessionEnvFlags.isW3C ? "browserVersion" : "version";

return assign({}, desiredCapabilities, { [versionKeyName]: this.version });
return _.assign({}, desiredCapabilities, { [versionKeyName]: this.version });
}

protected _getGridHost(url: URI): string {
Expand All @@ -186,7 +186,7 @@ export class NewBrowser extends Browser {
}

protected _getQueryParams(query: string): Record<string, string> {
if (isEmpty(query)) {
if (_.isEmpty(query)) {
return {};
}

Expand Down
3 changes: 1 addition & 2 deletions src/browser/screen-shooter/viewport/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use strict";

const _ = require("lodash");

const _ = require("../../../bundle/lodash").default;
const CoordValidator = require("./coord-validator");

module.exports = class Viewport {
Expand Down
2 changes: 1 addition & 1 deletion src/browser/stacktrace/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from "lodash";
import ErrorStackParser from "error-stack-parser";
import type { SetRequired } from "type-fest";
import _ from "../../bundle/lodash";
import logger from "../../utils/logger";
import { softFileURLToPath } from "../../utils/fs";
import { STACK_FRAME_REG_EXP, WDIO_IGNORED_STACK_FUNCTIONS, WDIO_STACK_TRACE_LIMIT } from "./constants";
Expand Down
5 changes: 5 additions & 0 deletions src/bundle/@wdio-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const bundle = require("./cjs");

export const sessionEnvironmentDetector: typeof import("@wdio/utils-cjs").sessionEnvironmentDetector =
bundle.wdioUtils.sessionEnvironmentDetector;
4 changes: 4 additions & 0 deletions src/bundle/cjs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from "./test-transformer";
export * from "./vendors/@wdio/utils-cjs";
export * from "./vendors/glob-extra";
export * from "./vendors/lodash";
Loading

0 comments on commit 1f95fab

Please sign in to comment.