Visual testing for tdd-buffet using Mugshot
npm install tdd-buffet @tdd-buffet/visual
import { describe } from 'tdd-buffet/suite/gui';
import { vit } from '@tdd-buffet/visual';
describe('Visual suite', () => {
vit('screenshot name', async browser => {
await browser.url('http://www.github.com');
});
});
The above will take a screenshot of the first child in body
and save it at tests/gui/screenshots/${browser}/${fullTestName}.png
(relative to cwd) where
browser
is the name of the browser taken fromprocess.env.BROWSER
(see writing GUI tests for more details),fullTestName
is the full name of thevit
test including all parentdescribe
block names (in this casevisual_suite_screenshot_name
).
You can mix and match "normal" tests (it
) and visual tests (vit
) and only the visual ones will result in screenshots being taken.