Coder Social home page Coder Social logo

replay-cli's Introduction

Replay CLI

The Replay CLI provides packages for interacting with Replay to record, manage, and upload replays, as well as upload sourcemaps.

To use Replay with a Desktop Browser, visit replay.io to download and install.

Packages

  • /replay CLI for viewing + uploading recordings
  • /cypress Beta Plugin for recording and capturing metadata for Cypress tests.
  • /playwright Beta Plugin for recording and capturing metadata for Playwright tests.
  • /puppeteer Experimental Plugin for recording Puppeteer tests.
  • /node Experimental CLI for recording Node.
  • /sourcemap-upload CLI for uploading sourcemaps to Replay servers to use when viewing replays.
  • /sourcemap-upload-webpack-plugin Webpack plugin for sourcemap-upload

Developing

  1. yarn
  2. yarn run bootstrap

That should create an installed version of the package in dist within each directory in packages.

Testing

You can run the unit tests for all of the packages with earthly +test. You can run the unit tests for any individual package with yarn run test within that package.

Deploying

  1. Adjust package.json#version in all packages that you want to release
  2. yarn release

replay-cli's People

Contributors

andarist avatar bhackett1024 avatar bvaughn avatar callingmedic911 avatar ceceliacreates avatar crutchcorn avatar domiii avatar github-actions[bot] avatar hbenl avatar jaril avatar jasonlaster avatar jazzdan avatar jcmorrow avatar klochek avatar markerikson avatar miriambudayr avatar noriste avatar ryanjduffy avatar simeonc avatar snyk-bot avatar toshok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

replay-cli's Issues

Replay CLI can fail if the recordings file gets too big

@bvaughn ran into this this morning when trying to debug some Playwright tests. It's a little unclear why he would have had so many replays exactly, but anyways, he got this when trying to run npx replay ls:

$ replay ls
node:buffer:593
    slice: (buf, start, end) => buf.utf8Slice(start, end),
                                    ^

Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (node:buffer:593:37)
    at Buffer.toString (node:buffer:811:14)
    at Object.readFileSync (node:fs:497:41)
    at readRecordingFile (/Users/bvaughn/.nvm/versions/node/v16.13.2/lib/node_modules/@replayio/replay/src/main.js:34:13)
    at readRecordings (/Users/bvaughn/.nvm/versions/node/v16.13.2/lib/node_modules/@replayio/replay/src/main.js:65:17)
    at listAllRecordings (/Users/bvaughn/.nvm/versions/node/v16.13.2/lib/node_modules/@replayio/replay/src/main.js:225:22)

ESM Error when trying to start replay CLI

I installed replay on my windows machine using pnpm i -g replayio

trying to execute:

replayio record https://first.replay.io

getting:

D:\Program Files (x86)\pnpm\global\5\.pnpm\[email protected][email protected]\node_modules\replayio\dist\utils\formatting.js:7
const strip_ansi_1 = __importDefault(require("strip-ansi"));
                                     ^

Error [ERR_REQUIRE_ESM]: require() of ES Module D:\Program Files (x86)\pnpm\global\5\.pnpm\[email protected]\node_modules\strip-ansi\index.js from D:\Program Files (x86)\pnpm\global\5\.pnpm\[email protected][email protected]\node_modules\replayio\dist\utils\formatting.js not supported.
Instead change the require of index.js in D:\Program Files (x86)\pnpm\global\5\.pnpm\[email protected][email protected]\node_modules\replayio\dist\utils\formatting.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (D:\Program Files (x86)\pnpm\global\5\.pnpm\[email protected][email protected]\node_modules\replayio\dist\utils\formatting.js:7:38) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.10.0

Error when using the `reporter` argument

Getting the following error message when running the npx playwright test --project replay-firefox --reporter=@replayio/playwright/reporter,line command:

Error: node_modules/@replayio/playwright/reporter.js: reporter file must export a single class.
    at errorWithFile (/Users/jaibhagat/hashicorp/nomad/e2e/ui/node_modules/@playwright/test/lib/util.js:189:10)
    at Loader.loadReporter (/Users/jaibhagat/hashicorp/nomad/e2e/ui/node_modules/@playwright/test/lib/loader.js:180:67)
    at Runner._createReporter (/Users/jaibhagat/hashicorp/nomad/e2e/ui/node_modules/@playwright/test/lib/runner.js:132:37)
    at Runner.runAllTests (/Users/jaibhagat/hashicorp/nomad/e2e/ui/node_modules/@playwright/test/lib/runner.js:167:22)
    at runTests (/Users/jaibhagat/hashicorp/nomad/e2e/ui/node_modules/@playwright/test/lib/cli.js:175:18)
    at Command.<anonymous> (/Users/jaibhagat/hashicorp/nomad/e2e/ui/node_modules/@playwright/test/lib/cli.js:74:7)

Support uploading unusable recordings

Unusable recordings aren't truly unusable, they just hit some operation that we won't be able to replay and we stopped generating recording data afterwards. We should have an option to the CLI to force these to upload so that people can still see the available portion of the recording.

Cypress package should install Replay browsers

Currently, when installing @replayio/cypress in a project then running the tests, the Replay Firefox browser is not found.

Error:

spawn /Users/cecelia/.replay/playwright/firefox/Nightly.app/Contents/MacOS/firefox ENOENT
Error: spawn /Users/cecelia/.replay/playwright/firefox/Nightly.app/Contents/MacOS/firefox ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Additionally, running ls on the browser path indicates no file or directory found, implying the Replay Browser is not installed.

I tested the Replayable Playwright project on my other computer and adding @replayio/playwright to the project then npm install did install the browser. I was able to ls the path and see it installed. So, this is a Cypress-specific problem.

I did notice that the install script for Cypress looks different than for Playwright.

https://github.com/replayio/replay-cli/blob/main/packages/playwright/src/install.ts

https://github.com/replayio/replay-cli/blob/main/packages/cypress/src/install.ts

Yarn Install Error: "workspaces config expects an Array"

I am running into this issue when upgrade my packages to the latest version

Exit code: 1

Command: npm run if:dist -- node ./bin/replayio-cypress first-run

Arguments: 

Directory: /Users/stephenakaeze/Desktop/guide/packages/app/node_modules/@replayio/cypress

Output:
TypeError: workspaces config expects an Array
    at getError (/usr/local/lib/node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js:66:24)
    at getPatterns (/usr/local/lib/node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js:36:11)
    at mapWorkspaces (/usr/local/lib/node_modules/npm/node_modules/@npmcli/map-workspaces/lib/index.js:82:20)
    at Config.loadLocalPrefix (/usr/local/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:676:34)
    at async Config.loadProjectConfig (/usr/local/lib/node_modules/npm/node_modules/@npmcli/config/lib/index.js:607:5)```

What is happening here?

Workspaces

I added npm workspaces + lerna.

The next step is to add replay-cli as a dependency to playwright. I think we first need to publish these packages to the replayio org.

Add upload-latest command

We have a view-latest to upload the latest recording and launch a browser to view it but it's also useful for CI/remote dev environments to upload the latest and just output the URL for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.