@applitools/spec-driver-selenium 1.3.4 → 1.3.5
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/dist/spec-driver.js +17 -0
- package/package.json +2 -2
package/dist/spec-driver.js
CHANGED
|
@@ -68,6 +68,7 @@ function transformDriver(driver) {
|
|
|
68
68
|
driver.getExecutor().defineCommand('setWindowPosition', 'POST', '/session/:sessionId/window/current/position');
|
|
69
69
|
driver.getExecutor().defineCommand('performTouch', 'POST', '/session/:sessionId/touch/perform');
|
|
70
70
|
driver.getExecutor().defineCommand('executeCdp', 'POST', '/session/:sessionId/chromium/send_command_and_get_result');
|
|
71
|
+
driver.getExecutor().defineCommand('setOrientation', 'POST', '/session/:sessionId/orientation/');
|
|
71
72
|
if (process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3') {
|
|
72
73
|
driver.getExecutor().defineCommand('switchToParentFrame', 'POST', '/session/:sessionId/frame/parent');
|
|
73
74
|
}
|
|
@@ -301,16 +302,32 @@ exports.waitUntilDisplayed = waitUntilDisplayed;
|
|
|
301
302
|
// #region MOBILE COMMANDS
|
|
302
303
|
async function getBarsHeight(driver) {
|
|
303
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
|
+
}
|
|
304
311
|
const getSystemBarsCommand = new Command('getSystemBars');
|
|
305
312
|
const { statusBar, navigationBar } = process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
306
313
|
? await driver.schedule(getSystemBarsCommand)
|
|
307
314
|
: await driver.execute(getSystemBarsCommand);
|
|
315
|
+
if (orientation.toLowerCase() === 'landscape') {
|
|
316
|
+
await setOrientation(driver, 'landscape');
|
|
317
|
+
}
|
|
308
318
|
return {
|
|
309
319
|
statusBarHeight: statusBar.visible ? statusBar.height : 0,
|
|
310
320
|
navigationBarHeight: navigationBar.visible ? navigationBar.height : 0,
|
|
311
321
|
};
|
|
312
322
|
}
|
|
313
323
|
exports.getBarsHeight = getBarsHeight;
|
|
324
|
+
async function setOrientation(driver, orientation) {
|
|
325
|
+
const { Command } = require('selenium-webdriver/lib/command');
|
|
326
|
+
const setOrientationCommand = new Command('setOrientation').setParameters({ orientation });
|
|
327
|
+
process.env.APPLITOOLS_SELENIUM_MAJOR_VERSION === '3'
|
|
328
|
+
? await driver.schedule(setOrientationCommand)
|
|
329
|
+
: await driver.execute(setOrientationCommand);
|
|
330
|
+
}
|
|
314
331
|
async function getOrientation(driver) {
|
|
315
332
|
const { Command } = require('selenium-webdriver/lib/command');
|
|
316
333
|
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.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"selenium",
|
|
6
6
|
"selenium-webdriver",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@applitools/api-extractor": "^1.2.7",
|
|
66
|
-
"@applitools/bongo": "2.0.
|
|
66
|
+
"@applitools/bongo": "2.0.1",
|
|
67
67
|
"@applitools/scripts": "1.1.0",
|
|
68
68
|
"@applitools/test-utils": "1.3.0",
|
|
69
69
|
"@types/mocha": "^9.0.0",
|