Add a helper to check whether a block is visible, meaning inside the bounds of the Blockly div.
Basic code looks like this:
const isVisible = await browser.execute((elem) => {
const rect = elem.getBoundingClientRect()
const blocklyDiv = document.getElementById('blocklyDiv');
const blocklyRect = blocklyDiv.getBoundingClientRect();
const vertInView = (rect.top >= blocklyRect.top) && (rect.bottom <= blocklyRect.bottom);
const horInView = (rect.left >= blocklyRect.left) && (rect.right <= blocklyRect.right);
return (vertInView && horInView)
}, flyoutBlock);
Add a helper to check whether a block is visible, meaning inside the bounds of the Blockly div.
Basic code looks like this: