diff --git a/packages/client/test/client.test.js b/packages/client/test/client.test.js index 00e627bb1..af1a3d7a9 100644 --- a/packages/client/test/client.test.js +++ b/packages/client/test/client.test.js @@ -857,7 +857,8 @@ describe('PercyClient', () => { consideredElementsData: consideredElementsData, domInfoSha: 'abcd=', metadata: { - windowHeight: 1947 + windowHeight: 1947, + screenshotType: 'singlepage' } })).toBeResolved(); @@ -870,7 +871,8 @@ describe('PercyClient', () => { 'consider-elements-data': consideredElementsData, 'dom-info-sha': 'abcd=', metadata: { - windowHeight: 1947 + windowHeight: 1947, + screenshotType: 'singlepage' } }, relationships: { @@ -1006,6 +1008,7 @@ describe('PercyClient', () => { externalDebugUrl: 'https://automate.browserstack.com/builds/acs', metadata: { windowHeight: 1947, + screenshotType: 'fullpage', abc: 123 } }; diff --git a/packages/core/src/config.js b/packages/core/src/config.js index 39a8f68ab..e0f3998cf 100644 --- a/packages/core/src/config.js +++ b/packages/core/src/config.js @@ -532,7 +532,8 @@ export const comparisonSchema = { minimum: 0 }, cliScreenshotStartTime: { type: 'integer', default: 0 }, - cliScreenshotEndTime: { type: 'integer', default: 0 } + cliScreenshotEndTime: { type: 'integer', default: 0 }, + screenshotType: { type: 'string', default: 'singlepage' } } }, tag: { diff --git a/packages/webdriver-utils/src/providers/automateProvider.js b/packages/webdriver-utils/src/providers/automateProvider.js index 9ffa6f3bf..5f84393d7 100644 --- a/packages/webdriver-utils/src/providers/automateProvider.js +++ b/packages/webdriver-utils/src/providers/automateProvider.js @@ -127,11 +127,12 @@ export default class AutomateProvider extends GenericProvider { 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 screenshotType = this.options?.fullPage ? 'fullpage' : 'singlepage'; const response = await TimeIt.run('percyScreenshot:screenshot', async () => { return await this.browserstackExecutor('percyScreenshot', { state: 'screenshot', percyBuildId: this.buildInfo.id, - screenshotType: this.options?.fullPage ? 'fullpage' : 'singlepage', + screenshotType: screenshotType, scaleFactor: dpr, options: this.options }); @@ -156,7 +157,9 @@ export default class AutomateProvider extends GenericProvider { sha: tileData.sha.split('-')[0] // drop build id })); } - const metadata = {}; + const metadata = { + screenshotType: screenshotType + }; return { tiles: tiles, domInfoSha: tileResponse.dom_sha, metadata: metadata }; } diff --git a/packages/webdriver-utils/test/providers/automateProvider.test.js b/packages/webdriver-utils/test/providers/automateProvider.test.js index 103e35f94..37f0515f7 100644 --- a/packages/webdriver-utils/test/providers/automateProvider.test.js +++ b/packages/webdriver-utils/test/providers/automateProvider.test.js @@ -297,7 +297,9 @@ describe('AutomateProvider', () => { }) ], domInfoSha: 'def', - metadata: {} + metadata: { + screenshotType: 'fullpage' + } }; expect(browserstackExecutorSpy).toHaveBeenCalledTimes(1); expect(executeScriptSpy).toHaveBeenCalledTimes(1); @@ -321,7 +323,9 @@ describe('AutomateProvider', () => { }) ], domInfoSha: 'def', - metadata: {} + metadata: { + screenshotType: 'fullpage' + } }; expect(browserstackExecutorSpy).toHaveBeenCalledTimes(1); expect(executeScriptSpy).toHaveBeenCalledTimes(1); @@ -357,7 +361,9 @@ describe('AutomateProvider', () => { }) ], domInfoSha: 'def', - metadata: {} + metadata: { + screenshotType: 'singlepage' + } }; expect(browserstackExecutorSpy).toHaveBeenCalledTimes(1); expect(executeScriptSpy).toHaveBeenCalledTimes(1);