Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: example of an embedded player #77

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { debuggerPlugin } = require('cypress-debugger');

module.exports = defineConfig({
e2e: {
baseUrl: 'https://todomvc.com/examples/backbone',
baseUrl: 'https://todomvc.com/examples/backbone/dist/',
specPattern: 'cypress/e2e/*.spec.js',
supportFile: 'cypress/support/e2e.ts',
setupNodeEvents(on, config) {
Expand Down
4 changes: 4 additions & 0 deletions apps/web/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@radix-ui/react-tooltip": "^1.0.5",
"class-variance-authority": "^0.5.2",
"clsx": "^1.2.1",
"cypress": "^12.8.1",
"cypress": "^12.17.4",
"cypress-debugger": "*",
"lodash": "^4.17.21",
"lucide-react": "^0.162.0",
Expand Down
33 changes: 25 additions & 8 deletions apps/web/src/components/PayloadHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestExecutionResult } from 'cypress-debugger';
import { Loader2 } from 'lucide-react';
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import { useCypressEventsContext } from '../context/cypressEvents';
import { useHttpArchiveContext } from '../context/httpArchiveEntries';
import { useReplayerContext } from '../context/replayer';
Expand All @@ -26,13 +26,16 @@ function PayloadHandler() {
)
);

const handleDataChange = (payload: TestExecutionResult | null) => {
setEvents(payload?.cy || []);
setReplayerData(payload?.rr || []);
setHttpArchiveLog(payload?.har || null);
setMeta(payload?.meta ?? null);
setBrowserLogs(payload?.browserLogs || null);
};
const handleDataChange = useCallback(
(payload: TestExecutionResult | null) => {
setEvents(payload?.cy || []);
setReplayerData(payload?.rr || []);
setHttpArchiveLog(payload?.har || null);
setMeta(payload?.meta ?? null);
setBrowserLogs(payload?.browserLogs || null);
},
[setEvents, setReplayerData, setHttpArchiveLog, setMeta, setBrowserLogs]
);

const handleFileChange = ({
filename,
Expand Down Expand Up @@ -71,6 +74,20 @@ function PayloadHandler() {
}
}, [queryParam]); // eslint-disable-line

useEffect(() => {
if (typeof window === 'undefined') return;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if ((window as any).trace) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
// handleDataChange((window as any).trace);
// parse base64
const str = (window as any).trace;
const payload = JSON.parse(str);
handleDataChange(payload);
setOrigin('trace');
}
}, []);

if (loading) {
return (
<div className="flex items-center justify-center h-full">
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading