Ionic 2 E2E Testing with protractor - e2e-testing

Struggling to get my head around E2E testing on my Ionic 2 app. I've read that I should use protractor but I don't know how to do this with Ionic 2.

Protractor is straightforward to set up with Ionic 2. Briefly, you need:
an e2e test file
a config file for protractor
a gulp (or similar) job to build your e2e if you've written it in Typescript
to install protractor
I've written a walkthrough for Ionic 2 with full source code available on github
EDIT: as of Ionic 2 RC1 we've updated the project and associated walkthrough to use ng-cli.

Related

How to debug Angular universal?

I am using Angular Universal Starter repo. In angular 4 universal for ssr we could debug browser and node part of application in dev mode(see console), but now I do not see way to debug node part. I tried to execute ts-node server.ts with some changes( paths to files, etc), but angular seems needs aot compiled app and
throw Error: You must pass in a NgModule or NgModuleFactory to be
bootstrapped.
from docs:
Development (Client-side only rendering)
- run npm run start which will start ng serve
Production (also for testing SSR/Pre-rendering locally)
- npm run build:ssr && npm run serve:ssr
At first glance debug on Node.js in development do not work. At least from the box. May be someone resolve this issue.
You can't debug node part of your Angular 4 app in browser. Node work on server part so you can't see this in browser (client side).
Only way to debug this part when you start it from ts-node server.ts is to use external tools like WebStorm etc. If you start your App in TS mode from Debug mode you can use all features of this tools.
I think this small piece of code can help you
create the project
ng n debuggable-universal-server --interactive=false
cd debuggable-universal-server
add universal
ng add #nguniversal/express-engine --clientProject debuggable-universal-server
To create the server-side app module, app.server.module.ts, run the following CLI command.
ng add #nguniversal/express-engine
To start rendering your app with Universal on your local system, use the following command.
npm run dev:ssr

Cucumber Js - How to run the features [Windows]

I'm trying to learn cucumber and so far got a grip on installing nodejs, cucumber, creating package.json, storing features files and steps. But when I'm trying to run using windows command prompt, I'm getting the below shown error.
project structure
features
- example.feature
- step_definitions
- steps.js
- support (nothing here yet)
node_modules (cucumber installed locally)
package.json
I started executing commands from the bin folder to ensure cucumberjs works and it echo'd out the version number 3.1.0
C:\Test Project\node_modules\.bin>cucumberjs -v
and then began to run the feature file
C:\Test Project\node_modules\.bin>cucumberjs "C:\Test Project\features\example.feature"
and it errors here
Note: If i install the cucumber globally then it works, this error happens when I install cucumber locally
Any help pointing out where I'm going wrong will be much appreciated
I haven't figured out what's the reason behind the error but managed to run the features files by adding the following to the project package.json and running cli npm run cucumber
"scripts": {
"cucumber": "cucumberjs ./features"
},

Enabling Intellisense for Mocha

I'm running VS Code 1.0. I've already successfully added intellisense for a number of frameworks, i.e., Express, Restify, and even Gulp.
Now I'm trying to enable it for Mocha.
The minimum setup I'm doing is:
Create a folder.
npm init
npm install mocha
typings install mocha --ambient
Open Code in said folder.
Create a new file and try to type "describe".
Also, this guy got it working.
You just have to ad jsconfig.json file to the root of your project. It can even be empty.
Check this docs.

How can I modify cordova-aurelia-skeleton to use skeleton-es2016-webpack

I am diving into Cordova development, and want to build the basic "Hello World" app using Aurelias skeleton-es2016-webpack. This is my first Cordova project and I am new to Aurelia and gulp.
Background: PHP/MySQL/JQuery/some Python/Ubuntu. Deleloping on OSX
Got cordova-aurelia-skeleton ( https://github.com/fragsalat/cordova-aurelia-skeleton ) up and running fine. However, it uses jspm as a package manager and "transpiles" the EMCAScript6 to EMCAScript5. I would prefer the skeleton-es2016-webpack that only uses npm and Webpack.
What would be involved in using skeleton-es2016-webpack instead?

How to exeHicute angular unit test cases using Nodejs and Karma

I have created a unit test in angular js,However I have no idea on how to setup node.js and Karma
So I downloaded the node.js from nodejs.org and installed it.
Open the command prompt and installed karma by executing "npm install karma"
It installed karma.But when I execute my angular js unit test case,it reports some errors
angular is undefined.
I followed the instructions as mentioned in this
http://bardevblog.wordpress.com/2013/07/28/setting-up-angularjs-angular-seed-node-js-and-karma/
Is there any where how to setup Karma and node js to execute angular unit test cases.
Please provide me the information
You can use the Yeoman generator for an Angular.js app to generate a new project and see how it is done there. Please follow the steps under "Usage" on the GitHub page to set up the new project. (For all questions yo is asking just hit enter.) Finally, type grunt test:client. This executes Karma configured with the karma.conf.js.
In your karma config file you need to define all the js files that needs to be loaded and the order in which you specify then is important! Example:
files : [
'source/lib/angular/angular.js', // angular first
'source/lib/angular/*.js', // then any other angular files (angular-mocks.js, angular-resource.js, angular-route.js ...
'source/lib/x2js/xml2json.min.js', // some libraries I used
'source/lib/jquery/jquery.js',
'source/lib/ui-bootstrap/ui-bootstrap.js',
'source/js/*.js', // my own js code
'source/tests/unit/*.js' // unit tests
]

Resources