Skip to content

Commit

Permalink
adding support for testcase base grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
prklm10 committed Mar 14, 2024
1 parent abaf3de commit 876a6b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ module.exports = async function percyScreenshot(driver, name, options = {}) {
topScrollviewOffset,
bottomScrollviewOffset,
scrollableId,
sync
sync,
testCase
} = options;
// allow working with or without standalone mode for wdio
if (!driver || typeof driver === 'string') {
Expand Down Expand Up @@ -56,6 +57,7 @@ module.exports = async function percyScreenshot(driver, name, options = {}) {
bottomScrollviewOffset = name.bottomScrollviewOffset;
scrollableId = name.scrollableId;
sync = name.sync;
testCase = name.testCase;
options = name;
}
try {
Expand Down Expand Up @@ -84,6 +86,9 @@ module.exports = async function percyScreenshot(driver, name, options = {}) {
return percyOnAutomateResponse?.body?.data;
}
const provider = ProviderResolver.resolve(driver);
// Only added for browserstack sdk.
let thTestCaseExecutionId = options.thTestCaseExecutionId

Check failure on line 90 in index.js

View workflow job for this annotation

GitHub Actions / Lint

Missing semicolon

const response = await provider.screenshot(name, {
fullscreen,
deviceName,
Expand All @@ -104,7 +109,9 @@ module.exports = async function percyScreenshot(driver, name, options = {}) {
topScrollviewOffset,
bottomScrollviewOffset,
scrollableId,
sync
sync,
testCase,
thTestCaseExecutionId
});
log.debug(`[${name}] -> end`);
return response?.body?.data;
Expand Down
8 changes: 6 additions & 2 deletions percy/providers/appAutomateProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class AppAutomateProvider extends GenericProvider {
topScrollviewOffset,
bottomScrollviewOffset,
scrollableId,
sync
sync,
testCase,
thTestCaseExecutionId
} = {}) {
let response = null;
let error;
Expand Down Expand Up @@ -63,7 +65,9 @@ class AppAutomateProvider extends GenericProvider {
topScrollviewOffset,
bottomScrollviewOffset,
scrollableId,
sync
sync,
testCase,
thTestCaseExecutionId
});
} catch (e) {
error = e;
Expand Down
8 changes: 6 additions & 2 deletions percy/providers/genericProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ class GenericProvider {
customConsiderRegions,
scrollableXpath,
scrollableId,
sync
sync,
testCase,
thTestCaseExecutionId
}) {
fullscreen = fullscreen || false;
sync = sync || null;
Expand Down Expand Up @@ -92,7 +94,9 @@ class GenericProvider {
},
environmentInfo: ENV_INFO,
clientInfo: CLIENT_INFO,
sync
sync,
testCase,
thTestCaseExecutionId
});
}

Expand Down

0 comments on commit 876a6b2

Please sign in to comment.