| 266 | afterEach(() => rmDir(dir)) |
| 267 | |
| 268 | function fullHelper(overrides = {}) { |
| 269 | return { |
| 270 | grabCurrentUrl: sinon.stub().resolves('https://example.com/'), |
| 271 | saveScreenshot: sinon.stub().callsFake(async file => fs.writeFileSync(file, 'fake-png')), |
| 272 | grabSource: sinon.stub().resolves('<html><body><div>hi</div></body></html>'), |
| 273 | grabAriaSnapshot: sinon.stub().resolves('main\n - text "hi"'), |
| 274 | grabBrowserLogs: sinon.stub().resolves(['log line']), |
| 275 | grabStorageState: sinon.stub().resolves({ |
| 276 | cookies: [{ name: 'sid', value: 'abc' }], |
| 277 | origins: [{ origin: 'https://example.com', localStorage: [{ name: 'k', value: 'v' }] }], |
| 278 | }), |
| 279 | ...overrides, |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | it('returns empty object when helper is null/undefined', async () => { |
| 284 | expect(await captureSnapshot(null, { dir })).to.deep.equal({}) |