From cc3c0d9bdf56a146e275144af9d57aee96d2c38b Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Thu, 14 Sep 2023 14:01:31 -0700 Subject: [PATCH] fix: minor issues in browser tests --- tests/browser/test/delete_blocks_test.js | 7 ++++--- tests/browser/test/field_edits_test.js | 2 +- tests/browser/test/procedure_test.js | 1 + tests/browser/test/toolbox_drag_test.js | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/browser/test/delete_blocks_test.js b/tests/browser/test/delete_blocks_test.js index cecee8ba177..b25c096a1ec 100644 --- a/tests/browser/test/delete_blocks_test.js +++ b/tests/browser/test/delete_blocks_test.js @@ -179,7 +179,8 @@ suite('Delete blocks', function (done) { await this.browser.keys([Key.Backspace]); await this.browser.pause(PAUSE_TIME); // Undo - await this.browser.keys([Key.Ctrl, 'Z']); + await this.browser.keys([Key.Ctrl, 'z']); + await this.browser.pause(PAUSE_TIME); const after = (await getAllBlocks(this.browser)).length; chai.assert.equal( before, @@ -195,10 +196,10 @@ suite('Delete blocks', function (done) { await this.browser.keys([Key.Backspace]); await this.browser.pause(PAUSE_TIME); // Undo - await this.browser.keys([Key.Ctrl, 'Z']); + await this.browser.keys([Key.Ctrl, 'z']); await this.browser.pause(PAUSE_TIME); // Redo - await this.browser.keys([Key.Ctrl, Key.Shift, 'Z']); + await this.browser.keys([Key.Ctrl, Key.Shift, 'z']); await this.browser.pause(PAUSE_TIME); const after = (await getAllBlocks(this.browser)).length; chai.assert.equal( diff --git a/tests/browser/test/field_edits_test.js b/tests/browser/test/field_edits_test.js index f0e3403a7c8..e1699fc2d77 100644 --- a/tests/browser/test/field_edits_test.js +++ b/tests/browser/test/field_edits_test.js @@ -45,8 +45,8 @@ async function testFieldEdits(browser, direction) { // Click on the field to change the value await numberBlock.click(); await browser.keys([Key.Delete]); - await numberBlock.click(); await browser.keys(['1093']); + // Click on the workspace to exit the field editor const workspace = await browser.$('#blocklyDiv > div > svg.blocklySvg > g'); await workspace.click(); diff --git a/tests/browser/test/procedure_test.js b/tests/browser/test/procedure_test.js index 2b8eab88fef..c36cb918592 100644 --- a/tests/browser/test/procedure_test.js +++ b/tests/browser/test/procedure_test.js @@ -104,5 +104,6 @@ suite('Testing Connecting Blocks', function (done) { await this.browser.pause(PAUSE_TIME); const alertText = await this.browser.getAlertText(); // get the alert text chai.assert.equal(alertText, '123'); + await this.browser.acceptAlert(); }); }); diff --git a/tests/browser/test/toolbox_drag_test.js b/tests/browser/test/toolbox_drag_test.js index 7991b2398ed..14a9f0836db 100644 --- a/tests/browser/test/toolbox_drag_test.js +++ b/tests/browser/test/toolbox_drag_test.js @@ -148,8 +148,8 @@ async function openCategories(browser, categoryList, directionMultiplier) { const flyoutBlock = await browser.$( `.blocklyFlyout .blocklyBlockCanvas > g:nth-child(${3 + i * 2})`, ); - if (!(await elementInBounds(browser, flyoutBlock))) { - await scrollFlyout(browser, 0, 500); + while (!(await elementInBounds(browser, flyoutBlock))) { + await scrollFlyout(browser, 0, 50); } await flyoutBlock.dragAndDrop({x: directionMultiplier * 50, y: 0});