mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
fix: Fix the browser tests. (#8735)
(cherry picked from commit a86ba15154)
This commit is contained in:
@@ -264,7 +264,10 @@ export class Menu {
|
||||
if (el) {
|
||||
aria.setState(el, aria.State.ACTIVEDESCENDANT, item.getId());
|
||||
}
|
||||
item.getElement()?.scrollIntoView();
|
||||
item.getElement()?.scrollIntoView({
|
||||
block: 'nearest',
|
||||
inline: 'start',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ suite('Disabling', function () {
|
||||
110,
|
||||
);
|
||||
await connect(this.browser, child, 'OUTPUT', parent, 'IF0');
|
||||
|
||||
await this.browser.pause(PAUSE_TIME);
|
||||
await contextMenuSelect(this.browser, parent, 'Disable Block');
|
||||
|
||||
chai.assert.isTrue(await getIsDisabled(this.browser, child.id));
|
||||
|
||||
@@ -123,10 +123,14 @@ suite('Delete blocks', function (done) {
|
||||
)
|
||||
.waitForExist({timeout: 2000, reverse: true});
|
||||
|
||||
// Load the start blocks
|
||||
await this.browser.execute((blocks) => {
|
||||
Blockly.serialization.workspaces.load(blocks, Blockly.getMainWorkspace());
|
||||
}, startBlocks);
|
||||
// Load the start blocks. This hangs indefinitely if `startBlocks` is
|
||||
// passed without being stringified.
|
||||
this.browser.execute((blocks) => {
|
||||
Blockly.serialization.workspaces.load(
|
||||
JSON.parse(blocks),
|
||||
Blockly.getMainWorkspace(),
|
||||
);
|
||||
}, JSON.stringify(startBlocks));
|
||||
// Wait for there to be a block on the main workspace before continuing
|
||||
(await getBlockElementById(this.browser, firstBlockId)).waitForExist({
|
||||
timeout: 2000,
|
||||
|
||||
@@ -26,6 +26,9 @@ suite('Testing Connecting Blocks', function (done) {
|
||||
// Setup Selenium for all of the tests
|
||||
suiteSetup(async function () {
|
||||
this.browser = await testSetup(testFileLocations.CODE_DEMO);
|
||||
// Prevent WebDriver from suppressing alerts
|
||||
// https://github.com/webdriverio/webdriverio/issues/13610#issuecomment-2357768103
|
||||
this.browser.on('dialog', (dialog) => {});
|
||||
});
|
||||
|
||||
test('Testing Procedure', async function () {
|
||||
|
||||
@@ -254,9 +254,9 @@ export async function getCategory(browser, categoryName) {
|
||||
export async function getNthBlockOfCategory(browser, categoryName, n) {
|
||||
const category = await getCategory(browser, categoryName);
|
||||
await category.click();
|
||||
const block = await browser.$(
|
||||
`.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + n * 2})`,
|
||||
);
|
||||
const block = (
|
||||
await browser.$$(`.blocklyFlyout .blocklyBlockCanvas > .blocklyDraggable`)
|
||||
)[n];
|
||||
return block;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
import * as chai from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import {testFileLocations, testSetup} from './test_setup.mjs';
|
||||
|
||||
suite('Workspace comments', function () {
|
||||
@@ -20,8 +19,6 @@ suite('Workspace comments', function () {
|
||||
});
|
||||
|
||||
teardown(async function () {
|
||||
sinon.restore();
|
||||
|
||||
await this.browser.execute(() => {
|
||||
Blockly.getMainWorkspace().clear();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user