Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should throw if capture fails', () => {
ScreenShooter.prototype.capture.rejects(new Error('capture fails'));
return assert.isRejected(capture(), /capture fails/);
});
it('should capture a screenshot image', async () => {
const browser = stubBrowser_();
browser.prepareScreenshot.resolves({foo: 'bar'});
await browser.publicAPI.assertView();
assert.calledOnceWith(ScreenShooter.prototype.capture, {foo: 'bar'});
});
beforeEach(() => {
sandbox.stub(temp);
sandbox.spy(ScreenShooter, 'create');
sandbox.stub(ScreenShooter.prototype, 'capture').resolves();
});
beforeEach(() => {
sandbox.stub(Image, 'create').returns(Object.create(Image.prototype));
sandbox.stub(Image, 'compare').resolves(true);
sandbox.stub(Image.prototype, 'getSize');
sandbox.stub(fs, 'readFileSync');
sandbox.stub(fs, 'existsSync').returns(true);
sandbox.stub(temp, 'path');
sandbox.stub(temp, 'attach');
sandbox.stub(RuntimeConfig, 'getInstance').returns({tempOpts: {}});
sandbox.spy(ScreenShooter, 'create');
sandbox.stub(ScreenShooter.prototype, 'capture').resolves(stubImage_());
sandbox.stub(updateRefs, 'handleNoRefImage').resolves();
sandbox.stub(updateRefs, 'handleImageDiff').resolves();
});