mirror of
https://github.com/google/blockly.git
synced 2026-02-01 13:10:22 +01:00
* refactor(tests): Use shims instead of bootstrap to load Blockly
- Modify tests/generators/index.html to import the test shims
instead of using bootstrap.js to load Blockly.
- Modify test/generators/webdriver.js to have it wait for the
workspace to exist before calling loadSelected(). There was
previously a race which index.html had been winning, but
now webdriver.js is winning (and the tests failing because
there is no workspace yet when start() is called.
* chore(tests): Delete bootstrap.js etc.
- Delete bootstrap.js, bootstrap_helper.js, and bootstrap_done.mjs.
- Remove remaining references to bootstrap.js
* refactor(build): Remove deps npm script
buildDeps is now only needed by buildCompiled, not ever for
runnning in uncompressed mode, so:
- Remove the deps gulp task (and the deps npm script.
- Have the minify task run buildJavaScript and buildDeps directly.
Additionally, the buildAdvanceCompilationTest target hasn't
needed deps.js for some time (if ever), so skip having it run
buildDeps entirely.
* refactor(build): Repatriate DEPS_FILE to build_tasks.js
Since this is no longer used anywhere else it doesn't need to
live in common.js.
* fix(scripts): Remove vestigial references to deps.mocha.js
* docs(tests): Add additional explanatory note
224 lines
7.7 KiB
HTML
224 lines
7.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Mocha Tests for Blockly</title>
|
|
|
|
<link href="../../node_modules/mocha/mocha.css" rel="stylesheet" />
|
|
</head>
|
|
<style>
|
|
#blocklyDiv {
|
|
height: 1000px;
|
|
position: fixed;
|
|
visibility: hidden;
|
|
width: 1000px;
|
|
}
|
|
</style>
|
|
<body>
|
|
<div id="mocha"></div>
|
|
<div id="failureCount" style="display: none" tests_failed="unset"></div>
|
|
<div id="failureMessages" style="display: none"></div>
|
|
<!-- Load mocha et al. before Blockly and the test modules so that
|
|
we can safely import the test modules that make calls
|
|
to (e.g.) suite() at the top level. -->
|
|
<script src="../../node_modules/chai/chai.js"></script>
|
|
<script src="../../node_modules/mocha/mocha.js"></script>
|
|
<script src="../../node_modules/sinon/pkg/sinon.js"></script>
|
|
<script>
|
|
mocha.setup({
|
|
ui: 'tdd',
|
|
failZero: true,
|
|
});
|
|
</script>
|
|
|
|
<script type="module">
|
|
import {loadScript} from '../scripts/load.mjs';
|
|
|
|
// Load Blockly in uncompressed mode.
|
|
import * as Blockly from '../../build/blockly.loader.mjs';
|
|
import '../../build/blocks.loader.mjs';
|
|
import {javascriptGenerator} from '../../build/javascript.loader.mjs';
|
|
|
|
// Import tests.
|
|
import './astnode_test.js';
|
|
import './block_json_test.js';
|
|
import './block_test.js';
|
|
import './clipboard_test.js';
|
|
import './comment_test.js';
|
|
import './comment_deserialization_test.js';
|
|
import './connection_checker_test.js';
|
|
import './connection_db_test.js';
|
|
import './connection_test.js';
|
|
import './contextmenu_items_test.js';
|
|
import './cursor_test.js';
|
|
import './dropdowndiv_test.js';
|
|
import './event_test.js';
|
|
import './event_block_change_test.js';
|
|
import './event_block_create_test.js';
|
|
import './event_block_delete_test.js';
|
|
import './event_block_drag_test.js';
|
|
import './event_block_field_intermediate_change_test.js';
|
|
import './event_block_move_test.js';
|
|
import './event_bubble_open_test.js';
|
|
import './event_click_test.js';
|
|
import './event_comment_change_test.js';
|
|
import './event_comment_create_test.js';
|
|
import './event_comment_delete_test.js';
|
|
import './event_comment_move_test.js';
|
|
import './event_marker_move_test.js';
|
|
import './event_selected_test.js';
|
|
import './event_theme_change_test.js';
|
|
import './event_toolbox_item_select_test.js';
|
|
import './event_trashcan_open_test.js';
|
|
import './event_var_create_test.js';
|
|
import './event_var_delete_test.js';
|
|
import './event_var_rename_test.js';
|
|
import './event_viewport_test.js';
|
|
import './extensions_test.js';
|
|
import './field_angle_test.js';
|
|
import './field_checkbox_test.js';
|
|
import './field_colour_test.js';
|
|
import './field_dropdown_test.js';
|
|
import './field_image_test.js';
|
|
import './field_label_serializable_test.js';
|
|
import './field_label_test.js';
|
|
import './field_multilineinput_test.js';
|
|
import './field_number_test.js';
|
|
import './field_registry_test.js';
|
|
import './field_test.js';
|
|
import './field_textinput_test.js';
|
|
import './field_variable_test.js';
|
|
import './flyout_test.js';
|
|
import './generator_test.js';
|
|
import './gesture_test.js';
|
|
import './icon_test.js';
|
|
import './input_test.js';
|
|
import './insertion_marker_test.js';
|
|
import './insertion_marker_manager_test.js';
|
|
import './jso_deserialization_test.js';
|
|
import './jso_serialization_test.js';
|
|
import './json_test.js';
|
|
import './keydown_test.js';
|
|
import './blocks/lists_test.js';
|
|
import './blocks/logic_ternary_test.js';
|
|
import './metrics_test.js';
|
|
import './mutator_test.js';
|
|
import './names_test.js';
|
|
import './procedure_map_test.js';
|
|
import './blocks/procedures_test.js';
|
|
import './registry_test.js';
|
|
import './render_management_test.js';
|
|
import './serializer_test.js';
|
|
import './shortcut_registry_test.js';
|
|
import './touch_test.js';
|
|
import './theme_test.js';
|
|
import './toolbox_test.js';
|
|
import './tooltip_test.js';
|
|
import './trashcan_test.js';
|
|
import './utils_test.js';
|
|
import './variable_map_test.js';
|
|
import './variable_model_test.js';
|
|
import './blocks/variables_test.js';
|
|
import './widget_div_test.js';
|
|
import './workspace_comment_test.js';
|
|
import './workspace_svg_test.js';
|
|
import './workspace_test.js';
|
|
import './xml_test.js';
|
|
import './zoom_controls_test.js';
|
|
|
|
// Make Blockly and generators available via global scope.
|
|
globalThis.Blockly = Blockly;
|
|
globalThis.javascriptGenerator = javascriptGenerator;
|
|
|
|
// Load additional scripts.
|
|
await loadScript('../../build/msg/en.js');
|
|
await loadScript('../playgrounds/screenshot.js');
|
|
await loadScript('../../node_modules/@blockly/dev-tools/dist/index.js');
|
|
|
|
let runner = mocha.run(function (failures) {
|
|
var failureDiv = document.getElementById('failureCount');
|
|
failureDiv.setAttribute('tests_failed', failures);
|
|
});
|
|
runner.on('fail', function (test, err) {
|
|
const msg = document.createElement('p');
|
|
msg.textContent = `"${test.fullTitle()}" failed: ${err.message}`;
|
|
const div = document.getElementById('failureMessages');
|
|
div.appendChild(msg);
|
|
});
|
|
</script>
|
|
|
|
<div id="blocklyDiv"></div>
|
|
|
|
<xml
|
|
xmlns="https://developers.google.com/blockly/xml"
|
|
id="toolbox-simple"
|
|
style="display: none">
|
|
<block type="logic_compare">
|
|
<field name="OP">NEQ</field>
|
|
<value name="A">
|
|
<shadow type="math_number">
|
|
<field name="NUM">1</field>
|
|
</shadow>
|
|
</value>
|
|
<value name="B">
|
|
<block type="math_number">
|
|
<field name="NUM">2</field>
|
|
</block>
|
|
</value>
|
|
</block>
|
|
<sep gap="20"></sep>
|
|
<button text="insert" callbackkey="insertConnectionRows"></button>
|
|
<label text="tooltips"></label>
|
|
</xml>
|
|
|
|
<xml
|
|
xmlns="https://developers.google.com/blockly/xml"
|
|
id="toolbox-categories"
|
|
style="display: none">
|
|
<category name="First" css-container="something">
|
|
<block type="basic_block">
|
|
<field name="TEXT">FirstCategory-FirstBlock</field>
|
|
</block>
|
|
<block type="basic_block">
|
|
<field name="TEXT">FirstCategory-SecondBlock</field>
|
|
</block>
|
|
</category>
|
|
<category name="Second">
|
|
<block type="basic_block">
|
|
<field name="TEXT">SecondCategory-FirstBlock</field>
|
|
</block>
|
|
</category>
|
|
</xml>
|
|
|
|
<xml
|
|
xmlns="https://developers.google.com/blockly/xml"
|
|
id="toolbox-test"
|
|
style="display: none">
|
|
<category name="First" expanded="true" categorystyle="logic_category">
|
|
<sep gap="-1"></sep>
|
|
<button text="insert" callbackkey="insertConnectionRows"></button>
|
|
<block type="stack_block"></block>
|
|
<block type="stack_block"></block>
|
|
</category>
|
|
<category name="Second">
|
|
<block type="stack_block"></block>
|
|
</category>
|
|
<sep toolboxitemid="separator" gap="-1"></sep>
|
|
<category name="Variables" custom="VARIABLE"></category>
|
|
<category name="NestedCategory">
|
|
<category
|
|
toolboxitemid="nestedCategory"
|
|
name="NestedItemOne"></category>
|
|
</category>
|
|
<category name="lastItem"></category>
|
|
</xml>
|
|
|
|
<xml
|
|
xmlns="https://developers.google.com/blockly/xml"
|
|
id="gesture-test-toolbox"
|
|
style="display: none">
|
|
<block type="test_field_block"></block>
|
|
</xml>
|
|
</body>
|
|
</html>
|