MOBILE-4616 behat: Block Behat for at least 500ms after a press

main
Albert Gasset 2024-08-30 11:26:28 +02:00
parent dd2ffd0044
commit 1815059e28
2 changed files with 18 additions and 0 deletions

View File

@ -139,6 +139,18 @@ export class TestingBehatBlockingService {
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
* cover almost everything, but sadly there is no way to do this because the transitionstart

View File

@ -219,6 +219,9 @@ export class TestingBehatRuntimeService {
// Click button
await TestingBehatDomUtils.pressElement(foundButton);
// Block Behat for at least 500ms, WS calls or DOM changes might not begin immediately.
TestingBehatBlocking.wait(500);
return 'OK';
}
@ -446,6 +449,9 @@ export class TestingBehatRuntimeService {
await TestingBehatDomUtils.pressElement(found);
// Block Behat for at least 500ms, WS calls or DOM changes might not begin immediately.
TestingBehatBlocking.wait(500);
return 'OK';
} catch (error) {
return 'ERROR: ' + error.message;