mbolotov / intellij-cypress

IntelliJ-Cypress plugin: https://plugins.jetbrains.com/plugin/13819-intellij-cypress Pro version: https://plugins.jetbrains.com/plugin/13987-cypress-support-pro
MIT License
35 stars 5 forks source link

No Specs Are Listed To Run #103

Closed larryh closed 1 year ago

larryh commented 1 year ago

Hi,

I've used your plugin - both Pro and Normal - for quite some time and love it - thanks for the work you do on it!

Recently you had a problem where the plugin was using the old Cypress pre-10.x 'testFiles' option to fire up tests, as opposed to the new 'specPattern'. Your fix worked like a charm and I was able to run my tests fine.

It's been awhile since I've run individual tests - about one month. I know they ran under the fix I mentioned above, but now when I try to run one test in Interactive Mode nothing shows up in the Cypress Window "Specs" list for me to run. I remember the last time I tried this, the test file that I had selected to run was listed, so I just double-clicked on it and Cypress ran the test.

I have attached a screen-shot of the empty "Specs" list. And here is the command that is used to run the test in Interactive Mode (I inserted the generic "~~~" for the directories on my computer): /usr/bin/node /home/~~~/node_modules/cypress/bin/cypress open --e2e --config specPattern=**/pol.spec.js

I can run the same test in non-interactive mode fine. Here is the command my (Rubymine) IDE spits out to run that kind of test: /usr/bin/node /home/~/node_modules/cypress/bin/cypress run --e2e --reporter /home/~/node_modules/cypress-intellij-reporter --spec /home/~~~/tests/integration/pages/pols/pol.spec.js

This happened while using the Normal version; I started my "Free Trial" with the Pro version to see if it worked there, but it did not; the same thing happened.

Here are the version numbers for what I am using: Normal: 1.5 and Pro: 3.2.2

Here is the value I have for e2e.specPattern in my cypress.config.js file: specPattern: 'tests/integration/*/.spec.js',

Hopefully it is something simple to fix, as I usually run just one test at a time in Interactive Mode.

NoSpecsListed

larryh commented 1 year ago

Okay, I think I know what might be the problem.

I am using Cypress 10.6, which was just released yesterday: https://docs.cypress.io/guides/references/changelog#10-6-0

Here are two of the bug fixes that they mentioned:

So it looks like it might be related to something Cypress did.

mbolotov commented 1 year ago

I tried both 10.2 and 10.6 and didn't found any problem with my sample project. Is that possible to share your project with me?

NUlmerTS commented 1 year ago

I have the same issue. For me, it was introduced in version 10.5.0 (We are currently stuck running on 10.4.0)

larryh commented 1 year ago

Not sure I can share the project with you - also, that might be a lot of overkill.

Thanks a lot to @NUlmerTS for your post! For me it also worked fine for 10.4 but not 10.5 => I guess it's safe to assume that that's when the breaking change occurred.

From https://docs.cypress.io/guides/references/changelog#10-5-0:

Fixes an issue where usage of the --spec option would result in no specs found if the absolute project path included glob pattern characters. Fixes #22272.

I looked at some other bugs referenced by their changelog and there seemed to be a concern about the root directory being e2e. I installed Cypress quite some time ago so I can't remember if that was the default installation directory; my guess is that it was.

Regardless, I think the problem might be related to tests living "outside the default directory structure" - hopefully @NUlmerTS can verify.

My specs live in /tests/integration/<two-directories>/<several-directories>/<individual-tests>

So, for example, I have:

/tests/integration/pages/about/contact.spec.js /tests/integration/pages/about/us.spec.js

/tests/integration/pages/support/forgot-password.spec.js /tests/integration/pages/support/resend-confirmation.spec.js

/tests/integration/routes/middleware-guards.spec.js /tests/integration/routes/pages-and-titles.spec.js

To repeat, my cypress.config.js has e2e.specPattern set to 'tests/integration/**/*.spec.js'

And this is the command my IDE spit out to run the about.us spec: /usr/bin/node /home/<laptop-specific-subdirs>/node_modules/cypress/bin/cypress open --e2e --config specPattern=**/us.spec.js

Hopefully this will help

larryh commented 1 year ago

Once again, a big THANK YOU to @NUlmerTS for providing the link to this same issue that she raised with the folks at Cypress: https://github.com/cypress-io/cypress/issues/23486

They found the problem and came up with a simple workaround, which you can read about in that thread.

I think this is closed, but didn't mark it as such because I wasn't sure.

Thanks again for all of the work you do on this plugin, @mbolotov !

mbolotov commented 1 year ago

So can we close the issue now?

larryh commented 1 year ago

Yes. The workaround worked (hence the name, I guess ;-) and Cypress fixed the problem in their new 10.7.0 release.

Thanks again for this plugin!