-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding visual regression testing with percy
- Loading branch information
Showing
3 changed files
with
248 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |