Skip to content

Commit

Permalink
chore(): update packages and add initial tests (ionic-team#695)
Browse files Browse the repository at this point in the history
* chore(): bump to ng7

* feat(): add initial unit test
  • Loading branch information
mhartington authored Nov 27, 2018
1 parent 6e72690 commit 9250a09
Show file tree
Hide file tree
Showing 17 changed files with 2,285 additions and 1,930 deletions.
45 changes: 34 additions & 11 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
"input": "src/assets",
"output": "assets"
},
{
"glob": "**/*.svg",
"input": "node_modules/@ionic/angular/dist/ionic/svg",
"output": "./svg"
}
"src/manifest.json"
],
"styles": [
{
Expand Down Expand Up @@ -53,7 +49,8 @@
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
"buildOptimizer": true,
"serviceWorker": true
}
}
},
Expand Down Expand Up @@ -83,7 +80,10 @@
"karmaConfig": "src/karma.conf.js",
"styles": [
{
"input": "styles.css"
"input": "src/theme/variables.scss"
},
{
"input": "src/global.scss"
}
],
"scripts": [],
Expand All @@ -97,7 +97,8 @@
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
}
},
"src/manifest.json"
]
}
},
Expand Down Expand Up @@ -138,16 +139,38 @@
}
}
}
},
"app-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "app:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {
"defaultCollection": "@ionic/schematics-angular"
"defaultCollection": "@ionic/angular-toolkit"
},
"schematics": {
"@ionic/schematics-angular:component": {
"@ionic/angular-toolkit:component": {
"styleext": "scss"
},
"@ionic/schematics-angular:page": {
"@ionic/angular-toolkit:page": {
"styleext": "scss"
}
}
Expand Down
28 changes: 28 additions & 0 deletions e2e/protractor.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts

const { SpecReporter } = require('jasmine-spec-reporter');

exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
24 changes: 24 additions & 0 deletions e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { AppPage } from './app.po';

describe('new App', () => {
let page: AppPage;

beforeEach(() => {
page = new AppPage();
});

it('should display the menu', () => {
page.navigateTo();
expect(page.getMenu()).toBeTruthy();
});
fit('should get the slides text', () => {
page.navigateTo();
expect(page.getFirstSlide()).toBe('ION-SLIDE');
// console.log(page.getFirstSlide());
});

it('should create a router outlet', () => {
page.navigateTo();
expect(page.getRouter()).toBeTruthy();
});
});
19 changes: 19 additions & 0 deletions e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { browser, by, element } from 'protractor';

export class AppPage {
navigateTo() {
return browser.get('/');
}

getMenu() {
return element(by.css('app-root ion-menu'));
}

getFirstSlide() {
return element(by.css('app-root ion-slides ion-slide:first-child')).getTagName();
}

getRouter() {
return element(by.css('app-root ion-router-outlet'));
}
}
9 changes: 9 additions & 0 deletions e2e/tsconfig.e2e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"baseUrl": "./",
"module": "commonjs",
"target": "es5"
}
}
26 changes: 26 additions & 0 deletions ngsw-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}
]
}
Loading

0 comments on commit 9250a09

Please sign in to comment.