Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run testcafe from visual studio code #35

Open
rehanmomin opened this issue Jun 13, 2019 · 3 comments
Open

Unable to run testcafe from visual studio code #35

rehanmomin opened this issue Jun 13, 2019 · 3 comments

Comments

@rehanmomin
Copy link

rehanmomin commented Jun 13, 2019

Unable to run testcafe from visual studio code

Installed TestCafe Test Runner 1.4.5 from market Place .

nothing is happening in Visual Studio Code.
No error is shown nothing.

Same program is running from Visual Studio Code Powershell.

@romanresh
Copy link
Owner

Hi @rehanmomin . Try to open any JS/TS file in your workspace and check the VS Code context menu. It should contain a few "TestCafe: ..." items.

@rehanmomin
Copy link
Author

@romanresh sorry to not include this in previous comment.
But after Clicking TesCafe: Run in (any browser)
Nothing is happening.

Now i have updated TestCafe Test Runner to 2.0.0

@romanresh
Copy link
Owner

@rehanmomin It's difficult to find out a cause of this problem without debugging. Let me describe you some background, how the extension works.

The extension uses the Terminal tab to run the testcafe process. When you click the "TestCafe: ..." menu item the extension determines a test name in your file (based on cursor position) and run the testcafe process in terminal with parameters (including filename and test name).

Usually the extension cannot run a test because of a few known problems:

  1. It cannot determines test name by the cursor position. In this case you will see the VSCode error message. The extension uses regular expression to find a nearest test and its name to the cursor.
  2. The testcafe process returns a error (if test name determined incorrectly or the extension passed wrong parameters to the testcafe process). In this case you will see the error in the Terminal tab of VS Code.

If nothing happens (both terminal is empty and no VSCode message box appears) you can try to find the cause of the problem yourself via debugging of the extension:

  1. clone this repository
  2. run npm i to install dependencies
  3. open the folder in VS Code
  4. set a breakpoint somewhere here:
    public startTestRun(browser:string, filePath:string, type:string, name:string = "") {
  5. press F5 to start debugging. It will run a new experimental instance of VSCode with overwritten version of the extension and attached debugger.
  6. in the runned experimental version of VS code open a folder with your testcafe tests and try to run any test via the extension (using a context menu). The debugger should stop on your breakpoint and you will be able to debug the extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants