redhat-developer / vscode-extension-tester

ExTester: Your Essential UI Testing Companion for Visual Studio Code Extensions! Seamlessly execute UI tests with Selenium WebDriver, ensuring robustness and reliability in your extension development journey. Simplify UI testing for your VS Code extensions and elevate the quality of your user interface effortlessly.
Apache License 2.0
265 stars 71 forks source link

[Bug] Not able to run tests in vscode extension testing #841

Closed code-withAshish closed 1 year ago

code-withAshish commented 1 year ago

Error:-

> yarn run test
Downloading VSCode: 1.79.0 / stable
VS Code exists in local cache, skipping download
Downloading ChromeDriver 108.0.5359.71 from: https://chromedriver.storage.googleapis.com/108.0.5359.71/chromedriver_linux64.zip
progress: 0/7297087 (0%)
progress: 7297087/7297087 (100%)
Unpacking ChromeDriver 108.0.5359.71 into /home/ashish/Desktop/grammy-org/vscode/test-resources
Success!
Executing prepublish script 'npm run vscode:prepublish'...

> grammyjs@1.0.0 vscode:prepublish
> yarn run esbuild-base --minify

  dist/extension.js  891.1kb

⚡ Done in 57ms
 DONE  Packaged: /home/ashish/Desktop/grammy-org/vscode/grammyjs-1.0.0.vsix (17 files, 963.11KB)
Installing extensions...
(node:259462) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
Extension 'grammyjs-1.0.0.vsix' was successfully installed.

Writing code settings to /home/ashish/Desktop/grammy-org/vscode/test-resources/settings/User/settings.json
Launching browser...
  1) "before all" hook in "{root}"
  2) "after all" hook in "{root}"

  0 passing (40ms)
  2 failing

  1) "before all" hook in "{root}":
     Error: Server terminated early with status 2
      at /home/ashish/Desktop/grammy-org/vscode/node_modules/selenium-webdriver/remote/index.js:260:24
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

  2) "after all" hook in "{root}":
     TypeError: Cannot read properties of undefined (reading 'manage')
      at VSBrowser.<anonymous> (node_modules/vscode-extension-tester/out/browser.js:129:48)
      at Generator.next (<anonymous>)
      at /home/ashish/Desktop/grammy-org/vscode/node_modules/vscode-extension-tester/out/browser.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/vscode-extension-tester/out/browser.js:4:12)
      at VSBrowser.quit (node_modules/vscode-extension-tester/out/browser.js:128:16)
      at Context.<anonymous> (node_modules/vscode-extension-tester/out/suite/runner.js:82:35)
      at Generator.next (<anonymous>)
      at /home/ashish/Desktop/grammy-org/vscode/node_modules/vscode-extension-tester/out/suite/runner.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (node_modules/vscode-extension-tester/out/suite/runner.js:4:12)
      at Context.<anonymous> (node_modules/vscode-extension-tester/out/suite/runner.js:80:24)

I am following everything as per the docs and still i am getting this issue

djelinek commented 1 year ago

@code-withAshish could you provide here also your scripts from package.json to show how execution of tests is called?

code-withAshish commented 1 year ago

@djelinek i am using the scripts as provided in docs here are all of my scripts

 "scripts": {
    "vscode:prepublish": "yarn run esbuild-base --minify",
    "esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node",
    "esbuild": "yarn run esbuild-base --sourcemap",
    "esbuild-watch": "yarn run esbuild-base --sourcemap --watch",
    "compile-web": "node src/scripts/compile_svelte.mjs",
    "generate-filter-queries": "ts-node src/filter_explorer/prepare.ts",
    "compile": "tsc -p .",
    "test": "yarn compile && extest setup-and-run out/test/*.js"
  },

and my test script being

"test": "yarn compile && extest setup-and-run out/test/*.js"
djelinek commented 1 year ago

what is your environment?

OS: ??? node version: ??? VSCode version: ??? vscode-extension-tester version: ???

code-withAshish commented 1 year ago

@djelinek

OS: Ubuntu 22.04 LTS node version: v18.16.0 vscode version: 1.79.0 vscode-extension-tester version: 5.7.1

djelinek commented 1 year ago

could you reproduce with node 16? we are currently not support node 16+

code-withAshish commented 1 year ago

Ohh that might be the issue thanks I'll look into it

code-withAshish commented 1 year ago

@djelinek also do you have any suggestions on how to test vscode extensions on node 18 i dont need very granular testing though my use case is not that big?

djelinek commented 1 year ago

unfortunately not yet. I will be for sure work on support of node v16+, but for now it is not tested and not supported so I dont know what is working or not at vscode-extension-tester side

code-withAshish commented 1 year ago

@djelinek it' working fine for node v16

code-withAshish commented 1 year ago

@djelinek is there a headless version or mode if this, so it can be run in CI i dont want the vscode nstance to visually open?

djelinek commented 1 year ago

@djelinek is there a headless version or mode if this, so it can be run in CI i dont want the vscode nstance to visually open?

It is not at this moment. Still only opened request to investigate more https://github.com/redhat-developer/vscode-extension-tester/issues/86

djelinek commented 1 year ago

closing - it was related to unsupported NodeJS 18 version.

Feel free to reopen or open another in case you will need.