cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.01k stars 3.18k forks source link

Console output with suggested test from selector (record/wizard mode) #73

Closed rblalock closed 3 years ago

rblalock commented 9 years ago

Easiest way to explain is a demo: https://db.tt/skFnp7gz

In other words, when you start interacting with your page, a mode that outputs a potential test for what you did, so a user can copy / paste it in to their test.

brian-mann commented 9 years ago

Right I agree, one thing that's still mentally taxing is having to manually traverse the DOM to create commands.

I think to really solve this we need something like in Chrome Dev Tools where you click the icon in the top left hand corner which highlights elements as you mouse over them. That way you just hover over the thing you want to interact with.

Cypress could be smart enough to figure out whether to use a selector approach (cy.get) or a text content approach (cy.contains). It could even go one step further by actually issuing action commands as you naturally interact with your app. So cy.click when you click, cy.dblclick when you double click. Even cy.drag when you drag.

I would call this "record" mode or "VCR" mode. I experimented with this awhile ago, and its very feasible. It will just take probably 2-3 weeks of work. Might be something we do once we hire more FT people.

I'll leave this issue open because it's something we will most likely do.

rblalock commented 9 years ago

Yeh a "record" mode toggle would make sense since it's def. something you wouldn't always want on.

kohesion commented 7 years ago

We want to be able to build tests as quickly as possible.

We believe that we could go faster if there was a multi-part point and click DOM selection feature.

I envision ability to click a "record" button, select the 3 elements I care about. At this point, placeholders are put in generated stub script (to be copy pasted?) and then I can describe the interaction with code later on.

brian-mann commented 7 years ago

Right. This is definitely something on our roadmap and we've experimented with it. It's definitely not easy to do, and will take a lot of work to build, but there's likely an MVP we can come up with to get this going in the right direction. Currently we won't have bandwidth to start on this for a little while. I'd be happy to do a proposal and come up with a comp of what I think is a good starting place. Hopefully the community could contribute to that.

filiphric commented 7 years ago

If you are looking for an easy way to find your selector, you should try this killer chrome extension. Could not imagine mi life with cypress without it. @brian-mann if you are thinking of implementing a recording functionality, I think this might be an interesting approach

jonsteelman commented 7 years ago

Record option would accelerate getting started with Cypress, a great jumpstarter.

yashutanna commented 6 years ago

Hey guys!

firstly thank you for this project - really like it.

Is there any update about the work in this space? I am currently looking to set my team up with a quick way to start end to end testing.

basically I want to give the platform to our product owner who is not very technical, allow them to install a chrome/firefox extension that allows them to record their interactions. I want to import those interactions and split them as a suite of fixtures. This is functionality that the new Selenium IDE provides.

If this feature is deprioritised for the time being - does anyone know of a decent alternative?

another thing that could work is exporting the .side project provided by Sel IDE and importing it into fixtures on cypress?

jennifer-shehane commented 6 years ago

This feature is still in the 'proposal' stage. No work has been done on this feature as of yet. We're a small team and as much as we'd love to work on everything, we have to choose what to work on based on a multitude of things.

dwelle commented 6 years ago

Just came across checkly/puppeteer-recorder which is a browser extension that records your interaction on a web page and generates commands for puppeteer.

I thought striving for something similar would be ideal, what do you think?

aurolle commented 5 years ago

This could really speed up the adoption of cypress. I will look around for it

vlafranca commented 5 years ago

I found that there is a chrome extension on the market but it need to improve : https://github.com/iGitScor/cypress-recorder https://chrome.google.com/webstore/detail/cypress-scenario-recorder/fmpgoobcionmfneadjapdabmjfkmfekb

mussrya commented 5 years ago

Would love this as a feature. It would make such a difference to perform quick tests and really make cypress stand out from the range of other testing frameworks out there as they all seem to lack this capability

PeterMurdoch commented 5 years ago

+1 for this feature

flotwig commented 5 years ago

Workaround

For anyone looking, there's a semi-popular Chrome extension that records Cypress tests directly from your actions:

https://chrome.google.com/webstore/detail/cypress-scenario-recorder/fmpgoobcionmfneadjapdabmjfkmfekb

I haven't used it myself, but it ought to meet the use case in the OP here.

chauey commented 5 years ago

@flotwig someone already mentioned above

meeladdawood commented 5 years ago

@jennifer-shehane Is there an update on this feature or a prototype that people can play with?

ken-can-code commented 5 years ago

@rblalock @jennifer-shehane There is a new Cypress Recorder extension (different from the one posted above) that we have created that we feel may be closer to what you are asking for than the previously posted one above.

https://chrome.google.com/webstore/detail/cypress-recorder/glcapdcacdfkokcmicllhcjigeodacab

Please feel free to let us know what you think.

jimpriest commented 4 years ago

I wonder if another option would be to build an Cypress exporter for Selenium IDE?

danielkroon commented 4 years ago

Didn't' such a recorder function already existed in the first version of Cypress?

buremba commented 4 years ago

Ideally, something like this would be great for starters: image The photo is taken from https://github.com/qawolf/qawolf

mingyixu commented 4 years ago

There is a new Cypress Recorder extension : https://chrome.google.com/webstore/detail/alibaba-scenario-recorder/inodhkekikcaapcjhcepfiplgeoffjpb

mbolotov commented 4 years ago

Cypress Support Pro plugin for IntelliJ platform now supports scenario recording, see this video overview: https://www.youtube.com/watch?v=FgnHYwmguFI

aalexgabi commented 4 years ago

Since #8615 was closed as a duplicate of this, I will post here.

This is a workflow proposal. I don't have time now to write a full specification. I will improve the specification if there is enough interest.

This is my attempt to make tests extremely easy to write and maintain. Debugging is already pretty good with cypress. The proposed workflow is different way of working with tests but please hear me out.

The proposed workflow:

Example test case:

Actions like "login" and "remove user photo" can be reused.

What are your thoughts on this? Why this is not the way we do testing today? Don't get me wrong you will still need to write code for some assertions and for simulating some interactions but this solution does not force you to write code if you don't have to.

abanta1212 commented 4 years ago

Hi. I am new to Cypress and this forum. I've tried the Cypress Recorder, but when I copy and paste it in Visual Studio Code and try to run it, I get errors. It says, 'The following error originated from your test code, not from Cypress. This usually happens when you accidentally write commands outside an it(....) test.'

Has anybody experienced this? Thanks.

cypress-bot[bot] commented 3 years ago

The code for this is done in cypress-io/cypress#9542, but has yet to be released. We'll update this issue and reference the changelog when it's released.

cypress-bot[bot] commented 3 years ago

Released in 6.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v6.3.0, please open a new issue.

jennifer-shehane commented 3 years ago

Cypress Studio provides a visual way to generate tests within the Test Runner, by recording interactions against the application under test. Cypress Studio is an experimental feature that can be enabled by setting experimentalStudio to true in your configuration, cypress.json by default.

If you're encountering a bug with the Cypress Studio, please open a new issue.

We would ❤️ to hear any other feedback about the Cypress Studio here: https://on.cypress.io/studio-beta