Skip to content

Commit 01bf4bf

Browse files
committed
Testing
1 parent 4db0368 commit 01bf4bf

8 files changed

Lines changed: 69 additions & 6 deletions

File tree

.travis.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
dist: trusty
2+
sudo: required
3+
4+
language: node_js
5+
node_js:
6+
- "8"
7+
8+
services:
9+
- mongodb
10+
11+
cache:
12+
directories:
13+
- ./node_modules
14+
15+
before_install:
16+
- "curl -L https://raw.githubusercontent.com/arunoda/travis-ci-meteor-packages/master/configure.sh | /bin/sh"
17+
- rm -rf node_modules
18+
19+
install:
20+
- git clean -fXd
21+
- npm install -g concurrently
22+
- npm install
23+
- meteor npm rebuild
24+
- npm run meteor-client:bundle
25+
- npm run api:reset
26+
27+
before_script:
28+
- "export PATH=$HOME/.meteor:$PATH"
29+
30+
script:
31+
# Use Chromium instead of Chrome.
32+
- export CHROME_BIN=chromium-browser
33+
- npm run test
34+
- concurrently "npm run start" "npm run api" "sleep 200; npm run e2e" --kill-others --success first

e2e/app.e2e-spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,13 @@ describe('angularcli-meteor App', () => {
1111
page.navigateTo();
1212
expect(page.getParagraphText()).toEqual('Welcome to app!');
1313
});
14+
15+
it('should load chats from the Meteor backend', () => {
16+
page.navigateTo();
17+
expect(page.getLastDiv()).toContain('Ethan Gonzalez');
18+
expect(page.getLastDiv()).toContain('Bryan Wallace');
19+
expect(page.getLastDiv()).toContain('Avery Stewart');
20+
expect(page.getLastDiv()).toContain('Katie Peterson');
21+
expect(page.getLastDiv()).toContain('Ray Edwards');
22+
});
1423
});

e2e/app.po.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ export class AppPage {
88
getParagraphText() {
99
return element(by.css('app-root h1')).getText();
1010
}
11+
12+
getLastDiv() {
13+
return element(by.css('app-root div:last-child')).getText();
14+
}
1115
}

karma.conf.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,22 @@ module.exports = function (config) {
2222
angularCli: {
2323
environment: 'dev'
2424
},
25-
reporters: ['progress', 'kjhtml'],
25+
reporters: ['kjhtml'],
2626
port: 9876,
2727
colors: true,
2828
logLevel: config.LOG_INFO,
2929
autoWatch: true,
30-
browsers: ['Chrome'],
31-
singleRun: false
30+
browsers: ['ChromeHeadlessNoSandbox'],
31+
customLaunchers: {
32+
ChromeHeadlessNoSandbox: {
33+
base: 'ChromeHeadless',
34+
flags: [
35+
'--no-sandbox', // required to run without privileges in docker
36+
'--user-data-dir=/tmp/chrome-test-profile',
37+
'--disable-web-security'
38+
]
39+
}
40+
},
41+
singleRun: true
3242
});
3343
};

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"start": "webpack-dev-server --port=4200",
1212
"start-prod": "webpack-dev-server --port=4200 --config webpack.config.js.prod",
1313
"test": "karma start ./karma.conf.js",
14-
"e2e": "protractor ./protractor.conf.js"
14+
"e2e": "protractor ./protractor.conf.js",
15+
"api": "cd api && meteor",
16+
"api:reset": "cd api && meteor reset",
17+
"meteor-client:bundle": "meteor-client bundle -s api"
1518
},
1619
"private": true,
1720
"dependencies": {

protractor.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ exports.config = {
99
'./e2e/**/*.e2e-spec.ts'
1010
],
1111
capabilities: {
12-
'browserName': 'chrome'
12+
'browserName': 'chrome',
13+
chromeOptions: {
14+
args: [ '--headless', '--no-sandbox', '--disable-gpu', '--window-size=800x600' ]
15+
}
1316
},
1417
directConnect: true,
1518
baseUrl: 'http://localhost:4200/',

src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export class AppComponent implements OnInit {
1616

1717
ngOnInit() {
1818
Chats.find({}).subscribe((chats: Chat[]) => {
19-
console.log(chats);
2019
this.chats = chats;
2120
});
2221
}

src/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
BrowserDynamicTestingModule,
1212
platformBrowserDynamicTesting
1313
} from '@angular/platform-browser-dynamic/testing';
14+
import 'meteor-client';
1415

1516
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
1617
declare const __karma__: any;

0 commit comments

Comments
 (0)