You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run `npm audit fix` to update the vulnerable packages. Only in situations, where nothing else helps, try `npm audit fix --force` (this will also install braking changes)
To pass Component props while using Vue.js Router, see https://stackoverflow.com/a/37940045/4964553.
493
492
493
+
How to test components with `router-view` or `router-link`https://vue-test-utils.vuejs.org/guides/using-with-vue-router.html#testing-components-that-use-router-link-or-router-view.
494
494
495
-
Vue.js Jest Docs: https://vue-test-utils.vuejs.org/guides/#testing-single-file-components-with-jest
495
+
The test files itself could be named `xyz.spec.js` or `xyz.test.js` - and could reside nearly everywhere in the project.
496
496
497
497
##### Jest Configuration
498
498
499
-
*[package.json](frontend/package.json):
499
+
The Jest run-configuration is done inside the[package.json](frontend/package.json):
500
500
501
501
```
502
502
"scripts": {
@@ -506,25 +506,112 @@ Vue.js Jest Docs: https://vue-test-utils.vuejs.org/guides/#testing-single-file-c
Jest itself is configured inside[frontend/test/unit/jest.conf.js](frontend/test/unit/jest.conf.js)
510
510
511
511
##### Run Unit tests
512
512
513
-
`npm run unit`
513
+
`npm run unit` - that´ll look like:
514
+
515
+

516
+
517
+
518
+
519
+
## End-2-End (E2E) tests with Nightwatch
514
520
515
-
Run all tests (incl. E2E): `npm test`
521
+
Great tooling: http://nightwatchjs.org/ - Nightwatch controls WebDriver / Selenium standalone Server in own childprocess and abstracts from those, providing a handy DSL for Acceptance tests:
Nightwatch is configured through the [nightwatch.conf.js](/frontend/test/e2e/nightwatch.conf.js). Watch out for breaking changes in 1.x: https://github.com/nightwatchjs/nightwatch/wiki/Migrating-to-Nightwatch-1.0
521
528
522
-
Nightwatch controls Selenium standalone Server in own childprocess
529
+
More options could be found in the docs: http://nightwatchjs.org/gettingstarted/#settings-file
530
+
531
+
532
+
#### Write Nightwatch tests
533
+
534
+
An example Nightwatch test is provided in [HelloAcceptance.test.js](/frontend/test/e2e/specs/HelloAcceptance.test.js):
535
+
536
+
```
537
+
module.exports = {
538
+
'default e2e tests': function (browser) {
539
+
// automatically uses dev Server port from /config.index.js
540
+
// default: http://localhost:8080
541
+
// see nightwatch.conf.js
542
+
const devServer = browser.globals.devServerURL
543
+
544
+
browser
545
+
.url(devServer)
546
+
.waitForElementVisible('#app', 5000)
547
+
.assert.elementPresent('.hello')
548
+
.assert.containsText('h1', 'Welcome to your Vue.js powered Spring Boot App')
549
+
.assert.elementCount('img', 1)
550
+
.end()
551
+
}
552
+
}
553
+
554
+
```
523
555
524
556
##### Run E2E Tests
525
557
526
558
`npm run e2e`
527
559
560
+
##### Current Problem with npm audit (see [NPM Security](#npm-security))
561
+
562
+
With 1.0.6, the following error occurs after an `npm run e2e`:
563
+
564
+
```
565
+
OK. 4 assertions passed. (8.625s)
566
+
The "path" argument must be of type string. Received type object
567
+
at assertPath (path.js:39:11)
568
+
at Object.join (path.js:1157:7)
569
+
at process._tickCallback (internal/process/next_tick.js:68:7)
570
+
```
571
+
572
+
With the latest 0.9.21 of Nightwatch, this issue is gone. __BUT:__ the the `npm audit` command does find vulnerabilities:
And thus the whole build process will brake. The problem are breaking changes in [Nightwatch 1.x](https://github.com/nightwatchjs/nightwatch#nightwatch-v10), that aren´t reflected inside the Vue.js Webpack template so far (they use the latest 0.9.x, which is vulnerable): https://github.com/nightwatchjs/nightwatch/wiki/Migrating-to-Nightwatch-1.0
Run `npm audit fix` to update the vulnerable packages. Only in situations, where nothing else helps, try `npm audit fix --force` (this will also install braking changes)
0 commit comments