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:
- 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`
will use the default production configuration.
*/
const path = require('path');
const packageDefinition = require('../package.json');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
import path from 'node:path';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import webpack from 'webpack';
import MiniCssExtractPlugin from '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 gitBranch = 'error-retrieving-branch';
const packageDefinition = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
try {
gitRevision = require('child_process').execSync('git rev-parse HEAD').toString().trim();
gitBranch = require('child_process')
.execSync('git rev-parse --abbrev-ref HEAD')
gitRevision = execSync('git rev-parse HEAD').toString().trim();
gitBranch = execSync('git rev-parse --abbrev-ref HEAD')
.toString()
.trim();
} catch (err) {
console.warn(err);
}
const projectRootDir = path.resolve(__dirname, '..');
const projectRootDir = fileURLToPath(new URL('../', import.meta.url));
/** @type {import('webpack').Configuration} */
const config = {
@ -56,6 +57,7 @@ const config = {
filename: '[name].js',
path: path.resolve(projectRootDir, 'dist'),
library: 'openmct',
libraryExport: 'default',
libraryTarget: 'umd',
publicPath: '',
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.
OpenMCT Continuous Integration servers use this configuration to add code coverage
information to pull requests.
*/
const config = require('./webpack.dev');
import config from './webpack.dev.js';
// eslint-disable-next-line no-undef
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
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.
*/
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
import path from 'path';
import webpack from 'webpack';
import { merge } from 'webpack-merge';
import { fileURLToPath } from 'node:url';
const common = require('./webpack.common');
const projectRootDir = path.resolve(__dirname, '..');
import common from './webpack.common.js';
module.exports = merge(common, {
export default merge(common, {
mode: 'development',
watchOptions: {
// Since we use require.context, webpack is watching the entire directory.
@ -42,7 +40,7 @@ module.exports = merge(common, {
},
watchFiles: ['**/*.css'],
static: {
directory: path.join(__dirname, '..', '/dist'),
directory: fileURLToPath(new URL('../dist', import.meta.url)),
publicPath: '/dist',
watch: false
}

View File

@ -1,17 +1,14 @@
/* global __dirname module */
/*
This configuration should be used for production installs.
It is the default webpack configuration.
*/
const path = require('path');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const common = require('./webpack.common');
const projectRootDir = path.resolve(__dirname, '..');
import webpack from 'webpack';
import { merge } from 'webpack-merge';
module.exports = merge(common, {
import common from './webpack.common.js';
export default merge(common, {
mode: 'production',
plugins: [
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:
```js
const { test, expect } = require('../../pluginFixtures.js');
import { test, expect } from '../../pluginFixtures.js';
test.describe('foo test suite', () => {

View File

@ -54,9 +54,9 @@
* @property {import('../src/api/notifications/NotificationAPI').NotificationOptions} [notificationOptions] additional options
*/
const Buffer = require('buffer').Buffer;
const genUuid = require('uuid').v4;
const { expect } = require('@playwright/test');
import { expect } from '@playwright/test';
import { Buffer } from 'buffer';
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
@ -644,8 +644,7 @@ async function renameObjectFromContextMenu(page, url, newName) {
await page.click('[aria-label="Save"]');
}
// eslint-disable-next-line no-undef
module.exports = {
export {
createDomainObjectWithDefaults,
createExampleTelemetryObject,
createNotification,
@ -653,16 +652,16 @@ module.exports = {
expandEntireTree,
expandTreePaneItemByName,
getCanvasPixels,
getHashUrlToDomainObject,
getFocusedObjectUuid,
getHashUrlToDomainObject,
navigateToObjectWithFixedTimeBounds,
openObjectTreeContextMenu,
renameObjectFromContextMenu,
setEndOffset,
setFixedTimeMode,
setIndependentTimeConductorBounds,
setRealTimeMode,
setStartOffset,
setEndOffset,
setTimeConductorBounds,
setIndependentTimeConductorBounds,
waitForPlotsToRender,
renameObjectFromContextMenu
waitForPlotsToRender
};

View File

@ -33,10 +33,11 @@
* existing ones.
*/
const fs = require('fs');
const path = require('path');
const { test, expect } = require('./pluginFixtures');
const AxeBuilder = require('@axe-core/playwright').default;
import AxeBuilder from '@axe-core/playwright';
import fs from 'fs';
import path from 'path';
import { expect, test } from './pluginFixtures.js';
// Constants for repeated values
const TEST_RESULTS_DIR = './test-results';
@ -56,7 +57,7 @@ const TEST_RESULTS_DIR = './test-results';
* otherwise returns null.
*/
/* eslint-disable no-undef */
exports.scanForA11yViolations = async function (page, testCaseName, options = {}) {
export async function scanForA11yViolations(page, testCaseName, options = {}) {
const builder = new AxeBuilder({ page });
builder.withTags(['wcag2aa']);
// 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.');
return null;
}
};
}
exports.expect = expect;
exports.test = test;
export { expect, test };

View File

@ -28,12 +28,12 @@
* GitHub issues.
*/
const base = require('@playwright/test');
const { expect, request } = base;
const fs = require('fs');
const path = require('path');
const { v4: uuid } = require('uuid');
const sinon = require('sinon');
import { expect, request, test } from '@playwright/test';
import fs from 'fs';
import path from 'path';
import sinon from 'sinon';
import { fileURLToPath } from 'url';
import { v4 as uuid } from 'uuid';
/**
* 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');
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
* the Time Indicator Clock to be in a specific state.
@ -97,7 +97,7 @@ exports.test = base.test.extend({
async ({ context, clockOptions }, use) => {
if (clockOptions !== undefined) {
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) => {
window.__clock = sinon.useFakeTimers(options);
@ -201,6 +201,4 @@ exports.test = base.test.extend({
}
});
exports.expect = expect;
exports.request = request;
exports.waitForAnimations = waitForAnimations;
export { expect, request, extendedTest as test, waitForAnimations };

View File

@ -19,14 +19,15 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
const path = require('path');
import { fileURLToPath } from 'url';
/**
* @param {import('@playwright/test').Page} 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);
}
@ -36,7 +37,7 @@ async function navigateToFaultManagementWithExample(page) {
*/
async function navigateToFaultManagementWithStaticExample(page) {
await page.addInitScript({
path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js')
path: fileURLToPath(new URL('./addInitExampleFaultProviderStatic.js', import.meta.url))
});
await navigateToFaultItemInTree(page);
@ -46,7 +47,9 @@ async function navigateToFaultManagementWithStaticExample(page) {
* @param {import('@playwright/test').Page} 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);
}
@ -265,29 +268,28 @@ async function openFaultRowMenu(page, rowNumber) {
.click();
}
// eslint-disable-next-line no-undef
module.exports = {
navigateToFaultManagementWithExample,
navigateToFaultManagementWithStaticExample,
navigateToFaultManagementWithoutExample,
navigateToFaultItemInTree,
export {
acknowledgeFault,
shelveMultipleFaults,
acknowledgeMultipleFaults,
shelveFault,
changeViewTo,
sortFaultsBy,
enterSearchTerm,
clearSearch,
selectFaultItem,
getHighestSeverity,
getLowestSeverity,
getFaultResultCount,
enterSearchTerm,
getFault,
getFaultByName,
getFaultName,
getFaultSeverity,
getFaultNamespace,
getFaultResultCount,
getFaultSeverity,
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.
*****************************************************************************/
const { createDomainObjectWithDefaults } = require('../appActions');
import { createDomainObjectWithDefaults } from '../appActions.js';
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
const CUSTOM_NAME = 'CUSTOM_NAME';
const path = require('path');
import { fileURLToPath } from 'url';
/**
* @param {import('@playwright/test').Page} page
@ -69,7 +69,9 @@ async function commitEntry(page) {
*/
async function startAndAddRestrictedNotebookObject(page) {
// 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' });
return createDomainObjectWithDefaults(page, {
@ -138,12 +140,11 @@ async function createNotebookEntryAndTags(page, iterations = 1) {
return notebook;
}
// eslint-disable-next-line no-undef
module.exports = {
enterTextEntry,
dragAndDropEmbed,
startAndAddRestrictedNotebookObject,
lockPage,
export {
createNotebookAndEntry,
createNotebookEntryAndTags,
createNotebookAndEntry
dragAndDropEmbed,
enterTextEntry,
lockPage,
startAndAddRestrictedNotebookObject
};

View File

@ -20,7 +20,7 @@
* 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

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import { expect } from '../pluginFixtures';
const { waitForPlotsToRender } = require('../appActions');
import { waitForPlotsToRender } from '../appActions.js';
import { expect } from '../pluginFixtures.js';
/**
* 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
// @ts-check
// eslint-disable-next-line no-unused-vars
const { devices } = require('@playwright/test');
import { devices } from '@playwright/test';
const MAX_FAILURES = 5;
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
// @ts-check
// eslint-disable-next-line no-unused-vars
const { devices } = require('@playwright/test');
import { devices } from '@playwright/test';
/** @type {import('@playwright/test').PlaywrightTestConfig} */
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
// @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
// @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
// @ts-check
// eslint-disable-next-line no-unused-vars
const { devices } = require('@playwright/test');
import { devices } from '@playwright/test';
const MAX_FAILURES = 5;
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.
*/
const { test, expect, request } = require('./baseFixtures');
// const { createDomainObjectWithDefaults } = require('./appActions');
const path = require('path');
// import { createDomainObjectWithDefaults } from './appActions.js';
import { fileURLToPath } from 'url';
import { expect, request, test } from './baseFixtures.js';
/**
* @typedef {Object} ObjectCreateOptions
@ -117,7 +118,7 @@ const theme = 'espresso';
*/
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
theme: [theme, { option: true }],
// eslint-disable-next-line no-shadow
@ -125,7 +126,9 @@ exports.test = test.extend({
// eslint-disable-next-line playwright/no-conditional-in-test
if (theme === 'snow') {
//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.
@ -142,19 +145,18 @@ exports.test = test.extend({
}
});
exports.expect = expect;
exports.request = request;
export { expect, request, extendedTest as test };
/**
* Takes a readable stream and returns a string.
* @param {ReadableStream} readable - the readable stream
* @return {Promise<String>} the stringified stream
*/
exports.streamToString = async function (readable) {
export async function streamToString(readable) {
let result = '';
for await (const chunk of readable) {
result += chunk;
}
return result;
};
}

View File

@ -20,12 +20,12 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test, expect } = require('../../pluginFixtures.js');
const {
import {
createDomainObjectWithDefaults,
createNotification,
expandEntireTree
} = require('../../appActions.js');
} from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('AppActions', () => {
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)
*/
const { test } = require('../../baseFixtures.js');
import { test } from '../../baseFixtures.js';
test.describe('baseFixtures tests', () => {
//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.
const { test, expect } = require('../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../appActions');
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
/**
* Structure:

View File

@ -19,7 +19,6 @@
* this source code distribution or the Licensing information page available
* 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
* 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.
*/
const { test, expect } = require('../../pluginFixtures.js');
const {
createDomainObjectWithDefaults,
createExampleTelemetryObject
} = require('../../appActions.js');
const { MISSION_TIME } = require('../../constants.js');
const path = require('path');
import { fileURLToPath } from 'url';
import { createDomainObjectWithDefaults, createExampleTelemetryObject } from '../../appActions.js';
import { MISSION_TIME } from '../../constants.js';
import { expect, test } from '../../pluginFixtures.js';
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
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
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
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.
@ -226,14 +229,18 @@ test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
await page.getByRole('button', { name: 'OK' }).click();
//Save localStorage for future test execution
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.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 }) => {
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.use({
storageState: path.join(
__dirname,
'../../../e2e/test-data/overlay_plot_with_delay_storage.json'
storageState: fileURLToPath(
new URL('../../../e2e/test-data/overlay_plot_with_delay_storage.json', import.meta.url)
)
});
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.
*/
const { test } = require('../../pluginFixtures.js');
import { test } from '../../pluginFixtures.js';
// eslint-disable-next-line playwright/no-skipped-test
test.describe.skip('pluginFixtures tests', () => {

View File

@ -24,7 +24,7 @@
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('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.
*/
const { test, expect } = require('../../pluginFixtures.js');
const { createDomainObjectWithDefaults } = require('../../appActions.js');
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
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.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.
*/
const { test, expect } = require('../../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../../appActions');
import { createDomainObjectWithDefaults } from '../../../appActions.js';
import { expect, test } from '../../../pluginFixtures.js';
test.describe('Example Event Generator CRUD Operations', () => {
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.
*/
const { test, expect } = require('../../../../baseFixtures');
import { expect, test } from '../../../../baseFixtures.js';
test.describe('Sine Wave Generator', () => {
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
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
/*
This test suite is dedicated to tests which verify form functionality in isolation
*/
const { test, expect } = require('../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../appActions');
const genUuid = require('uuid').v4;
const path = require('path');
import { fileURLToPath } from 'url';
import { v4 as genUuid } from 'uuid';
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
const TEST_FOLDER = 'test folder';
const jsonFilePath = 'e2e/test-data/ExampleLayouts.json';
@ -72,7 +73,7 @@ test.describe('Form Validation Behavior', () => {
test.describe('Form File Input Behavior', () => {
test.beforeEach(async ({ page }) => {
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
test.beforeEach(async ({ page }) => {
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
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
/*
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', () => {
// add non persistable root item
test.beforeEach(async ({ page }) => {
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.
*/
const { test, expect } = require('../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../appActions');
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Move & link item tests', () => {
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
*/
const { createDomainObjectWithDefaults, createNotification } = require('../../appActions');
const { test, expect } = require('../../pluginFixtures');
import { createDomainObjectWithDefaults, createNotification } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Notifications List', () => {
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
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test, expect } = require('../../../pluginFixtures');
const { createPlanFromJSON, createDomainObjectWithDefaults } = require('../../../appActions');
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json');
const {
import fs from 'fs';
import { getPreciseDuration } from '../../../../src/utils/duration.js';
import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../../appActions.js';
import {
assertPlanActivities,
setBoundsToSpanAllActivities
} = require('../../../helper/planningUtils');
const { getPreciseDuration } = require('../../../../src/utils/duration');
} from '../../../helper/planningUtils.js';
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', () => {
let ganttChart;

View File

@ -19,15 +19,27 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test } = require('../../../pluginFixtures');
const { createPlanFromJSON } = require('../../../appActions');
const { addPlanGetInterceptor } = require('../../../helper/planningUtils.js');
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
const testPlanWithOrderedLanes = require('../../../test-data/examplePlans/ExamplePlanWithOrderedLanes.json');
const {
import fs from 'fs';
import { createPlanFromJSON } from '../../../appActions.js';
import {
addPlanGetInterceptor,
assertPlanActivities,
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', () => {
let plan;

View File

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

View File

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

View File

@ -24,7 +24,7 @@
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('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
// eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures');
import { expect, test } from '../../../../baseFixtures.js';
test.describe('Remote Clock', () => {
// eslint-disable-next-line require-await

View File

@ -19,19 +19,19 @@
* this source code distribution or the Licensing information page available
* 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
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.
*/
const { test, expect } = require('../../../../pluginFixtures.js');
const {
import { fileURLToPath } from 'url';
import {
createDomainObjectWithDefaults,
createExampleTelemetryObject
} = require('../../../../appActions');
const path = require('path');
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
let conditionSetUrl;
let getConditionSetIdentifierFromUrl;
@ -50,7 +50,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
//Save localStorage for future test execution
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
@ -63,7 +65,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
//Load localStorage for subsequent tests
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

View File

@ -19,20 +19,19 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
const { test, expect } = require('../../../../pluginFixtures');
const path = require('path');
const {
createDomainObjectWithDefaults,
setStartOffset,
setFixedTimeMode,
setRealTimeMode,
setIndependentTimeConductorBounds
} = require('../../../../appActions');
import { fileURLToPath } from 'url';
const LOCALSTORAGE_PATH = path.resolve(
__dirname,
'../../../../test-data/display_layout_with_child_layouts.json'
import {
createDomainObjectWithDefaults,
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 =
'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();
});
test.use({
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH)
storageState: LOCALSTORAGE_PATH
});
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.
*****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures');
const utils = require('../../../../helper/faultUtils');
import * as utils from '../../../../helper/faultUtils.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('The Fault Management Plugin using example faults', () => {
test.beforeEach(async ({ page }) => {

View File

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

View File

@ -24,12 +24,13 @@
* This test suite is dedicated to testing the Gauge component.
*/
const { test, expect } = require('../../../../pluginFixtures');
const {
import { v4 as uuid } from 'uuid';
import {
createDomainObjectWithDefaults,
createExampleTelemetryObject
} = require('../../../../appActions');
const uuid = require('uuid').v4;
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Gauge', () => {
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.
*/
/* globals process */
const { waitForAnimations } = require('../../../../baseFixtures');
const { test, expect } = require('../../../../pluginFixtures');
const { createDomainObjectWithDefaults, setRealTimeMode } = require('../../../../appActions');
import { createDomainObjectWithDefaults, setRealTimeMode } from '../../../../appActions.js';
import { waitForAnimations } from '../../../../baseFixtures.js';
import { expect, test } from '../../../../pluginFixtures.js';
const backgroundImageSelector = '.c-imagery__main-image__background-image';
const panHotkey = process.platform === 'linux' ? ['Shift', 'Alt'] : ['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
// eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures');
import { expect, test } from '../../../../baseFixtures.js';
test.describe('ExportAsJSON', () => {
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
// eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures');
import { expect, test } from '../../../../baseFixtures.js';
test.describe('ExportAsJSON', () => {
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
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
const { test, expect } = require('../../../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const path = require('path');
import { fileURLToPath } from 'url';
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.beforeEach(async ({ page }) => {
// eslint-disable-next-line no-undef
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' });
});

View File

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

View File

@ -19,15 +19,16 @@
* this source code distribution or the Licensing information page available
* 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.
*/
const { test, expect, streamToString } = require('../../../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const nbUtils = require('../../../../helper/notebookUtils');
const path = require('path');
import { fileURLToPath } from 'url';
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import * as nbUtils from '../../../../helper/notebookUtils.js';
import { expect, streamToString, test } from '../../../../pluginFixtures.js';
const NOTEBOOK_NAME = 'Notebook';
@ -278,7 +279,7 @@ test.describe('Notebook entry tests', () => {
test.beforeEach(async ({ page }) => {
// eslint-disable-next-line no-undef
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' });

View File

@ -19,15 +19,16 @@
* this source code distribution or the Licensing information page available
* 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.
*/
const fs = require('fs').promises;
const path = require('path');
const { test, expect } = require('../../../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions');
import fs from 'fs/promises';
import { fileURLToPath } from 'url';
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
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 }) => {
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 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.
*/
const { test, expect } = require('../../../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const nbUtils = require('../../../../helper/notebookUtils');
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import * as nbUtils from '../../../../helper/notebookUtils.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Notebook Tests with CouchDB @couchdb', () => {
let testNotebook;

View File

@ -20,14 +20,14 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test, expect, streamToString } = require('../../../../pluginFixtures');
const { openObjectTreeContextMenu } = require('../../../../appActions');
const {
lockPage,
import { openObjectTreeContextMenu } from '../../../../appActions.js';
import {
dragAndDropEmbed,
enterTextEntry,
lockPage,
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_NAME = 'Test Page';

View File

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

View File

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

View File

@ -24,8 +24,8 @@
Testsuite for plot autoscale.
*/
const { createDomainObjectWithDefaults } = require('../../../../appActions');
const { test, expect } = require('../../../../pluginFixtures');
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.use({
viewport: {
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.
*/
const { test, expect } = require('../../../../pluginFixtures');
const { setTimeConductorBounds } = require('../../../../appActions');
import { setTimeConductorBounds } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Log plot tests', () => {
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
*/
const { test, expect } = require('../../../../pluginFixtures');
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Handle missing object for plots', () => {
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.
*/
const { test, expect } = require('../../../../pluginFixtures');
const {
import {
createDomainObjectWithDefaults,
getCanvasPixels,
waitForPlotsToRender
} = require('../../../../appActions');
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Overlay Plot', () => {
test.beforeEach(async ({ page }) => {

View File

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

View File

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

View File

@ -24,18 +24,14 @@
Tests to verify plot tagging functionality.
*/
const { test, expect } = require('../../../../pluginFixtures');
const {
basicTagsTests,
createTags,
testTelemetryItem
} = require('../../../../helper/plotTagsUtils');
const {
import {
createDomainObjectWithDefaults,
setRealTimeMode,
setFixedTimeMode,
setRealTimeMode,
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.beforeEach(async ({ page }) => {

View File

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

View File

@ -20,11 +20,8 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const {
createDomainObjectWithDefaults,
setTimeConductorBounds
} = require('../../../../appActions');
const { test, expect } = require('../../../../pluginFixtures');
import { createDomainObjectWithDefaults, setTimeConductorBounds } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Telemetry Table', () => {
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.
*****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures');
const {
import {
setEndOffset,
setFixedTimeMode,
setRealTimeMode,
setStartOffset,
setEndOffset,
setTimeConductorBounds
} = require('../../../../appActions');
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Time conductor operations', () => {
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.
*****************************************************************************/
const { test, expect } = require('../../../../pluginFixtures');
const {
openObjectTreeContextMenu,
createDomainObjectWithDefaults
} = require('../../../../appActions');
import { MISSION_TIME } from '../../../../constants';
import {
createDomainObjectWithDefaults,
openObjectTreeContextMenu
} from '../../../../appActions.js';
import { MISSION_TIME } from '../../../../constants.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Timer', () => {
let timer;

View File

@ -20,9 +20,9 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test, expect } = require('../../pluginFixtures.js');
const { createDomainObjectWithDefaults } = require('../../appActions.js');
const { waitForAnimations } = require('../../baseFixtures.js');
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { waitForAnimations } from '../../baseFixtures.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Recent Objects', () => {
/** @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.
*/
const { test, expect } = require('../../baseFixtures.js');
const {
createDomainObjectWithDefaults,
renameObjectFromContextMenu
} = require('../../appActions.js');
import { createDomainObjectWithDefaults, renameObjectFromContextMenu } from '../../appActions.js';
import { expect, test } from '../../baseFixtures.js';
test.describe('Renaming objects', () => {
test.beforeEach(async ({ page }) => {

View File

@ -23,9 +23,10 @@
* This test suite is dedicated to tests which verify search functionalities.
*/
const { test, expect } = require('../../pluginFixtures');
const { createDomainObjectWithDefaults } = require('../../appActions');
const { v4: uuid } = require('uuid');
import { v4 as uuid } from 'uuid';
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Grand Search', () => {
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.
*/
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 ({
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.
*/
const { test, expect } = require('../../pluginFixtures');
const { createDomainObjectWithDefaults, expandEntireTree } = require('../../appActions');
import { createDomainObjectWithDefaults, expandEntireTree } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Verify tooltips', () => {
let folder1;

View File

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

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';

View File

@ -19,14 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
const { test, expect } = require('@playwright/test');
const path = require('path');
import { expect, test } from '@playwright/test';
import { fileURLToPath } from 'url';
const memoryLeakFilePath = path.resolve(
__dirname,
'../../../../e2e/test-data/memory-leak-detection.json'
const memoryLeakFilePath = fileURLToPath(
new URL('../../../../e2e/test-data/memory-leak-detection.json', import.meta.url)
);
/**
* 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.
*****************************************************************************/
const { createDomainObjectWithDefaults, waitForPlotsToRender } = require('../../appActions');
const { test, expect } = require('../../pluginFixtures');
import { createDomainObjectWithDefaults, waitForPlotsToRender } from '../../appActions.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Tabs View', () => {
test('Renders tabbed elements nicely', async ({ page }) => {

View File

@ -24,14 +24,14 @@
Tests to verify plot tagging performance.
*/
const { test, expect } = require('../../pluginFixtures');
const { basicTagsTests, createTags, testTelemetryItem } = require('../../helper/plotTagsUtils');
const {
import {
createDomainObjectWithDefaults,
setRealTimeMode,
setFixedTimeMode,
setRealTimeMode,
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.beforeEach(async ({ page }) => {

View File

@ -20,8 +20,8 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test, scanForA11yViolations } = require('../../avpFixtures');
const VISUAL_URL = require('../../constants').VISUAL_URL;
import { scanForA11yViolations, test } from '../../avpFixtures.js';
import { VISUAL_URL } from '../../constants.js';
test.describe('a11y - Default @a11y', () => {
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
*/
const { test, expect } = require('../../../pluginFixtures');
const percySnapshot = require('@percy/playwright');
const VISUAL_URL = require('../../../constants').VISUAL_URL;
import percySnapshot from '@percy/playwright';
import { VISUAL_URL } from '../../../constants.js';
import { expect, test } from '../../../pluginFixtures.js';
test.describe('Visual - Branding', () => {
test.beforeEach(async ({ page }) => {

View File

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

View File

@ -20,13 +20,11 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test } = require('../../../pluginFixtures.js');
const {
expandTreePaneItemByName,
createDomainObjectWithDefaults
} = require('../../../appActions.js');
const VISUAL_URL = require('../../../constants.js').VISUAL_URL;
const percySnapshot = require('@percy/playwright');
import percySnapshot from '@percy/playwright';
import { createDomainObjectWithDefaults, expandTreePaneItemByName } from '../../../appActions.js';
import { VISUAL_URL } from '../../../constants.js';
import { test } from '../../../pluginFixtures.js';
//Declare the scope of the visual test
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.
*/
const { VISUAL_URL, MISSION_TIME } = require('../../constants');
const { test, expect } = require('../../pluginFixtures');
const percySnapshot = require('@percy/playwright');
import percySnapshot from '@percy/playwright';
import { MISSION_TIME, VISUAL_URL } from '../../constants.js';
import { expect, test } from '../../pluginFixtures.js';
test.describe('Visual - Controlled Clock', () => {
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.
*/
const { test, expect, scanForA11yViolations } = require('../../avpFixtures');
const percySnapshot = require('@percy/playwright');
const { createDomainObjectWithDefaults } = require('../../appActions');
const { VISUAL_URL } = require('../../constants');
import percySnapshot from '@percy/playwright';
import { createDomainObjectWithDefaults } from '../../appActions.js';
import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
import { VISUAL_URL } from '../../constants.js';
test.describe('Visual - Default @a11y', () => {
test.beforeEach(async ({ page }) => {

View File

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

View File

@ -19,17 +19,16 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/* global __dirname */
const path = require('path');
const { test } = require('../../pluginFixtures');
const percySnapshot = require('@percy/playwright');
import percySnapshot from '@percy/playwright';
import { fileURLToPath } from 'url';
const utils = require('../../helper/faultUtils');
import * as utils from '../../helper/faultUtils.js';
import { test } from '../../pluginFixtures.js';
test.describe('Fault Management Visual Tests', () => {
test('icon test', async ({ page, theme }) => {
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' });

View File

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

View File

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

View File

@ -24,10 +24,11 @@
* This test is dedicated to test notification banner functionality and its accessibility attributes.
*/
const { test, expect, scanForA11yViolations } = require('../../avpFixtures');
const percySnapshot = require('@percy/playwright');
const { createDomainObjectWithDefaults } = require('../../appActions');
const VISUAL_URL = require('../../constants').VISUAL_URL;
import percySnapshot from '@percy/playwright';
import { createDomainObjectWithDefaults } from '../../appActions.js';
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.beforeEach(async ({ page }) => {

View File

@ -20,15 +20,17 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
const { test, scanForA11yViolations } = require('../../avpFixtures');
const {
setBoundsToSpanAllActivities,
setDraftStatusForPlan
} = require('../../helper/planningUtils');
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../appActions');
const percySnapshot = require('@percy/playwright');
const VISUAL_URL = require('../../constants').VISUAL_URL;
const examplePlanSmall = require('../../test-data/examplePlans/ExamplePlan_Small2.json');
import percySnapshot from '@percy/playwright';
import fs from 'fs';
import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../appActions.js';
import { scanForA11yViolations, test } from '../../avpFixtures.js';
import { VISUAL_URL } from '../../constants.js';
import { setBoundsToSpanAllActivities, setDraftStatusForPlan } from '../../helper/planningUtils.js';
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';

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* 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';
describe('the plugin', () => {

View File

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

View File

@ -20,7 +20,7 @@
* 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 STATUS_ROLES = ['flight', 'driver'];

View File

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

View File

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

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