Merge pull request #74 from NoelDeMartin/MOBILE-3833
MOBILE-3833 behat: Wait for scroll before click
This commit is contained in:
		
						commit
						5b66ef7f69
					
				| @ -515,12 +515,20 @@ | ||||
|      * | ||||
|      * @param {HTMLElement} element Element to press. | ||||
|      */ | ||||
|     const pressElement = function(element) { | ||||
|     const pressElement = async function(element) { | ||||
|         // Scroll the item into view.
 | ||||
|         const initialRect = element.getBoundingClientRect(); | ||||
| 
 | ||||
|         element.scrollIntoView(false); | ||||
| 
 | ||||
|         await new Promise(resolve => requestAnimationFrame(resolve)); | ||||
| 
 | ||||
|         const rect = element.getBoundingClientRect(); | ||||
| 
 | ||||
|         if (initialRect.y !== rect.y) { | ||||
|             await new Promise(resolve => setTimeout(resolve, 300)); | ||||
|         } | ||||
| 
 | ||||
|         // Simulate a mouse click on the button.
 | ||||
|         const eventOptions = { | ||||
|             clientX: rect.left + rect.width / 2, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user