@percy/webdriver-utils
Advanced tools
Comparing version 1.27.4-beta.3 to 1.27.4-beta.4
@@ -13,2 +13,11 @@ import utils from '@percy/sdk-utils'; | ||
} | ||
static requestPostOptions(command) { | ||
return { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json;charset=utf-8' | ||
}, | ||
body: JSON.stringify(command) | ||
}; | ||
} | ||
async getCapabilites() { | ||
@@ -42,9 +51,3 @@ return await Cache.withCache(Cache.caps, this.sessionId, async () => { | ||
} | ||
const options = { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json;charset=utf-8' | ||
}, | ||
body: JSON.stringify(command) | ||
}; | ||
const options = Driver.requestPostOptions(command); | ||
const baseUrl = `${this.executorUrl}/session/${this.sessionId}/execute/sync`; | ||
@@ -65,12 +68,6 @@ const response = JSON.parse((await request(baseUrl, options)).body); | ||
async findElement(using, value) { | ||
const options = { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json;charset=utf-8' | ||
}, | ||
body: JSON.stringify({ | ||
using, | ||
value | ||
}) | ||
}; | ||
const options = Driver.requestPostOptions({ | ||
using, | ||
value | ||
}); | ||
const baseUrl = `${this.executorUrl}/session/${this.sessionId}/element`; | ||
@@ -77,0 +74,0 @@ const response = JSON.parse((await request(baseUrl, options)).body); |
@@ -26,2 +26,3 @@ import ProviderResolver from './providers/providerResolver.js'; | ||
comparisonData.metadata.cliScreenshotEndTime = Date.now(); | ||
log.debug(`[${snapshotName}] : Comparison Data: ${JSON.stringify(comparisonData)}`); | ||
return comparisonData; | ||
@@ -28,0 +29,0 @@ } catch (e) { |
@@ -52,3 +52,3 @@ import Cache from '../util/cache.js'; | ||
const data = await this.driver.executeScript({ | ||
script: 'return [(window.screen.width * window.devicePixelRatio).toString(), (window.screen.height * window.devicePixelRatio).toString()];', | ||
script: 'return [parseInt(window.screen.width * window.devicePixelRatio).toString(), parseInt(window.screen.height * window.devicePixelRatio).toString()];', | ||
args: [] | ||
@@ -55,0 +55,0 @@ }); |
@@ -171,6 +171,2 @@ import utils from '@percy/sdk-utils'; | ||
const orientation = (_ref = this.metaData.orientation() || automateCaps.deviceOrientation) === null || _ref === void 0 ? void 0 : _ref.toLowerCase(); | ||
// for android window size only constitutes of browser viewport, hence adding nav / status / url bar heights | ||
[this.header, this.footer] = await this.getHeaderFooter(deviceName, osVersion, browserName); | ||
height = this.metaData.device() && (osName === null || osName === void 0 ? void 0 : osName.toLowerCase()) === 'android' ? height + this.header + this.footer : height; | ||
return { | ||
@@ -177,0 +173,0 @@ name: deviceName, |
@@ -5,7 +5,2 @@ import utils from '@percy/sdk-utils'; | ||
import Driver from '../driver.js'; | ||
import Cache from '../util/cache.js'; | ||
const { | ||
request | ||
} = utils; | ||
const DEVICES_CONFIG_URL = 'https://storage.googleapis.com/percy-utils/devices.json'; | ||
const log = utils.logger('webdriver-utils:genericProvider'); | ||
@@ -136,5 +131,2 @@ export default class GenericProvider { | ||
const orientation = this.metaData.orientation(); | ||
[this.header, this.footer] = await this.getHeaderFooter(); | ||
// for android window size only constitutes of browser viewport, hence adding nav / status / url bar heights | ||
height = this.metaData.osName() === 'android' ? height + this.header + this.footer : height; | ||
return { | ||
@@ -243,10 +235,2 @@ name: this.metaData.deviceName(), | ||
} | ||
async getHeaderFooter(deviceName, osVersion, browserName) { | ||
// passing 0 as key, since across different pages and tests, this config will remain same | ||
const devicesConfig = await Cache.withCache(Cache.devicesConfig, 0, async () => { | ||
return (await request(DEVICES_CONFIG_URL)).body; | ||
}); | ||
let deviceKey = `${deviceName}-${osVersion}`; | ||
return devicesConfig[deviceKey] ? devicesConfig[deviceKey][browserName] ? [devicesConfig[deviceKey][browserName].header, devicesConfig[deviceKey][browserName].footer] : [0, 0] : [0, 0]; | ||
} | ||
} |
{ | ||
"name": "@percy/webdriver-utils", | ||
"version": "1.27.4-beta.3", | ||
"version": "1.27.4-beta.4", | ||
"license": "MIT", | ||
@@ -32,6 +32,6 @@ "repository": { | ||
"dependencies": { | ||
"@percy/config": "1.27.4-beta.3", | ||
"@percy/sdk-utils": "1.27.4-beta.3" | ||
"@percy/config": "1.27.4-beta.4", | ||
"@percy/sdk-utils": "1.27.4-beta.4" | ||
}, | ||
"gitHead": "e560f5df1637d30722f8d1d7e6eae9cf99ede2dd" | ||
"gitHead": "4aaa7b217f60ed9ce953fa8c788f4061a7689459" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33545
828
89
3
11
0
72
+ Added@percy/config@1.27.4-beta.4(transitive)
+ Added@percy/logger@1.27.4-beta.4(transitive)
+ Added@percy/sdk-utils@1.27.4-beta.4(transitive)
- Removed@percy/config@1.27.4-beta.3(transitive)
- Removed@percy/logger@1.27.4-beta.3(transitive)
- Removed@percy/sdk-utils@1.27.4-beta.3(transitive)
Updated@percy/config@1.27.4-beta.4