@applitools/spec-driver-selenium 1.5.47 → 1.5.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ ## [1.5.49](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-selenium@1.5.48...js/spec-driver-selenium@1.5.49) (2023-06-21)
4
+
5
+
6
+ ### Dependencies
7
+
8
+ * @applitools/driver bumped from 1.12.2 to 1.12.3
9
+
10
+
11
+ ## [1.5.48](https://github.com/applitools/eyes.sdk.javascript1/compare/js/spec-driver-selenium-v1.5.47...js/spec-driver-selenium@1.5.48) (2023-06-13)
12
+
13
+
14
+ ### Dependencies
15
+
16
+ * update some dependencies
17
+ * The following workspace dependencies were updated
18
+ * dependencies
19
+ * @applitools/driver bumped from 1.12.1 to 1.12.2
20
+ * @applitools/utils bumped from 1.3.37 to 1.4.0
package/dist/index.js CHANGED
@@ -27,11 +27,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const spec = __importStar(require("./spec-driver"));
30
- if (!process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION) {
30
+ if (!process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION) {
31
31
  try {
32
- const { version } = require('selenium-webdriver/package.json');
32
+ const version = process.env.APPLITOOLS_FRAMEWORK_VERSION || require('selenium-webdriver/package.json').version;
33
33
  const [major] = version.split('.', 1);
34
- process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION = major;
34
+ process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION = major;
35
35
  }
36
36
  catch {
37
37
  // NOTE: ignore error
@@ -41,7 +41,7 @@ function isByHashSelector(selector) {
41
41
  return byHash.includes(Object.keys(selector)[0]);
42
42
  }
43
43
  async function executeCustomCommand(driver, command) {
44
- return process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
44
+ return process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3'
45
45
  ? driver.schedule(command)
46
46
  : driver.execute(command);
47
47
  }
@@ -77,7 +77,7 @@ function transformDriver(driver) {
77
77
  driver.getExecutor().defineCommand('getCurrentContext', 'GET', '/session/:sessionId/context');
78
78
  driver.getExecutor().defineCommand('getContexts', 'GET', '/session/:sessionId/contexts');
79
79
  driver.getExecutor().defineCommand('switchToContext', 'POST', '/session/:sessionId/context');
80
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
80
+ if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
81
81
  driver.getExecutor().defineCommand('switchToParentFrame', 'POST', '/session/:sessionId/frame/parent');
82
82
  }
83
83
  return driver;
@@ -143,7 +143,7 @@ async function mainContext(driver) {
143
143
  }
144
144
  exports.mainContext = mainContext;
145
145
  async function parentContext(driver) {
146
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
146
+ if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
147
147
  await executeCustomCommand(driver, new command_1.Command('switchToParentFrame'));
148
148
  return driver;
149
149
  }
@@ -283,7 +283,7 @@ async function click(driver, element) {
283
283
  exports.click = click;
284
284
  async function hover(driver, element) {
285
285
  const resolvedElement = isSelector(element) ? await findElement(driver, element) : element;
286
- if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
286
+ if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
287
287
  const { ActionSequence } = require('selenium-webdriver');
288
288
  const action = new ActionSequence(driver);
289
289
  await action.mouseMove(resolvedElement).perform();
@@ -360,11 +360,18 @@ const browserOptionsNames = {
360
360
  * When wiring the spec-driver up to an SDK and calling this function, if you don't have the same dev deps
361
361
  * installed in the SDK, then this function will error.
362
362
  */
363
- async function build({ selenium, ...env }) {
363
+ async function build(env) {
364
364
  var _a;
365
- const { Builder } = (selenium !== null && selenium !== void 0 ? selenium : require('selenium-webdriver'));
365
+ let frameworkPath;
366
+ try {
367
+ frameworkPath = require.resolve('selenium-webdriver', { paths: [`${process.cwd()}/node_modules`] });
368
+ }
369
+ catch {
370
+ frameworkPath = 'selenium-webdriver';
371
+ }
372
+ const { Builder } = require(frameworkPath);
366
373
  const parseEnv = require('@applitools/test-utils/src/parse-env');
367
- const { browser, capabilities, url, attach, proxy, configurable = true, appium = false, args = [], headless, } = parseEnv({ ...env, legacy: (_a = env.legacy) !== null && _a !== void 0 ? _a : process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3' });
374
+ const { browser, capabilities, url, attach, proxy, configurable = true, appium = false, args = [], headless, } = parseEnv({ ...env, legacy: (_a = env.legacy) !== null && _a !== void 0 ? _a : process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3' });
368
375
  const desiredCapabilities = { ...capabilities };
369
376
  if (configurable) {
370
377
  const browserOptionsName = browserOptionsNames[browser || desiredCapabilities.browserName];
@@ -385,7 +392,7 @@ async function build({ selenium, ...env }) {
385
392
  if (appium) {
386
393
  desiredCapabilities['appium:chromeOptions'] = { w3c: false, ...desiredCapabilities['appium:chromeOptions'] };
387
394
  }
388
- else if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
395
+ else if (process.env.APPLITOOLS_FRAMEWORK_MAJOR_VERSION === '3') {
389
396
  desiredCapabilities['goog:chromeOptions'] = { w3c: false, ...desiredCapabilities['goog:chromeOptions'] };
390
397
  }
391
398
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-selenium",
3
- "version": "1.5.47",
3
+ "version": "1.5.49",
4
4
  "keywords": [
5
5
  "selenium",
6
6
  "selenium-webdriver",
@@ -25,9 +25,6 @@
25
25
  "name": "Applitools Team",
26
26
  "email": "team@applitools.com"
27
27
  },
28
- "aliases": [
29
- "spec-selenium"
30
- ],
31
28
  "exports": {
32
29
  ".": {
33
30
  "types": "./types/index.d.ts",
@@ -41,29 +38,19 @@
41
38
  "types"
42
39
  ],
43
40
  "scripts": {
44
- "lint": "node ../../node_modules/.bin/eslint '**/*.ts'",
45
- "build": "node ../../node_modules/.bin/tspc --project ./tsconfig.build.json",
46
- "test": "node ../../node_modules/.bin/mocha './test/**/*.spec.ts' -r @applitools/test-utils/mocha-hooks/docker --exit",
47
- "test:sanity": "yarn test",
48
- "setup": "yarn docker:setup",
49
- "docker:setup": "node ../../scripts/generate-docker-compose-config.js && docker-compose up -d",
50
- "docker:teardown": "docker-compose down",
51
- "upgrade:framework": "if [ ! -z $APPLITOOLS_SELENIUM_MAJOR_VERSION ]; then packagejson=`cat package.json`; yarn upgrade --no-lockfile selenium-webdriver@$APPLITOOLS_SELENIUM_MAJOR_VERSION; echo \"$packagejson\" > package.json; fi",
52
- "deps": "bongo deps",
53
- "gh:test": "gh workflow run test.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium spec-selenium@3' -f links='types utils test-utils'",
54
- "gh:publish": "gh workflow run publish-spec-selenium.yml --ref $(git rev-parse --abbrev-ref HEAD)",
55
- "preversion": "bongo preversion",
56
- "version": "bongo version",
57
- "postversion": "bongo postversion"
41
+ "lint": "run --top-level eslint '**/*.ts'",
42
+ "build": "run --top-level tspc --project ./tsconfig.build.json",
43
+ "test": "run --top-level mocha './test/**/*.spec.ts' -r @applitools/test-utils/mocha-hooks/docker --exit",
44
+ "setup": "run --top-level browsers:setup",
45
+ "up:framework": "run --top-level add-silent selenium-webdriver"
58
46
  },
59
47
  "dependencies": {
60
- "@applitools/driver": "1.12.1",
61
- "@applitools/utils": "1.3.37"
48
+ "@applitools/driver": "1.12.3",
49
+ "@applitools/utils": "1.4.0"
62
50
  },
63
51
  "devDependencies": {
64
52
  "@applitools/api-extractor": "^1.2.21",
65
- "@applitools/bongo": "4.0.0",
66
- "@applitools/test-utils": "1.5.17",
53
+ "@applitools/test-utils": "^1.5.17",
67
54
  "@types/node": "^12.20.55",
68
55
  "@types/selenium-webdriver": "^4.1.1",
69
56
  "nock": "^13.2.9",
@@ -74,5 +61,8 @@
74
61
  },
75
62
  "engines": {
76
63
  "node": ">=12.13.0"
64
+ },
65
+ "publishConfig": {
66
+ "access": "public"
77
67
  }
78
- }
68
+ }
package/types/index.d.ts CHANGED
@@ -43,7 +43,7 @@ export function getSystemBars(driver: Driver): Promise<{ statusBar: {
43
43
  width: number;
44
44
  }; }>;
45
45
  export function setOrientation(driver: Driver, orientation: import('@applitools/driver').ScreenOrientation): Promise<void>;
46
- export function getOrientation(driver: Driver): Promise<"landscape" | "portrait">;
46
+ export function getOrientation(driver: Driver): Promise<"portrait" | "landscape">;
47
47
  export function getElementRegion(_driver: Driver, element: Element): Promise<{
48
48
  x: number;
49
49
  y: number;
@@ -55,9 +55,9 @@ export function performAction(driver: Driver, steps: Array<any>): Promise<void>;
55
55
  export function getCurrentWorld(driver: Driver): Promise<string>;
56
56
  export function getWorlds(driver: Driver): Promise<Array<string>>;
57
57
  export function switchWorld(driver: Driver, name: string): Promise<void>;
58
- export function build(__0: any): Promise<[import('selenium-webdriver').WebDriver & { __applitoolsBrand?: undefined; } & { __serverUrl?: undefined | string; }, () => Promise<void>]>;
58
+ export function build(env: any): Promise<[import('selenium-webdriver').WebDriver & { __applitoolsBrand?: undefined; } & { __serverUrl?: undefined | string; }, () => Promise<void>]>;
59
59
  export type Driver = import('selenium-webdriver').WebDriver & { __applitoolsBrand?: undefined; };
60
60
  export type Element = import('selenium-webdriver').WebElement & { __applitoolsBrand?: undefined; };
61
61
  export type ShadowRoot = { 'shadow-6066-11e4-a52e-4f735466cecf': string; };
62
- export type Selector = (import('selenium-webdriver').By | import('selenium-webdriver').RelativeBy | import('selenium-webdriver').ByHash | { using: string; value: string; } | ((webdriver: import('selenium-webdriver').WebDriver) => Promise<any>)) & { __applitoolsBrand?: undefined; };
62
+ export type Selector = (import('selenium-webdriver').By | import('selenium-webdriver').ByHash | import('selenium-webdriver').RelativeBy | { using: string; value: string; } | ((webdriver: import('selenium-webdriver').WebDriver) => Promise<any>)) & { __applitoolsBrand?: undefined; };
63
63
  export type SpecType = { driver: Driver; context: Driver; element: Element; selector: Selector; };