Skip to content

Commit

Permalink
percySnapshot as named export as well
Browse files Browse the repository at this point in the history
  • Loading branch information
rishigupta1599 committed Jun 17, 2024
1 parent 333c279 commit 116b9aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ENV_INFO = `${playwrightPkg.name}/${playwrightPkg.version}`;
const log = utils.logger('playwright');

// Take a DOM snapshot and post it to the snapshot endpoint
module.exports = async function percySnapshot(page, name, options) {
const percySnapshot = async function percySnapshot(page, name, options) {
if (!page) throw new Error('A Playwright `page` object is required.');
if (!name) throw new Error('The `name` argument is required.');
if (!(await utils.isPercyEnabled())) return;
Expand Down Expand Up @@ -42,7 +42,7 @@ module.exports = async function percySnapshot(page, name, options) {
};

// Takes Playwright screenshot with Automate
module.exports.percyScreenshot = async function percyScreenshot(page, name, options) {
const percyScreenshot = async function percyScreenshot(page, name, options) {
if (!page) throw new Error('A Playwright `page` object is required.');
if (!name) throw new Error('The `name` argument is required.');
if (!(await utils.isPercyEnabled())) return;
Expand Down Expand Up @@ -73,5 +73,8 @@ module.exports.percyScreenshot = async function percyScreenshot(page, name, opti
}
};

module.exports = percySnapshot;
module.exports.percySnapshot = percySnapshot;
module.exports.percyScreenshot = percyScreenshot;
module.exports.CLIENT_INFO = CLIENT_INFO;
module.exports.ENV_INFO = ENV_INFO;

0 comments on commit 116b9aa

Please sign in to comment.