cypress-io / cypress

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

Open in IDE doesn't work in version 13.13.0 #29820

Closed bluebellbus closed 2 weeks ago

bluebellbus commented 2 months ago

Current behavior

Version: 13.13.0 IDE: Version: 1.91.0 (user setup) Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286 Date: 2024-07-01T18:52:22.949Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0

Results: Nothing happens. Note that I rolled back to cypress version 13.12.0 and the open in IDE link worked fine. Re-installed 13.13.0 and it was again broken.

Desired behavior

open the js file in visual code

Test code to reproduce

I cannot provide this

Cypress Version

13.13.0

Node version

Node.js: 20.9.0

Operating System

OS: Windows_NT x64 10.0.22631

Debug Logs

No response

Other

No response

jennifer-shehane commented 2 months ago

@bluebellbus Which button exactly are you clicking in the UI? We have several of these buttons. Can you provide a screenshot?

jennifer-shehane commented 2 months ago

I was not able to recreate this with the Open in IDE buttons in the test runner when the test was running with some simple tests. I'm also using VS Code.

bluebellbus commented 2 months ago

@jennifer-shehane This button with title of the test spec was the button I'm referring to. Not sure if this is relevant, but I am not running cypress cloud.

2024-07-09_13h04_14

jennifer-shehane commented 2 months ago

There was an update to the launch-editor in 13.13.0 here: https://github.com/cypress-io/cypress/pull/29770 so its possible there is a regression introduced. Maybe it's isolated to Windows. @MikeMcC399 Are you able to recreate in windows?

MikeMcC399 commented 2 months ago

@bluebellbus

What is the output of the following commands in the situation where "Open in IDE" does not work for you?

node -v
npx cypress version

You have reported an issue with Cypress 13.3.0, however the discussion is about the later version Cypress 13.13.0 it seems.

Can you confirm that you are running Windows 11 23H2?

@jennifer-shehane

I can't reproduce this issue in Cypress 13.13.0.

MikeMcC399 commented 2 months ago

image

bluebellbus commented 2 months ago

@bluebellbus

What is the output of the following commands in the situation where "Open in IDE" does not work for you?

node -v
npx cypress version

You have reported an issue with Cypress 13.3.0, however the discussion is about the later version Cypress 13.13.0 it seems.

Can you confirm that you are running Windows 11 23H2?

@jennifer-shehane

I can't reproduce this issue in Cypress 13.13.0.

Node: v20.15.0 Cypress Version: 13.13.0 Visual Studio Code: 1.91.0 image

image

MikeMcC399 commented 2 months ago

@bluebellbus

It's strange it doesn't work for you. I can only see some small differences in our environment:

Windows 11 Pro / Enterprise VSCode system setup / user setup

jennifer-shehane commented 2 months ago

Maybe you could try following these instructions to Clear App Data? You'd have to reset up your IDE of choice I believe after that is cleared.

bluebellbus commented 2 months ago

@jennifer-shehane I went through all the motions of clearing the app data and resetting the IDE to Visual Code as the instructions suggested. The js file still does not open in VSC. Is there some type of log I can pull that would throw an error for this?

bluebellbus commented 2 months ago

@jennifer-shehane @MikeMcC399 The Open in IDE also doesn't work in the assertion error here:

image

It is not limited to the orginal button I posted.

MikeMcC399 commented 2 months ago

@bluebellbus

I tried on a second Windows system and I was still unable to reproduce.

You may like to try clearing your Cypress cache and reinstalling

npx cypress cache clear
npx cypress install
bluebellbus commented 2 months ago

@jennifer-shehane @MikeMcC399 Still no luck after cache clear and reinstallation.

MikeMcC399 commented 2 months ago

For reference, here are my repro steps

git clone https://github.com/cypress-io/cypress-example-kitchensink
cd cypress-example-kitchensink
npm ci
npx cypress open --e2e --browser electron

image

Sorry I don't think I can be of any more help since I am unable to reproduce and I don't know how to debug this UI issue further.

bluebellbus commented 2 months ago

@jennifer-shehane @MikeMcC399 Is there anything in our cypress.config that could potentially affect this?

MikeMcC399 commented 2 months ago

@bluebellbus

Is there anything in our cypress.config that could potentially affect this?

You can test this by using the https://github.com/cypress-io/cypress-example-kitchensink project (see https://github.com/cypress-io/cypress/issues/29820#issuecomment-2225861162). If possible you could try your own project on a different Windows system.

bluebellbus commented 2 months ago

@MikeMcC399 I can try with that example repo, however I will say my colleague is also experiencing this on his laptop as well with our repo.

MikeMcC399 commented 2 months ago

@bluebellbus

Please do check with the example repo. If that has no problem and your repo has issues on more than one laptop, then that is a sign that there is an incompatibility in your repo. To diagnose the incompatibility it would probably need you to share a repo which shows the problem.

bluebellbus commented 2 months ago

@MikeMcC399 I am not able to able to reproduce the issue when I use the example repo, it works as expected. What I find odd is, if I rollback to 13.12, the Open in IDE works perfectly fine in our repo and has up to this point. I will see about providing our repo, there could be issues with GDPR regarding that.

MikeMcC399 commented 2 months ago

@bluebellbus

I am not able to able to reproduce the issue when I use the example repo, it works as expected.

That is an excellent piece of information!

What I find odd is, if I rollback to 13.12, the Open in IDE works perfectly fine in our repo and has up to this point.

I am guessing that there may be some sensitivity to file or path names, perhaps with unusual characters.

I will see about providing our repo, there could be issues with GDPR regarding that.

The ideal repo shared for reproduction purposes contains the minimum amount of content required to reproduce the issue. You should not be sharing any information which has privacy concerns.

bluebellbus commented 3 weeks ago

@MikeMcC399 @jennifer-shehane Update: In the latest cypress version (13.14.2) this seems to now work when clicking the open in IDE option in the errors here: image

However it still does NOT work when clicking the Open in IDE option at the top of the test window to open the test spec file here: image

MikeMcC399 commented 3 weeks ago

@bluebellbus

Thank you for your screenshots! I can reproduce your issue with a spec filename containing spaces. In that case I get the following error showing in the terminal I used to start Cypress with npx cypress open. The filename was spec with-spaces.cy.js

Could not open spec with-spaces.cy.js in the editor.

When running on Windows, file names are checked against a safe file name pattern to protect against remote code execution > attacks. File names may consist only of alphanumeric characters (all languages), periods, dashes, slashes, and underscores.

This seems to be a system restriction. Edit: see next comment

MikeMcC399 commented 3 weeks ago

Not allowing spaces in Windows filenames when launching an IDE is a restriction in launch-editor@2.8.0 currently used by Cypress

https://github.com/cypress-io/cypress/blob/23e67e1f53bf76982cb814b9a8d76f52adfc3f01/packages/server/package.json#L87

https://github.com/cypress-io/cypress/blob/23e67e1f53bf76982cb814b9a8d76f52adfc3f01/packages/data-context/package.json#L43

This restriction was lifted in launch-editor@2.8.1 released last month.

The latest version is launch-editor@2.9.1 released last week.

bluebellbus commented 3 weeks ago

@MikeMcC399 Thanks Mike. Is there a plan to update the launch editor cypress uses in the near future?

MikeMcC399 commented 3 weeks ago

@bluebellbus

Is there a plan to update the launch editor cypress uses in the near future?

That would be a question for @jennifer-shehane . She noted in https://github.com/cypress-io/cypress/issues/29820#issuecomment-2218455728 about the previous update, which is now confirmed to have caused a regression in Windows.

There was an update to the launch-editor in 13.13.0 here: #29770 so its possible there is a regression introduced. Maybe it's isolated to Windows.

The Cypress.io team could request Renovate to update launch-editor again.

jennifer-shehane commented 2 weeks ago

Opened a PR to bump the launch-editor: https://github.com/cypress-io/cypress/pull/30247

jennifer-shehane commented 2 weeks ago

@MikeMcC399 A binary should be built on this commit (will take some time to build) to test this new fix in Windows, I'd be curious if this fixes it. https://github.com/cypress-io/cypress/commit/12288691982d0084ccd6b55660c871e7d8ea9cad

MikeMcC399 commented 2 weeks ago

@bluebellbus

As @jennifer-shehane mentioned, a beta build with the fix for Windows is available.

You may like to install this and test it before the next version of Cypress is released:

npm install https://cdn.cypress.io/beta/npm/13.14.3/win32-x64/develop-12288691982d0084ccd6b55660c871e7d8ea9cad/cypress.tgz

I did a quick test and was able to confirm that Cypress test specs with one or more spaces in their filenames could be opened through the Open in IDE tooltip running in Windows 11.

jennifer-shehane commented 1 week ago

Thanks @MikeMcC399!

cypress-bot[bot] commented 1 week ago

Released in 13.15.0.

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