feat: Allow dragging from simple toolbox (#7301)

fix: Add delay after block connection.  Otherwise it can randomly and silently fail.
This commit is contained in:
Neil Fraser
2023-07-18 19:36:20 +02:00
committed by GitHub
parent 30ed44558d
commit 06ba992206

View File

@@ -155,14 +155,17 @@ async function getNthBlockOfCategory(browser, categoryName, n) {
/**
* @param browser The active WebdriverIO Browser object.
* @param categoryName The name of the toolbox category to search.
* Null if the toolbox has no categories (simple).
* @param blockType The type of the block to search for.
* @return A Promise that resolves to the root element of the first
* block with the given type in the given category.
*/
async function getBlockTypeFromCategory(browser, categoryName, blockType) {
const category = await getCategory(browser, categoryName);
category.click();
await browser.pause(100);
if (categoryName) {
const category = await getCategory(browser, categoryName);
category.click();
await browser.pause(100);
}
const id = await browser.execute((blockType) => {
return Blockly.getMainWorkspace()
@@ -271,6 +274,7 @@ async function connect(
y: targetLocation.y - draggedLocation.y,
};
await draggedBlock.dragAndDrop(delta);
await browser.pause(200);
}
/**
@@ -310,6 +314,7 @@ async function dragNthBlockFromFlyout(browser, categoryName, n, x, y) {
*
* @param browser The active WebdriverIO Browser object.
* @param categoryName The name of the toolbox category to search.
* Null if the toolbox has no categories (simple).
* @param type The type of the block to search for.
* @param x The x-distance to drag, as a delta from the block's
* initial location on screen.