mirror of
https://github.com/google/blockly.git
synced 2026-01-06 08:30:13 +01:00
* chore(tests): use helpers for the basic drag test in the playground * chore(tests): miscellaneous test cleanup * chore: format * feat(tests): add test that drags out every block from the toolbox * feat(tests): add RTL version of toolbox drag tests * chore: lint * chore(tests): respond to PR feedback
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2023 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview Node.js script to run Automated tests in Chrome, via webdriver.
|
|
*/
|
|
|
|
const chai = require('chai');
|
|
const {Key} = require('webdriverio');
|
|
const {
|
|
testSetup,
|
|
testFileLocations,
|
|
dragBlockTypeFromFlyout,
|
|
screenDirection,
|
|
getAllBlocks,
|
|
} = require('./test_setup');
|
|
|
|
suite('Testing undo block movement', function (done) {
|
|
// Setting timeout to unlimited as the webdriver takes a longer time to run than most mocha test
|
|
this.timeout(0);
|
|
|
|
test('Undoing Block Movement LTR', async function () {
|
|
this.browser = await testSetup(testFileLocations.PLAYGROUND);
|
|
await testUndoBlock(this.browser, screenDirection.LTR);
|
|
});
|
|
|
|
test('Undoing Block Movement RTL', async function () {
|
|
this.browser = await testSetup(testFileLocations.PLAYGROUND_RTL);
|
|
await testUndoBlock(this.browser, screenDirection.RTL);
|
|
});
|
|
});
|
|
|
|
async function testUndoBlock(browser, direction) {
|
|
// Drag out first function
|
|
await dragBlockTypeFromFlyout(
|
|
browser,
|
|
'Functions',
|
|
'procedures_defreturn',
|
|
50 * direction,
|
|
20,
|
|
);
|
|
|
|
await browser.keys([Key.Ctrl, 'z']);
|
|
|
|
const allBlocks = await getAllBlocks(browser);
|
|
chai.assert.equal(allBlocks.length, 0);
|
|
}
|