@percy/appium-app
Advanced tools
Comparing version 2.0.6 to 2.0.7
10
index.js
@@ -32,3 +32,5 @@ const { AppiumDriver } = require('./percy/driver/driverWrapper'); | ||
sync, | ||
testCase | ||
testCase, | ||
androidScrollAreaPercentage, | ||
scrollSpeed | ||
} = options; | ||
@@ -62,2 +64,4 @@ // allow working with or without standalone mode for wdio | ||
testCase = name.testCase; | ||
androidScrollAreaPercentage = name.androidScrollAreaPercentage; | ||
scrollSpeed = name.scrollSpeed; | ||
options = name; | ||
@@ -116,3 +120,5 @@ } | ||
testCase, | ||
thTestCaseExecutionId | ||
thTestCaseExecutionId, | ||
androidScrollAreaPercentage, | ||
scrollSpeed | ||
}); | ||
@@ -119,0 +125,0 @@ log.debug(`[${name}] -> end`); |
{ | ||
"name": "@percy/appium-app", | ||
"description": "Appium client library for visual testing with Percy", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Perceptual Inc.", |
@@ -14,29 +14,36 @@ const { GenericProvider } = require('./genericProvider'); | ||
static supports(driver) { | ||
return driver.remoteHostname.includes(process.env.AA_DOMAIN || 'browserstack'); | ||
return driver.remoteHostname.includes( | ||
process.env.AA_DOMAIN || 'browserstack' | ||
); | ||
} | ||
async screenshot(name, { | ||
fullscreen, | ||
deviceName, | ||
orientation, | ||
statusBarHeight, | ||
navigationBarHeight, | ||
fullPage, | ||
screenLengths, | ||
ignoreRegionXpaths, | ||
ignoreRegionAccessibilityIds, | ||
ignoreRegionAppiumElements, | ||
customIgnoreRegions, | ||
considerRegionXpaths, | ||
considerRegionAccessibilityIds, | ||
considerRegionAppiumElements, | ||
customConsiderRegions, | ||
scrollableXpath, | ||
topScrollviewOffset, | ||
bottomScrollviewOffset, | ||
scrollableId, | ||
sync, | ||
testCase, | ||
thTestCaseExecutionId | ||
} = {}) { | ||
async screenshot( | ||
name, | ||
{ | ||
fullscreen, | ||
deviceName, | ||
orientation, | ||
statusBarHeight, | ||
navigationBarHeight, | ||
fullPage, | ||
screenLengths, | ||
ignoreRegionXpaths, | ||
ignoreRegionAccessibilityIds, | ||
ignoreRegionAppiumElements, | ||
customIgnoreRegions, | ||
considerRegionXpaths, | ||
considerRegionAccessibilityIds, | ||
considerRegionAppiumElements, | ||
customConsiderRegions, | ||
scrollableXpath, | ||
topScrollviewOffset, | ||
bottomScrollviewOffset, | ||
scrollableId, | ||
sync, | ||
testCase, | ||
thTestCaseExecutionId, | ||
androidScrollAreaPercentage, | ||
scrollSpeed | ||
} = {} | ||
) { | ||
let response = null; | ||
@@ -71,3 +78,5 @@ let error; | ||
testCase, | ||
thTestCaseExecutionId | ||
thTestCaseExecutionId, | ||
androidScrollAreaPercentage, | ||
scrollSpeed | ||
}); | ||
@@ -78,3 +87,8 @@ } catch (e) { | ||
} finally { | ||
await this.percyScreenshotEnd(name, response?.body?.link, sync, `${error}`); | ||
await this.percyScreenshotEnd( | ||
name, | ||
response?.body?.link, | ||
sync, | ||
`${error}` | ||
); | ||
} | ||
@@ -103,3 +117,8 @@ return response; | ||
async percyScreenshotEnd(name, percyScreenshotUrl, sync, statusMessage = null) { | ||
async percyScreenshotEnd( | ||
name, | ||
percyScreenshotUrl, | ||
sync, | ||
statusMessage = null | ||
) { | ||
return await TimeIt.run('percyScreenshotEnd', async () => { | ||
@@ -122,7 +141,19 @@ try { | ||
// Override this for AA specific optimizations | ||
async getTiles(fullscreen, fullPage, screenLengths, scrollableXpath, topScrollviewOffset, bottomScrollviewOffset, scrollableId) { | ||
async getTiles( | ||
fullscreen, | ||
fullPage, | ||
screenLengths, | ||
scrollableXpath, | ||
topScrollviewOffset, | ||
bottomScrollviewOffset, | ||
scrollableId, | ||
androidScrollAreaPercentage, | ||
scrollSpeed | ||
) { | ||
// Override AA optimizations | ||
if (this.isDisableRemoteUpload()) { | ||
if (fullPage === true) { | ||
log.warn('Full page screenshots are only supported when "PERCY_DISABLE_REMOTE_UPLOADS" is not set'); | ||
log.warn( | ||
'Full page screenshots are only supported when "PERCY_DISABLE_REMOTE_UPLOADS" is not set' | ||
); | ||
} | ||
@@ -141,24 +172,31 @@ return await super.getTiles(fullscreen, fullPage, screenLengths); | ||
// Take screenshots via browserstack executor | ||
const response = await TimeIt.run('percyScreenshot:screenshot', async () => { | ||
return await this.browserstackExecutor('percyScreenshot', { | ||
state: 'screenshot', | ||
percyBuildId: utils.percy?.build?.id, | ||
screenshotType, | ||
projectId, | ||
scaleFactor: await this.metadata.scaleFactor(), | ||
options: { | ||
numOfTiles: screenLengths || 4, | ||
deviceHeight: (await this.metadata.screenSize()).height, | ||
scollableXpath: scrollableXpath || null, | ||
topScrollviewOffset: topScrollviewOffset || 0, | ||
bottomScrollviewOffset: bottomScrollviewOffset || 0, | ||
scrollableId: scrollableId || null, | ||
FORCE_FULL_PAGE: process.env.FORCE_FULL_PAGE === 'true' | ||
} | ||
}); | ||
}); | ||
const response = await TimeIt.run( | ||
'percyScreenshot:screenshot', | ||
async () => { | ||
return await this.browserstackExecutor('percyScreenshot', { | ||
state: 'screenshot', | ||
percyBuildId: utils.percy?.build?.id, | ||
screenshotType, | ||
projectId, | ||
scaleFactor: await this.metadata.scaleFactor(), | ||
options: { | ||
numOfTiles: screenLengths || 4, | ||
deviceHeight: (await this.metadata.screenSize()).height, | ||
scollableXpath: scrollableXpath || null, | ||
topScrollviewOffset: topScrollviewOffset || 0, | ||
bottomScrollviewOffset: bottomScrollviewOffset || 0, | ||
scrollableId: scrollableId || null, | ||
FORCE_FULL_PAGE: process.env.FORCE_FULL_PAGE === 'true', | ||
androidScrollAreaPercentage: androidScrollAreaPercentage || null, | ||
scrollSpeed: scrollSpeed || null | ||
} | ||
}); | ||
} | ||
); | ||
if (!response.success) { | ||
throw new Error('Failed to get screenshots from App Automate.' + | ||
' Check dashboard for error.'); | ||
throw new Error( | ||
'Failed to get screenshots from App Automate.' + | ||
' Check dashboard for error.' | ||
); | ||
} | ||
@@ -170,11 +208,13 @@ | ||
JSON.parse(response.result).forEach(tileData => { | ||
tiles.push(new Tile({ | ||
statusBarHeight: statBarHeight, | ||
navBarHeight, | ||
fullscreen, | ||
headerHeight: tileData.header_height, | ||
footerHeight: tileData.footer_height, | ||
sha: tileData.sha.split('-')[0] // drop build id | ||
})); | ||
JSON.parse(response.result).forEach((tileData) => { | ||
tiles.push( | ||
new Tile({ | ||
statusBarHeight: statBarHeight, | ||
navBarHeight, | ||
fullscreen, | ||
headerHeight: tileData.header_height, | ||
footerHeight: tileData.footer_height, | ||
sha: tileData.sha.split('-')[0] // drop build id | ||
}) | ||
); | ||
}); | ||
@@ -187,3 +227,7 @@ | ||
let options = args ? { action, arguments: args } : { action }; | ||
return JSON.parse(await this.driver.execute(`browserstack_executor: ${JSON.stringify(options)}`)); | ||
return JSON.parse( | ||
await this.driver.execute( | ||
`browserstack_executor: ${JSON.stringify(options)}` | ||
) | ||
); | ||
} | ||
@@ -190,0 +234,0 @@ |
@@ -164,2 +164,5 @@ # @percy/appium-app | ||
- `right` (int): Right coordinate of the consider region. | ||
- `androidScrollAreaPercentage` - Percentage Area to scroll for android devices. (should be between 0 and 100) | ||
- `scrollSpeed` - Scroll speed in pixel/second. (Should be between 0 and 5000) | ||
### Creating Percy on automate build | ||
@@ -178,2 +181,2 @@ Note: Automate Percy Token starts with `auto` keyword. The command can be triggered using `exec` keyword. | ||
Refer to docs here: [Percy on Automate](https://docs.percy.io/docs/integrate-functional-testing-with-visual-testing) | ||
Refer to docs here: [Percy on Automate](https://www.browserstack.com/docs/percy/integrate/functional-and-visual) |
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
53386
1292
181