From f2552ee9e976247841f7135123ae19a866a8e369 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Mon, 24 Jun 2024 13:42:41 -0400 Subject: [PATCH] Apply Replay Cypress config --- cypress.config.ts | 11 ++++++++++- cypress/support/e2e.ts | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cypress.config.ts b/cypress.config.ts index d4548d76c..0011482a4 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -7,6 +7,7 @@ import codeCoverageTask from "@cypress/code-coverage/task"; import { devServer } from "@cypress/vite-dev-server"; import { defineConfig } from "cypress"; import { mergeConfig, loadEnv } from "vite"; +import { plugin as replayPlugin, wrapOn } from "@replayio/cypress"; dotenv.config({ path: ".env.local" }); dotenv.config(); @@ -97,9 +98,17 @@ module.exports = defineConfig({ viewportHeight: 1000, viewportWidth: 1280, experimentalRunAllSpecs: true, - setupNodeEvents(on, config) { + setupNodeEvents(cyOn, config) { const testDataApiEndpoint = `${config.env.apiUrl}/testData`; + const on = wrapOn(cyOn); + + replayPlugin(on, config, { + upload: true, // automatically upload your replays to DevTools + + apiKey: process.env.REPLAY_API_KEY, + }); + const queryDatabase = ({ entity, query }, callback) => { const fetchData = async (attrs) => { const { data } = await axios.get(`${testDataApiEndpoint}/${entity}`); diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 2b2058088..02ed121c1 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -1,5 +1,6 @@ // @ts-check import "@cypress/code-coverage/support"; +import "@replayio/cypress/support"; import "./commands"; import { isMobile } from "./utils";