Skip to content

Commit deb69f4

Browse files
committed
2 parents d48b72c + 0d49a1e commit deb69f4

File tree

6 files changed

+93
-15
lines changed

6 files changed

+93
-15
lines changed

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,39 @@ You need to create an account for Microting API and get your access credentials.
2020

2121
## Development recommendations
2222

23-
- Visual Studio 2015
24-
- MS SQL Server Management Studio
25-
- Node.js
23+
To work with back-end use <a href="https://www.visualstudio.com/vs/community/">**Visual Studio 2017 Community edition**</a>.
24+
25+
To work with Angular front-end code recommended to use <a href="https://www.jetbrains.com/webstorm/">**WebStorm**</a> or <a href="https://code.visualstudio.com">**VS Code**</a>. If you're going to use VS Code you're need to install several plugins.
26+
27+
1. <a href="https://marketplace.visualstudio.com/items?itemName=johnpapa.angular-essentials"> Angular Essentials</a> - for Angular intellisense.
28+
2. <a href="https://marketplace.visualstudio.com/items?itemName=Mikael.Angular-BeastCode">Angular Snippets</a> - for Angular snippets.
29+
3. <a href="https://marketplace.visualstudio.com/items?itemName=johnpapa.angular-essentials"> Angular Language Service</a>
30+
4. <a href="https://augury.angular.io/"> Chrome Augury extention</a> - to observe variables and changes in a real time.
31+
32+
After installing, run **cmd** navigate to front-end **eform-client** folder and type **npm i**, after that **npm start**. This will start **Webpack** development server that will reload on any change in the front-end code.
33+
34+
There is two ways how to debug Angular application.
35+
First way is to put breakpoints in the **Sources**. To do that Open **Chrome Dev Tools** and then navigate to **Sources** tab. Go down and open **webpack://** tab from left panel. After that open tab with *disk_name:/app_folder/eform-client* (for example *C:/Users/MyUser/eForm/eform-client/*). Here you will see an entire application as you see it in **VS Code** and put a **debugger** where you're need it.
36+
The second way is simple, you can just put a **debugger** word dirrectly in code. After that app will reload and with open **Chrome Dev Tools** on the function call **debugger** will be triggered.
37+
For example **debugger** will be triggered on click *Logout* button:
38+
39+
```
40+
logout(): Observable<any> {
41+
debugger;
42+
return this.post(AuthMethods.Logout, {});
43+
}
44+
```
45+
46+
To use **Augury** go to **Chrome Dev Tools** and navigate to this tab.
47+
The component tree displays a hierarchical relationship of the components. When a component is selected, Augury presents additional information about the selected component.
48+
49+
1) View Source — a link to the source code of the component.
50+
2) Change Detection — displays whether or not Change Detection is in use for the component.
51+
3) Object Properties — lists the properties of the component.
52+
4) Dependencies - lists the dependencies of the component.
53+
54+
To view the source code of the selected component, click the **View Source** link. This will bring the **Sources** tab into focus and display the source code.
55+
The major feature of Augury is the Router Tree, which displays the routing information for the application. The **Router Tree** tab is located next to the **Component Tree** tab along the top left side.
2656

2757

2858
## Installation

eform-client/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ testem.log
3535
/e2e/*.js
3636
/e2e/*.map
3737

38+
# Tests
39+
/test-output
40+
3841
#System Files
3942
.DS_Store
4043
Thumbs.db

eform-client/gulpfile.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const Server = require('karma').Server;
2+
const path = require('path');
3+
const gulp = require('gulp');
4+
5+
gulp.task("tests", function (done) {
6+
new Server({
7+
configFile: path.join(__dirname, 'karma.conf.js'),
8+
singleRun: true,
9+
}, function(exitCode) {
10+
process.exit(exitCode); // <-- this is the important part
11+
done(exitCode);
12+
}).start();
13+
});

eform-client/karma.conf.js

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,61 @@
44
module.exports = function (config) {
55
config.set({
66
basePath: '',
7+
78
frameworks: ['jasmine', '@angular/cli'],
9+
810
plugins: [
911
require('karma-jasmine'),
1012
require('karma-chrome-launcher'),
1113
require('karma-remap-istanbul'),
14+
require('karma-phantomjs-launcher'),
15+
require('karma-junit-reporter'),
1216
require('@angular/cli/plugins/karma')
1317
],
14-
files: [{
18+
19+
20+
/*files: [{
1521
pattern: './src/test.ts',
1622
watched: false
17-
}],
23+
}],*/
24+
25+
files: [
26+
'./src/*-test.ts',
27+
'./src/test.ts'
28+
],
29+
1830
preprocessors: {
1931
'./src/test.ts': ['@angular/cli']
2032
},
33+
34+
2135
mime: {
2236
'text/x-typescript': ['ts', 'tsx']
37+
38+
2339
},
2440
remapIstanbulReporter: {
2541
reports: {
26-
html: 'coverage',
27-
lcovonly: './coverage/coverage.lcov'
42+
html: './test-output/coverage',
43+
lcovonly: './test-output/coverage.lcov'
2844
}
2945
},
46+
3047
angularCli: {
3148
config: './angular-cli.json',
3249
environment: 'dev'
3350
},
34-
reporters: config.angularCli && config.angularCli.codeCoverage ?
35-
['progress', 'karma-remap-istanbul'] :
36-
['progress'],
37-
port: 9876,
51+
52+
junitReporter: {
53+
outputDir: 'test-output',
54+
outputFile: 'unit.xml',
55+
suite: 'unit'
56+
},
57+
58+
reporters: ['progress', 'karma-remap-istanbul', 'junit'],
3859
colors: true,
3960
logLevel: config.LOG_INFO,
40-
autoWatch: true,
41-
browsers: ['Chrome'],
42-
singleRun: false
61+
browsers: ['PhantomJS'],
62+
singleRun: true
4363
});
4464
};

eform-client/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"build": "ng build --env=prod",
1313
"server": "node server.js",
1414
"winserver-install": "node svc.js install",
15-
"winserver-uninstall": "node svc.js uninstall"
15+
"winserver-uninstall": "node svc.js uninstall",
16+
"test-single-headless": "ng test --single-run=true --browsers=PhantomJS --reporters=progress,junit"
1617
},
1718
"private": true,
1819
"dependencies": {
@@ -55,14 +56,20 @@
5556
"@angular/compiler-cli": "^4.2.4",
5657
"@types/jasmine": "2.5.38",
5758
"@types/node": "~6.0.60",
59+
"angular-mocks": "^1.6.8",
5860
"codelyzer": "~2.0.0",
61+
"gulp": "^3.9.1",
5962
"jasmine-core": "2.5.2",
6063
"jasmine-spec-reporter": "2.5.0",
6164
"karma": "~1.4.1",
6265
"karma-chrome-launcher": "~2.1.1",
6366
"karma-cli": "^1.0.1",
6467
"karma-jasmine": "^1.0.2",
68+
"karma-junit-reporter": "^1.2.0",
69+
"karma-phantomjs-launcher": "^1.0.4",
6570
"karma-remap-istanbul": "^0.6.0",
71+
"path": "^0.12.7",
72+
"phantomjs-prebuilt": "^2.1.16",
6673
"protractor": "~5.1.0",
6774
"ts-node": "~2.0.0",
6875
"tslint": "~4.5.0",

eform-client/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Test
2+
3+
Run tests by executing 'gulp tests'.
4+
5+
If gulp is not available install gulp globally in your cli by running `npm install --global gulp-cli`

0 commit comments

Comments
 (0)