Files
mostlymatter/e2e-tests/playwright/support/visual/percy.ts
Saturnino Abril 20825101a4 Playwright/E2E: Upgrade to playwright@1.43 and its dependencies (#26833)
* chore: upgrade to playwright@1.43 and its dependencies

* fix lint

* attempt to fix lint error on console
2024-04-23 06:58:49 +08:00

22 строки
835 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import percySnapshot from '@percy/playwright';
import testConfig from '@e2e-test.config';
import {TestArgs} from '@e2e-types';
export default async function snapshotWithPercy(name: string, testArgs: TestArgs) {
if (testArgs.browserName === 'chromium' && testConfig.percyEnabled && testArgs.viewport) {
const {page, viewport} = testArgs;
try {
await percySnapshot(page, name, {widths: [viewport.width], minHeight: viewport.height});
} catch (error) {
// log an error for debugging
// eslint-disable-next-line no-console
console.log(`${error}\nIn addition, check if token is properly set by "export PERCY_TOKEN=<change_me>"`);
}
}
}