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

Tests for 'Generate a new Quarkus Project' #172

Merged
merged 1 commit into from
Feb 21, 2020
Merged

Tests for 'Generate a new Quarkus Project' #172

merged 1 commit into from
Feb 21, 2020

Conversation

xorye
Copy link
Contributor

@xorye xorye commented Dec 9, 2019

This PR provides 6 tests that test the 'Generate a new Quarkus Project' command.

To run the tests, either select the 'VS Code UI Extension Tests' debug config:
image

or, run npm run ui-test from the command line.

Fedora 30: Tests work
Windows 10: Tests work
Mac OS: There are two tests that do not work because of the lack of support for Mac's native folder selection window redhat-developer/vscode-extension-tester#40

@fbricon
Copy link
Collaborator

fbricon commented Dec 23, 2019

@xorye Travis build fails

@fbricon
Copy link
Collaborator

fbricon commented Jan 31, 2020

CLI build fails:


> [email protected] ui-test /Users/fbricon/Dev/projects/vscode-quarkus
> npm run test-compile && extest setup-and-run 'out/test/vscodeUiTest/suite/*.js' -u


> [email protected] test-compile /Users/fbricon/Dev/projects/vscode-quarkus
> tsc -p ./

VS Code exists in local cache, skipping download
ChromeDriver 76.0.3809.126 exists in local cache, skipping download

> [email protected] vscode:prepublish /Users/fbricon/Dev/projects/vscode-quarkus
> webpack --mode production

Hash: 1374edbd6b9383b9c55a
Version: webpack 4.32.2
Time: 8933ms
Built at: 2020-01-31 11:33:01 a.m.
           Asset      Size  Chunks             Chunk Names
    extension.js  1.14 MiB       0  [emitted]  main
extension.js.map  3.68 MiB       0  [emitted]  main
Entrypoint main = extension.js extension.js.map
  [0] external "path" 42 bytes {0} [built]
  [1] external "vscode" 42 bytes {0} [built]
 [28] ./src/definitions/constants.ts 2.21 KiB {0} [built]
 [36] ./src/QuarkusConfig.ts 3.35 KiB {0} [built]
 [58] ./src/QuarkusContext.ts 3.23 KiB {0} [built]
[144] ./src/extension.ts 8.1 KiB {0} [built]
[145] ./src/languageServer/requirements.ts 4.58 KiB {0} [built]
[177] ./src/addExtensions/addExtensionsWizard.ts 4.96 KiB {0} [built]
[345] ./src/debugging/terminateProcess.ts 5.14 KiB {0} [built]
[347] ./src/generateProject/generationWizard.ts 11.9 KiB {0} [built]
[376] ./src/languageServer/javaServerStarter.ts 2.49 KiB {0} [built]
[385] ./src/debugging/startDebugging.ts 2.78 KiB {0} [built]
[389] ./src/webviews/WelcomeWebview.ts 5.33 KiB {0} [built]
[393] ./src/lsp-commands.ts 3.43 KiB {0} [built]
[394] ./src/yaml/YamlSchema.ts 6.17 KiB {0} [built]
    + 381 hidden modules

WARNING in ./node_modules/ejs/lib/ejs.js 917:4-22
require.extensions is not supported by webpack. Use a loader instead.
 @ ./src/webviews/WelcomeWebview.ts 27:12-26
 @ ./src/extension.ts

WARNING in ./node_modules/ejs/lib/ejs.js 918:2-20
require.extensions is not supported by webpack. Use a loader instead.
 @ ./src/webviews/WelcomeWebview.ts 27:12-26
 @ ./src/extension.ts
 DONE  Packaged: /Users/fbricon/Dev/projects/vscode-quarkus/vscode-quarkus-1.3.0.vsix (90 files, 8.29MB)
Installing extensions...
Extension 'vscode-quarkus-1.3.0.vsix' was successfully installed.
Installing extensions...
Extension 'api-handler.vsix' was successfully installed.


Writing code settings to /Users/fbricon/Dev/projects/vscode-quarkus/test-resources/settings/User/settings.json
  Project generation tests
    1) should open project generation wizard

Shutting down the browser
Uninstalling vscode-extension-tester.api-handler...
Extension 'vscode-extension-tester.api-handler' was successfully uninstalled!
Uninstalling redhat.vscode-quarkus...
Extension 'redhat.vscode-quarkus' was successfully uninstalled!

  0 passing (29s)
  1 failing

  1) Project generation tests
       should open project generation wizard:
     Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/Users/fbricon/Dev/projects/vscode-quarkus/out/test/vscodeUiTest/suite/projectGenerationTest.js)
      at listOnTimeout (internal/timers.js:549:17)
      at processTimers (internal/timers.js:492:7)

I can see the command being typed in the palette, but then nothing happens

@xorye
Copy link
Contributor Author

xorye commented Feb 3, 2020

@fbricon vscode-extension-tester 2.3.0 introduces this new dependency https://www.npmjs.com/package/@nut-tree/nut-js to improve mac support.

nut-js has some prerequisites: https://www.npmjs.com/package/@nut-tree/nut-js#prerequisites which is probably why the Travis test for Linux is failing.

@xorye
Copy link
Contributor Author

xorye commented Feb 3, 2020

Here is what I did to get the tests working on macOs 10.15.2:

  1. Change the node version to 12.12. nut-js has an issue on macs: Segmentation Fault on macOS when trying to send keyboard events nut-tree/nut.js#98 (comment)

  2. Give accessibility permissions to the terminal (iTerm in this case)
    image

  3. Run npm i and npm run ui-tests in the same terminal application as step 2.

When running the ui tests, it would be best to disable all other extensions so that they don't interfere with the testing. Also, please be sure to not do anything else with your computer. Its very important to leave your computer when running the ui-tests, or else the test functions will not work properly.

Running the ui tests will create a vscode-quarkus/test-resources directory, which stores things (like the VS Code test installation) for the tests. When changing branches, that directory should be deleted because if not, vsce package will result in an error. To fix the error, test-resources should be added to .vscodeignore, which this PR does already:

test-resources/**

@xorye
Copy link
Contributor Author

xorye commented Feb 18, 2020

@fbricon its finally working on both ubuntu 16.04 and mac, but on ubuntu, the folder choosing test seems to work/stop working randomly (Edit: seems like it works more often than not)

I will soon squash all commits to one

@xorye
Copy link
Contributor Author

xorye commented Feb 18, 2020

I've updated the contributing guide to mention about testing.

I've also changed the test commands:
Run regular vscode tests: npm test
Run UI tests: npm run test-ui
Run both: npm run test-all

@xorye xorye marked this pull request as ready for review February 19, 2020 17:42
@angelozerr
Copy link
Contributor

@xorye please resolve conflicts

@xorye
Copy link
Contributor Author

xorye commented Feb 21, 2020

Fixing conflict

@angelozerr
Copy link
Contributor

@xorye please fix the new conflict please.

@xorye
Copy link
Contributor Author

xorye commented Feb 21, 2020

fixed

@fbricon fbricon merged commit 527c0d4 into redhat-developer:master Feb 21, 2020
@fbricon
Copy link
Collaborator

fbricon commented Feb 21, 2020

Thanks @xorye!

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

Successfully merging this pull request may close these issues.

4 participants