Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit 1e23107

Browse files
committed
Chrome on Travis test.
1 parent 2efbbec commit 1e23107

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ sudo: false
55
addons:
66
sauce_connect: true
77
before_install:
8+
- export CHROME_BIN=chromium-browser
89
- export DISPLAY=:99.0
910
- sh -e /etc/init.d/xvfb start
1011
install:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"jasmine-core": "^2.2.0",
4848
"jasmine-spec-reporter": "^2.1.0",
4949
"karma": "~0.12.31",
50-
"karma-chrome-launcher": "^0.1.7",
50+
"karma-chrome-launcher": "^0.2.2",
5151
"karma-coverage": "^0.2.7",
5252
"karma-failed-reporter": "0.0.3",
5353
"karma-firefox-launcher": "^0.1.4",

tests/automatic_karma.conf.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module.exports = function(config) {
55
config.set({
66
frameworks: ['jasmine'],
7-
browsers: ['PhantomJS'],
7+
browsers: ['Chrome'],
88
reporters: ['spec', 'failed', 'coverage'],
99
autowatch: false,
1010
singleRun: true,
@@ -40,4 +40,19 @@ module.exports = function(config) {
4040
'unit/**/*.spec.js'
4141
]
4242
});
43+
44+
var configuration = {
45+
customLaunchers: {
46+
Chrome_travis_ci: {
47+
base: 'Chrome',
48+
flags: ['--no-sandbox']
49+
}
50+
},
51+
};
52+
53+
if (process.env.TRAVIS) {
54+
configuration.browsers = ['Chrome_travis_ci'];
55+
}
56+
57+
config.set(configuration);
4358
};

tests/protractor/tictactoe/tictactoe.spec.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ describe('TicTacToe App', function () {
1515
var flow = protractor.promise.controlFlow();
1616

1717
function waitOne() {
18-
return protractor.promise.delayed(500);
18+
return protractor.promise.delayed(1500);
1919
}
2020

2121
function sleep() {
22+
// flow.execute takes a function and if the
23+
// function returns a promise it waits for it
24+
// to be resolved
2225
flow.execute(waitOne);
2326
}
2427

@@ -65,22 +68,19 @@ describe('TicTacToe App', function () {
6568
$('#resetRef').click();
6669

6770
// Wait for the board to reset
68-
browser.sleep().then(function() {
69-
// Make sure the board has 9 cells
71+
sleep();
7072

71-
var cells = element.all(by.css('.cell'));
72-
expect(cells.count()).toBe(9);
73+
// Make sure the board has 9 cells
74+
var cells = element.all(by.css('.cell'));
75+
expect(cells.count()).toBe(9);
7376

74-
// Make sure the board is empty
75-
cells.each(function(element) {
76-
expect(element.getText()).toBe('');
77-
});
77+
// Make sure the board is empty
78+
cells.each(function(element) {
79+
expect(element.getText()).toBe('');
7880
});
7981
});
8082

8183
it('updates the board when cells are clicked', function () {
82-
83-
var cells = element.all(by.css('.cell'));
8484
// Make sure the board has 9 cells
8585
expect(cells.count()).toBe(9);
8686

@@ -89,20 +89,21 @@ describe('TicTacToe App', function () {
8989
cells.get(2).click();
9090
cells.get(6).click();
9191

92-
browser.sleep().then(function() {
93-
// Make sure the content of each clicked cell is correct
94-
expect(cells.get(0).getText()).toBe('X');
95-
expect(cells.get(2).getText()).toBe('O');
96-
expect(cells.get(6).getText()).toBe('X');
97-
});
92+
sleep();
9893

94+
// Make sure the content of each clicked cell is correct
95+
expect(cells.get(0).getText()).toBe('X');
96+
expect(cells.get(2).getText()).toBe('O');
97+
expect(cells.get(6).getText()).toBe('X');
9998
});
10099

101100
it('persists state across refresh', function(done) {
102101
// Refresh the page, passing the push ID to use for data storage
103102
browser.get('tictactoe/tictactoe.html?pushId=' + firebaseRef.key()).then(function() {
104103
// Wait for AngularFire to sync the initial state
105104
sleep();
105+
sleep();
106+
106107
// Make sure the board has 9 cells
107108
expect(cells.count()).toBe(9);
108109

0 commit comments

Comments
 (0)