Skip to content

Commit

Permalink
Fixing TestCases
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit3200 committed Dec 3, 2024
1 parent cce1e0b commit 92bb0c6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ async function currentURL(driver, options) {
const percySnapshot = async function percySnapshot(driver, name, options) {
if (!driver) throw new Error('An instance of the selenium driver object is required.');
if (!name) throw new Error('The `name` argument is required.');
if (!(await module.exports.isPercyEnabled())) throw new Error('Percy is not running, disabling snapshots.');
if (!(await module.exports.isPercyEnabled())) {
if (process.env.PERCY_RAISE_ERROR === 'true') {
throw new Error('Percy is not running, disabling snapshots.');
} else {
return;
}
}
if (utils.percy?.type === 'automate') {
throw new Error('Invalid function call - percySnapshot(). Please use percyScreenshot() function while using Percy with Automate. For more information on usage of percyScreenshot, refer https://www.browserstack.com/docs/percy/integrate/functional-and-visual');
}
Expand Down Expand Up @@ -187,7 +193,13 @@ module.exports.percyScreenshot = async function percyScreenshot(driver, name, op

if (!driver) throw new Error('An instance of the selenium driver object is required.');
if (!name) throw new Error('The `name` argument is required.');
if (!(await module.exports.isPercyEnabled())) throw new Error('Percy is not running, disabling snapshots.');
if (!(await module.exports.isPercyEnabled())) {
if (process.env.PERCY_RAISE_ERROR === 'true') {
throw new Error('Percy is not running, disabling snapshots.');
} else {
return;
}
}
if (utils.percy?.type !== 'automate') {
throw new Error('Invalid function call - percyScreenshot(). Please use percySnapshot() function for taking screenshot. percyScreenshot() should be used only while using Percy with Automate. For more information on usage of PercySnapshot(), refer doc for your language https://www.browserstack.com/docs/percy/integrate/overview');
}
Expand Down

0 comments on commit 92bb0c6

Please sign in to comment.