diff --git a/eslint.config.js b/eslint.config.js index 4b6119cb..60bfe8ab 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -129,7 +129,7 @@ module.exports = [ }, }, { - files: ['**/*.mocha.js', 'test/webdriverio/test/*_test.mjs'], + files: ['**/*.mocha.js', 'test/webdriverio/test/*_test.js'], languageOptions: { globals: { ...globals.mocha, diff --git a/package-lock.json b/package-lock.json index ff22e7db..d9fadcc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,8 @@ "@blockly/field-colour": "^5.0.7", "@eslint/eslintrc": "^2.1.2", "@eslint/js": "^8.49.0", + "@types/chai": "^5.2.1", + "@types/mocha": "^10.0.10", "@types/p5": "^1.7.6", "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "^6.7.2", @@ -1586,6 +1588,15 @@ "@types/node": "*" } }, + "node_modules/@types/chai": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.1.tgz", + "integrity": "sha512-iu1JLYmGmITRzUgNiLMZD3WCoFzpYtueuyAgHTXqgwSRAMIlFTnZqG6/xenkpUGRJEzSfklUTI4GNSzks/dc0w==", + "dev": true, + "dependencies": { + "@types/deep-eql": "*" + } + }, "node_modules/@types/connect": { "version": "3.4.38", "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", @@ -1607,6 +1618,12 @@ "@types/node": "*" } }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true + }, "node_modules/@types/eslint": { "version": "8.56.10", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz", @@ -1699,14 +1716,19 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true + }, "node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "22.13.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.14.tgz", + "integrity": "sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w==", "dev": true, - "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.20.0" } }, "node_modules/@types/node-forge": { @@ -2205,6 +2227,21 @@ "node": ">=18.20.0" } }, + "node_modules/@wdio/repl/node_modules/@types/node": { + "version": "20.17.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.28.tgz", + "integrity": "sha512-DHlH/fNL6Mho38jTy7/JT7sn2wnXI+wULR6PV4gy4VHLVvnrV/d3pHAMQHhc4gjdLmK2ZiPoMxzp6B3yRajLSQ==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@wdio/repl/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "node_modules/@wdio/types": { "version": "9.10.1", "resolved": "https://registry.npmjs.org/@wdio/types/-/types-9.10.1.tgz", @@ -2217,6 +2254,21 @@ "node": ">=18.20.0" } }, + "node_modules/@wdio/types/node_modules/@types/node": { + "version": "20.17.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.28.tgz", + "integrity": "sha512-DHlH/fNL6Mho38jTy7/JT7sn2wnXI+wULR6PV4gy4VHLVvnrV/d3pHAMQHhc4gjdLmK2ZiPoMxzp6B3yRajLSQ==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@wdio/types/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "node_modules/@wdio/utils": { "version": "9.12.1", "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-9.12.1.tgz", @@ -3587,6 +3639,22 @@ "node": ">=6.0" } }, + "node_modules/chromium-bidi": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.3.tgz", + "integrity": "sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.23.8" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "node_modules/clean-css": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", @@ -4162,6 +4230,14 @@ "dev": true, "license": "MIT" }, + "node_modules/devtools-protocol": { + "version": "0.0.1312386", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", + "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/diff": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", @@ -7295,6 +7371,14 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/mocha": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.1.0.tgz", @@ -8257,6 +8341,48 @@ "node": ">=6" } }, + "node_modules/puppeteer-core": { + "version": "22.15.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.15.0.tgz", + "integrity": "sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "@puppeteer/browsers": "2.3.0", + "chromium-bidi": "0.6.3", + "debug": "^4.3.6", + "devtools-protocol": "0.0.1312386", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core/node_modules/@puppeteer/browsers": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.0.tgz", + "integrity": "sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "debug": "^4.3.5", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.4.0", + "semver": "^7.6.3", + "tar-fs": "^3.0.6", + "unbzip2-stream": "^1.4.3", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/qs": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", @@ -9659,6 +9785,14 @@ "dev": true, "license": "MIT" }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/thunky": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", @@ -9864,6 +9998,44 @@ "node": ">=14.17" } }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unbzip2-stream/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "optional": true, + "peer": true, + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, "node_modules/undici": { "version": "6.21.2", "resolved": "https://registry.npmjs.org/undici/-/undici-6.21.2.tgz", @@ -9874,11 +10046,10 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true, - "license": "MIT" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true }, "node_modules/universalify": { "version": "2.0.1", @@ -10098,6 +10269,21 @@ "node": ">=18.20.0" } }, + "node_modules/webdriver/node_modules/@types/node": { + "version": "20.17.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.28.tgz", + "integrity": "sha512-DHlH/fNL6Mho38jTy7/JT7sn2wnXI+wULR6PV4gy4VHLVvnrV/d3pHAMQHhc4gjdLmK2ZiPoMxzp6B3yRajLSQ==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/webdriver/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "node_modules/webdriverio": { "version": "9.12.1", "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-9.12.1.tgz", @@ -10142,6 +10328,15 @@ } } }, + "node_modules/webdriverio/node_modules/@types/node": { + "version": "20.17.28", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.28.tgz", + "integrity": "sha512-DHlH/fNL6Mho38jTy7/JT7sn2wnXI+wULR6PV4gy4VHLVvnrV/d3pHAMQHhc4gjdLmK2ZiPoMxzp6B3yRajLSQ==", + "dev": true, + "dependencies": { + "undici-types": "~6.19.2" + } + }, "node_modules/webdriverio/node_modules/is-plain-obj": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", @@ -10154,6 +10349,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/webdriverio/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "node_modules/webidl-conversions": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", @@ -10745,6 +10946,17 @@ "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "dev": true, + "optional": true, + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } } } } diff --git a/package.json b/package.json index da0b96cf..1386445b 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,11 @@ "prepublishOnly": "npm login --registry https://wombat-dressing-room.appspot.com", "start": "blockly-scripts start", "test": "npm run wdio:clean && npm run wdio:build && npm run wdio:run", - "wdio:build": "cd test/webdriverio && webpack", - "wdio:clean": "cd test/webdriverio && rm -rf build", - "wdio:run": "cd test/webdriverio && npx mocha" + "wdio:build": "npm run wdio:build:app && npm run wdio:build:tests", + "wdio:build:app": "cd test/webdriverio && webpack", + "wdio:build:tests": "tsc -p ./test/webdriverio/test/tsconfig.json", + "wdio:clean": "cd test/webdriverio/test && rm -rf dist", + "wdio:run": "npm run wdio:build && cd test/webdriverio/test && npx mocha dist" }, "main": "./dist/index.js", "module": "./src/index.js", @@ -48,6 +50,8 @@ "@blockly/field-colour": "^5.0.7", "@eslint/eslintrc": "^2.1.2", "@eslint/js": "^8.49.0", + "@types/chai": "^5.2.1", + "@types/mocha": "^10.0.10", "@types/p5": "^1.7.6", "@typescript-eslint/eslint-plugin": "^6.7.2", "@typescript-eslint/parser": "^6.7.2", diff --git a/test/webdriverio/.mocharc.js b/test/webdriverio/.mocharc.js index 21a7a875..9afa290d 100644 --- a/test/webdriverio/.mocharc.js +++ b/test/webdriverio/.mocharc.js @@ -8,5 +8,5 @@ module.exports = { ui: 'tdd', - require: __dirname + '/test/hooks.mjs', + require: __dirname + '/test/dist/hooks.js', }; diff --git a/test/webdriverio/test/basic_test.mjs b/test/webdriverio/test/basic_test.ts similarity index 92% rename from test/webdriverio/test/basic_test.mjs rename to test/webdriverio/test/basic_test.ts index bd435696..ab12b24d 100644 --- a/test/webdriverio/test/basic_test.mjs +++ b/test/webdriverio/test/basic_test.ts @@ -5,7 +5,8 @@ */ import * as chai from 'chai'; -import {testSetup, testFileLocations, PAUSE_TIME} from './test_setup.mjs'; +import * as Blockly from 'blockly'; +import {testSetup, testFileLocations, PAUSE_TIME} from './test_setup.js'; import {Key} from 'webdriverio'; suite('Keyboard navigation', function () { @@ -38,7 +39,7 @@ suite('Keyboard navigation', function () { } const selectedId = await this.browser.execute(() => { - return Blockly.common.getSelected().id; + return Blockly.common.getSelected()?.id; }); chai.assert.equal(selectedId, 'draw_circle_1'); }); diff --git a/test/webdriverio/test/hooks.mjs b/test/webdriverio/test/hooks.ts similarity index 70% rename from test/webdriverio/test/hooks.mjs rename to test/webdriverio/test/hooks.ts index 27f9da32..8d0f66fa 100644 --- a/test/webdriverio/test/hooks.mjs +++ b/test/webdriverio/test/hooks.ts @@ -9,10 +9,11 @@ * These create a shared chromedriver instance, so we don't have to fire up * a new one for every suite. */ -import {driverSetup, driverTeardown} from './test_setup.mjs'; +import {RootHookObject} from 'mocha'; +import {driverSetup, driverTeardown} from './test_setup.js'; -export const mochaHooks = { - async beforeAll() { +export const mochaHooks: RootHookObject = { + async beforeAll(this: Mocha.Context) { // Set a long timeout for startup. this.timeout(10000); return await driverSetup(); diff --git a/test/webdriverio/test/mocha.d.ts b/test/webdriverio/test/mocha.d.ts new file mode 100644 index 00000000..f3a93258 --- /dev/null +++ b/test/webdriverio/test/mocha.d.ts @@ -0,0 +1,11 @@ +import {Browser} from 'webdriverio'; + +declare module 'mocha' { + export interface Context { + /** + * This is typically only defined by suite setup but it is more practical to + * write tests that can assume it is defined. + */ + browser: Browser; + } +} diff --git a/test/webdriverio/test/package.json b/test/webdriverio/test/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/test/webdriverio/test/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/test/webdriverio/test/test_setup.mjs b/test/webdriverio/test/test_setup.ts similarity index 64% rename from test/webdriverio/test/test_setup.mjs rename to test/webdriverio/test/test_setup.ts index 86eead28..17c54509 100644 --- a/test/webdriverio/test/test_setup.mjs +++ b/test/webdriverio/test/test_setup.ts @@ -20,16 +20,10 @@ import * as webdriverio from 'webdriverio'; import * as path from 'path'; import {fileURLToPath} from 'url'; -/** - * The directory where this code was run. - * - */ -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - /** * The webdriverio instance, which should only be initialized once. */ -let driver = null; +let driver: webdriverio.Browser | null = null; /** * The default amount of time to wait during a test. Increase this to make @@ -40,21 +34,24 @@ export const PAUSE_TIME = 50; /** * Start up the test page. This should only be done once, to avoid * constantly popping browser windows open and closed. - * @returns {Promise} A Promise that resolves to a webdriverIO browser that tests can manipulate. + * + * @returns A Promise that resolves to a webdriverIO browser that tests can manipulate. */ -export async function driverSetup() { +export async function driverSetup(): Promise { const options = { capabilities: { 'browserName': 'chrome', 'unhandledPromptBehavior': 'ignore', + // eslint-disable-next-line @typescript-eslint/naming-convention 'goog:chromeOptions': { args: ['--allow-file-access-from-files'], }, // We aren't (yet) using any BiDi features, and BiDi is sensitive to // mismatches between Chrome version and Chromedriver version. - 'wdio:enforceWebDriverClassic': 'true', + // eslint-disable-next-line @typescript-eslint/naming-convention + 'wdio:enforceWebDriverClassic': true, }, - logLevel: 'warn', + logLevel: 'warn' as const, }; // Run in headless mode on Github Actions. @@ -78,23 +75,27 @@ export async function driverSetup() { /** * End the webdriverIO session. + * * @return A Promise that resolves after the actions have been completed. */ export async function driverTeardown() { - await driver.deleteSession(); + await driver?.deleteSession(); driver = null; return; } /** * Navigate to the correct URL for the test, using the shared driver. - * @param {string} playgroundUrl The URL to open for the test, which should be + * + * @param playgroundUrl The URL to open for the test, which should be * a Blockly playground with a workspace. - * @returns {Promise} A Promsie that resolves to a webdriverIO browser that tests can manipulate. + * @returns A Promise that resolves to a webdriverIO browser that tests can manipulate. */ -export async function testSetup(playgroundUrl) { +export async function testSetup( + playgroundUrl: string, +): Promise { if (!driver) { - await driverSetup(); + driver = await driverSetup(); } await driver.url(playgroundUrl); // Wait for the workspace to exist and be rendered. @@ -109,26 +110,33 @@ export async function testSetup(playgroundUrl) { * * Simplified implementation based on * https://stackoverflow.com/a/63251716/4969945 - * @param {string} target target path - * @returns {string} posix path + * + * @param target target path + * @returns posix path */ -function posixPath(target) { +function posixPath(target: string): string { const result = target.split(path.sep).join(path.posix.sep); console.log(result); return result; } +// Relative to dist folder for TS build +const createTestUrl = (options?: URLSearchParams) => { + const dirname = path.dirname(fileURLToPath(import.meta.url)); + const base = new URL( + `file://${posixPath(path.join(dirname, '..', '..', 'build', 'index.html'))}`, + ); + base.search = options?.toString() ?? ''; + return base.toString(); +}; + export const testFileLocations = { - BASE: - 'file://' + posixPath(path.join(__dirname, '..', 'build')) + '/index.html', - BASE_RTL: - 'file://' + posixPath(path.join(__dirname, '..', 'build')) + '/index.html?rtl=true', - GERAS: - 'file://' + - posixPath(path.join(__dirname, '..', 'build')) + - '/index.html?renderer=geras', - GERAS_RTL: - 'file://' + - posixPath(path.join(__dirname, '..', 'build')) + - '/index.html?renderer=geras&rtl=true', + BASE: createTestUrl(), + // eslint-disable-next-line @typescript-eslint/naming-convention + BASE_RTL: createTestUrl(new URLSearchParams({rtl: 'true'})), + GERAS: createTestUrl(new URLSearchParams({renderer: 'geras'})), + // eslint-disable-next-line @typescript-eslint/naming-convention + GERAS_RTL: createTestUrl( + new URLSearchParams({renderer: 'geras', rtl: 'true'}), + ), }; diff --git a/test/webdriverio/test/tsconfig.json b/test/webdriverio/test/tsconfig.json new file mode 100644 index 00000000..4a6633de --- /dev/null +++ b/test/webdriverio/test/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "baseUrl": "./", + "outDir": "dist", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "module": "NodeNext", + "moduleResolution": "nodenext", + "target": "es6", + "strict": true, + "skipLibCheck": true + }, + "include": ["."] +} diff --git a/tsconfig.json b/tsconfig.json index 3619881f..51d036ae 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,5 +12,6 @@ }, // NOTE: `test/**/*` is automatically included in `blockly-scripts start`. // Only src matters for production builds. - "include": ["./src", "./test"] + "include": ["./src", "./test"], + "exclude": ["./test/webdriverio/"] }