mirror of
https://github.com/vector-im/element-web.git
synced 2025-12-02 16:01:10 +01:00
* Update dependency @storybook/test-runner to ^0.24.0 * Storybook migration Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add missing file Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update yarn.lock Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Make jest happier Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/*
|
|
Copyright 2025 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import { waitForPageReady, TestRunnerConfig } from "@storybook/test-runner";
|
|
import { toMatchImageSnapshot } from "jest-image-snapshot";
|
|
|
|
const customSnapshotsDir = `${process.cwd()}/playwright/snapshots/`;
|
|
const customReceivedDir = `${process.cwd()}/playwright/received/`;
|
|
|
|
const config: TestRunnerConfig = {
|
|
setup() {
|
|
expect.extend({ toMatchImageSnapshot });
|
|
},
|
|
async postVisit(page, context) {
|
|
await waitForPageReady(page);
|
|
|
|
// If you want to take screenshot of multiple browsers, use
|
|
// page.context().browser().browserType().name() to get the browser name to prefix the file name
|
|
const image = await page.screenshot();
|
|
expect(image).toMatchImageSnapshot({
|
|
customSnapshotsDir,
|
|
customSnapshotIdentifier: `${context.id}-${process.platform}`,
|
|
storeReceivedOnFailure: true,
|
|
customReceivedDir,
|
|
customDiffDir: customReceivedDir,
|
|
});
|
|
},
|
|
};
|
|
|
|
export default config;
|