Export Cypress Tests from Google Chrome DevTools' Recorder

Overview

@cypress/chrome-recorder

GitHub tag (latest by date) Commitizen friendly

This repo provides tools to export Cypress Tests from Google Chrome DevTools' Recordings

Installation

$ npm install -g @cypress/chrome-recorder

Usage

Via CLI

To use the interactive CLI, run:

$ npx @cypress/chrome-recorder

The CLI will prompt you to enter the path of the directory or file that you would like to modify as well as a path to write the generated Cypress test to.

If you prefer to enter paths via the CLI, you can run the following command to export individual recordings:

$ npx @cypress/chrome-recorder <relative path to target test file>

or for folders containing multiple recordings:

$ npx @cypress/chrome-recorder <relative path to target test folder>/*.json

CLI Options

Option Description
-f, --force Bypass Git safety checks and force exporter to run
-d, --dry Dry run (no changes are made to files)
-p, --print Print transformed files to stdout, useful for development

Note: Currently the output will be written to cypress/integration. If you do not have that folder, create it or install Cypress by running yarn add -D cypress or npm install --save-dev cypress in your project.

Via Import

import { cypressStringifyChromeRecording } from '@cypress/chrome-recorder';

const stringifiedContent = await cypressStringifyChromeRecording(
  recordingContent
);

return stringifiedContent;

License

license

This project is licensed under the terms of the MIT license.

Comments
  • Issue writing the output to cypress/integration

    Issue writing the output to cypress/integration

    I have created a login.json file through chrome recorder and copied it to cypress\downloads. Now when I run "npx @cypress/chrome-recorder cypress\downloads\login.json" OR "npx @cypress/chrome-recorder cypress\downloads\login.json --print" .

    I am getting the error "There was an issue writing the output to cypress/integration. Please check that it exists and try again.". image

    Can anybody help me on this. Thanks

    stage: needs info 
    opened by Puneet-humm 6
  • Support copy single step as Cypress script

    Support copy single step as Cypress script

    Chrome 109 launches a new "Copy a single step as script" feature.

    How to test

    • In a recording, right click on a step, select copy as [your extension] script option.

    Action required

    • Your extension needs to implement the stringifyStep API for this feature to work.
    • You can test this feature with the latest Chrome Canary
    recorder-copy
    opened by jecfish 3
  • feat(hover): add support for hover

    feat(hover): add support for hover

    A recorder hover event will be mapped to cy.get("#element").trigger("mouseover");.

    I'm aware of this is not a 1-1 match as trigger event in cypress only works for element with javascript function (e.g. mouseover). For element with native css:hover, it doesn't trigger the UI changes.

    Closes #29.

    Refer to:

    • https://docs.cypress.io/api/commands/hover#Add-as-a-custom-command
    • https://github.com/cypress-io/cypress/issues/10

    Test pages:

    released 
    opened by jecfish 3
  • feat: Update the output path from .spec to .cy

    feat: Update the output path from .spec to .cy

    User facing changelog

    Changes the output files type from .spec to .cy as per Cypress v10 changes.

    How has the user experience changed?

    No change on user action. Any new files generated will output as filename.cy instead of filename.spec.

    released 
    opened by jecfish 3
  • feat: add supported keys for keyDown step.

    feat: add supported keys for keyDown step.

    This PR adds support for the keyDown step type. It enables support for special sequences found in both DevTools Recorder and the cy.type documentation.

    Fixes #14.

    released 
    opened by admah 3
  • feat: add assertion for navigation event after click. update various libraries.

    feat: add assertion for navigation event after click. update various libraries.

    Add ability to handle assertedEvents that happen after a user clicks a link.

    Output is:

    cy.get("{selector}").click();
    cy.location("href").should("eq", "{url}");
    
    released 
    opened by admah 2
  • feat: Update the output path from .spec to .cy for v10

    feat: Update the output path from .spec to .cy for v10

    User facing changelog

    Changes the output files type from .spec to .cy as per Cypress v10 changes.

    How has the user experience changed?

    No change. Any new files generated will output as filename.cy instead of filename.spec.

    opened by jecfish 2
  • feat(click): add support for dblclick and rightclick.

    feat(click): add support for dblclick and rightclick.

    When a click-type event has button: 'secondary', the output will be cy.get("_element_").rightclick();.

    A doubleClick event will become cy.get("_element_").dblclick();.

    Closes #20.

    released 
    opened by admah 2
  • Support double and right clicks

    Support double and right clicks

    Hey there! 👋

    We have extended the Schema in @puppeteer/replay with some new attributes for the click step and a new step type called double click:

    1. https://github.com/puppeteer/replay/blob/main/src/Schema.ts#L66
    2. https://github.com/puppeteer/replay/blob/main/src/Schema.ts#L87

    It'd be great to update the cypress recorder to support those. The feature will be shipping in Chromium 103.

    enhancement released 
    opened by OrKoN 2
  • Errors - Cypress does not currently handle migrating step type

    Errors - Cypress does not currently handle migrating step type

    I tried doing a fairly simple recording, or so I thought.

    Went into our ERP and added a part. I ran the tool, and got this:

    Cypress does not currently handle migrating step type: keyDown
    Cypress does not currently handle migrating step type: keyUp
    ... 
    
    

    It does seem to generate some files, with the text that I had entered, but the errors kind of threw me. I think this would nearly aways generate such errors if there is more to the recorded session than statically clicking on a page, so some mention of what this error means, and when or if it can be ignored would be good.

    My guess is this can be ignored?

    opened by jgwinner 2
  • Not able to convert files in a directory: illegal operation on a directory

    Not able to convert files in a directory: illegal operation on a directory

    1. I have a recordings folder with a user flow json file in it.
    2. Run npx @cypress/chrome-recorder recordings
    3. Hit error EISDIR: illegal operation on a directory, read [NOT OK]

    Expect all user flow JSON in the recordings folder are converted successfully.

    Run npx @cypress/chrome-recorder recordings/order-a-coffee.json to convert a single JSON file is successful without error [OK].

    Screen Shot 2022-04-26 at 4 19 42 PM released 
    opened by jecfish 2
  • Automate the Cypress Chrome Recorder publishing

    Automate the Cypress Chrome Recorder publishing

    Currently the repo doesn't handle publishing. We need to generate and add this manifest.json file as part of the yarn build step:

    {
      "manifest_version": 3,
      "version": "1.1.0",
      "name": "Cypress Chrome Recorder",
      "description": "Cypress extension for DevTools that allows you to export tests directly from the Recorder panel.",
      "permissions": [],
      "devtools_page": "DevToolsPlugin.html",
      "content_security_policy": {
        "extension_pages": "script-src 'self'; object-src 'self'"
      },
      "minimum_chrome_version": "104.0.0.0",
      "icons": {
        "16": "icon_16x16.png",
        "32": "icon_32x32.png",
        "48": "icon_48x48.png",
        "128": "icon_128x128.png"
      }
    }
    

    Ideally we could then make the publishing automated as part of CI if possible as well

    opened by jordanpowell88 0
  • Change action on select generates non-functioning cypress code

    Change action on select generates non-functioning cypress code

    When clicking on and choosing a option within a select, the code generated on cypress export creates cy.get('element').type('value of option')

    I believe when the element is of type select/option and the event is change we should do a cy.get('element').select('value or label of option selected') instead.

    We simple select a value from a dropdown, export it, run the test in cypress and the select does not work properly.

    opened by cjhudson101 0
  • Error reported in output file

    Error reported in output file

    environment: Windows system step: when execute npx @cypress/chrome-recorder D:\workspace\UIAutoTest\cypress811\cypressuinew\cypress\e2e\recording\record.json -o=D:\workspace\UIAutoTest\cypress811\cypressuinew\cypress\e2e\recording error detail: Running Cypress Chrome Recorder on D:\workspace\UIAutoTest\cypress811\cypressuinew\cypress\e2e\recording\record.json There was an issue writing the output to D:\workspace\UIAutoTest\cypress811\cypressuinew\cypress\e2e\recording. Please check that it exists and try again.

    opened by ChrisSaturday 0
  • Add support for xpath and text selector

    Add support for xpath and text selector

    DevTools Recorder support text and XPath selector from Chrome 108 onwards. I am wondering if there are similar selector in Cypress?

    Here is the example step's json.

    {
          "type": "click",
          "target": "main",
          "selectors": [
            [
              "aria/Proceed to checkout"
            ],
            [
              "[data-test=checkout]"
            ],
            [
              "xpath///*[@data-test=\"checkout\"]"
            ],
            [
              "text/Total: $0.00"
            ]
          ]
        }
    
    Screen Shot 2022-10-16 at 9 35 19 AM
    opened by jecfish 0
  • SEC-229 | Initial Commit of Snyk Git Actions

    SEC-229 | Initial Commit of Snyk Git Actions

    This PR adds security controls in support of vulnerability scanning for third party packages as well as first party code.

    Snyk is already implemented, but these actions bring the Cypress Tools into alignment with our vulnerability management strategy. The actions that this pull request introduces send the scan results back to the Snyk dashboard. The Snyk dashboard is then coupled with branch protection rules that dictate our levels of protection by blocking PRs where this git action fails as a check.

    Once the solution is fully implemented, the failures you see on the PR related to this would prevent merges of the code to the 'develop' and 'master' branches. The exit status it failed with today indicates that there is a critical vulnerability in the code base. This PR aims to increase this type of visibility.

    opened by cypresschris 1
Releases(v2.3.0)
Owner
Cypress.io
Fast, easy and reliable testing for anything that runs in a browser
Cypress.io
Generate WebdriverIO Tests from Google Chrome DevTools Recordings.

WebdriverIO Chrome Recorder This repo provide tools to convert JSON user flows from Google Chrome DevTools Recorder to WebdriverIO test scripts progra

WebdriverIO 10 Sep 28, 2022
Based on Google Chrome recorder, implement UI interface capture and notify the result to the target mailbox

chrome-recoder-crawler README-CN Modify the .js file exported by Google Chrome recorder. By default, the innerText property of the node operated in th

wudu 4 Oct 18, 2022
Cypress commands are asynchronous. It's a common pattern to use a then callback to get the value of a cypress command

cypress-thenify Rationale Cypress commands are asynchronous. It's a common pattern to use a then callback to get the value of a cypress command. Howev

Mikhail Bolotov 15 Oct 2, 2022
Access the internals of React components from Cypress end-to-end tests

cypress-react-app-actions Access the internals of React components from Cypress end-to-end tests Read Access React Components From Cypress E2E Tests a

Gleb Bahmutov 5 May 12, 2022
A simple application to estuding tests end-to-end in Angular with Cypress

Conhecimento sobre testes End to End (ponta a ponta) Sobre o Cypress: Testes feitos do sistema para ver como um usuário se comportaria, esses testes é

Kauã Werle 3 Jun 15, 2022
SAP Community Code Challenge: This repository contains an empty OpenUI5 application and end-to-end tests written with wdi5. Take part in the challenge and develop an app that passes the tests.

SAP Community Code Challenge - UI5 The change log describes notable changes in this package. Description This repository is the starting point for the

SAP Samples 8 Oct 24, 2022
⏱ A Google Chrome extension for keeping track of who is talking during Google Meets

Am I Talking A Lot? ⏱ A Google Chrome extension for keeping track of who is talking during Google Meets Features Tracks talking time for each particip

Sean McPherson 8 Oct 5, 2022
Google-Drive-Directory-Index | Combining the power of Cloudflare Workers and Google Drive API will allow you to index your Google Drive files on the browser.

?? Google-Drive-Directory-Index Combining the power of Cloudflare Workers and Google Drive will allow you to index your Google Drive files on the brow

Aicirou 127 Jan 2, 2023
Chrome extension to generate tests for solidjs.

Solid Test Recorder Automated Chrome extension to generate unit/integration tests for solidjs Features Generates UI tests which relay on vitest and ms

Chris Czopp 14 Dec 16, 2022
基于React开发的新一代web调试工具,支持React组件调试,类似于Chrome Devtools。A Lightweight, Easy To Extend Web Debugging Tool Build With React

English | 简体中文 基于React开发的移动web调试工具 更新日志 简单易用 功能全面 易扩展 高性能 使用cdn方式,一键接入 类Chrome devtools, 内嵌React开发者工具,支持日志,网络,元素,代理,存储,性能等, 具有更好的网络捕获能力和丰富的日志展现形式 暴露内部

腾讯TNTWeb前端团队 236 Dec 25, 2022
The universal DevTools for LIFF (WebView) browser

LIFF Inspector ?? The universal DevTools for LIFF (WebView) browser LIFF Inspector is the official DevTools for LIFF(LNE Frontend Framework) that is i

LINE 34 Dec 19, 2022
API and CLI tool to fetch and query Chome DevTools heap snapshots.

Puppeteer Heap Snapshot Capture heap snapshots and query the snapshot for objects matching a set of properties. Read more about it in this blog post.

Adrian Cooney 858 Jan 3, 2023
React-query devtools for swr

React-query devtools for swr

Erfan Khadivar 12 Aug 14, 2022
🚀Starter project with Angular 13, Ngx-admin, NestJS, Nx Workspace, Jest, Cypress, ESLint & Prettier 🚀

Angular 13 + Ngx-admin + NestJs + NX Starter project with Angular 13, Ngx-admin, NestJs, Nx Workspace, Jest, Cypress, ESLint & Prettier Features ✅ Ang

Wilfried 49 Jan 4, 2023
Projeto de exemplo para realização de testes de integração (API) utilizando o Cypress

Projeto de exemplo para realização de testes de integração (API) utilizando o Cypress

Robson Agapito Correa 14 Nov 28, 2022
A cypress plugin for projects using @azure/msal-browser

A cypress plugin for projects using @azure/msal-browser

Intility 15 Aug 11, 2022
A repository of a Cypress testing demo

adeoweb-cypress-demo This is a repository of a Cypress testing demo. Based on adeoweb.biz website case study. What is this talk We will ?? live-code a

Eimantas 3 Mar 24, 2022
Run cucumber/gherkin-syntaxed specs with Cypress

cypress-cucumber-preprocessor This preprocessor aims to provide a developer experience and behavior similar to that of Cucumber, to Cypress. Installat

Klaveness Digital A/S 6 Dec 7, 2022