Files
mostlymatter/e2e-tests/playwright/support/visual/percy.ts
Saturnino Abril 6746857ee7 MM-52642 CLD-6352 MM-54007 Prepare setup for Playwright pipeline (#24647)
* pipeline(playwright): prepare setup for playwright

* feedback address

* clean up readme

* Fix docker-compose command and definition for dashboard

* fix the dashboard

* ignore dashboard when formatting

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Co-authored-by: Mario Vitale <mvitale1989@hotmail.com>
2023-10-14 07:02:32 +08:00

24 строки
923 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) {
if (!testConfig.percyToken) {
// eslint-disable-next-line no-console
console.error('Error: Token is missing! Please set using: "export PERCY_TOKEN=<change_me>"');
}
const {page, viewport} = testArgs;
// Ignore since percy is using Playwright.Page
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
await percySnapshot(page, name, {widths: [viewport.width], minHeight: viewport.height});
}
}