What is a proper way of end-to-end (e2e) testing in Vue.js

Sergei Panfilov picture Sergei Panfilov · Apr 18, 2016 · Viewed 18.3k times · Source

Of cause I can use selenium-standalone with xpath to test an app. But testing SPA could be challenging sometime.

But, for example angularjs's team provides protractor for this purpose.

The reason behind protractor as I can see is that protractor waits till angularjs will be loaded and few more features:

Protractor provides some new locator strategies and functions which are very helpful to automate the AngularJS application. Examples include things like: waitForAngular, By.binding, By.repeater, By.textarea, By.model, WebElement.all, WebElement.evaluate, etc.

So, the question is: Is it any tool or best practice for e2e testing in Vuejs?

UPD: feel free to post links to tutorials, example and everything cool about e2e-testing in vue.js. Thanks.

Answer

Alex picture Alex · Nov 8, 2016

The tool you are thinking about is Nightwatch. With this, you can do E2E testing with Vue.js.

Even better, this is bundled by default when you are using vue-cli, ready to run.

The command line to create a project with Nightwatch activated by default is vue init webpack myProjectName.

Here are small tutorials about it.

EDIT: Lately I used Webdriver.io a lot, and I must say I prefer it to Nightwatch (better documentation, reactive community with a live gitter, issues that are treated in a timely fashion, etc.)