@applitools/spec-driver-selenium 1.3.5 → 1.3.6

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.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;
33
+ exports.build = exports.performAction = exports.getElementText = exports.getElementAttribute = exports.getElementRegion = exports.getOrientation = exports.setOrientation = exports.getBarsSize = 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
@@ -300,27 +300,19 @@ async function waitUntilDisplayed(driver, selector, timeout) {
300
300
  exports.waitUntilDisplayed = waitUntilDisplayed;
301
301
  // #endregion
302
302
  // #region MOBILE COMMANDS
303
- async function getBarsHeight(driver) {
303
+ async function getBarsSize(driver) {
304
304
  const { Command } = require('selenium-webdriver/lib/command');
305
- const orientation = await getOrientation(driver);
306
- // when calling getSystemBars when orientation is landscape it seems that appium is buggy and returns the wrong dimensions
307
- // therefore, we set the orientation to portrait to get the correct systemBars dimensions and we flip back to landscape
308
- if (orientation.toLowerCase() === 'landscape') {
309
- await setOrientation(driver, 'portrait');
310
- }
311
305
  const getSystemBarsCommand = new Command('getSystemBars');
312
306
  const { statusBar, navigationBar } = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
313
307
  ? await driver.schedule(getSystemBarsCommand)
314
308
  : await driver.execute(getSystemBarsCommand);
315
- if (orientation.toLowerCase() === 'landscape') {
316
- await setOrientation(driver, 'landscape');
317
- }
318
309
  return {
319
310
  statusBarHeight: statusBar.visible ? statusBar.height : 0,
320
311
  navigationBarHeight: navigationBar.visible ? navigationBar.height : 0,
312
+ navigationBarWidth: navigationBar.visible ? navigationBar.width : 0,
321
313
  };
322
314
  }
323
- exports.getBarsHeight = getBarsHeight;
315
+ exports.getBarsSize = getBarsSize;
324
316
  async function setOrientation(driver, orientation) {
325
317
  const { Command } = require('selenium-webdriver/lib/command');
326
318
  const setOrientationCommand = new Command('setOrientation').setParameters({ orientation });
@@ -328,6 +320,7 @@ async function setOrientation(driver, orientation) {
328
320
  ? await driver.schedule(setOrientationCommand)
329
321
  : await driver.execute(setOrientationCommand);
330
322
  }
323
+ exports.setOrientation = setOrientation;
331
324
  async function getOrientation(driver) {
332
325
  const { Command } = require('selenium-webdriver/lib/command');
333
326
  const getOrientationCommand = new Command('getOrientation');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/spec-driver-selenium",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "keywords": [
5
5
  "selenium",
6
6
  "selenium-webdriver",
@@ -58,14 +58,14 @@
58
58
  }
59
59
  },
60
60
  "dependencies": {
61
- "@applitools/types": "1.3.0",
62
- "@applitools/utils": "1.2.13"
61
+ "@applitools/types": "1.3.2",
62
+ "@applitools/utils": "1.2.14"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@applitools/api-extractor": "^1.2.7",
66
- "@applitools/bongo": "2.0.1",
66
+ "@applitools/bongo": "2.0.3",
67
67
  "@applitools/scripts": "1.1.0",
68
- "@applitools/test-utils": "1.3.0",
68
+ "@applitools/test-utils": "1.3.1",
69
69
  "@types/mocha": "^9.0.0",
70
70
  "@types/node": "^16.10.2",
71
71
  "@types/selenium-webdriver": "^4.0.15",
package/types/index.d.ts CHANGED
@@ -28,7 +28,8 @@ export function hover(driver: Driver, element: Element | Selector): Promise<void
28
28
  export function type(driver: Driver, element: Element | Selector, keys: string): Promise<void>;
29
29
  export function scrollIntoView(driver: Driver, element: Element | Selector, align: boolean): Promise<void>;
30
30
  export function waitUntilDisplayed(driver: Driver, selector: Selector, timeout: number): Promise<void>;
31
- export function getBarsHeight(driver: Driver): Promise<{ statusBarHeight: number; navigationBarHeight: number; }>;
31
+ export function getBarsSize(driver: Driver): Promise<{ statusBarHeight: number; navigationBarHeight: number; navigationBarWidth: number; }>;
32
+ export function setOrientation(driver: Driver, orientation: import('@applitools/types').ScreenOrientation): Promise<void>;
32
33
  export function getOrientation(driver: Driver): Promise<"portrait" | "landscape">;
33
34
  export function getElementRegion(_driver: Driver, element: Element): Promise<import('@applitools/types').Region>;
34
35
  export function getElementAttribute(_driver: Driver, element: Element, attr: string): Promise<string>;