diff --git a/test/package.json b/test/package.json index d090d90..67bd623 100644 --- a/test/package.json +++ b/test/package.json @@ -12,5 +12,6 @@ "chromedriver": "^147.0.1", "mocha": "^11.7.5", "selenium-webdriver": "^4.41.0" - } + }, + "type": "module" } diff --git a/test/test.js b/test/test.js index 560c3e6..ca0ff00 100644 --- a/test/test.js +++ b/test/test.js @@ -1,20 +1,16 @@ #!/usr/bin/env node -/* jshint esversion: 8 */ +import 'chromedriver'; +import { execSync } from 'node:child_process'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import timers from 'node:timers/promises'; +import { Builder, By, until } from 'selenium-webdriver'; +import { Options } from 'selenium-webdriver/chrome'; + /* global it, xit, describe, before, after, afterEach */ -'use strict'; - -require('chromedriver'); - -const execSync = require('child_process').execSync, - assert = require('node:assert/strict'), - fs = require('fs'), - path = require('path'), - timers = require('timers/promises'), - { Builder, By, until } = require('selenium-webdriver'), - { Options } = require('selenium-webdriver/chrome'); - if (!process.env.USERNAME || !process.env.PASSWORD) { console.log('USERNAME and PASSWORD env vars need to be set'); process.exit(1); @@ -27,7 +23,7 @@ describe('Application life cycle test', function () { const TEST_TIMEOUT = 30000; const FOLDER = 'xmf'; // keep this small. long folder names fail in automation, not sure why const SYNC_PORT = 22001; - const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; + const EXEC_ARGS = { cwd: path.resolve(import.meta.dirname, '..'), stdio: 'inherit' }; let browser, app; const adminUsername = 'admin', adminPassword = 'changeme';