v2.1.0
What's new?
You can now pass your own domTransformation option to percySnapshot. This will allow you to add elements to the clone of the DOM that Percy captures (#188). For example:
test('passing a custom DOM transform', async function(assert) {
await visit('/');
assert.equal(currentURL(), '/');
await percySnapshot(assert, {
domTransformation: function(clonedDom) {
let $scopedRoot = clonedDom.querySelector('#ember-testing');
let $h1 = document.createElement('h1');
$h1.innerText = 'Hello modified DOM!';
$scopedRoot.appendChild($h1);
return clonedDom;
}
});This could be useful if you have an Ember addon which adds DOM elements outside of the Ember application root (which is ember-testing in tests). You could then collect those elements and add them back into the DOM clone Percy captures.