Files
Detox/detox/test/e2e/10.async-and-callbacks.test.js
Doron PearlandRotem Mizrachi-Meidan 2dda61c5f6 Support parallel test execution (#609)
This PR brings DeviceRegistry, an entity which synchronizes device distribution across processes, enabling parallel test execution on any supported test runner.
2018-05-29 00:40:51 +03:00

24 lines
572 B
JavaScript

describe('Async and Callbacks', () => {
beforeEach(async () => {
await device.reloadReactNative();
await element(by.text('Sanity')).tap();
});
it('should handle done() callback', (done) => {
expect(element(by.text('Welcome'))).toBeVisible().then(() => {
setTimeout(() => {
done();
}, 1000);
});
});
it('should handle async await', async () => {
await timeout(1);
await expect(element(by.text('Welcome'))).toBeVisible();
});
});
function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}