MOBILE-4616 behat: Block Behat for at least 500ms after a press
parent
dd2ffd0044
commit
1815059e28
|
@ -139,6 +139,18 @@ export class TestingBehatBlockingService {
|
||||||
this.unblock(key);
|
this.unblock(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a pending key to the array, and remove it after some time.
|
||||||
|
*
|
||||||
|
* @param milliseconds Number of milliseconds to wait before the key is removed.
|
||||||
|
* @returns Promise resolved after the time has passed.
|
||||||
|
*/
|
||||||
|
async wait(milliseconds: number): Promise<void> {
|
||||||
|
const key = this.block();
|
||||||
|
await CoreWait.wait(milliseconds);
|
||||||
|
this.unblock(key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It would be really beautiful if you could detect CSS transitions and animations, that would
|
* It would be really beautiful if you could detect CSS transitions and animations, that would
|
||||||
* cover almost everything, but sadly there is no way to do this because the transitionstart
|
* cover almost everything, but sadly there is no way to do this because the transitionstart
|
||||||
|
|
|
@ -219,6 +219,9 @@ export class TestingBehatRuntimeService {
|
||||||
// Click button
|
// Click button
|
||||||
await TestingBehatDomUtils.pressElement(foundButton);
|
await TestingBehatDomUtils.pressElement(foundButton);
|
||||||
|
|
||||||
|
// Block Behat for at least 500ms, WS calls or DOM changes might not begin immediately.
|
||||||
|
TestingBehatBlocking.wait(500);
|
||||||
|
|
||||||
return 'OK';
|
return 'OK';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,6 +449,9 @@ export class TestingBehatRuntimeService {
|
||||||
|
|
||||||
await TestingBehatDomUtils.pressElement(found);
|
await TestingBehatDomUtils.pressElement(found);
|
||||||
|
|
||||||
|
// Block Behat for at least 500ms, WS calls or DOM changes might not begin immediately.
|
||||||
|
TestingBehatBlocking.wait(500);
|
||||||
|
|
||||||
return 'OK';
|
return 'OK';
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return 'ERROR: ' + error.message;
|
return 'ERROR: ' + error.message;
|
||||||
|
|
Loading…
Reference in New Issue