@applitools/spec-driver-selenium 1.3.3 → 1.3.4

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.
@@ -30,7 +30,7 @@ var __rest = (this && this.__rest) || function (s, e) {
30
30
  return t;
31
31
  };
32
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.build = exports.performAction = exports.getElementText = exports.getElementAttribute = exports.getElementRegion = exports.getOrientation = exports.getBarsHeight = exports.waitUntilDisplayed = exports.scrollIntoView = exports.type = exports.hover = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getCapabilities = exports.getDriverInfo = exports.getCookies = exports.setWindowSize = exports.getWindowSize = exports.findElements = exports.findElement = exports.childContext = exports.parentContext = exports.mainContext = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.transformDriver = exports.isSelector = exports.isElement = exports.isDriver = void 0;
33
+ exports.build = exports.performAction = exports.getElementText = exports.getElementAttribute = exports.getElementRegion = exports.getOrientation = exports.getBarsHeight = exports.waitUntilDisplayed = exports.scrollIntoView = exports.type = exports.hover = exports.click = exports.takeScreenshot = exports.visit = exports.getUrl = exports.getTitle = exports.getCapabilities = exports.getDriverInfo = exports.getCookies = exports.setWindowSize = exports.getWindowSize = exports.waitForSelector = exports.findElements = exports.findElement = exports.childContext = exports.parentContext = exports.mainContext = exports.executeScript = exports.isEqualElements = exports.isStaleElementError = exports.transformSelector = exports.transformDriver = exports.isSelector = exports.isElement = exports.isDriver = void 0;
34
34
  const Selenium = __importStar(require("selenium-webdriver"));
35
35
  const utils = __importStar(require("@applitools/utils"));
36
36
  // #region HELPERS
@@ -150,6 +150,17 @@ async function findElements(driver, selector, parent) {
150
150
  return root.findElements(selector);
151
151
  }
152
152
  exports.findElements = findElements;
153
+ async function waitForSelector(driver, selector, _parent, options) {
154
+ var _a;
155
+ if (((_a = options === null || options === void 0 ? void 0 : options.state) !== null && _a !== void 0 ? _a : 'exists') === 'exist') {
156
+ return driver.wait(Selenium.until.elementLocated(selector), options === null || options === void 0 ? void 0 : options.timeout);
157
+ }
158
+ else if ((options === null || options === void 0 ? void 0 : options.state) === 'visible') {
159
+ const element = await findElement(driver, selector);
160
+ return driver.wait(Selenium.until.elementIsVisible(element), options === null || options === void 0 ? void 0 : options.timeout);
161
+ }
162
+ }
163
+ exports.waitForSelector = waitForSelector;
153
164
  async function getWindowSize(driver) {
154
165
  try {
155
166
  const rect = await driver.manage().window().getRect();
@@ -373,6 +384,9 @@ async function build(env) {
373
384
  if (appium && browser === 'chrome') {
374
385
  desiredCapabilities['appium:chromeOptions'] = { w3c: false };
375
386
  }
387
+ if (browser === 'chrome' && process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
388
+ desiredCapabilities['goog:chromeOptions'] = { w3c: false };
389
+ }
376
390
  const builder = new Selenium.Builder().withCapabilities(desiredCapabilities);
377
391
  if (url && !attach)
378
392
  builder.usingServer(url.href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-selenium",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "keywords": [
5
5
  "selenium",
6
6
  "selenium-webdriver",
@@ -41,14 +41,13 @@
41
41
  "lint": "eslint '**/*.ts'",
42
42
  "build": "ttsc",
43
43
  "test": "mocha ./test/**/*.spec.ts --no-timeouts -r ts-node/register -r @applitools/test-utils/mocha-hooks/docker",
44
- "setup": "yarn chromedriver:setup",
45
- "chromedriver:setup": "chromedriver --port=4444 --url-base=/wd/hub &",
44
+ "setup": "yarn docker:setup",
46
45
  "docker:setup": "node ../scripts/scripts/generate-docker-compose-config.js && docker-compose up -d",
47
46
  "docker:teardown": "docker-compose down",
48
47
  "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",
49
48
  "deps": "bongo deps",
50
49
  "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'",
51
- "gh:publish": "gh workflow run publish.yml --ref $(git rev-parse --abbrev-ref HEAD) -f packages='spec-selenium'",
50
+ "gh:publish": "gh workflow run publish-spec-selenium.yml --ref $(git rev-parse --abbrev-ref HEAD)",
52
51
  "preversion": "bongo preversion",
53
52
  "version": "bongo version",
54
53
  "postversion": "bongo postversion --skip-release-notification"
@@ -59,20 +58,19 @@
59
58
  }
60
59
  },
61
60
  "dependencies": {
62
- "@applitools/types": "1.0.23",
63
- "@applitools/utils": "1.2.11"
61
+ "@applitools/types": "1.3.0",
62
+ "@applitools/utils": "1.2.13"
64
63
  },
65
64
  "devDependencies": {
66
- "@applitools/api-extractor": "^1.2.6",
65
+ "@applitools/api-extractor": "^1.2.7",
66
+ "@applitools/bongo": "2.0.0",
67
67
  "@applitools/scripts": "1.1.0",
68
- "@applitools/sdk-release-kit": "0.13.10",
69
- "@applitools/test-utils": "1.0.10",
68
+ "@applitools/test-utils": "1.3.0",
70
69
  "@types/mocha": "^9.0.0",
71
70
  "@types/node": "^16.10.2",
72
71
  "@types/selenium-webdriver": "^4.0.15",
73
72
  "@typescript-eslint/eslint-plugin": "^4.15.1",
74
73
  "@typescript-eslint/parser": "^4.15.1",
75
- "chromedriver": "^96",
76
74
  "eslint": "^7.9.0",
77
75
  "eslint-config-prettier": "^7.2.0",
78
76
  "eslint-plugin-mocha-no-only": "^1.1.1",
package/types/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export function parentContext(driver: Driver): Promise<Driver>;
13
13
  export function childContext(driver: Driver, element: Element): Promise<Driver>;
14
14
  export function findElement(driver: Driver, selector: Selector, parent?: Element): Promise<Element>;
15
15
  export function findElements(driver: Driver, selector: Selector, parent?: Element): Promise<Array<Element>>;
16
+ export function waitForSelector(driver: Driver, selector: Selector, _parent?: Element, options?: import('@applitools/types').WaitOptions): Promise<Element>;
16
17
  export function getWindowSize(driver: Driver): Promise<import('@applitools/types').Size>;
17
18
  export function setWindowSize(driver: Driver, size: import('@applitools/types').Size): Promise<void>;
18
19
  export function getCookies(driver: Driver, context?: boolean): Promise<Array<import('@applitools/types').Cookie>>;
package/CHANGELOG.md DELETED
@@ -1,46 +0,0 @@
1
- # Change Log
2
-
3
- ## Unreleased
4
-
5
-
6
- ## 1.3.3 - 2022/1/12
7
-
8
- - add support of selenium 4 `ShadowRoot` objects
9
-
10
- ## 1.3.2 - 2022/1/12
11
-
12
- - no changes
13
-
14
- ## 1.3.1 - 2022/1/12
15
-
16
- - use chromedriver instead of selenium docker container for testing
17
- - fix tests for selenium 3
18
- - fix `getCapabilities` for selenium 3
19
- - updated to @applitools/types@1.0.23 (from 1.0.20)
20
- - updated to @applitools/utils@1.2.11 (from 1.2.4)
21
-
22
- ## 1.3.0 - 2021/11/17
23
-
24
- - implement `getCapabilities` and `getBarsHeight` instead of `getDriverInfo`
25
- - updated to @applitools/types@1.0.20 (from 1.0.19)
26
-
27
- ## 1.2.0 - 2021/11/10
28
-
29
- - updated to @applitools/types@1.0.19 (from 1.0.15)
30
- - updated to @applitools/utils@1.2.4 (from 1.2.3)
31
-
32
- ## 1.1.1 - 2021/10/20
33
-
34
- - install prettier
35
-
36
- ## 1.1.0 - 2021/10/12
37
-
38
- - change default selenium version
39
-
40
- ## 1.0.2 - 2021/10/12
41
-
42
- - handle non-w3c appium driver
43
-
44
- ## 1.0.1 - 2021/10/12
45
-
46
- - spec driver implementation for selenium framework