mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user