Web Dev Solutions

Catalin Mititiuc

From ac8eb25ac0b1d518beebe810e6430e375032028c Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Wed, 12 Jun 2024 10:50:34 -0700 Subject: Add some 'load scenario' todo tests --- esbuild-server.mjs | 6 ++++-- package.json | 4 ++-- test/integration/loadScenario.test.js | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 test/integration/loadScenario.test.js diff --git a/esbuild-server.mjs b/esbuild-server.mjs index bf73692..c269a52 100644 --- a/esbuild-server.mjs +++ b/esbuild-server.mjs @@ -259,7 +259,8 @@ if (process.env.NODE_ENV === 'test') { res.end("Not found"); } }).listen(3005, () => { - console.log('test server is online'); + const serverUrl = 'http://localhost:3005'; + console.log(`Test server running at ${serverUrl}`); }); } else { buildOptions.define = { 'window.IS_DEV': 'true' }; @@ -321,7 +322,8 @@ if (process.env.NODE_ENV === 'test') { req.pipe(proxyReq, { end: true }); } }).listen(8080, (e) => { - console.log('server is online', e); + const serverUrl = 'http://localhost:8080'; + console.log(`Development server running at ${serverUrl}`); }); } diff --git a/package.json b/package.json index 9c26357..e72df9b 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "selenium-webdriver": "^4.19.0" }, "scripts": { - "start": "node server.cjs", - "start:esbuildserver": "node esbuild-server.mjs", + "start": "node esbuild-server.mjs", + "start:esbuild-server": "node server.cjs", "test:integ": "node ./node_modules/.bin/jest --detectOpenHandles --config jest.config.integ.cjs", "test:integ:debug": "NODE_INSPECT_RESUME_ON_START=1 node inspect ./node_modules/jest/bin/jest.js --config jest.config.integ.cjs --runInBand", "test": "jest" diff --git a/test/integration/loadScenario.test.js b/test/integration/loadScenario.test.js new file mode 100644 index 0000000..645c5c2 --- /dev/null +++ b/test/integration/loadScenario.test.js @@ -0,0 +1,23 @@ +const { Builder } = require('selenium-webdriver'), + chrome = require('selenium-webdriver/chrome.js'), + chromeOptions = new chrome.Options(); + +chromeOptions.addArguments('--headless', '--disable-gpu', '--no-sandbox'); +chromeOptions.enableBidi(); + +let driver; + +beforeEach(async () => { + const builder = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions); + driver = builder.build(); +}); + +it.todo('loads default scenario on initial page load'); +it.todo('loads previously-loaded scenario on page refresh'); +it.todo('loads built-in scenario from dialog'); +it.todo('loads custom scenario directly from file'); +it.todo('loads saved scenario from file'); + +afterEach(async () => { + await driver.quit(); +}); -- cgit v1.2.3