BlueWallet/tests/e2e/init.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-03-16 14:51:08 +01:00
/* global jasmine, jest, beforeAll, afterAll, beforeEach, device */
const detox = require('detox');
const config = require('../../package.json').detox;
const adapter = require('detox/runners/jest/adapter');
const specReporter = require('detox/runners/jest/specReporter');
const assignReporter = require('detox/runners/jest/assignReporter');
jasmine.getEnv().addReporter(adapter);
// This takes care of generating status logs on a per-spec basis. By default, jest only reports at file-level.
// This is strictly optional.
jasmine.getEnv().addReporter(specReporter);
// This will post which device has assigned to run a suite, which can be useful in a multiple-worker tests run.
// This is strictly optional.
jasmine.getEnv().addReporter(assignReporter);
// Set the default timeout
2020-03-25 11:33:11 +01:00
jest.setTimeout(1200000); // 20 min
2020-03-16 14:51:08 +01:00
beforeAll(async () => {
await detox.init(config, { launchApp: false });
2020-03-25 11:33:11 +01:00
}, 1200000);
2020-03-16 14:51:08 +01:00
beforeEach(async () => {
2020-03-23 11:59:18 +01:00
await device.launchApp({ newInstance: true, delete: true });
2020-03-16 14:51:08 +01:00
await sleep(2000);
await adapter.beforeEach();
});
afterAll(async () => {
await adapter.afterAll();
await detox.cleanup();
});
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}