mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
* refactor(tests): Have testSetup accept a URL Have testSetup accept a URL. Make testFileLocations a dictionary whose values are URLs, and change the spellings of the keys to be CONSTANT_CASE. This allows tests to specify their own URL, or to add a query or fragment. * feat(tests): Add getAllBlocks helper * test: Verify drag blocks works properly * chore(tests): Reformat comments Manually reformat comments to comply with styleguide.
56 lines
1.2 KiB
JavaScript
56 lines
1.2 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, of basic Blockly block functionality.
|
|
*/
|
|
|
|
const chai = require('chai');
|
|
const {
|
|
testSetup,
|
|
testFileLocations,
|
|
getAllBlocks,
|
|
getSelectedBlockElement,
|
|
switchRTL,
|
|
dragBlockTypeFromFlyout,
|
|
screenDirection,
|
|
} = require('./test_setup');
|
|
const {Key} = require('webdriverio');
|
|
|
|
let browser;
|
|
|
|
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 () {
|
|
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 dragBlockTypeFromFlyout(
|
|
browser,
|
|
'Basic',
|
|
'test_basic_empty',
|
|
250,
|
|
50 * i
|
|
);
|
|
chai.assert.equal((await getAllBlocks(browser)).length, i);
|
|
}
|
|
});
|
|
|
|
// Teardown entire suite after test are done running
|
|
suiteTeardown(async function () {
|
|
await browser.deleteSession();
|
|
});
|
|
});
|