mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
23 lines
575 B
JavaScript
23 lines
575 B
JavaScript
import fs from 'fs';
|
|
import { resetHabiticaDB } from '../helpers/api-integration/mongo';
|
|
|
|
before(async () => {
|
|
await resetHabiticaDB();
|
|
})
|
|
|
|
// based on https://github.com/angular/protractor/issues/114#issuecomment-29046939
|
|
afterEach(async function () {
|
|
let lastTest = this.currentTest;
|
|
|
|
if (lastTest.state === 'failed') {
|
|
let filename = `exception_${lastTest.title}.png`;
|
|
let png = await browser.takeScreenshot();
|
|
let buffer = new Buffer(png, 'base64');
|
|
let stream = fs.createWriteStream(filename);
|
|
|
|
stream.write(buffer);
|
|
stream.end();
|
|
}
|
|
});
|
|
|