Files

43 lines
1.1 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const detox = require('detox');
const config = require('../package.json').detox;
before(async () => {
await detox.init(config);
// needs to be called before any usage of firestore
// await firebase.firestore().settings({ persistence: true });
// await firebase.firestore().settings({ persistence: false });
});
beforeEach(async function beforeEach() {
if (jet.context && jet.root && jet.root.setState) {
jet.root.setState({
currentTest: this.currentTest,
});
}
const retry = this.currentTest.currentRetry();
if (retry > 0) {
if (retry === 1) {
console.log('');
console.warn(`⚠️ A test failed:`);
console.warn(` -> ${this.currentTest.title}`);
}
if (retry > 1) {
console.warn(` 🔴 Retry #${retry - 1} failed...`);
}
console.warn(` -> Retrying... (${retry})`);
await sleep(3000);
}
});
after(async () => {
console.log('Cleaning up...');
await TestHelpers.firestore.cleanup();
console.log('Firestore cleaned up...');
// await detox.cleanup(); // TODO hangs - most likely jet internals interfering
console.log('Detox cleaned up...');
});