Skip to content

Commit

Permalink
adding visual regression testing with percy
Browse files Browse the repository at this point in the history
  • Loading branch information
mansona committed Jul 5, 2019
1 parent de77987 commit 436eef9
Show file tree
Hide file tree
Showing 3 changed files with 248 additions and 0 deletions.
219 changes: 219 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"ember-load-initializers": "^2.0.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-native-dom-helpers": "^0.6.2",
"ember-percy": "^1.5.0",
"ember-qunit": "^4.4.1",
"ember-resolver": "^5.0.1",
"ember-sinon": "^2.2.0",
Expand Down
28 changes: 28 additions & 0 deletions tests/acceptance/visual-regression-test-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { module, test } from 'qunit';
import { visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { percySnapshot } from 'ember-percy';

async function renderFromToc(tableOfContents, path = "") {
for (const item of tableOfContents) {
if (!item.pages || item.pages.length === 0) {
await visit(path + item.title);
await percySnapshot(path + item.title);
} else {
await renderFromToc(item.pages, `${path + item.title}/`);
}
}
}

module('Acceptance | visual regression test', function(hooks) {
setupApplicationTest(hooks);

test(`visiting visual regressions with Percy`, async function(assert) {
assert.expect(0);
await visit('/');

let tableOfContents = this.owner.lookup('controller:application').model;

await renderFromToc(tableOfContents);
});
});

0 comments on commit 436eef9

Please sign in to comment.