Skip to content

Commit

Permalink
add percy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Selden committed Jul 14, 2016
1 parent 226a2f8 commit c9d4540
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ cache:
- node_modules

env:
- PARTITION=1
- PARTITION=2
- PARTITION=3
- PARTITION=4
- PARTITION=5
global:
- PERCY_PROJECT=kellyselden/package-hint-historic-resolver
- PERCY_PARALLEL_TOTAL=5
matrix:
- PARTITION=1
- PARTITION=2
- PARTITION=3
- PARTITION=4
- PARTITION=5

before_install:
- npm config set spin false
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"ember-metrics": "^0.6.0",
"ember-metrics-mixins": "0.0.3",
"ember-moment": "^6.0.0",
"ember-percy": "^1.0.0",
"ember-resolver": "^2.0.3",
"ember-simple-auth": "^1.0.0",
"ember-sinon": "0.5.1",
Expand Down
5 changes: 4 additions & 1 deletion tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
extends: '../node_modules/ember-cli-eslint/coding-standard/ember-testing.js'
extends: '../node_modules/ember-cli-eslint/coding-standard/ember-testing.js',
globals: {
percySnapshot: true
}
};
13 changes: 10 additions & 3 deletions tests/acceptance/application-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ let githubRequestHeaders;

moduleForAcceptance('Acceptance | application', {
beforeEach() {
server = new Pretender();
server = new Pretender(function() {
this.post('/_percy/:method', this.passthrough);
});
server.prepareBody = JSON.stringify;

application = startApp();
Expand Down Expand Up @@ -93,9 +95,14 @@ moduleForAcceptance('Acceptance | application', {
}
});

test('loads a fresh page', function(assert) {
let testName;

testName = 'loads a fresh page';
test(testName, function(assert) {
visit('/');

percySnapshot(testName);

andThen(function() {
assert.equal(find('#header').text().trim(), 'Why is CI Broken?');
});
Expand Down Expand Up @@ -135,7 +142,7 @@ test('loads a populated page', function(assert) {
andThen(function() {
assert.equal(find('.repo-broken-date .date-time-picker').val(), '2016/06/01 0:00');
assert.equal(find('.repo-broken-date .commit').text(), `Latest commit ${sha} on ${commitDate}`);
assert.equal(server.handlers[0].numberOfCalls, 1, 'identical calls to github api are consolidated');
assert.equal(server.handlers[1].numberOfCalls, 1, 'identical calls to github api are consolidated');
assert.equal(find('.github-auth-code').text().trim(), `GitHub authorization code: ${githubAuthCode}`);
assert.equal(find('.github-access-token').text().trim(), `GitHub access token: ${githubAccessToken}`);
assert.equal(find('.github-rate-limit').text().trim(), `GitHub API rate limit: ${githubRateLimit}`);
Expand Down
1 change: 1 addition & 0 deletions tests/helpers/module-for-acceptance.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { module } from 'qunit';
import Ember from 'ember';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';
import '../helpers/percy/register-helpers';

const { RSVP: { Promise } } = Ember;

Expand Down

0 comments on commit c9d4540

Please sign in to comment.