index : pan-zoom | |
SVG pan/zoom library. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2025-03-06 15:27:27 -0800 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2025-03-06 21:47:00 -0800 |
commit | f0b5c1a511ba794609178e5f08e7c8f8c2ec1723 (patch) | |
tree | 3f8f2801b7ae20dd41923c24861779cca994b664 /__tests__ | |
parent | c0b2d77d14b0fd998a36f647c918778030c35623 (diff) |
Diffstat (limited to '__tests__')
-rw-r--r-- | __tests__/integration/page.spec.js | 21 | ||||
-rw-r--r-- | __tests__/integration/setup.js | 21 | ||||
-rw-r--r-- | __tests__/integration/teardown.js | 4 |
3 files changed, 46 insertions, 0 deletions
diff --git a/__tests__/integration/page.spec.js b/__tests__/integration/page.spec.js new file mode 100644 index 0000000..069a222 --- /dev/null +++ b/__tests__/integration/page.spec.js @@ -0,0 +1,21 @@ +const { Builder } = require('selenium-webdriver'); +const chrome = require('selenium-webdriver/chrome'); +const chromeOptions = new chrome.Options(); + +let driver; + +chromeOptions.addArguments('--headless', '--disable-gpu', '--no-sandbox'); + +beforeEach(async () => { + const builder = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions); + driver = builder.build(); +}); + +it('loads the page', async () => { + await driver.get('http://localhost:8080'); + expect(await driver.getTitle()).toEqual('SVG Element Pan & Zoom Demo'); +}); + +afterEach(async () => { + await driver.quit(); +}); diff --git a/__tests__/integration/setup.js b/__tests__/integration/setup.js new file mode 100644 index 0000000..b50e1ca --- /dev/null +++ b/__tests__/integration/setup.js @@ -0,0 +1,21 @@ +const { spawn } = require('child_process'); + +module.exports = async function (globalConfig, projectConfig) { + console.info('\nSpawning server process...'); + const child = spawn('node', ['server.js']); + + child.stdout.on('data', data => { + console.log(`${data}`); + }); + + globalThis.__INTEG_TEST_SERVER_PID__ = child.pid; + + child.stderr.on('data', data => { + const str = data.toString(); + console.log('[server]', str); + + if (str.includes(projectConfig.globals.testServerUrl)) { + setTimeout(resolve, 200); + } + }); +}; diff --git a/__tests__/integration/teardown.js b/__tests__/integration/teardown.js new file mode 100644 index 0000000..c4a55b9 --- /dev/null +++ b/__tests__/integration/teardown.js @@ -0,0 +1,4 @@ +module.exports = async function (globalConfig, projectConfig) { + console.info('Stopping server.'); + process.kill(globalThis.__INTEG_TEST_SERVER_PID__); +}; |