Files
blockly/tests/browser/test/basic_block_test.mjs
RoboErikG 361b453f17 fix: Fix browser tests PART 1 (#9064)
* Move block into view before clicking

* fix right click test failures

* Fix drag three blocks test

dragAndDrop is relative to the start and the test window is very small.

* Fix a few more tests

- Switch to using clickBlock instead of getting the block and clicking it
- Update drag positions for some tests so they don't snap and change size

* Add a pause between right clicking a block and waiting for the menu

* Fix mutator test by finding the dragged out elseif block

* Make disable test less flakey
2025-05-19 14:25:55 -07:00

39 lines
976 B
JavaScript

/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Node.js script to run Automated tests in Chrome, via
* webdriver, of basic Blockly block functionality.
*/
import * as chai from 'chai';
import {
dragNthBlockFromFlyout,
getAllBlocks,
testFileLocations,
testSetup,
} from './test_setup.mjs';
suite('Basic block tests', function (done) {
// Setting timeout to unlimited as the webdriver takes a longer time
// to run than most mocha test
this.timeout(0);
// Setup Selenium for all of the tests
suiteSetup(async function () {
this.browser = await testSetup(
testFileLocations.PLAYGROUND + '?toolbox=test-blocks',
);
});
test('Drag three blocks into the workspace', async function () {
for (let i = 1; i <= 3; i++) {
await dragNthBlockFromFlyout(this.browser, 'Align', 0, 50, 50);
chai.assert.equal((await getAllBlocks(this.browser)).length, i);
}
});
});