refactor: migrate to ESM (#7331)

* refactor: move package.json to type: module

this is where the fun begins

* chore: move webpack common and prod to esm

* chore: move webpack to esm, eslint to explicit cjs

* refactor: migrate all files to esm

* style: lint

* refactor: begin moving karma to cjs, use dynamic esm import

* refactor: move index-test to cjs

* refactor: begin moving e2e to ESM

this was manual. I'm committing this because I'm about to try the `cjstoesm` tool

* refactor: move all to esm

* fix: make all e2e tests use .js imports

* refactor: begin moving exports to esm

* refactor: use URL transforms instead of __dirname

* fix: use libraryExport: default to properly handle openmct

* fix: export all playwright configs as modules

* refactor: move all instances of __dirname to import.meta.url

* refactor: lint, drop unnecessary URL call

* fix: use correct URL path on helper/addNoneditableObject.js

* fix: more incorrect URL resolve issues

* fix: parse json after reading it
This commit is contained in:
Tristan F 2024-01-02 10:24:22 -05:00 committed by GitHub
parent 68e60e332e
commit fce98a1c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
485 changed files with 1220 additions and 1190 deletions

View File

@ -1,5 +1,3 @@
/* global __dirname module */
/* /*
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations: This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
- webpack.prod.js - the production configuration for OpenMCT (default) - webpack.prod.js - the production configuration for OpenMCT (default)
@ -8,27 +6,30 @@ This is the OpenMCT common webpack file. It is imported by the other three webpa
There are separate npm scripts to use these configurations, though simply running `npm install` There are separate npm scripts to use these configurations, though simply running `npm install`
will use the default production configuration. will use the default production configuration.
*/ */
const path = require('path'); import path from 'node:path';
const packageDefinition = require('../package.json'); import CopyWebpackPlugin from 'copy-webpack-plugin';
const CopyWebpackPlugin = require('copy-webpack-plugin'); import webpack from 'webpack';
const webpack = require('webpack'); import MiniCssExtractPlugin from 'mini-css-extract-plugin';
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); import fs from 'node:fs';
import { execSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
const { VueLoaderPlugin } = require('vue-loader'); import { VueLoaderPlugin } from 'vue-loader';
let gitRevision = 'error-retrieving-revision'; let gitRevision = 'error-retrieving-revision';
let gitBranch = 'error-retrieving-branch'; let gitBranch = 'error-retrieving-branch';
const packageDefinition = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
try { try {
gitRevision = require('child_process').execSync('git rev-parse HEAD').toString().trim(); gitRevision = execSync('git rev-parse HEAD').toString().trim();
gitBranch = require('child_process') gitBranch = execSync('git rev-parse --abbrev-ref HEAD')
.execSync('git rev-parse --abbrev-ref HEAD')
.toString() .toString()
.trim(); .trim();
} catch (err) { } catch (err) {
console.warn(err); console.warn(err);
} }
const projectRootDir = path.resolve(__dirname, '..'); const projectRootDir = fileURLToPath(new URL('../', import.meta.url));
/** @type {import('webpack').Configuration} */ /** @type {import('webpack').Configuration} */
const config = { const config = {
@ -56,6 +57,7 @@ const config = {
filename: '[name].js', filename: '[name].js',
path: path.resolve(projectRootDir, 'dist'), path: path.resolve(projectRootDir, 'dist'),
library: 'openmct', library: 'openmct',
libraryExport: 'default',
libraryTarget: 'umd', libraryTarget: 'umd',
publicPath: '', publicPath: '',
hashFunction: 'xxhash64', hashFunction: 'xxhash64',
@ -183,4 +185,4 @@ const config = {
} }
}; };
module.exports = config; export default config;

View File

@ -1,12 +1,10 @@
/* global module */
/* /*
This file extends the webpack.dev.js config to add babel istanbul coverage. This file extends the webpack.dev.js config to add babel istanbul coverage.
OpenMCT Continuous Integration servers use this configuration to add code coverage OpenMCT Continuous Integration servers use this configuration to add code coverage
information to pull requests. information to pull requests.
*/ */
const config = require('./webpack.dev'); import config from './webpack.dev.js';
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const CI = process.env.CI === 'true'; const CI = process.env.CI === 'true';
@ -34,4 +32,4 @@ config.module.rules.push({
} }
}); });
module.exports = config; export default config;

View File

@ -1,18 +1,16 @@
/* global __dirname module */
/* /*
This configuration should be used for development purposes. It contains full source map, a This configuration should be used for development purposes. It contains full source map, a
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution. devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
If OpenMCT is to be used for a production server, use webpack.prod.js instead. If OpenMCT is to be used for a production server, use webpack.prod.js instead.
*/ */
const path = require('path'); import path from 'path';
const webpack = require('webpack'); import webpack from 'webpack';
const { merge } = require('webpack-merge'); import { merge } from 'webpack-merge';
import { fileURLToPath } from 'node:url';
const common = require('./webpack.common'); import common from './webpack.common.js';
const projectRootDir = path.resolve(__dirname, '..');
module.exports = merge(common, { export default merge(common, {
mode: 'development', mode: 'development',
watchOptions: { watchOptions: {
// Since we use require.context, webpack is watching the entire directory. // Since we use require.context, webpack is watching the entire directory.
@ -42,7 +40,7 @@ module.exports = merge(common, {
}, },
watchFiles: ['**/*.css'], watchFiles: ['**/*.css'],
static: { static: {
directory: path.join(__dirname, '..', '/dist'), directory: fileURLToPath(new URL('../dist', import.meta.url)),
publicPath: '/dist', publicPath: '/dist',
watch: false watch: false
} }

View File

@ -1,17 +1,14 @@
/* global __dirname module */
/* /*
This configuration should be used for production installs. This configuration should be used for production installs.
It is the default webpack configuration. It is the default webpack configuration.
*/ */
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const common = require('./webpack.common'); import webpack from 'webpack';
const projectRootDir = path.resolve(__dirname, '..'); import { merge } from 'webpack-merge';
module.exports = merge(common, { import common from './webpack.common.js';
export default merge(common, {
mode: 'production', mode: 'production',
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({

View File

@ -480,7 +480,7 @@ The following contains a list of tips and tricks which don't exactly fit into a
It is possible to override the browser's clock in order to control time-based elements. Since this can cause unwanted behavior (i.e. Tree not rendering), only use this sparingly. To do this, use the `overrideClock` fixture as such: It is possible to override the browser's clock in order to control time-based elements. Since this can cause unwanted behavior (i.e. Tree not rendering), only use this sparingly. To do this, use the `overrideClock` fixture as such:
```js ```js
const { test, expect } = require('../../pluginFixtures.js'); import { test, expect } from '../../pluginFixtures.js';
test.describe('foo test suite', () => { test.describe('foo test suite', () => {

View File

@ -54,9 +54,9 @@
* @property {import('../src/api/notifications/NotificationAPI').NotificationOptions} [notificationOptions] additional options * @property {import('../src/api/notifications/NotificationAPI').NotificationOptions} [notificationOptions] additional options
*/ */
const Buffer = require('buffer').Buffer; import { expect } from '@playwright/test';
const genUuid = require('uuid').v4; import { Buffer } from 'buffer';
const { expect } = require('@playwright/test'); import { v4 as genUuid } from 'uuid';
/** /**
* This common function creates a domain object with the default options. It is the preferred way of creating objects * This common function creates a domain object with the default options. It is the preferred way of creating objects
@ -644,8 +644,7 @@ async function renameObjectFromContextMenu(page, url, newName) {
await page.click('[aria-label="Save"]'); await page.click('[aria-label="Save"]');
} }
// eslint-disable-next-line no-undef export {
module.exports = {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
createExampleTelemetryObject, createExampleTelemetryObject,
createNotification, createNotification,
@ -653,16 +652,16 @@ module.exports = {
expandEntireTree, expandEntireTree,
expandTreePaneItemByName, expandTreePaneItemByName,
getCanvasPixels, getCanvasPixels,
getHashUrlToDomainObject,
getFocusedObjectUuid, getFocusedObjectUuid,
getHashUrlToDomainObject,
navigateToObjectWithFixedTimeBounds, navigateToObjectWithFixedTimeBounds,
openObjectTreeContextMenu, openObjectTreeContextMenu,
renameObjectFromContextMenu,
setEndOffset,
setFixedTimeMode, setFixedTimeMode,
setIndependentTimeConductorBounds,
setRealTimeMode, setRealTimeMode,
setStartOffset, setStartOffset,
setEndOffset,
setTimeConductorBounds, setTimeConductorBounds,
setIndependentTimeConductorBounds, waitForPlotsToRender
waitForPlotsToRender,
renameObjectFromContextMenu
}; };

View File

@ -33,10 +33,11 @@
* existing ones. * existing ones.
*/ */
const fs = require('fs'); import AxeBuilder from '@axe-core/playwright';
const path = require('path'); import fs from 'fs';
const { test, expect } = require('./pluginFixtures'); import path from 'path';
const AxeBuilder = require('@axe-core/playwright').default;
import { expect, test } from './pluginFixtures.js';
// Constants for repeated values // Constants for repeated values
const TEST_RESULTS_DIR = './test-results'; const TEST_RESULTS_DIR = './test-results';
@ -56,7 +57,7 @@ const TEST_RESULTS_DIR = './test-results';
* otherwise returns null. * otherwise returns null.
*/ */
/* eslint-disable no-undef */ /* eslint-disable no-undef */
exports.scanForA11yViolations = async function (page, testCaseName, options = {}) { export async function scanForA11yViolations(page, testCaseName, options = {}) {
const builder = new AxeBuilder({ page }); const builder = new AxeBuilder({ page });
builder.withTags(['wcag2aa']); builder.withTags(['wcag2aa']);
// https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md // https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md
@ -91,7 +92,6 @@ exports.scanForA11yViolations = async function (page, testCaseName, options = {}
console.log('No accessibility violations found, no report generated.'); console.log('No accessibility violations found, no report generated.');
return null; return null;
} }
}; }
exports.expect = expect; export { expect, test };
exports.test = test;

View File

@ -28,12 +28,12 @@
* GitHub issues. * GitHub issues.
*/ */
const base = require('@playwright/test'); import { expect, request, test } from '@playwright/test';
const { expect, request } = base; import fs from 'fs';
const fs = require('fs'); import path from 'path';
const path = require('path'); import sinon from 'sinon';
const { v4: uuid } = require('uuid'); import { fileURLToPath } from 'url';
const sinon = require('sinon'); import { v4 as uuid } from 'uuid';
/** /**
* Takes a `ConsoleMessage` and returns a formatted string. Used to enable console log error detection. * Takes a `ConsoleMessage` and returns a formatted string. Used to enable console log error detection.
@ -68,7 +68,7 @@ function waitForAnimations(locator) {
*/ */
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output'); const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
exports.test = base.test.extend({ const extendedTest = test.extend({
/** /**
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need * This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
* the Time Indicator Clock to be in a specific state. * the Time Indicator Clock to be in a specific state.
@ -97,7 +97,7 @@ exports.test = base.test.extend({
async ({ context, clockOptions }, use) => { async ({ context, clockOptions }, use) => {
if (clockOptions !== undefined) { if (clockOptions !== undefined) {
await context.addInitScript({ await context.addInitScript({
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js') path: fileURLToPath(new URL('../node_modules/sinon/pkg/sinon.js', import.meta.url))
}); });
await context.addInitScript((options) => { await context.addInitScript((options) => {
window.__clock = sinon.useFakeTimers(options); window.__clock = sinon.useFakeTimers(options);
@ -201,6 +201,4 @@ exports.test = base.test.extend({
} }
}); });
exports.expect = expect; export { expect, request, extendedTest as test, waitForAnimations };
exports.request = request;
exports.waitForAnimations = waitForAnimations;

View File

@ -19,14 +19,15 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */ import { fileURLToPath } from 'url';
const path = require('path');
/** /**
* @param {import('@playwright/test').Page} page * @param {import('@playwright/test').Page} page
*/ */
async function navigateToFaultManagementWithExample(page) { async function navigateToFaultManagementWithExample(page) {
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') }); await page.addInitScript({
path: fileURLToPath(new URL('./addInitExampleFaultProvider.js', import.meta.url))
});
await navigateToFaultItemInTree(page); await navigateToFaultItemInTree(page);
} }
@ -36,7 +37,7 @@ async function navigateToFaultManagementWithExample(page) {
*/ */
async function navigateToFaultManagementWithStaticExample(page) { async function navigateToFaultManagementWithStaticExample(page) {
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js') path: fileURLToPath(new URL('./addInitExampleFaultProviderStatic.js', import.meta.url))
}); });
await navigateToFaultItemInTree(page); await navigateToFaultItemInTree(page);
@ -46,7 +47,9 @@ async function navigateToFaultManagementWithStaticExample(page) {
* @param {import('@playwright/test').Page} page * @param {import('@playwright/test').Page} page
*/ */
async function navigateToFaultManagementWithoutExample(page) { async function navigateToFaultManagementWithoutExample(page) {
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') }); await page.addInitScript({
path: fileURLToPath(new URL('./addInitFaultManagementPlugin.js', import.meta.url))
});
await navigateToFaultItemInTree(page); await navigateToFaultItemInTree(page);
} }
@ -265,29 +268,28 @@ async function openFaultRowMenu(page, rowNumber) {
.click(); .click();
} }
// eslint-disable-next-line no-undef export {
module.exports = {
navigateToFaultManagementWithExample,
navigateToFaultManagementWithStaticExample,
navigateToFaultManagementWithoutExample,
navigateToFaultItemInTree,
acknowledgeFault, acknowledgeFault,
shelveMultipleFaults,
acknowledgeMultipleFaults, acknowledgeMultipleFaults,
shelveFault,
changeViewTo, changeViewTo,
sortFaultsBy,
enterSearchTerm,
clearSearch, clearSearch,
selectFaultItem, enterSearchTerm,
getHighestSeverity,
getLowestSeverity,
getFaultResultCount,
getFault, getFault,
getFaultByName, getFaultByName,
getFaultName, getFaultName,
getFaultSeverity,
getFaultNamespace, getFaultNamespace,
getFaultResultCount,
getFaultSeverity,
getFaultTriggerTime, getFaultTriggerTime,
openFaultRowMenu getHighestSeverity,
getLowestSeverity,
navigateToFaultItemInTree,
navigateToFaultManagementWithExample,
navigateToFaultManagementWithoutExample,
navigateToFaultManagementWithStaticExample,
openFaultRowMenu,
selectFaultItem,
shelveFault,
shelveMultipleFaults,
sortFaultsBy
}; };

View File

@ -20,11 +20,11 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { createDomainObjectWithDefaults } = require('../appActions'); import { createDomainObjectWithDefaults } from '../appActions.js';
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area'; const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
const CUSTOM_NAME = 'CUSTOM_NAME'; const CUSTOM_NAME = 'CUSTOM_NAME';
const path = require('path'); import { fileURLToPath } from 'url';
/** /**
* @param {import('@playwright/test').Page} page * @param {import('@playwright/test').Page} page
@ -69,7 +69,9 @@ async function commitEntry(page) {
*/ */
async function startAndAddRestrictedNotebookObject(page) { async function startAndAddRestrictedNotebookObject(page) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') }); await page.addInitScript({
path: fileURLToPath(new URL('./addInitRestrictedNotebook.js', import.meta.url))
});
await page.goto('./', { waitUntil: 'domcontentloaded' }); await page.goto('./', { waitUntil: 'domcontentloaded' });
return createDomainObjectWithDefaults(page, { return createDomainObjectWithDefaults(page, {
@ -138,12 +140,11 @@ async function createNotebookEntryAndTags(page, iterations = 1) {
return notebook; return notebook;
} }
// eslint-disable-next-line no-undef export {
module.exports = { createNotebookAndEntry,
enterTextEntry,
dragAndDropEmbed,
startAndAddRestrictedNotebookObject,
lockPage,
createNotebookEntryAndTags, createNotebookEntryAndTags,
createNotebookAndEntry dragAndDropEmbed,
enterTextEntry,
lockPage,
startAndAddRestrictedNotebookObject
}; };

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { expect } from '../pluginFixtures'; import { expect } from '../pluginFixtures.js';
/** /**
* Asserts that the number of activities in the plan view matches the number of * Asserts that the number of activities in the plan view matches the number of

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { expect } from '../pluginFixtures'; import { waitForPlotsToRender } from '../appActions.js';
const { waitForPlotsToRender } = require('../appActions'); import { expect } from '../pluginFixtures.js';
/** /**
* Given a canvas and a set of points, tags the points on the canvas. * Given a canvas and a set of points, tags the points on the canvas.

View File

@ -1,9 +1,8 @@
/* eslint-disable no-undef */
// playwright.config.js // playwright.config.js
// @ts-check // @ts-check
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { devices } = require('@playwright/test'); import { devices } from '@playwright/test';
const MAX_FAILURES = 5; const MAX_FAILURES = 5;
const NUM_WORKERS = 2; const NUM_WORKERS = 2;
@ -81,4 +80,4 @@ const config = {
] ]
}; };
module.exports = config; export default config;

View File

@ -1,9 +1,8 @@
/* eslint-disable no-undef */
// playwright.config.js // playwright.config.js
// @ts-check // @ts-check
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { devices } = require('@playwright/test'); import { devices } from '@playwright/test';
/** @type {import('@playwright/test').PlaywrightTestConfig} */ /** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = { const config = {
@ -104,4 +103,4 @@ const config = {
] ]
}; };
module.exports = config; export default config;

View File

@ -1,4 +1,3 @@
/* eslint-disable no-undef */
// playwright.config.js // playwright.config.js
// @ts-check // @ts-check
@ -40,4 +39,4 @@ const config = {
] ]
}; };
module.exports = config; export default config;

View File

@ -1,4 +1,3 @@
/* eslint-disable no-undef */
// playwright.config.js // playwright.config.js
// @ts-check // @ts-check
@ -57,4 +56,4 @@ const config = {
] ]
}; };
module.exports = config; export default config;

View File

@ -51,4 +51,4 @@ const config = {
] ]
}; };
module.exports = config; export default config;

View File

@ -1,9 +1,8 @@
/* eslint-disable no-undef */
// playwright.config.js // playwright.config.js
// @ts-check // @ts-check
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { devices } = require('@playwright/test'); import { devices } from '@playwright/test';
const MAX_FAILURES = 5; const MAX_FAILURES = 5;
const NUM_WORKERS = 2; const NUM_WORKERS = 2;
@ -51,4 +50,4 @@ const config = {
] ]
}; };
module.exports = config; export default config;

View File

@ -26,9 +26,10 @@
* and appActions. These fixtures should be generalized across all plugins. * and appActions. These fixtures should be generalized across all plugins.
*/ */
const { test, expect, request } = require('./baseFixtures'); // import { createDomainObjectWithDefaults } from './appActions.js';
// const { createDomainObjectWithDefaults } = require('./appActions'); import { fileURLToPath } from 'url';
const path = require('path');
import { expect, request, test } from './baseFixtures.js';
/** /**
* @typedef {Object} ObjectCreateOptions * @typedef {Object} ObjectCreateOptions
@ -117,7 +118,7 @@ const theme = 'espresso';
*/ */
const myItemsFolderName = 'My Items'; const myItemsFolderName = 'My Items';
exports.test = test.extend({ const extendedTest = test.extend({
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js // This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
theme: [theme, { option: true }], theme: [theme, { option: true }],
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
@ -125,7 +126,9 @@ exports.test = test.extend({
// eslint-disable-next-line playwright/no-conditional-in-test // eslint-disable-next-line playwright/no-conditional-in-test
if (theme === 'snow') { if (theme === 'snow') {
//inject snow theme //inject snow theme
await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') }); await page.addInitScript({
path: fileURLToPath(new URL('./helper/useSnowTheme.js', import.meta.url))
});
} }
// Attach info about the currently running test and its project. // Attach info about the currently running test and its project.
@ -142,19 +145,18 @@ exports.test = test.extend({
} }
}); });
exports.expect = expect; export { expect, request, extendedTest as test };
exports.request = request;
/** /**
* Takes a readable stream and returns a string. * Takes a readable stream and returns a string.
* @param {ReadableStream} readable - the readable stream * @param {ReadableStream} readable - the readable stream
* @return {Promise<String>} the stringified stream * @return {Promise<String>} the stringified stream
*/ */
exports.streamToString = async function (readable) { export async function streamToString(readable) {
let result = ''; let result = '';
for await (const chunk of readable) { for await (const chunk of readable) {
result += chunk; result += chunk;
} }
return result; return result;
}; }

View File

@ -20,12 +20,12 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../pluginFixtures.js'); import {
const {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
createNotification, createNotification,
expandEntireTree expandEntireTree
} = require('../../appActions.js'); } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('AppActions', () => { test.describe('AppActions', () => {
test('createDomainObjectsWithDefaults', async ({ page }) => { test('createDomainObjectsWithDefaults', async ({ page }) => {

View File

@ -26,7 +26,7 @@ relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions ma
(`npm start` and ./e2e/webpack-dev-middleware.js) (`npm start` and ./e2e/webpack-dev-middleware.js)
*/ */
const { test } = require('../../baseFixtures.js'); import { test } from '../../baseFixtures.js';
test.describe('baseFixtures tests', () => { test.describe('baseFixtures tests', () => {
//Skip this test for now https://github.com/nasa/openmct/issues/6785 //Skip this test for now https://github.com/nasa/openmct/issues/6785

View File

@ -45,8 +45,8 @@
*/ */
// Structure: Some standard Imports. Please update the required pathing. // Structure: Some standard Imports. Please update the required pathing.
const { test, expect } = require('../../pluginFixtures'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../appActions'); import { expect, test } from '../../pluginFixtures.js';
/** /**
* Structure: * Structure:

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/** /**
* This test suite is dedicated to generating LocalStorage via Session Storage to be used * This test suite is dedicated to generating LocalStorage via Session Storage to be used
* in some visual test suites like controlledClock.visual.spec.js. This suite should run to completion * in some visual test suites like controlledClock.visual.spec.js. This suite should run to completion
@ -32,13 +31,11 @@
* and is additionally verified in the validation test suites below. * and is additionally verified in the validation test suites below.
*/ */
const { test, expect } = require('../../pluginFixtures.js'); import { fileURLToPath } from 'url';
const {
createDomainObjectWithDefaults, import { createDomainObjectWithDefaults, createExampleTelemetryObject } from '../../appActions.js';
createExampleTelemetryObject import { MISSION_TIME } from '../../constants.js';
} = require('../../appActions.js'); import { expect, test } from '../../pluginFixtures.js';
const { MISSION_TIME } = require('../../constants.js');
const path = require('path');
const overlayPlotName = 'Overlay Plot with Telemetry Object'; const overlayPlotName = 'Overlay Plot with Telemetry Object';
@ -87,7 +84,9 @@ test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
//Save localStorage for future test execution //Save localStorage for future test execution
await context.storageState({ await context.storageState({
path: path.join(__dirname, '../../../e2e/test-data/display_layout_with_child_layouts.json') path: fileURLToPath(
new URL('../../../e2e/test-data/display_layout_with_child_layouts.json', import.meta.url)
)
}); });
}); });
@ -112,7 +111,9 @@ test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
//Save localStorage for future test execution //Save localStorage for future test execution
await context.storageState({ await context.storageState({
path: path.join(__dirname, '../../../e2e/test-data/flexible_layout_with_child_layouts.json') path: fileURLToPath(
new URL('../../../e2e/test-data/flexible_layout_with_child_layouts.json', import.meta.url)
)
}); });
}); });
@ -189,7 +190,9 @@ test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
// Save localStorage for future test execution // Save localStorage for future test execution
await context.storageState({ await context.storageState({
path: path.join(__dirname, '../../../e2e/test-data/overlay_plot_storage.json') path: fileURLToPath(
new URL('../../../e2e/test-data/overlay_plot_storage.json', import.meta.url)
)
}); });
}); });
// TODO: Merge this with previous test. Edit object created in previous test. // TODO: Merge this with previous test. Edit object created in previous test.
@ -226,14 +229,18 @@ test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
await page.getByRole('button', { name: 'OK' }).click(); await page.getByRole('button', { name: 'OK' }).click();
//Save localStorage for future test execution //Save localStorage for future test execution
await context.storageState({ await context.storageState({
path: path.join(__dirname, '../../../e2e/test-data/overlay_plot_with_delay_storage.json') path: fileURLToPath(
new URL('../../../e2e/test-data/overlay_plot_with_delay_storage.json', import.meta.url)
)
}); });
}); });
}); });
test.describe('Validate Overlay Plot with Telemetry Object @localStorage @generatedata', () => { test.describe('Validate Overlay Plot with Telemetry Object @localStorage @generatedata', () => {
test.use({ test.use({
storageState: path.join(__dirname, '../../../e2e/test-data/overlay_plot_storage.json') storageState: fileURLToPath(
new URL('../../../e2e/test-data/overlay_plot_storage.json', import.meta.url)
)
}); });
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => { test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {
await page.goto('./', { waitUntil: 'domcontentloaded' }); await page.goto('./', { waitUntil: 'domcontentloaded' });
@ -275,9 +282,8 @@ test.describe('Validate Overlay Plot with Telemetry Object @localStorage @genera
test.describe('Validate Overlay Plot with 5s Delay Telemetry Object @localStorage @generatedata', () => { test.describe('Validate Overlay Plot with 5s Delay Telemetry Object @localStorage @generatedata', () => {
test.use({ test.use({
storageState: path.join( storageState: fileURLToPath(
__dirname, new URL('../../../e2e/test-data/overlay_plot_with_delay_storage.json', import.meta.url)
'../../../e2e/test-data/overlay_plot_with_delay_storage.json'
) )
}); });
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => { test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {

View File

@ -25,7 +25,7 @@ This test suite is dedicated to testing our use of our custom fixtures to verify
that they are working as expected. that they are working as expected.
*/ */
const { test } = require('../../pluginFixtures.js'); import { test } from '../../pluginFixtures.js';
// eslint-disable-next-line playwright/no-skipped-test // eslint-disable-next-line playwright/no-skipped-test
test.describe.skip('pluginFixtures tests', () => { test.describe.skip('pluginFixtures tests', () => {

View File

@ -24,7 +24,7 @@
This test suite is dedicated to tests which verify branding related components. This test suite is dedicated to tests which verify branding related components.
*/ */
const { test, expect } = require('../../baseFixtures.js'); import { expect, test } from '../../baseFixtures.js';
test.describe('Branding tests', () => { test.describe('Branding tests', () => {
test('About Modal launches with basic branding properties', async ({ page }) => { test('About Modal launches with basic branding properties', async ({ page }) => {

View File

@ -24,8 +24,8 @@
Verify that the "Clear Data" menu action performs as expected for various object types. Verify that the "Clear Data" menu action performs as expected for various object types.
*/ */
const { test, expect } = require('../../pluginFixtures.js'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../appActions.js'); import { expect, test } from '../../pluginFixtures.js';
const backgroundImageSelector = '.c-imagery__main-image__background-image'; const backgroundImageSelector = '.c-imagery__main-image__background-image';

View File

@ -25,7 +25,7 @@
* *
*/ */
const { test, expect } = require('../../pluginFixtures'); import { expect, test } from '../../pluginFixtures.js';
test.describe('CouchDB Status Indicator with mocked responses @couchdb', () => { test.describe('CouchDB Status Indicator with mocked responses @couchdb', () => {
test.use({ failOnConsoleError: false }); test.use({ failOnConsoleError: false });

View File

@ -24,8 +24,8 @@
This test suite is dedicated to tests which verify the basic operations surrounding the example event generator. This test suite is dedicated to tests which verify the basic operations surrounding the example event generator.
*/ */
const { test, expect } = require('../../../pluginFixtures'); import { createDomainObjectWithDefaults } from '../../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../../appActions'); import { expect, test } from '../../../pluginFixtures.js';
test.describe('Example Event Generator CRUD Operations', () => { test.describe('Example Event Generator CRUD Operations', () => {
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => { test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {

View File

@ -24,7 +24,7 @@
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. This test suite is dedicated to tests which verify the basic operations surrounding conditionSets.
*/ */
const { test, expect } = require('../../../../baseFixtures'); import { expect, test } from '../../../../baseFixtures.js';
test.describe('Sine Wave Generator', () => { test.describe('Sine Wave Generator', () => {
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({ test('Create new Sine Wave Generator Object and validate create Form Logic', async ({

View File

@ -19,15 +19,16 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/* /*
This test suite is dedicated to tests which verify form functionality in isolation This test suite is dedicated to tests which verify form functionality in isolation
*/ */
const { test, expect } = require('../../pluginFixtures'); import { fileURLToPath } from 'url';
const { createDomainObjectWithDefaults } = require('../../appActions'); import { v4 as genUuid } from 'uuid';
const genUuid = require('uuid').v4;
const path = require('path'); import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
const TEST_FOLDER = 'test folder'; const TEST_FOLDER = 'test folder';
const jsonFilePath = 'e2e/test-data/ExampleLayouts.json'; const jsonFilePath = 'e2e/test-data/ExampleLayouts.json';
@ -72,7 +73,7 @@ test.describe('Form Validation Behavior', () => {
test.describe('Form File Input Behavior', () => { test.describe('Form File Input Behavior', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../helper', 'addInitFileInputObject.js') path: fileURLToPath(new URL('../../helper/addInitFileInputObject.js', import.meta.url))
}); });
}); });
@ -109,7 +110,7 @@ test.describe('Persistence operations @addInit', () => {
// add non persistable root item // add non persistable root item
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') path: fileURLToPath(new URL('../../helper/addNoneditableObject.js', import.meta.url))
}); });
}); });

View File

@ -19,20 +19,20 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/* /*
This test suite is dedicated to tests which verify persistability checks This test suite is dedicated to tests which verify persistability checks
*/ */
const { test, expect } = require('../../baseFixtures.js'); import { fileURLToPath } from 'url';
const path = require('path'); import { expect, test } from '../../baseFixtures.js';
test.describe('Persistence operations @addInit', () => { test.describe('Persistence operations @addInit', () => {
// add non persistable root item // add non persistable root item
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') path: fileURLToPath(new URL('../../helper/addNoneditableObject.js', import.meta.url))
}); });
}); });

View File

@ -24,8 +24,8 @@
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects. This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
*/ */
const { test, expect } = require('../../pluginFixtures'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../appActions'); import { expect, test } from '../../pluginFixtures.js';
test.describe('Move & link item tests', () => { test.describe('Move & link item tests', () => {
test('Create a basic object and verify that it can be moved to another folder', async ({ test('Create a basic object and verify that it can be moved to another folder', async ({

View File

@ -24,8 +24,8 @@
This test suite is dedicated to tests which verify Open MCT's Notification functionality This test suite is dedicated to tests which verify Open MCT's Notification functionality
*/ */
const { createDomainObjectWithDefaults, createNotification } = require('../../appActions'); import { createDomainObjectWithDefaults, createNotification } from '../../appActions.js';
const { test, expect } = require('../../pluginFixtures'); import { expect, test } from '../../pluginFixtures.js';
test.describe('Notifications List', () => { test.describe('Notifications List', () => {
test.fixme('Notifications can be dismissed individually', async ({ page }) => { test.fixme('Notifications can be dismissed individually', async ({ page }) => {

View File

@ -19,15 +19,26 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../pluginFixtures'); import fs from 'fs';
const { createPlanFromJSON, createDomainObjectWithDefaults } = require('../../../appActions');
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json'); import { getPreciseDuration } from '../../../../src/utils/duration.js';
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json'); import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../../appActions.js';
const { import {
assertPlanActivities, assertPlanActivities,
setBoundsToSpanAllActivities setBoundsToSpanAllActivities
} = require('../../../helper/planningUtils'); } from '../../../helper/planningUtils.js';
const { getPreciseDuration } = require('../../../../src/utils/duration'); import { expect, test } from '../../../pluginFixtures.js';
const testPlan1 = JSON.parse(
fs.readFileSync(
new URL('../../../test-data/examplePlans/ExamplePlan_Small1.json', import.meta.url)
)
);
const testPlan2 = JSON.parse(
fs.readFileSync(
new URL('../../../test-data/examplePlans/ExamplePlan_Small2.json', import.meta.url)
)
);
test.describe('Gantt Chart', () => { test.describe('Gantt Chart', () => {
let ganttChart; let ganttChart;

View File

@ -19,15 +19,27 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test } = require('../../../pluginFixtures'); import fs from 'fs';
const { createPlanFromJSON } = require('../../../appActions');
const { addPlanGetInterceptor } = require('../../../helper/planningUtils.js'); import { createPlanFromJSON } from '../../../appActions.js';
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json'); import {
const testPlanWithOrderedLanes = require('../../../test-data/examplePlans/ExamplePlanWithOrderedLanes.json'); addPlanGetInterceptor,
const {
assertPlanActivities, assertPlanActivities,
assertPlanOrderedSwimLanes assertPlanOrderedSwimLanes
} = require('../../../helper/planningUtils'); } from '../../../helper/planningUtils.js';
import { test } from '../../../pluginFixtures.js';
const testPlan1 = JSON.parse(
fs.readFileSync(
new URL('../../../test-data/examplePlans/ExamplePlan_Small1.json', import.meta.url)
)
);
const testPlanWithOrderedLanes = JSON.parse(
fs.readFileSync(
new URL('../../../test-data/examplePlans/ExamplePlanWithOrderedLanes.json', import.meta.url)
)
);
test.describe('Plan', () => { test.describe('Plan', () => {
let plan; let plan;

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../pluginFixtures'); import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../../appActions.js';
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../../appActions'); import { expect, test } from '../../../pluginFixtures.js';
const testPlan = { const testPlan = {
TEST_GROUP: [ TEST_GROUP: [

View File

@ -20,12 +20,12 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../pluginFixtures'); import {
const {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
createPlanFromJSON, createPlanFromJSON,
setIndependentTimeConductorBounds setIndependentTimeConductorBounds
} = require('../../../appActions'); } from '../../../appActions.js';
import { expect, test } from '../../../pluginFixtures.js';
const testPlan = { const testPlan = {
TEST_GROUP: [ TEST_GROUP: [

View File

@ -24,7 +24,7 @@
This test suite is dedicated to tests which verify the basic operations surrounding Clock. This test suite is dedicated to tests which verify the basic operations surrounding Clock.
*/ */
const { test, expect } = require('../../../../baseFixtures'); import { expect, test } from '../../../../baseFixtures.js';
test.describe('Clock Generator CRUD Operations', () => { test.describe('Clock Generator CRUD Operations', () => {
test('Timezone dropdown will collapse when clicked outside or on dropdown icon again', async ({ test('Timezone dropdown will collapse when clicked outside or on dropdown icon again', async ({

View File

@ -22,7 +22,7 @@
// FIXME: Remove this eslint exception once tests are implemented // FIXME: Remove this eslint exception once tests are implemented
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures'); import { expect, test } from '../../../../baseFixtures.js';
test.describe('Remote Clock', () => { test.describe('Remote Clock', () => {
// eslint-disable-next-line require-await // eslint-disable-next-line require-await

View File

@ -19,19 +19,19 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/* /*
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
suite is sharing state between tests which is considered an anti-pattern. Implementing in this way to suite is sharing state between tests which is considered an anti-pattern. Implementing in this way to
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites. demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
*/ */
const { test, expect } = require('../../../../pluginFixtures.js'); import { fileURLToPath } from 'url';
const {
import {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
createExampleTelemetryObject createExampleTelemetryObject
} = require('../../../../appActions'); } from '../../../../appActions.js';
const path = require('path'); import { expect, test } from '../../../../pluginFixtures.js';
let conditionSetUrl; let conditionSetUrl;
let getConditionSetIdentifierFromUrl; let getConditionSetIdentifierFromUrl;
@ -50,7 +50,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
//Save localStorage for future test execution //Save localStorage for future test execution
await context.storageState({ await context.storageState({
path: path.resolve(__dirname, '../../../../test-data/recycled_local_storage.json') path: fileURLToPath(
new URL('../../../../test-data/recycled_local_storage.json', import.meta.url)
)
}); });
//Set object identifier from url //Set object identifier from url
@ -63,7 +65,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
//Load localStorage for subsequent tests //Load localStorage for subsequent tests
test.use({ test.use({
storageState: path.resolve(__dirname, '../../../../test-data/recycled_local_storage.json') storageState: fileURLToPath(
new URL('../../../../test-data/recycled_local_storage.json', import.meta.url)
)
}); });
//Begin suite of tests again localStorage //Begin suite of tests again localStorage

View File

@ -19,20 +19,19 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */ import { fileURLToPath } from 'url';
const { test, expect } = require('../../../../pluginFixtures');
const path = require('path');
const {
createDomainObjectWithDefaults,
setStartOffset,
setFixedTimeMode,
setRealTimeMode,
setIndependentTimeConductorBounds
} = require('../../../../appActions');
const LOCALSTORAGE_PATH = path.resolve( import {
__dirname, createDomainObjectWithDefaults,
'../../../../test-data/display_layout_with_child_layouts.json' setFixedTimeMode,
setIndependentTimeConductorBounds,
setRealTimeMode,
setStartOffset
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
const LOCALSTORAGE_PATH = fileURLToPath(
new URL('../../../../test-data/display_layout_with_child_layouts.json', import.meta.url)
); );
const TINY_IMAGE_BASE64 = const TINY_IMAGE_BASE64 =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII'; 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
@ -51,7 +50,7 @@ test.describe('Display Layout Toolbar Actions @localStorage', () => {
await page.getByLabel('Edit').click(); await page.getByLabel('Edit').click();
}); });
test.use({ test.use({
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH) storageState: LOCALSTORAGE_PATH
}); });
test('can add/remove Text element to a single layout', async ({ page }) => { test('can add/remove Text element to a single layout', async ({ page }) => {

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures'); import * as utils from '../../../../helper/faultUtils.js';
const utils = require('../../../../helper/faultUtils'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('The Fault Management Plugin using example faults', () => { test.describe('The Fault Management Plugin using example faults', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -19,18 +19,17 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
const { test, expect } = require('../../../../pluginFixtures'); import { fileURLToPath } from 'url';
const {
import {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
setIndependentTimeConductorBounds setIndependentTimeConductorBounds
} = require('../../../../appActions'); } from '../../../../appActions.js';
const path = require('path'); import { expect, test } from '../../../../pluginFixtures.js';
const LOCALSTORAGE_PATH = path.resolve( const LOCALSTORAGE_PATH = fileURLToPath(
__dirname, new URL('../../../../test-data/flexible_layout_with_child_layouts.json', import.meta.url)
'../../../../test-data/flexible_layout_with_child_layouts.json'
); );
test.describe('Flexible Layout', () => { test.describe('Flexible Layout', () => {
@ -267,7 +266,7 @@ test.describe('Flexible Layout', () => {
test.describe('Flexible Layout Toolbar Actions @localStorage', () => { test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
test.use({ test.use({
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH) storageState: LOCALSTORAGE_PATH
}); });
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -24,12 +24,13 @@
* This test suite is dedicated to testing the Gauge component. * This test suite is dedicated to testing the Gauge component.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { v4 as uuid } from 'uuid';
const {
import {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
createExampleTelemetryObject createExampleTelemetryObject
} = require('../../../../appActions'); } from '../../../../appActions.js';
const uuid = require('uuid').v4; import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Gauge', () => { test.describe('Gauge', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -25,9 +25,9 @@ This test suite is dedicated to tests which verify the basic operations surround
but only assume that example imagery is present. but only assume that example imagery is present.
*/ */
/* globals process */ /* globals process */
const { waitForAnimations } = require('../../../../baseFixtures'); import { createDomainObjectWithDefaults, setRealTimeMode } from '../../../../appActions.js';
const { test, expect } = require('../../../../pluginFixtures'); import { waitForAnimations } from '../../../../baseFixtures.js';
const { createDomainObjectWithDefaults, setRealTimeMode } = require('../../../../appActions'); import { expect, test } from '../../../../pluginFixtures.js';
const backgroundImageSelector = '.c-imagery__main-image__background-image'; const backgroundImageSelector = '.c-imagery__main-image__background-image';
const panHotkey = process.platform === 'linux' ? ['Shift', 'Alt'] : ['Alt']; const panHotkey = process.platform === 'linux' ? ['Shift', 'Alt'] : ['Alt'];
const tagHotkey = ['Shift', 'Alt']; const tagHotkey = ['Shift', 'Alt'];

View File

@ -26,7 +26,7 @@ This test suite is dedicated to tests which verify the basic operations surround
// FIXME: Remove this eslint exception once tests are implemented // FIXME: Remove this eslint exception once tests are implemented
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures'); import { expect, test } from '../../../../baseFixtures.js';
test.describe('ExportAsJSON', () => { test.describe('ExportAsJSON', () => {
test.fixme( test.fixme(

View File

@ -26,7 +26,7 @@ This test suite is dedicated to tests which verify the basic operations surround
// FIXME: Remove this eslint exception once tests are implemented // FIXME: Remove this eslint exception once tests are implemented
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures'); import { expect, test } from '../../../../baseFixtures.js';
test.describe('ExportAsJSON', () => { test.describe('ExportAsJSON', () => {
test.fixme('Verify that domain object can be importAsJSON from Tree', async ({ page }) => { test.fixme('Verify that domain object can be importAsJSON from Tree', async ({ page }) => {

View File

@ -19,17 +19,19 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
const { test, expect } = require('../../../../pluginFixtures'); import { fileURLToPath } from 'url';
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const path = require('path'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Testing numeric data with inspector data visualization (i.e., data pivoting)', () => { test.describe('Testing numeric data with inspector data visualization (i.e., data pivoting)', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../../../helper/', 'addInitDataVisualization.js') path: fileURLToPath(
new URL('../../../../helper/addInitDataVisualization.js', import.meta.url)
)
}); });
await page.goto('./', { waitUntil: 'domcontentloaded' }); await page.goto('./', { waitUntil: 'domcontentloaded' });
}); });

View File

@ -20,14 +20,14 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures'); import {
const {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
setStartOffset, openObjectTreeContextMenu,
setFixedTimeMode, setFixedTimeMode,
setRealTimeMode, setRealTimeMode,
openObjectTreeContextMenu setStartOffset
} = require('../../../../appActions'); } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Testing LAD table configuration', () => { test.describe('Testing LAD table configuration', () => {
let ladTable; let ladTable;

View File

@ -19,15 +19,16 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/* /*
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks. This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
*/ */
const { test, expect, streamToString } = require('../../../../pluginFixtures'); import { fileURLToPath } from 'url';
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const nbUtils = require('../../../../helper/notebookUtils'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
const path = require('path'); import * as nbUtils from '../../../../helper/notebookUtils.js';
import { expect, streamToString, test } from '../../../../pluginFixtures.js';
const NOTEBOOK_NAME = 'Notebook'; const NOTEBOOK_NAME = 'Notebook';
@ -278,7 +279,7 @@ test.describe('Notebook entry tests', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../../../helper/', 'addInitNotebookWithUrls.js') path: fileURLToPath(new URL('../../../../helper/addInitNotebookWithUrls.js', import.meta.url))
}); });
await page.goto('./', { waitUntil: 'domcontentloaded' }); await page.goto('./', { waitUntil: 'domcontentloaded' });

View File

@ -19,15 +19,16 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/* /*
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks. This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
*/ */
const fs = require('fs').promises; import fs from 'fs/promises';
const path = require('path'); import { fileURLToPath } from 'url';
const { test, expect } = require('../../../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
const NOTEBOOK_NAME = 'Notebook'; const NOTEBOOK_NAME = 'Notebook';
@ -178,7 +179,9 @@ test.describe('Snapshot image tests', () => {
test('Can drop an image onto a notebook and create a new entry', async ({ page }) => { test('Can drop an image onto a notebook and create a new entry', async ({ page }) => {
const imageData = await fs.readFile( const imageData = await fs.readFile(
path.resolve(__dirname, '../../../../../src/images/favicons/favicon-96x96.png') fileURLToPath(
new URL('../../../../../src/images/favicons/favicon-96x96.png', import.meta.url)
)
); );
const imageArray = new Uint8Array(imageData); const imageArray = new Uint8Array(imageData);
const fileData = Array.from(imageArray); const fileData = Array.from(imageArray);

View File

@ -24,9 +24,9 @@
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks with CouchDB. This test suite is dedicated to tests which verify the basic operations surrounding Notebooks with CouchDB.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../../../appActions'); import * as nbUtils from '../../../../helper/notebookUtils.js';
const nbUtils = require('../../../../helper/notebookUtils'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Notebook Tests with CouchDB @couchdb', () => { test.describe('Notebook Tests with CouchDB @couchdb', () => {
let testNotebook; let testNotebook;

View File

@ -20,14 +20,14 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect, streamToString } = require('../../../../pluginFixtures'); import { openObjectTreeContextMenu } from '../../../../appActions.js';
const { openObjectTreeContextMenu } = require('../../../../appActions'); import {
const {
lockPage,
dragAndDropEmbed, dragAndDropEmbed,
enterTextEntry, enterTextEntry,
lockPage,
startAndAddRestrictedNotebookObject startAndAddRestrictedNotebookObject
} = require('../../../../helper/notebookUtils'); } from '../../../../helper/notebookUtils.js';
import { expect, streamToString, test } from '../../../../pluginFixtures.js';
const TEST_TEXT = 'Testing text for entries.'; const TEST_TEXT = 'Testing text for entries.';
const TEST_TEXT_NAME = 'Test Page'; const TEST_TEXT_NAME = 'Test Page';

View File

@ -24,13 +24,13 @@
This test suite is dedicated to tests which verify notebook tag functionality. This test suite is dedicated to tests which verify notebook tag functionality.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../../../appActions'); import {
const {
enterTextEntry,
createNotebookAndEntry, createNotebookAndEntry,
createNotebookEntryAndTags createNotebookEntryAndTags,
} = require('../../../../helper/notebookUtils'); enterTextEntry
} from '../../../../helper/notebookUtils.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Tagging in Notebooks @addInit', () => { test.describe('Tagging in Notebooks @addInit', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -19,13 +19,13 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
/* /*
* This test suite is dedicated to testing the operator status plugin. * This test suite is dedicated to testing the operator status plugin.
*/ */
const path = require('path'); import { fileURLToPath } from 'url';
const { test, expect } = require('../../../../pluginFixtures');
import { expect, test } from '../../../../pluginFixtures.js';
/* /*
@ -41,10 +41,10 @@ test.describe('Operator Status', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
// FIXME: determine if plugins will be added to index.html or need to be injected // FIXME: determine if plugins will be added to index.html or need to be injected
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../../../helper/', 'addInitExampleUser.js') path: fileURLToPath(new URL('../../../../helper/addInitExampleUser.js', import.meta.url))
}); });
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../../../helper/', 'addInitOperatorStatus.js') path: fileURLToPath(new URL('../../../../helper/addInitOperatorStatus.js', import.meta.url))
}); });
await page.goto('./', { waitUntil: 'domcontentloaded' }); await page.goto('./', { waitUntil: 'domcontentloaded' });
await expect(page.getByText('Select Role')).toBeVisible(); await expect(page.getByText('Select Role')).toBeVisible();

View File

@ -24,8 +24,8 @@
Testsuite for plot autoscale. Testsuite for plot autoscale.
*/ */
const { createDomainObjectWithDefaults } = require('../../../../appActions'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
const { test, expect } = require('../../../../pluginFixtures'); import { expect, test } from '../../../../pluginFixtures.js';
test.use({ test.use({
viewport: { viewport: {
width: 1280, width: 1280,

View File

@ -25,8 +25,8 @@ Tests to verify log plot functionality. Note this test suite if very much under
necessarily be used for reference when writing new tests in this area. necessarily be used for reference when writing new tests in this area.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { setTimeConductorBounds } from '../../../../appActions.js';
const { setTimeConductorBounds } = require('../../../../appActions'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Log plot tests', () => { test.describe('Log plot tests', () => {
test('Log Plot ticks are functionally correct in regular and log mode and after refresh', async ({ test('Log Plot ticks are functionally correct in regular and log mode and after refresh', async ({

View File

@ -24,7 +24,7 @@
Tests to verify log plot functionality when objects are missing Tests to verify log plot functionality when objects are missing
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Handle missing object for plots', () => { test.describe('Handle missing object for plots', () => {
test('Displays empty div for missing stacked plot item @unstable', async ({ test('Displays empty div for missing stacked plot item @unstable', async ({

View File

@ -25,12 +25,12 @@ Tests to verify log plot functionality. Note this test suite if very much under
necessarily be used for reference when writing new tests in this area. necessarily be used for reference when writing new tests in this area.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import {
const {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
getCanvasPixels, getCanvasPixels,
waitForPlotsToRender waitForPlotsToRender
} = require('../../../../appActions'); } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Overlay Plot', () => { test.describe('Overlay Plot', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -25,8 +25,8 @@
* *
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { createDomainObjectWithDefaults, getCanvasPixels } from '../../../../appActions.js';
const { createDomainObjectWithDefaults, getCanvasPixels } = require('../../../../appActions'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Plot Rendering', () => { test.describe('Plot Rendering', () => {
let sineWaveGeneratorObject; let sineWaveGeneratorObject;

View File

@ -24,9 +24,10 @@
* This test suite is dedicated to testing the Scatter Plot component. * This test suite is dedicated to testing the Scatter Plot component.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { v4 as uuid } from 'uuid';
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const uuid = require('uuid').v4; import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Scatter Plot', () => { test.describe('Scatter Plot', () => {
let scatterPlot; let scatterPlot;

View File

@ -25,8 +25,8 @@ Tests to verify log plot functionality. Note this test suite if very much under
necessarily be used for reference when writing new tests in this area. necessarily be used for reference when writing new tests in this area.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import { createDomainObjectWithDefaults, waitForPlotsToRender } from '../../../../appActions.js';
const { createDomainObjectWithDefaults, waitForPlotsToRender } = require('../../../../appActions'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Stacked Plot', () => { test.describe('Stacked Plot', () => {
let stackedPlot; let stackedPlot;

View File

@ -24,18 +24,14 @@
Tests to verify plot tagging functionality. Tests to verify plot tagging functionality.
*/ */
const { test, expect } = require('../../../../pluginFixtures'); import {
const {
basicTagsTests,
createTags,
testTelemetryItem
} = require('../../../../helper/plotTagsUtils');
const {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
setRealTimeMode,
setFixedTimeMode, setFixedTimeMode,
setRealTimeMode,
waitForPlotsToRender waitForPlotsToRender
} = require('../../../../appActions'); } from '../../../../appActions.js';
import { basicTagsTests, createTags, testTelemetryItem } from '../../../../helper/plotTagsUtils.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Plot Tagging', () => { test.describe('Plot Tagging', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { createDomainObjectWithDefaults } = require('../../../../appActions'); import { createDomainObjectWithDefaults } from '../../../../appActions.js';
const { test, expect } = require('../../../../pluginFixtures'); import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Tabs View', () => { test.describe('Tabs View', () => {
test('Renders tabbed elements', async ({ page }) => { test('Renders tabbed elements', async ({ page }) => {

View File

@ -20,11 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { import { createDomainObjectWithDefaults, setTimeConductorBounds } from '../../../../appActions.js';
createDomainObjectWithDefaults, import { expect, test } from '../../../../pluginFixtures.js';
setTimeConductorBounds
} = require('../../../../appActions');
const { test, expect } = require('../../../../pluginFixtures');
test.describe('Telemetry Table', () => { test.describe('Telemetry Table', () => {
test('unpauses and filters data when paused by button and user changes bounds', async ({ test('unpauses and filters data when paused by button and user changes bounds', async ({

View File

@ -20,14 +20,14 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures'); import {
const { setEndOffset,
setFixedTimeMode, setFixedTimeMode,
setRealTimeMode, setRealTimeMode,
setStartOffset, setStartOffset,
setEndOffset,
setTimeConductorBounds setTimeConductorBounds
} = require('../../../../appActions'); } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Time conductor operations', () => { test.describe('Time conductor operations', () => {
test('validate start time does not exceeds end time', async ({ page }) => { test('validate start time does not exceeds end time', async ({ page }) => {

View File

@ -20,12 +20,12 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures'); import {
const { createDomainObjectWithDefaults,
openObjectTreeContextMenu, openObjectTreeContextMenu
createDomainObjectWithDefaults } from '../../../../appActions.js';
} = require('../../../../appActions'); import { MISSION_TIME } from '../../../../constants.js';
import { MISSION_TIME } from '../../../../constants'; import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Timer', () => { test.describe('Timer', () => {
let timer; let timer;

View File

@ -20,9 +20,9 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../pluginFixtures.js'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const { createDomainObjectWithDefaults } = require('../../appActions.js'); import { waitForAnimations } from '../../baseFixtures.js';
const { waitForAnimations } = require('../../baseFixtures.js'); import { expect, test } from '../../pluginFixtures.js';
test.describe('Recent Objects', () => { test.describe('Recent Objects', () => {
/** @type {import('@playwright/test').Locator} */ /** @type {import('@playwright/test').Locator} */

View File

@ -24,11 +24,8 @@
This test suite is dedicated to tests for renaming objects, and their global application effects. This test suite is dedicated to tests for renaming objects, and their global application effects.
*/ */
const { test, expect } = require('../../baseFixtures.js'); import { createDomainObjectWithDefaults, renameObjectFromContextMenu } from '../../appActions.js';
const { import { expect, test } from '../../baseFixtures.js';
createDomainObjectWithDefaults,
renameObjectFromContextMenu
} = require('../../appActions.js');
test.describe('Renaming objects', () => { test.describe('Renaming objects', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -23,9 +23,10 @@
* This test suite is dedicated to tests which verify search functionalities. * This test suite is dedicated to tests which verify search functionalities.
*/ */
const { test, expect } = require('../../pluginFixtures'); import { v4 as uuid } from 'uuid';
const { createDomainObjectWithDefaults } = require('../../appActions');
const { v4: uuid } = require('uuid'); import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Grand Search', () => { test.describe('Grand Search', () => {
const searchResultSelector = '.c-gsearch-result__title'; const searchResultSelector = '.c-gsearch-result__title';

View File

@ -33,7 +33,7 @@ comfortable running this test during a live mission?" Avoid creating or deleting
Make no assumptions about the order that elements appear in the DOM. Make no assumptions about the order that elements appear in the DOM.
*/ */
const { test, expect } = require('../../pluginFixtures'); import { expect, test } from '../../pluginFixtures.js';
test('Verify that the create button appears and that the Folder Domain Object is available for selection', async ({ test('Verify that the create button appears and that the Folder Domain Object is available for selection', async ({
page page

View File

@ -33,8 +33,8 @@ comfortable running this test during a live mission?" Avoid creating or deleting
Make no assumptions about the order that elements appear in the DOM. Make no assumptions about the order that elements appear in the DOM.
*/ */
const { test, expect } = require('../../pluginFixtures'); import { createDomainObjectWithDefaults, expandEntireTree } from '../../appActions.js';
const { createDomainObjectWithDefaults, expandEntireTree } = require('../../appActions'); import { expect, test } from '../../pluginFixtures.js';
test.describe('Verify tooltips', () => { test.describe('Verify tooltips', () => {
let folder1; let folder1;

View File

@ -20,11 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, expect } = require('../../pluginFixtures.js'); import { createDomainObjectWithDefaults, renameObjectFromContextMenu } from '../../appActions.js';
const { import { expect, test } from '../../pluginFixtures.js';
createDomainObjectWithDefaults,
renameObjectFromContextMenu
} = require('../../appActions.js');
test.describe('Main Tree', () => { test.describe('Main Tree', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -32,7 +32,7 @@ TODO:
*/ */
const { test, expect } = require('@playwright/test'); import { expect, test } from '@playwright/test';
const filePath = 'e2e/test-data/PerformanceDisplayLayout.json'; const filePath = 'e2e/test-data/PerformanceDisplayLayout.json';

View File

@ -31,7 +31,7 @@ TODO:
*/ */
const { test, expect } = require('@playwright/test'); import { expect, test } from '@playwright/test';
const notebookFilePath = 'e2e/test-data/PerformanceNotebook.json'; const notebookFilePath = 'e2e/test-data/PerformanceNotebook.json';

View File

@ -19,14 +19,12 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */
const { test, expect } = require('@playwright/test'); import { expect, test } from '@playwright/test';
const path = require('path'); import { fileURLToPath } from 'url';
const memoryLeakFilePath = path.resolve( const memoryLeakFilePath = fileURLToPath(
__dirname, new URL('../../../../e2e/test-data/memory-leak-detection.json', import.meta.url)
'../../../../e2e/test-data/memory-leak-detection.json'
); );
/** /**
* Executes tests to verify that views are not leaking memory on navigation away. This sort of * Executes tests to verify that views are not leaking memory on navigation away. This sort of

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { createDomainObjectWithDefaults, waitForPlotsToRender } = require('../../appActions'); import { createDomainObjectWithDefaults, waitForPlotsToRender } from '../../appActions.js';
const { test, expect } = require('../../pluginFixtures'); import { expect, test } from '../../pluginFixtures.js';
test.describe('Tabs View', () => { test.describe('Tabs View', () => {
test('Renders tabbed elements nicely', async ({ page }) => { test('Renders tabbed elements nicely', async ({ page }) => {

View File

@ -24,14 +24,14 @@
Tests to verify plot tagging performance. Tests to verify plot tagging performance.
*/ */
const { test, expect } = require('../../pluginFixtures'); import {
const { basicTagsTests, createTags, testTelemetryItem } = require('../../helper/plotTagsUtils');
const {
createDomainObjectWithDefaults, createDomainObjectWithDefaults,
setRealTimeMode,
setFixedTimeMode, setFixedTimeMode,
setRealTimeMode,
waitForPlotsToRender waitForPlotsToRender
} = require('../../appActions'); } from '../../appActions.js';
import { basicTagsTests, createTags, testTelemetryItem } from '../../helper/plotTagsUtils.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Plot Tagging Performance', () => { test.describe('Plot Tagging Performance', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, scanForA11yViolations } = require('../../avpFixtures'); import { scanForA11yViolations, test } from '../../avpFixtures.js';
const VISUAL_URL = require('../../constants').VISUAL_URL; import { VISUAL_URL } from '../../constants.js';
test.describe('a11y - Default @a11y', () => { test.describe('a11y - Default @a11y', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -24,9 +24,10 @@
Tests the branding associated with the default deployment. At least the about modal for now Tests the branding associated with the default deployment. At least the about modal for now
*/ */
const { test, expect } = require('../../../pluginFixtures'); import percySnapshot from '@percy/playwright';
const percySnapshot = require('@percy/playwright');
const VISUAL_URL = require('../../../constants').VISUAL_URL; import { VISUAL_URL } from '../../../constants.js';
import { expect, test } from '../../../pluginFixtures.js';
test.describe('Visual - Branding', () => { test.describe('Visual - Branding', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -20,9 +20,10 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test } = require('../../../pluginFixtures.js'); import percySnapshot from '@percy/playwright';
const { VISUAL_URL, MISSION_TIME } = require('../../../constants.js');
const percySnapshot = require('@percy/playwright'); import { MISSION_TIME, VISUAL_URL } from '../../../constants.js';
import { test } from '../../../pluginFixtures.js';
//Declare the scope of the visual test //Declare the scope of the visual test
const inspectorPane = '.l-shell__pane-inspector'; const inspectorPane = '.l-shell__pane-inspector';

View File

@ -20,13 +20,11 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test } = require('../../../pluginFixtures.js'); import percySnapshot from '@percy/playwright';
const {
expandTreePaneItemByName, import { createDomainObjectWithDefaults, expandTreePaneItemByName } from '../../../appActions.js';
createDomainObjectWithDefaults import { VISUAL_URL } from '../../../constants.js';
} = require('../../../appActions.js'); import { test } from '../../../pluginFixtures.js';
const VISUAL_URL = require('../../../constants.js').VISUAL_URL;
const percySnapshot = require('@percy/playwright');
//Declare the scope of the visual test //Declare the scope of the visual test
const treePane = "[role=tree][aria-label='Main Tree']"; const treePane = "[role=tree][aria-label='Main Tree']";

View File

@ -25,9 +25,10 @@ Collection of Visual Tests set to run with browser clock manipulate made possibl
clockOptions plugin fixture. clockOptions plugin fixture.
*/ */
const { VISUAL_URL, MISSION_TIME } = require('../../constants'); import percySnapshot from '@percy/playwright';
const { test, expect } = require('../../pluginFixtures');
const percySnapshot = require('@percy/playwright'); import { MISSION_TIME, VISUAL_URL } from '../../constants.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Visual - Controlled Clock', () => { test.describe('Visual - Controlled Clock', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -26,10 +26,11 @@ are only meant to run against openmct's app.js started by `npm run start` within
`./e2e/playwright-visual.config.js` file. `./e2e/playwright-visual.config.js` file.
*/ */
const { test, expect, scanForA11yViolations } = require('../../avpFixtures'); import percySnapshot from '@percy/playwright';
const percySnapshot = require('@percy/playwright');
const { createDomainObjectWithDefaults } = require('../../appActions'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const { VISUAL_URL } = require('../../constants'); import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
import { VISUAL_URL } from '../../constants.js';
test.describe('Visual - Default @a11y', () => { test.describe('Visual - Default @a11y', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -26,10 +26,11 @@
* @property {Object<string, import('@playwright/test').Locator>} LayoutLocator * @property {Object<string, import('@playwright/test').Locator>} LayoutLocator
*/ */
const { test } = require('../../pluginFixtures'); import percySnapshot from '@percy/playwright';
const { createDomainObjectWithDefaults } = require('../../appActions');
const VISUAL_URL = require('../../constants').VISUAL_URL; import { createDomainObjectWithDefaults } from '../../appActions.js';
const percySnapshot = require('@percy/playwright'); import { VISUAL_URL } from '../../constants.js';
import { test } from '../../pluginFixtures.js';
const snapshotScope = '.l-shell__pane-main .l-pane__contents'; const snapshotScope = '.l-shell__pane-main .l-pane__contents';
test.describe('Visual - Display Layout', () => { test.describe('Visual - Display Layout', () => {

View File

@ -19,17 +19,16 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
/* global __dirname */ import percySnapshot from '@percy/playwright';
const path = require('path'); import { fileURLToPath } from 'url';
const { test } = require('../../pluginFixtures');
const percySnapshot = require('@percy/playwright');
const utils = require('../../helper/faultUtils'); import * as utils from '../../helper/faultUtils.js';
import { test } from '../../pluginFixtures.js';
test.describe('Fault Management Visual Tests', () => { test.describe('Fault Management Visual Tests', () => {
test('icon test', async ({ page, theme }) => { test('icon test', async ({ page, theme }) => {
await page.addInitScript({ await page.addInitScript({
path: path.join(__dirname, '../../helper/', 'addInitFaultManagementPlugin.js') path: fileURLToPath(new URL('../../helper/addInitFaultManagementPlugin.js', import.meta.url))
}); });
await page.goto('./', { waitUntil: 'domcontentloaded' }); await page.goto('./', { waitUntil: 'domcontentloaded' });

View File

@ -20,10 +20,11 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { expect, test } = require('../../pluginFixtures'); import percySnapshot from '@percy/playwright';
const percySnapshot = require('@percy/playwright');
const { createDomainObjectWithDefaults } = require('../../appActions'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const VISUAL_URL = require('../../constants').VISUAL_URL; import { VISUAL_URL } from '../../constants.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Visual - LAD Table', () => { test.describe('Visual - LAD Table', () => {
/** @type {import('@playwright/test').Locator} */ /** @type {import('@playwright/test').Locator} */

View File

@ -20,14 +20,12 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, scanForA11yViolations } = require('../../avpFixtures'); import percySnapshot from '@percy/playwright';
const percySnapshot = require('@percy/playwright');
const { expandTreePaneItemByName, createDomainObjectWithDefaults } = require('../../appActions'); import { createDomainObjectWithDefaults, expandTreePaneItemByName } from '../../appActions.js';
const { import { scanForA11yViolations, test } from '../../avpFixtures.js';
startAndAddRestrictedNotebookObject, import { VISUAL_URL } from '../../constants.js';
enterTextEntry import { enterTextEntry, startAndAddRestrictedNotebookObject } from '../../helper/notebookUtils.js';
} = require('../../helper/notebookUtils');
const { VISUAL_URL } = require('../../constants');
test.describe('Visual - Restricted Notebook', () => { test.describe('Visual - Restricted Notebook', () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -24,10 +24,11 @@
* This test is dedicated to test notification banner functionality and its accessibility attributes. * This test is dedicated to test notification banner functionality and its accessibility attributes.
*/ */
const { test, expect, scanForA11yViolations } = require('../../avpFixtures'); import percySnapshot from '@percy/playwright';
const percySnapshot = require('@percy/playwright');
const { createDomainObjectWithDefaults } = require('../../appActions'); import { createDomainObjectWithDefaults } from '../../appActions.js';
const VISUAL_URL = require('../../constants').VISUAL_URL; import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
import { VISUAL_URL } from '../../constants.js';
test.describe("Visual - Check Notification Info Banner of 'Save successful' @a11y", () => { test.describe("Visual - Check Notification Info Banner of 'Save successful' @a11y", () => {
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {

View File

@ -20,15 +20,17 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
const { test, scanForA11yViolations } = require('../../avpFixtures'); import percySnapshot from '@percy/playwright';
const { import fs from 'fs';
setBoundsToSpanAllActivities,
setDraftStatusForPlan import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../appActions.js';
} = require('../../helper/planningUtils'); import { scanForA11yViolations, test } from '../../avpFixtures.js';
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../appActions'); import { VISUAL_URL } from '../../constants.js';
const percySnapshot = require('@percy/playwright'); import { setBoundsToSpanAllActivities, setDraftStatusForPlan } from '../../helper/planningUtils.js';
const VISUAL_URL = require('../../constants').VISUAL_URL;
const examplePlanSmall = require('../../test-data/examplePlans/ExamplePlan_Small2.json'); const examplePlanSmall = JSON.parse(
fs.readFileSync(new URL('../../test-data/examplePlans/ExamplePlan_Small2.json', import.meta.url))
);
const snapshotScope = '.l-shell__pane-main .l-pane__contents'; const snapshotScope = '.l-shell__pane-main .l-pane__contents';

View File

@ -24,11 +24,11 @@
This test suite is dedicated to tests which verify search functionality. This test suite is dedicated to tests which verify search functionality.
*/ */
const { test, expect, scanForA11yViolations } = require('../../avpFixtures'); import percySnapshot from '@percy/playwright';
const { createDomainObjectWithDefaults } = require('../../appActions');
const { VISUAL_URL } = require('../../constants');
const percySnapshot = require('@percy/playwright'); import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
import { VISUAL_URL } from '../../constants.js';
test.describe('Grand Search @a11y', () => { test.describe('Grand Search @a11y', () => {
let conditionWidget; let conditionWidget;

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import ExampleDataVisualizationSourceViewProvider from './ExampleDataVisualizationSourceViewProvider'; import ExampleDataVisualizationSourceViewProvider from './ExampleDataVisualizationSourceViewProvider.js';
export default function () { export default function () {
return function install(openmct) { return function install(openmct) {

View File

@ -19,8 +19,8 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import EventMetadataProvider from './EventMetadataProvider'; import EventMetadataProvider from './EventMetadataProvider.js';
import EventTelemetryProvider from './EventTelemetryProvider'; import EventTelemetryProvider from './EventTelemetryProvider.js';
export default function EventGeneratorPlugin(options) { export default function EventGeneratorPlugin(options) {
return function install(openmct) { return function install(openmct) {

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available * this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { createOpenMct, resetApplicationState } from '../../src/utils/testing'; import { createOpenMct, resetApplicationState } from '../../src/utils/testing.js';
import EventMessageGeneratorPlugin from './plugin.js'; import EventMessageGeneratorPlugin from './plugin.js';
describe('the plugin', () => { describe('the plugin', () => {

View File

@ -23,7 +23,7 @@
import EventEmitter from 'EventEmitter'; import EventEmitter from 'EventEmitter';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import createExampleUser from './exampleUserCreator'; import createExampleUser from './exampleUserCreator.js';
const STATUSES = [ const STATUSES = [
{ {

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import ExampleUserProvider from './ExampleUserProvider'; import ExampleUserProvider from './ExampleUserProvider.js';
const AUTO_LOGIN_USER = 'mct-user'; const AUTO_LOGIN_USER = 'mct-user';
const STATUS_ROLES = ['flight', 'driver']; const STATUS_ROLES = ['flight', 'driver'];

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import { createOpenMct, resetApplicationState } from '../../src/utils/testing'; import { createOpenMct, resetApplicationState } from '../../src/utils/testing.js';
import ExampleUserProvider from './ExampleUserProvider'; import ExampleUserProvider from './ExampleUserProvider.js';
describe('The Example User Plugin', () => { describe('The Example User Plugin', () => {
let openmct; let openmct;

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information. * at runtime from the About dialog for additional information.
*****************************************************************************/ *****************************************************************************/
import utils from './utils'; import utils from './utils.js';
export default function (staticFaults = false) { export default function (staticFaults = false) {
return function install(openmct) { return function install(openmct) {

Some files were not shown because too many files have changed in this diff Show More