romanresh / vscode-testcafe

This extension allows you to run TestCafe tests directly from VS Code
https://marketplace.visualstudio.com/items?itemName=romanresh.testcafe-test-runner
MIT License
47 stars 15 forks source link

Browser detection issues Linux #47

Open staplespeter opened 1 year ago

staplespeter commented 1 year ago

I wish to use this extension to debug within VSCode. I am running Ubuntu 22.04 and have Firefox and Brave (chromium based) browsers installed via Snap. I can test against Firefox and Brave from the CLI with no issues, using the :userProfile option for Firefox or the executable paths for both browsers. Using this VSCode extension i am unable to execute against either browser.

Issues:

  1. This extension detects the Firefox browser but not the Brave browser.
  2. The known issue with the default profiles of Snap-installed Firefox and TestCafe prevent the tests being executed from the context menu in VSCode.
  3. There seems to be no way get the extension to use the TestCafe config file, or to pass a 'browsers' argument to the runner in VSCode. The following is the command executed to start the debugging from VSCode: /usr/bin/env 'NODE_OPTIONS=--require /snap/code/130/usr/share/code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"/tmp/node-cdp.35459-43416ed5-1.sock","deferredMode":false,"waitForDebugger":"","execPath":"/home/pstaples/.nvm/versions/node/v18.7.0/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/tmp/node-debug-callback-eabe9fe4b99de171"}' /home/pstaples/.nvm/versions/node/v18.7.0/bin/node --no-deprecation ./node_modules/testcafe/lib/cli/index.js firefox /mnt/Data/Repos/Demo-Project/test/testcafe/SignIn.ts firefox:userProfile --test User\ can\ sign\ up it can be seen that the browser name firefox is passed to the testcafe index.js via node. I attempted to use the "testcafeTestRunner.customArguments": "firefox:userProfile" and the result can also be seen in the command.

Solutions: -Have more complete Chromium browser detection. -Add a context menu argument that allows running using the TestCafe config e.g. TestCafe: Run Test(s) -Add an extension setting that mirrors the TestCafe config 'browsers' option e.g. "testcafeTestRunner.browsers": "path:/to/my/browser/executable"

Yes i could install Firefox via APT but i don't want to, and shouldn't have to. And Brave is a Chromium browser so should be supported OOTB?

If there is a solution to this i am missing please let me know.

Anyway, thank you for the extension (even if i haven't actually used it yet)

staplespeter commented 1 year ago

In the meantime I've just decided to use Launch Config in VSCode, which works fine.

https://testcafe.io/documentation/402800/recipes/debugging/visual-studio-code