Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/blockly/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"start": "npm run package && npx nx run @blockly/dev-tools:build && concurrently -n watch,devtools-server,core-server \"npx nx watch --projects=@blockly/dev-tools --includeDependencies -- npm run build\" \"npx nx run @blockly/dev-tools:start --no-open\" \"http-server ./ -p 8081 -s -o /tests/playground.html -c-1\"",
"tsc": "gulp tsc",
"test": "gulp test",
"test:browser": "npx mocha --config tests/browser/.mocharc.js",
"test:browser": "npx nx run @blockly/block-test:build && npx mocha --config tests/browser/.mocharc.js",
"test:mocha:node": "npm run test:mocha:typecheck && npx mocha --config tests/mocha/.mocharc.node.cjs \"tests/mocha/**/*_test.{js,ts}\"",
"test:mocha:typecheck": "tsc -p tests/mocha/tsconfig.json",
"test:generators": "gulp testGenerators",
Expand Down
39 changes: 31 additions & 8 deletions packages/blockly/tests/browser/test/toolbox_drag_test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/

import * as chai from 'chai';
import {readFileSync} from 'fs';
import {createRequire} from 'module';
import {Key} from 'webdriverio';
import {
getBlockTypeFromCategory,
Expand All @@ -19,6 +21,29 @@ import {
testSetup,
} from './test_setup.mjs';

const require = createRequire(import.meta.url);

const blockTestSource = readFileSync(
require.resolve('@blockly/block-test'),
'utf8',
);

/**
* Load the test blocks into the playground page and swap in their toolbox.
* @param browser The active WebdriverIO Browser object.
*/
async function loadTestBlocks(browser) {
await browser.execute((source) => {
const script = document.createElement('script');
script.textContent = source;
document.head.appendChild(script);

const workspace = Blockly.getMainWorkspace();
workspace.updateToolbox(window.toolboxTestBlocks);
window.toolboxTestBlocksInit(workspace);
}, blockTestSource);
}

// Categories in the basic toolbox.
const basicCategories = [
'Logic',
Expand Down Expand Up @@ -194,17 +219,15 @@ suite('Open toolbox categories', function () {
await openCategories(this.browser, basicCategories, screenDirection.RTL);
});

test.skip('opening every toolbox category in the test toolbox in LTR', async function () {
this.browser = await testSetup(
testFileLocations.PLAYGROUND + '?toolbox=test-blocks',
);
test('opening every toolbox category in the test toolbox in LTR', async function () {
this.browser = await testSetup(testFileLocations.PLAYGROUND);
await loadTestBlocks(this.browser);
await openCategories(this.browser, testCategories, screenDirection.LTR);
});

test.skip('opening every toolbox category in the test toolbox in RTL', async function () {
this.browser = await testSetup(
testFileLocations.PLAYGROUND + '?toolbox=test-blocks&dir=rtl',
);
test('opening every toolbox category in the test toolbox in RTL', async function () {
this.browser = await testSetup(testFileLocations.PLAYGROUND_RTL);
await loadTestBlocks(this.browser);
await openCategories(this.browser, testCategories, screenDirection.RTL);
});

Expand Down
Loading