This thread is trying to answer question "Why can't I get VSCode to recognize my tests or the extension?"
Okay, I have helped on several queries in regards to this. Sadly, need to go back to basics to help you.
First off, make sure you have updated vscode, the vscode extension and playwright to the latest. I assume you are all good to go.
Second, just create a new playwright project by running npm init playwright@latest
Third, let's see if it works!
You should see the default tests in the test explorer, the key element that catches you out in the testDir setting. In my example I told the setup to look under the tests folder, it also needs to be set based on where your root folder is or were you will be executing your terminal from.
This should work, and will be a simple review that things are working. If this doesn't work we can look deeper into why.
Now, for your original setup. You will need to verify that the testDir looks correct. To diagnose this further, you will need to post your directory tree, your terminal execution and what you got set in testDir.
Other issues, ensure you are using test.spec.ts, you can set this differently but out of the box .spec. is required.
Hopefully, this gave you a push into the right direction. Will need more details to diagnose further.
I tried to reproduce your scenario again, but was not able to. Since, you are able to work via the CLI, I am making the assumption that this is an extension issue. A few more things you could try.
You might have a conflicting VS Code extension, so you could attempt to disable all of your extensions except the Playwright Test for VS Code v1.0.15, You will probably need to restart VS Code to have this take effect. If this fixes your problem you will need to review your extensions, possibly another extension is taking precedent over the operation of the Test Explorer. Simply disable the conflicting one, you can use a workspace file to manage your extensions if you require both.
Finally, if that didn't work. Do not enable anything yet and uninstall the Playwright extension, restart VS Code and then reinstall the extension. This sometimes is an issue depending on what version you previously were on.
After this, I am really stumped. We have stripped back the layers to go to bare bones, it should work with the example code. If you get it working and still having an issue we can review that scenario. I am interested if the above actions do not work.
i tried restarting my vscode and clearing all extensions and basically factory reset and no dice.
I decided to download visual studio again on my mac and move it to the applications folder and it is now called Visual studio code 2 and now works properly unsure as to why the first insance of vs code was insanely broken
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email email@example.com.