@percy/webdriver-utils
Advanced tools
Comparing version 1.27.0-beta.1 to 1.27.0-beta.2
@@ -92,4 +92,6 @@ import utils from '@percy/sdk-utils'; | ||
async getTiles(headerHeight, footerHeight, fullscreen) { | ||
var _responseValue$metada; | ||
if (!this.driver) throw new Error('Driver is null, please initialize driver with createDriver().'); | ||
log.debug('Starting actual screenshotting phase'); | ||
const dpr = await this.metaData.devicePixelRatio(); | ||
const response = await TimeIt.run('percyScreenshot:screenshot', async () => { | ||
@@ -100,3 +102,3 @@ return await this.browserstackExecutor('percyScreenshot', { | ||
screenshotType: 'singlepage', | ||
scaleFactor: await this.metaData.devicePixelRatio(), | ||
scaleFactor: dpr, | ||
options: this.options | ||
@@ -112,6 +114,7 @@ }); | ||
log.debug('Tiles captured successfully'); | ||
const windowHeight = (responseValue === null || responseValue === void 0 ? void 0 : (_responseValue$metada = responseValue.metadata) === null || _responseValue$metada === void 0 ? void 0 : _responseValue$metada.window_height) || 0; | ||
for (let tileData of tileResponse.sha) { | ||
tiles.push(new Tile({ | ||
statusBarHeight: 0, | ||
navBarHeight: 0, | ||
statusBarHeight: tileResponse.header_height || 0, | ||
navBarHeight: tileResponse.footer_height || 0, | ||
headerHeight, | ||
@@ -124,5 +127,9 @@ footerHeight, | ||
const metadata = { | ||
windowHeight: Math.ceil(windowHeight * dpr) | ||
}; | ||
return { | ||
tiles: tiles, | ||
domInfoSha: tileResponse.dom_sha | ||
domInfoSha: tileResponse.dom_sha, | ||
metadata: metadata | ||
}; | ||
@@ -129,0 +136,0 @@ } |
@@ -135,3 +135,4 @@ import utils from '@percy/sdk-utils'; | ||
clientInfo: [...this.clientInfo].join(' '), | ||
domInfoSha: tiles.domInfoSha | ||
domInfoSha: tiles.domInfoSha, | ||
metadata: tiles.metadata || null | ||
}; | ||
@@ -145,2 +146,10 @@ } | ||
} | ||
async getWindowHeight() { | ||
// execute script and return window height | ||
return await this.driver.executeScript({ | ||
script: 'return window.innerHeight', | ||
args: [] | ||
}); | ||
; | ||
} | ||
async getTiles(headerHeight, footerHeight, fullscreen) { | ||
@@ -160,3 +169,6 @@ if (!this.driver) throw new Error('Driver is null, please initialize driver with createDriver().'); | ||
// TODO: Add Generic support sha for contextual diff for non-automate | ||
domInfoSha: await this.getDomContent() | ||
domInfoSha: await this.getDomContent(), | ||
metadata: { | ||
windowHeight: await this.getWindowHeight() | ||
} | ||
}; | ||
@@ -163,0 +175,0 @@ } |
{ | ||
"name": "@percy/webdriver-utils", | ||
"version": "1.27.0-beta.1", | ||
"version": "1.27.0-beta.2", | ||
"license": "MIT", | ||
@@ -32,6 +32,6 @@ "repository": { | ||
"dependencies": { | ||
"@percy/config": "1.27.0-beta.1", | ||
"@percy/sdk-utils": "1.27.0-beta.1" | ||
"@percy/config": "1.27.0-beta.2", | ||
"@percy/sdk-utils": "1.27.0-beta.2" | ||
}, | ||
"gitHead": "40cdf9c38613ccaf5e3707cd2cd2d2778ffbd5dd" | ||
"gitHead": "bac46d4a3352884d4466cbc543ea599af33536ca" | ||
} |
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
35491
867
+ Added@percy/config@1.27.0-beta.2(transitive)
+ Added@percy/logger@1.27.0-beta.2(transitive)
+ Added@percy/sdk-utils@1.27.0-beta.2(transitive)
- Removed@percy/config@1.27.0-beta.1(transitive)
- Removed@percy/logger@1.27.0-beta.1(transitive)
- Removed@percy/sdk-utils@1.27.0-beta.1(transitive)
Updated@percy/config@1.27.0-beta.2