Merge remote-tracking branch 'origin' into recent-objects-style
# Conflicts: # src/ui/layout/pane.scss
@ -1,59 +1,33 @@
|
||||
version: 2.1
|
||||
orbs:
|
||||
node: circleci/node@5.2.0
|
||||
browser-tools: circleci/browser-tools@1.3.0
|
||||
executors:
|
||||
pw-focal-development:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/playwright:v1.39.0-focal
|
||||
- image: mcr.microsoft.com/playwright:v1.42.1-focal
|
||||
environment:
|
||||
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
||||
PERCY_POSTINSTALL_BROWSER: "true" # Needed to store the percy browser in cache deps
|
||||
PERCY_LOGLEVEL: "debug" # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||
PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
|
||||
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||
PERCY_PARALLEL_TOTAL: 2
|
||||
ubuntu:
|
||||
machine:
|
||||
image: ubuntu-2204:current
|
||||
docker_layer_caching: true
|
||||
parameters:
|
||||
BUST_CACHE:
|
||||
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
||||
default: false
|
||||
type: boolean
|
||||
commands:
|
||||
build_and_install:
|
||||
description: "All steps used to build and install. Will use cache if found"
|
||||
description: 'All steps used to build and install.'
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache_cmd:
|
||||
node-version: << parameters.node-version >>
|
||||
- node/install:
|
||||
node-version: << parameters.node-version >>
|
||||
- run: npm install --no-audit --progress=false
|
||||
restore_cache_cmd:
|
||||
description: "Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache"
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
steps:
|
||||
- when:
|
||||
condition:
|
||||
equal: [false, << pipeline.parameters.BUST_CACHE >>]
|
||||
steps:
|
||||
- restore_cache:
|
||||
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||
save_cache_cmd:
|
||||
description: "Custom command for saving cache."
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
steps:
|
||||
- save_cache:
|
||||
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||
paths:
|
||||
- ~/.npm
|
||||
- node_modules
|
||||
- node/install-packages
|
||||
generate_and_store_version_and_filesystem_artifacts:
|
||||
description: "Track important packages and files"
|
||||
description: 'Track important packages and files'
|
||||
steps:
|
||||
- run: |
|
||||
[[ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
|
||||
@ -64,16 +38,13 @@ commands:
|
||||
- store_artifacts:
|
||||
path: /tmp/artifacts/
|
||||
generate_e2e_code_cov_report:
|
||||
description: "Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test"
|
||||
description: 'Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test'
|
||||
parameters:
|
||||
suite:
|
||||
type: string
|
||||
steps:
|
||||
- run: npm run cov:e2e:report || true
|
||||
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
||||
orbs:
|
||||
node: circleci/node@5.1.0
|
||||
browser-tools: circleci/browser-tools@1.3.0
|
||||
jobs:
|
||||
npm-audit:
|
||||
parameters:
|
||||
@ -111,8 +82,6 @@ jobs:
|
||||
TESTFILES=$(circleci tests glob "src/**/*Spec.js")
|
||||
echo "$TESTFILES" | circleci tests run --command="xargs npm run test" --verbose
|
||||
- run: npm run cov:unit:publish
|
||||
- save_cache_cmd:
|
||||
node-version: <<parameters.node-version>>
|
||||
- store_test_results:
|
||||
path: dist/reports/tests/
|
||||
- store_artifacts:
|
||||
@ -133,7 +102,7 @@ jobs:
|
||||
node-version: lts/hydrogen
|
||||
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
||||
condition:
|
||||
equal: ["full", <<parameters.suite>>]
|
||||
equal: ['full', <<parameters.suite>>]
|
||||
steps:
|
||||
- run: npx playwright install chrome-beta
|
||||
- run:
|
||||
@ -190,7 +159,7 @@ jobs:
|
||||
steps:
|
||||
- build_and_install:
|
||||
node-version: lts/hydrogen
|
||||
- run: npx playwright@1.39.0 install #Necessary for bare ubuntu machine
|
||||
- run: npx playwright@1.42.1 install #Necessary for bare ubuntu machine
|
||||
- run: |
|
||||
export $(cat src/plugins/persistence/couch/.env.ci | xargs)
|
||||
docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
||||
@ -252,14 +221,15 @@ jobs:
|
||||
equal: [42, 42] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||
steps:
|
||||
- generate_and_store_version_and_filesystem_artifacts
|
||||
visual-a11y-tests:
|
||||
visual-a11y:
|
||||
parameters:
|
||||
suite:
|
||||
type: string # ci or full
|
||||
executor: pw-focal-development
|
||||
parallelism: 2
|
||||
steps:
|
||||
- build_and_install:
|
||||
node-version: lts/hydrogen
|
||||
node-version: lts/iron
|
||||
- run: npm run test:e2e:visual:<<parameters.suite>>
|
||||
- store_test_results:
|
||||
path: test-results/results.xml
|
||||
@ -286,8 +256,8 @@ workflows:
|
||||
name: e2e-stable
|
||||
suite: stable
|
||||
- e2e-mobile
|
||||
- visual-a11y-tests:
|
||||
name: visual-a11y-test-ci
|
||||
- visual-a11y:
|
||||
name: visual-a11y-ci
|
||||
suite: ci
|
||||
|
||||
the-nightly: #These jobs do not run on PRs, but against master at night
|
||||
@ -306,13 +276,13 @@ workflows:
|
||||
- e2e-mobile
|
||||
- perf-test
|
||||
- mem-test
|
||||
- visual-a11y-tests:
|
||||
name: visual-a11y-test-nightly
|
||||
- visual-a11y:
|
||||
name: visual-a11y-nightly
|
||||
suite: full
|
||||
- e2e-couchdb
|
||||
triggers:
|
||||
- schedule:
|
||||
cron: "0 0 * * *"
|
||||
cron: '0 0 * * *'
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
|
@ -1,10 +1,13 @@
|
||||
const LEGACY_FILES = ['example/**'];
|
||||
module.exports = {
|
||||
/** @type {import('eslint').Linter.Config} */
|
||||
const config = {
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
es2024: true,
|
||||
jasmine: true,
|
||||
amd: true
|
||||
node: true,
|
||||
worker: true,
|
||||
serviceworker: true
|
||||
},
|
||||
globals: {
|
||||
_: 'readonly'
|
||||
@ -23,10 +26,11 @@ module.exports = {
|
||||
parser: '@babel/eslint-parser',
|
||||
requireConfigFile: false,
|
||||
allowImportExportEverywhere: true,
|
||||
ecmaVersion: 2015,
|
||||
ecmaVersion: 'latest',
|
||||
ecmaFeatures: {
|
||||
impliedStrict: true
|
||||
}
|
||||
},
|
||||
sourceType: 'module'
|
||||
},
|
||||
rules: {
|
||||
'simple-import-sort/imports': 'warn',
|
||||
@ -152,7 +156,7 @@ module.exports = {
|
||||
cases: {
|
||||
pascalCase: true
|
||||
},
|
||||
ignore: ['^.*\\.js$']
|
||||
ignore: ['^.*\\.(js|cjs|mjs)$']
|
||||
}
|
||||
],
|
||||
'vue/first-attribute-linebreak': 'error',
|
||||
@ -179,3 +183,5 @@ module.exports = {
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
|
1
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -17,7 +17,6 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
||||
* [ ] Has this been smoke tested?
|
||||
* [ ] Have you associated this PR with a `type:` label? Note: this is not necessarily the same as the original issue.
|
||||
* [ ] Have you associated a milestone with this PR? Note: leave blank if unsure.
|
||||
* [ ] Is this a breaking change to be called out in the release notes?
|
||||
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
||||
|
||||
### Reviewer Checklist
|
||||
|
4
.github/workflows/e2e-couchdb.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||
- run: npm ci --no-audit --progress=false
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
@ -37,7 +37,7 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- run: npx playwright@1.39.0 install
|
||||
- run: npx playwright@1.42.1 install
|
||||
|
||||
- name: Start CouchDB Docker Container and Init with Setup Scripts
|
||||
run: |
|
||||
|
4
.github/workflows/e2e-flakefinder.yml
vendored
@ -30,8 +30,8 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npx playwright@1.39.0 install
|
||||
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||
- run: npx playwright@1.42.1 install
|
||||
- run: npm ci --no-audit --progress=false
|
||||
|
||||
- name: Run E2E Tests (Repeated 10 Times)
|
||||
run: npm run test:e2e:stable -- --retries=0 --repeat-each=10 --max-failures=50
|
||||
|
4
.github/workflows/e2e-perf.yml
vendored
@ -28,8 +28,8 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npx playwright@1.39.0 install
|
||||
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||
- run: npx playwright@1.42.1 install
|
||||
- run: npm ci --no-audit --progress=false
|
||||
- run: npm run test:perf:localhost
|
||||
- run: npm run test:perf:contract
|
||||
- run: npm run test:perf:memory
|
||||
|
4
.github/workflows/e2e-pr.yml
vendored
@ -33,9 +33,9 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- run: npx playwright@1.39.0 install
|
||||
- run: npx playwright@1.42.1 install
|
||||
- run: npx playwright install chrome-beta
|
||||
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||
- run: npm ci --no-audit --progress=false
|
||||
- run: npm run test:e2e:full -- --max-failures=40
|
||||
- run: npm run cov:e2e:report || true
|
||||
- shell: bash
|
||||
|
4
.github/workflows/npm-prerelease.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: lts/hydrogen
|
||||
- run: npm install
|
||||
- run: npm ci
|
||||
- run: |
|
||||
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
||||
npm whoami
|
||||
@ -31,7 +31,7 @@ jobs:
|
||||
with:
|
||||
node-version: lts/hydrogen
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm install
|
||||
- run: npm ci
|
||||
- run: npm publish --access=public --tag unstable
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
2
.github/workflows/pr-platform.yml
vendored
@ -45,7 +45,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.node_version }}-
|
||||
|
||||
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||
- run: npm ci --no-audit --progress=false
|
||||
|
||||
- run: npm test
|
||||
|
||||
|
2
.github/workflows/prcop.yml
vendored
@ -5,6 +5,8 @@ on:
|
||||
types:
|
||||
- labeled
|
||||
- unlabeled
|
||||
- milestoned
|
||||
- demilestoned
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
|
4
.gitignore
vendored
@ -48,5 +48,5 @@ index.html.bak
|
||||
coverage
|
||||
codecov
|
||||
|
||||
# :(
|
||||
package-lock.json
|
||||
# Don't commit MacOS screenshots
|
||||
*-darwin.png
|
||||
|
3
.npmrc
@ -2,6 +2,3 @@ loglevel=warn
|
||||
|
||||
#Prevent folks from ignoring an important error when building from source
|
||||
engine-strict=true
|
||||
|
||||
# Dont include lockfile
|
||||
package-lock=false
|
1
.vscode/extensions.json
vendored
@ -5,7 +5,6 @@
|
||||
// List of extensions which should be recommended for users of this workspace.
|
||||
"recommendations": [
|
||||
"Vue.volar",
|
||||
"Vue.vscode-typescript-vue-plugin",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"rvest.vs-code-prettier-eslint"
|
||||
],
|
||||
|
@ -5,11 +5,8 @@ information to pull requests.
|
||||
*/
|
||||
|
||||
import config from './webpack.dev.js';
|
||||
// eslint-disable-next-line no-undef
|
||||
const CI = process.env.CI === 'true';
|
||||
|
||||
config.devtool = CI ? false : undefined;
|
||||
|
||||
config.devtool = 'source-map';
|
||||
config.devServer.hot = false;
|
||||
|
||||
config.module.rules.push({
|
||||
|
10
API.md
@ -1305,6 +1305,16 @@ View provider Example:
|
||||
}
|
||||
```
|
||||
|
||||
## User API
|
||||
|
||||
Open MCT provides a User API which can be used to define providers for user information. The API
|
||||
can be used to manage user information and roles.
|
||||
|
||||
### Example
|
||||
|
||||
Open MCT provides an example [user](example/exampleUser/exampleUserCreator.js) and [user provider](example/exampleUser/ExampleUserProvider.js) which
|
||||
can be used as a starting point for creating a custom user provider.
|
||||
|
||||
## Visibility-Based Rendering in View Providers
|
||||
|
||||
To enhance performance and resource efficiency in OpenMCT, a visibility-based rendering feature has been added. This feature is designed to defer the execution of rendering logic for views that are not currently visible. It ensures that views are only updated when they are in the viewport, similar to how modern browsers handle rendering of inactive tabs but optimized for the OpenMCT tabbed display. It also works when views are scrolled outside the viewport (e.g., in a Display Layout).
|
||||
|
@ -16,8 +16,6 @@ The [CodeQL GitHub Actions workflow](https://github.com/nasa/openmct/blob/master
|
||||
|
||||
CodeQL is run for every pull-request in GitHub Actions.
|
||||
|
||||
The project is also monitored by [LGTM](https://lgtm.com/projects/g/nasa/openmct/) and is available to public.
|
||||
|
||||
### ESLint
|
||||
|
||||
Static analysis is run for every push on the master branch and every pull request on all branches in Github Actions.
|
||||
|
14
TESTING.md
@ -91,12 +91,14 @@ There are a few reasons that your GitHub PR could be failing beyond simple faile
|
||||
### Local=Pass and CI=Fail
|
||||
Although rare, it is possible that your test can pass locally but fail in CI.
|
||||
|
||||
#### Busting Cache
|
||||
In certain circumstances, the CircleCI cache can become stale. In order to bust the cache, we've implemented a runtime boolean parameter in Circle CI creatively name BUST_CACHE. To execute:
|
||||
1. Navigate to the branch in Circle CI believed to have stale cache.
|
||||
1. Click on the 'Trigger Pipeline' button.
|
||||
1. Add Parameter -> Parameter Type = boolean , Name = BUST_CACHE ,Value = true
|
||||
1. Click 'Trigger Pipeline'
|
||||
### Reset your workspace
|
||||
It's possible that you're running with dependencies or a local environment which is out of sync with the branch you're working on. Make sure to execute the following:
|
||||
|
||||
```sh
|
||||
nvm use
|
||||
npm run clean
|
||||
npm install
|
||||
```
|
||||
|
||||
#### Run tests in the same container as CI
|
||||
|
||||
|
@ -76,28 +76,30 @@ To read about how to write a good visual test, please see [How to write a great
|
||||
|
||||
`npm run test:e2e:visual` commands will run all of the visual tests against a local instance of Open MCT. If no `PERCY_TOKEN` API key is found in the terminal or command line environment variables, no visual comparisons will be made.
|
||||
|
||||
- `npm run test:e2e:visual:ci` will run against every commit and PR.
|
||||
- `npm run test:e2e:visual:full` will run every night with additional comparisons made for Larger Displays and with the `snow` theme.
|
||||
- `npm run test:e2e:visual:ci` will run against every commit and PR.
|
||||
- `npm run test:e2e:visual:full` will run every night with additional comparisons made for Larger Displays and with the `snow` theme.
|
||||
|
||||
#### Percy.io
|
||||
|
||||
To make this possible, we're leveraging a 3rd party service, [Percy](https://percy.io/). This service maintains a copy of all changes, users, scm-metadata, and baselines to verify that the application looks and feels the same _unless approved by a Open MCT developer_. To request a Percy API token, please reach out to the Open MCT Dev team on GitHub. For more information, please see the official [Percy documentation](https://docs.percy.io/docs/visual-testing-basics).
|
||||
|
||||
At present, we are using percy with two configuration files: `./e2e/.percy.nightly.yml` and `./e2e/.percy.ci.yml`. This is mainly to reduce the number of snapshots.
|
||||
At present, we are using percy with two configuration files: `./e2e/.percy.nightly.yml` and `./e2e/.percy.ci.yml`. This is mainly to reduce the number of snapshots.
|
||||
|
||||
### Advanced: Snapshot Testing (Not Recommended)
|
||||
|
||||
While snapshot testing offers a precise way to detect changes in your application without relying on third-party services like Percy.io, we've found that it doesn't offer any advantages over visual testing in our use-cases. Therefore, snapshot testing is **not recommended** for further implementation.
|
||||
|
||||
#### CI vs Manual Checks
|
||||
|
||||
Snapshot tests can be reliably executed in Continuous Integration (CI) environments but lack the manual oversight provided by visual testing platforms like Percy.io. This means they may miss issues that a human reviewer could catch during manual checks.
|
||||
|
||||
#### Example
|
||||
|
||||
A single visual test assertion in Percy.io can be executed across 10 different browser and resolution combinations without additional setup, providing comprehensive testing with minimal configuration. In contrast, a snapshot test is restricted to a single OS and browser resolution, requiring more effort to achieve the same level of coverage.
|
||||
|
||||
|
||||
#### Further Reading
|
||||
For those interested in the mechanics of snapshot testing with Playwright, you can refer to the [Playwright Snapshots Documentation](https://playwright.dev/docs/test-snapshots). However, keep in mind that we do not recommend using this approach.
|
||||
|
||||
For those interested in the mechanics of snapshot testing with Playwright, you can refer to the [Playwright Snapshots Documentation](https://playwright.dev/docs/test-snapshots). However, keep in mind that we do not recommend using this approach.
|
||||
|
||||
#### Open MCT's implementation
|
||||
|
||||
@ -118,14 +120,6 @@ When the `@snapshot` tests fail, they will need to be evaluated to determine if
|
||||
|
||||
To compare a snapshot, run a test and open the html report with the 'Expected' vs 'Actual' screenshot. If the actual screenshot is preferred, then the source-controlled 'Expected' snapshots will need to be updated with the following scripts.
|
||||
|
||||
MacOS
|
||||
|
||||
```
|
||||
npm run test:e2e:updatesnapshots
|
||||
```
|
||||
|
||||
Linux/CI
|
||||
|
||||
```sh
|
||||
// Replace {X.X.X} with the current Playwright version
|
||||
// from our package.json or circleCI configuration file
|
||||
@ -335,9 +329,11 @@ We have a Mission-need to support iPad and mobile devices. To run our test suite
|
||||
In general, our test suite is not designed to run against mobile devices as the mobile experience is a focused version of the application. Core functionality is missing (chiefly the 'Create' button). To bypass the object creation, we leverage the `storageState` properties for starting the mobile tests with localstorage.
|
||||
|
||||
For now, the mobile tests will exist in the /tests/mobile/ suites and be executed with the
|
||||
|
||||
```sh
|
||||
npm run test:e2e:mobile
|
||||
```
|
||||
|
||||
command.
|
||||
|
||||
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
||||
@ -377,6 +373,7 @@ In general, strive to test only through the UI as a user would. As stated in the
|
||||
By adhering to this principle, we can create tests that are both robust and reflective of actual user experiences.
|
||||
|
||||
#### How to make tests robust to function in other contexts (VISTA, COUCHDB, YAMCS, VIPER, etc.)
|
||||
|
||||
1. Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`. This ensures that your tests will create unique instances of objects for your test to interact with.
|
||||
1. Do not assert on the order or structure of objects available unless you created them yourself. These tests may be used against a persistent datastore like couchdb with many objects in the tree.
|
||||
1. Do not search for your created objects. Open MCT does not performance uniqueness checks so it's possible that your tests will break when run twice.
|
||||
@ -384,6 +381,7 @@ By adhering to this principle, we can create tests that are both robust and refl
|
||||
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });` instead of `{ waitUntil: 'networkidle' }`. Tests run against deployments with websockets often have issues with the networkidle detection.
|
||||
|
||||
#### How to make tests faster and more resilient
|
||||
|
||||
1. Avoid app interaction when possible. The best way of doing this is to navigate directly by URL:
|
||||
|
||||
```js
|
||||
@ -396,10 +394,11 @@ By adhering to this principle, we can create tests that are both robust and refl
|
||||
|
||||
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });`
|
||||
- Initial navigation should _almost_ always use the `{ waitUntil: 'domcontentloaded' }` option.
|
||||
1. Avoid repeated setup to test a single assertion. Write longer tests with multiple soft assertions.
|
||||
1. Avoid repeated setup to test a single assertion. Write longer tests with multiple soft assertions.
|
||||
This ensures that your changes will be picked up with large refactors.
|
||||
|
||||
##### Utilizing LocalStorage
|
||||
|
||||
1. In order to save test runtime in the case of tests that require a decent amount of initial setup (such as in the case of testing complex displays), you may use [Playwright's `storageState` feature](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state) to generate and load localStorage states.
|
||||
1. To generate a localStorage state to be used in a test:
|
||||
- Add an e2e test to our generateLocalStorageData suite which sets the initial state (creating/configuring objects, etc.), saving it in the `test-data` folder:
|
||||
@ -420,7 +419,6 @@ By adhering to this principle, we can create tests that are both robust and refl
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### How to write a great test
|
||||
|
||||
- Avoid using css locators to find elements to the page. Use modern web accessible locators like `getByRole`
|
||||
@ -436,7 +434,7 @@ By adhering to this principle, we can create tests that are both robust and refl
|
||||
await notesInput.fill(testNotes);
|
||||
```
|
||||
|
||||
#### How to Write a Great Visual Test
|
||||
#### How to Write a Great Visual Test
|
||||
|
||||
1. **Look for the Unknown Unknowns**: Avoid asserting on specific differences in the visual diff. Visual tests are most effective for identifying unknown unknowns.
|
||||
|
||||
@ -445,23 +443,27 @@ By adhering to this principle, we can create tests that are both robust and refl
|
||||
3. **Expect the Unexpected**: Use functional expect statements only to verify assumptions about the state between steps. A great visual test doesn't fail during the test itself, but rather when changes are reviewed in Percy.io.
|
||||
|
||||
4. **Control Variability**: Account for variations inherent in working with time-based telemetry and clocks.
|
||||
- Utilize `percyCSS` to ignore time-based elements. For more details, consult our [percyCSS file](./.percy.ci.yml).
|
||||
- Use Open MCT's fixed-time mode unless explicitly testing realtime clock
|
||||
- Employ the `createExampleTelemetryObject` appAction to source telemetry and specify a `name` to avoid autogenerated names.
|
||||
- Avoid creating objects with a time component like timers and clocks.
|
||||
|
||||
- Utilize `percyCSS` to ignore time-based elements. For more details, consult our [percyCSS file](./.percy.ci.yml).
|
||||
- Use Open MCT's fixed-time mode unless explicitly testing realtime clock
|
||||
- Employ the `createExampleTelemetryObject` appAction to source telemetry and specify a `name` to avoid autogenerated names.
|
||||
- Avoid creating objects with a time component like timers and clocks.
|
||||
|
||||
5. **Hide the Tree and Inspector**: Generally, your test will not require comparisons involving the tree and inspector. These aspects are covered in component-specific tests (explained below). To exclude them from the comparison by default, navigate to the root of the main view with the tree and inspector hidden:
|
||||
- `await page.goto('./#/browse/mine?hideTree=true&hideInspector=true')`
|
||||
|
||||
6. **Component-Specific Tests**: If you wish to focus on a particular component, use the `/visual-a11y/component/` folder and limit the scope of the comparison to that component. For instance:
|
||||
|
||||
```js
|
||||
await percySnapshot(page, `Tree Pane w/ single level expanded (theme: ${theme})`, {
|
||||
scope: treePane
|
||||
});
|
||||
```
|
||||
|
||||
- Note: The `scope` variable can be any valid CSS selector.
|
||||
|
||||
7. **Write many `percySnapshot` commands in a single test**: In line with our approach to longer functional tests, we recommend that many test percySnapshots are taken in a single test. For instance:
|
||||
|
||||
```js
|
||||
//<Some interesting state>
|
||||
await percySnapshot(page, `Before object expanded (theme: ${theme})`);
|
||||
@ -511,11 +513,35 @@ test.describe('foo test suite', () => {
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
More info and options for `overrideClock` can be found in [baseFixtures.js](baseFixtures.js)
|
||||
|
||||
- Working with multiple pages
|
||||
There are instances where multiple browser pages will needed to verify multi-page or multi-tab application behavior. Make sure to use the `@2p` annotation as well as name each page appropriately: i.e. `page1` and `page2` or `tab1` and `tab2` depending on the intended use case. Generally pages should be used unless testing `sharedWorker` code, specifically.
|
||||
|
||||
- Working with file downloads and JSON data
|
||||
Open MCT has the capability of exporting certain objects in the form of a JSON file handled by the chrome browser. The best example of this type of test can be found in the exportAsJson test.
|
||||
|
||||
```js
|
||||
const [download] = await Promise.all([
|
||||
page.waitForEvent('download'), // Waits for the download event
|
||||
page.getByLabel('Export as JSON').click() // Triggers the download
|
||||
]);
|
||||
|
||||
// Wait for the download process to complete
|
||||
const path = await download.path();
|
||||
|
||||
// Read the contents of the downloaded file using readFile from fs/promises
|
||||
const fileContents = await fs.readFile(path, 'utf8');
|
||||
const jsonData = JSON.parse(fileContents);
|
||||
|
||||
// Use the function to retrieve the key
|
||||
const key = getFirstKeyFromOpenMctJson(jsonData);
|
||||
|
||||
// Verify the contents of the JSON file
|
||||
expect(jsonData.openmct[key]).toHaveProperty('name', 'e2e folder');
|
||||
```
|
||||
|
||||
### Reporting
|
||||
|
||||
Test Reporting is done through official Playwright reporters and the CI Systems which execute them.
|
||||
@ -591,6 +617,7 @@ A single e2e test in Open MCT is extended to run:
|
||||
### Writing Tests
|
||||
|
||||
Playwright provides 3 supported methods of debugging and authoring tests:
|
||||
|
||||
- A 'watch mode' for running tests locally and debugging on the fly
|
||||
- A 'debug mode' for debugging tests and writing assertions against tests
|
||||
- A 'VSCode plugin' for debugging tests within the VSCode IDE.
|
||||
|
@ -392,6 +392,8 @@ async function setTimeConductorMode(page, isFixedTimespan = true) {
|
||||
await page.getByRole('menuitem', { name: /Real-Time/ }).click();
|
||||
await page.waitForURL(/tc\.mode=local/);
|
||||
}
|
||||
//dismiss the time conductor popup
|
||||
await page.getByLabel('Discard changes and close time popup').click();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -505,15 +507,14 @@ async function setTimeConductorBounds(page, startDate, endDate) {
|
||||
* @param {string} startDate
|
||||
* @param {string} endDate
|
||||
*/
|
||||
async function setIndependentTimeConductorBounds(page, startDate, endDate) {
|
||||
// Activate Independent Time Conductor in Fixed Time Mode
|
||||
await page.getByRole('switch').click();
|
||||
async function setIndependentTimeConductorBounds(page, { start, end }) {
|
||||
// Activate Independent Time Conductor
|
||||
await page.getByLabel('Enable Independent Time Conductor').click();
|
||||
|
||||
// Bring up the time conductor popup
|
||||
await page.click('.c-conductor-holder--compact .c-compact-tc');
|
||||
await page.getByLabel('Independent Time Conductor Settings').click();
|
||||
await expect(page.locator('.itc-popout')).toBeInViewport();
|
||||
|
||||
await setTimeBounds(page, startDate, endDate);
|
||||
await setTimeBounds(page, start, end);
|
||||
|
||||
await page.keyboard.press('Enter');
|
||||
}
|
||||
@ -663,5 +664,6 @@ export {
|
||||
setRealTimeMode,
|
||||
setStartOffset,
|
||||
setTimeConductorBounds,
|
||||
setTimeConductorMode,
|
||||
waitForPlotsToRender
|
||||
};
|
||||
|
@ -36,27 +36,67 @@
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
import { expect, test } from './pluginFixtures.js';
|
||||
|
||||
// Constants for repeated values
|
||||
const TEST_RESULTS_DIR = './test-results';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const TEST_RESULTS_DIR = path.join(__dirname, './test-results');
|
||||
|
||||
const extendedTest = test.extend({
|
||||
/**
|
||||
* Overrides the default screenshot function to apply default options that should apply to all
|
||||
* screenshots taken in the AVP tests.
|
||||
*
|
||||
* @param {import('@playwright/test').PlaywrightTestArgs} args - The Playwright test arguments.
|
||||
* @param {Function} use - The function to use the page object.
|
||||
* Defaults:
|
||||
* - Disables animations
|
||||
* - Masks the clock indicator
|
||||
* - Masks the time conductor last update time in realtime mode
|
||||
* - Masks the time conductor start bounds in fixed mode
|
||||
* - Masks the time conductor end bounds in fixed mode
|
||||
*/
|
||||
page: async ({ page }, use) => {
|
||||
const playwrightScreenshot = page.screenshot;
|
||||
|
||||
/**
|
||||
* Override the screenshot function to always mask a given set of locators which will always
|
||||
* show variance across screenshots. Defaults may be overridden by passing in options to the
|
||||
* screenshot function.
|
||||
* @param {import('@playwright/test').PageScreenshotOptions} options - The options for the screenshot.
|
||||
* @returns {Promise<Buffer>} Returns the screenshot as a buffer.
|
||||
*/
|
||||
page.screenshot = async function (options = {}) {
|
||||
const mask = [
|
||||
this.getByLabel('Clock Indicator'), // Mask the clock indicator
|
||||
this.getByLabel('Last update'), // Mask the time conductor last update time in realtime mode
|
||||
this.getByLabel('Start bounds'), // Mask the time conductor start bounds in fixed mode
|
||||
this.getByLabel('End bounds') // Mask the time conductor end bounds in fixed mode
|
||||
];
|
||||
|
||||
const result = await playwrightScreenshot.call(this, {
|
||||
animations: 'disabled',
|
||||
mask,
|
||||
...options // Pass through or override any options
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
await use(page);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Scans for accessibility violations on a page and writes a report to disk if violations are found.
|
||||
* Automatically asserts that no violations should be present.
|
||||
*
|
||||
* @typedef {object} GenerateReportOptions
|
||||
* @property {string} [reportName] - The name for the report file.
|
||||
*
|
||||
* @param {import('playwright').Page} page - The page object from Playwright.
|
||||
* @param {string} testCaseName - The name of the test case.
|
||||
* @param {GenerateReportOptions} [options={}] - The options for the report generation.
|
||||
*
|
||||
* @returns {Promise<object|null>} Returns the accessibility scan results if violations are found,
|
||||
* otherwise returns null.
|
||||
* @param {{ reportName?: string }} [options={}] - The options for the report generation.
|
||||
* @returns {Promise<Object|null>} Returns the accessibility scan results if violations are found, otherwise returns null.
|
||||
*/
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
export async function scanForA11yViolations(page, testCaseName, options = {}) {
|
||||
const builder = new AxeBuilder({ page });
|
||||
builder.withTags(['wcag2aa']);
|
||||
@ -93,4 +133,4 @@ export async function scanForA11yViolations(page, testCaseName, options = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
export { expect, test };
|
||||
export { expect, extendedTest as test };
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
@ -40,7 +39,7 @@ import { v4 as uuid } from 'uuid';
|
||||
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
||||
* @private
|
||||
* @param {import('@playwright/test').ConsoleMessage} msg
|
||||
* @returns {String} formatted string with message type, text, url, and line and column numbers
|
||||
* @returns {string} formatted string with message type, text, url, and line and column numbers
|
||||
*/
|
||||
function _consoleMessageToString(msg) {
|
||||
const { url, lineNumber, columnNumber } = msg.location();
|
||||
@ -111,6 +110,40 @@ const extendedTest = test.extend({
|
||||
scope: 'test'
|
||||
}
|
||||
],
|
||||
/**
|
||||
* Exposes a function to manually tick the clock. This is useful when overriding the clock to not
|
||||
* tick (`shouldAdvanceTime: false`) for visual tests, as events such as re-renders and router params
|
||||
* updates are clock-driven and must be manually ticked.
|
||||
*
|
||||
* Usage:
|
||||
* ```js
|
||||
* test.describe('Manual Clock Tick', () => {
|
||||
* test.use({
|
||||
* clockOptions: {
|
||||
* now: MISSION_TIME, // Set to the desired time
|
||||
* shouldAdvanceTime: false // Clock overridden to no longer tick
|
||||
* }
|
||||
* });
|
||||
* test('Visual - Manual Clock Tick', async ({ page, tick }) => {
|
||||
* // Tick the clock 2 seconds in the future
|
||||
* await tick(2000);
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param {Object} param0
|
||||
* @param {import('@playwright/test').Page} param0.page
|
||||
* @param {import('@playwright/test').Use} param0.use
|
||||
*/
|
||||
tick: async ({ page }, use) => {
|
||||
// eslint-disable-next-line func-style
|
||||
const tick = async (milliseconds) => {
|
||||
await page.evaluate((_milliseconds) => {
|
||||
window.__clock.tick(_milliseconds);
|
||||
}, milliseconds);
|
||||
};
|
||||
await use(tick);
|
||||
},
|
||||
/**
|
||||
* Extends the base context class to add codecoverage shim.
|
||||
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
||||
@ -154,17 +187,13 @@ const extendedTest = test.extend({
|
||||
// function in the generatorWorker context. This is necessary
|
||||
// to ensure that example telemetry data is generated for the new clock time.
|
||||
if (clockOptions?.now !== undefined) {
|
||||
page.on(
|
||||
'worker',
|
||||
(worker) => {
|
||||
if (worker.url().includes('generatorWorker')) {
|
||||
worker.evaluate((time) => {
|
||||
self.Date.now = () => time;
|
||||
});
|
||||
}
|
||||
},
|
||||
clockOptions.now
|
||||
);
|
||||
page.on('worker', (worker) => {
|
||||
if (worker.url().includes('generatorWorker')) {
|
||||
worker.evaluate((time) => {
|
||||
self.Date.now = () => time;
|
||||
}, clockOptions.now);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Capture any console errors during test execution
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable prettier/prettier */
|
||||
/**
|
||||
* Constants which may be used across all e2e tests.
|
||||
*/
|
||||
@ -8,12 +7,30 @@
|
||||
* - Used for overriding the browser clock in tests.
|
||||
*/
|
||||
export const MISSION_TIME = 1732413600000; // Saturday, November 23, 2024 6:00:00 PM GMT-08:00 (Thanksgiving Dinner Time)
|
||||
// Subtracting 30 minutes from MISSION_TIME
|
||||
export const MISSION_TIME_FIXED_START = 1732413600000 - 1800000; // 1732411800000
|
||||
|
||||
// Adding 1 minute to MISSION_TIME
|
||||
export const MISSION_TIME_FIXED_END = 1732413600000 + 60000; // 1732413660000
|
||||
/**
|
||||
* URL Constants
|
||||
* - This is the URL that the browser will be directed to when running visual tests. This URL
|
||||
* - hides the tree and inspector to prevent visual noise
|
||||
* - sets the time bounds to a fixed range
|
||||
* These constants are used for initial navigation in visual tests, in either fixed or realtime mode.
|
||||
* They navigate to the 'My Items' folder at MISSION_TIME.
|
||||
* They set the following url parameters:
|
||||
* - tc.mode - The time conductor mode ('fixed' or 'local')
|
||||
* - tc.startBound - The time conductor start bound (when in fixed mode)
|
||||
* - tc.endBound - The time conductor end bound (when in fixed mode)
|
||||
* - tc.startDelta - The time conductor start delta (when in realtime mode)
|
||||
* - tc.endDelta - The time conductor end delta (when in realtime mode)
|
||||
* - tc.timeSystem - The time conductor time system ('utc')
|
||||
* - view - The view to display ('grid')
|
||||
* - hideInspector - Whether to hide the inspector (true)
|
||||
* - hideTree - Whether to hide the tree (true)
|
||||
* @typedef {string} VisualUrl
|
||||
*/
|
||||
export const VISUAL_URL =
|
||||
'./#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
|
||||
|
||||
/** @type {VisualUrl} */
|
||||
export const VISUAL_FIXED_URL = `./#/browse/mine?tc.mode=fixed&tc.startBound=${MISSION_TIME_FIXED_START}&tc.endBound=${MISSION_TIME_FIXED_END}&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true`;
|
||||
/** @type {VisualUrl} */
|
||||
export const VISUAL_REALTIME_URL =
|
||||
'./#/browse/mine?tc.mode=local&tc.timeSystem=utc&view=grid&tc.startDelta=1800000&tc.endDelta=30000&hideTree=true&hideInspector=true';
|
||||
|
@ -68,7 +68,6 @@ async function commitEntry(page) {
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function startAndAddRestrictedNotebookObject(page) {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('./addInitRestrictedNotebook.js', import.meta.url))
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ import { expect } from '../pluginFixtures.js';
|
||||
* for each activity in the plan data per group, using the earliest activity's
|
||||
* start time as the start bound and the current activity's end time as the end bound.
|
||||
* @param {import('@playwright/test').Page} page the page
|
||||
* @param {object} plan The raw plan json to assert against
|
||||
* @param {Object} plan The raw plan json to assert against
|
||||
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||
*/
|
||||
export async function assertPlanActivities(page, plan, objectUrl) {
|
||||
@ -86,7 +86,7 @@ function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
||||
* Asserts that the swim lanes / groups in the plan view matches the order of
|
||||
* groups in the plan data.
|
||||
* @param {import('@playwright/test').Page} page the page
|
||||
* @param {object} plan The raw plan json to assert against
|
||||
* @param {Object} plan The raw plan json to assert against
|
||||
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||
*/
|
||||
export async function assertPlanOrderedSwimLanes(page, plan, objectUrl) {
|
||||
@ -110,7 +110,7 @@ export async function assertPlanOrderedSwimLanes(page, plan, objectUrl) {
|
||||
* Navigate to the plan view, switch to fixed time mode,
|
||||
* and set the bounds to span all activities.
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {object} planJson
|
||||
* @param {Object} planJson
|
||||
* @param {string} planObjectUrl
|
||||
*/
|
||||
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
||||
@ -125,7 +125,7 @@ export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} planJson
|
||||
* @param {Object} planJson
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getEarliestStartTime(planJson) {
|
||||
@ -135,7 +135,7 @@ export function getEarliestStartTime(planJson) {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} planJson
|
||||
* @param {Object} planJson
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getLatestEndTime(planJson) {
|
||||
|
@ -27,8 +27,8 @@ import { expect } from '../pluginFixtures.js';
|
||||
* Given a canvas and a set of points, tags the points on the canvas.
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {HTMLCanvasElement} canvas a telemetry item with a plot
|
||||
* @param {Number} xEnd a telemetry item with a plot
|
||||
* @param {Number} yEnd a telemetry item with a plot
|
||||
* @param {number} xEnd a telemetry item with a plot
|
||||
* @param {number} yEnd a telemetry item with a plot
|
||||
* @returns {Promise}
|
||||
*/
|
||||
export async function createTags({ page, canvas, xEnd = 700, yEnd = 520 }) {
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
// playwright.config.js
|
||||
// @ts-check
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
@ -123,7 +122,6 @@ const extendedTest = test.extend({
|
||||
theme: [theme, { option: true }],
|
||||
// eslint-disable-next-line no-shadow
|
||||
page: async ({ page, theme }, use, testInfo) => {
|
||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
||||
if (theme === 'snow') {
|
||||
//inject snow theme
|
||||
await page.addInitScript({
|
||||
|
26
e2e/test-data/display_layout_with_child_overlay_plot.json
Normal file
@ -174,6 +174,6 @@ test.describe('AppActions', () => {
|
||||
type: 'Folder'
|
||||
});
|
||||
await openObjectTreeContextMenu(page, folder.url);
|
||||
await expect(page.getByLabel('Menu')).toBeVisible();
|
||||
await expect(page.getByLabel(`${folder.name} Context Menu`)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
@ -26,11 +26,12 @@ relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions ma
|
||||
(`npm start` and ./e2e/webpack-dev-middleware.js)
|
||||
*/
|
||||
|
||||
import { test } from '../../baseFixtures.js';
|
||||
import { expect, test } from '../../baseFixtures.js';
|
||||
import { MISSION_TIME } from '../../constants.js';
|
||||
|
||||
test.describe('baseFixtures tests', () => {
|
||||
//Skip this test for now https://github.com/nasa/openmct/issues/6785
|
||||
test.fixme('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||
test('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||
test.fail();
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
@ -52,3 +53,27 @@ test.describe('baseFixtures tests', () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('baseFixtures tests @clock', () => {
|
||||
test.use({
|
||||
clockOptions: {
|
||||
now: MISSION_TIME,
|
||||
shouldAdvanceTime: false
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Can use clockOptions and tick fixtures to control the clock', async ({ page, tick }) => {
|
||||
let time = await page.evaluate(() => new Date().getTime());
|
||||
expect(time).toBe(MISSION_TIME);
|
||||
await tick(1000);
|
||||
time = await page.evaluate(() => new Date().getTime());
|
||||
expect(time).toBe(MISSION_TIME + 1000 * 1);
|
||||
await tick(1000);
|
||||
time = await page.evaluate(() => new Date().getTime());
|
||||
expect(time).toBe(MISSION_TIME + 1000 * 2);
|
||||
});
|
||||
});
|
||||
|
@ -33,7 +33,12 @@
|
||||
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
import { createDomainObjectWithDefaults, createExampleTelemetryObject } from '../../appActions.js';
|
||||
import {
|
||||
createDomainObjectWithDefaults,
|
||||
createExampleTelemetryObject,
|
||||
setIndependentTimeConductorBounds,
|
||||
setTimeConductorBounds
|
||||
} from '../../appActions.js';
|
||||
import { MISSION_TIME } from '../../constants.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
@ -89,6 +94,53 @@ test.describe('Generate Visual Test Data @localStorage @generatedata @clock', ()
|
||||
});
|
||||
});
|
||||
|
||||
test('Generate display layout with 1 child overlay plot', async ({ page, context }) => {
|
||||
const parent = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
name: 'Parent Display Layout'
|
||||
});
|
||||
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Overlay Plot',
|
||||
name: 'Child Overlay Plot 1',
|
||||
parent: parent.uuid
|
||||
});
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
name: 'Child SWG 1',
|
||||
parent: overlayPlot.uuid
|
||||
});
|
||||
|
||||
await page.goto(parent.url, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await setIndependentTimeConductorBounds(page, {
|
||||
start: '2024-11-12 19:11:11.000Z',
|
||||
end: '2024-11-12 20:11:11.000Z'
|
||||
});
|
||||
|
||||
const NEW_GLOBAL_START_BOUNDS = '2024-11-11 19:11:11.000Z';
|
||||
const NEW_GLOBAL_END_BOUNDS = '2024-11-11 20:11:11.000Z';
|
||||
|
||||
await setTimeConductorBounds(page, NEW_GLOBAL_START_BOUNDS, NEW_GLOBAL_END_BOUNDS);
|
||||
|
||||
// Verify that the global time conductor bounds have been updated
|
||||
expect(
|
||||
await page.getByLabel('Global Time Conductor').getByLabel('Start bounds').textContent()
|
||||
).toEqual(NEW_GLOBAL_START_BOUNDS);
|
||||
expect(
|
||||
await page.getByLabel('Global Time Conductor').getByLabel('End bounds').textContent()
|
||||
).toEqual(NEW_GLOBAL_END_BOUNDS);
|
||||
|
||||
//Save localStorage for future test execution
|
||||
await context.storageState({
|
||||
path: fileURLToPath(
|
||||
new URL(
|
||||
'../../../e2e/test-data/display_layout_with_child_overlay_plot.json',
|
||||
import.meta.url
|
||||
)
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
test('Generate flexible layout with 2 child display layouts', async ({ page, context }) => {
|
||||
// Create Display Layout
|
||||
const parent = await createDomainObjectWithDefaults(page, {
|
||||
|
@ -131,7 +131,10 @@ test.describe('Time Strip', () => {
|
||||
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
||||
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
||||
|
||||
await setIndependentTimeConductorBounds(page, startBoundString, endBoundString);
|
||||
await setIndependentTimeConductorBounds(page, {
|
||||
start: startBoundString,
|
||||
end: endBoundString
|
||||
});
|
||||
expect(await activityBounds.count()).toEqual(1);
|
||||
});
|
||||
|
||||
@ -160,7 +163,10 @@ test.describe('Time Strip', () => {
|
||||
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
||||
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
||||
|
||||
await setIndependentTimeConductorBounds(page, startBoundString, endBoundString);
|
||||
await setIndependentTimeConductorBounds(page, {
|
||||
start: startBoundString,
|
||||
end: endBoundString
|
||||
});
|
||||
|
||||
// Verify that two events are displayed
|
||||
expect(await activityBounds.count()).toEqual(2);
|
||||
|
@ -286,12 +286,22 @@ test.describe('Basic Condition Set Use', () => {
|
||||
await page.locator('button[title="Save"]').click();
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
await page.click('button[title="Change the current view"]');
|
||||
await page.getByLabel('Open the View Switcher Menu').click();
|
||||
|
||||
await expect(page.getByRole('menuitem', { name: /Lad Table/ })).toBeHidden();
|
||||
await expect(page.getByRole('menuitem', { name: /Conditions View/ })).toBeVisible();
|
||||
await expect(page.getByRole('menuitem', { name: /Plot/ })).toBeVisible();
|
||||
await expect(page.getByRole('menuitem', { name: /Telemetry Table/ })).toBeVisible();
|
||||
await page.getByLabel('Plot').click();
|
||||
await expect(
|
||||
page.getByLabel('Plot Legend Collapsed').getByText('Test Condition Set')
|
||||
).toBeVisible();
|
||||
await page.getByLabel('Open the View Switcher Menu').click();
|
||||
await page.getByLabel('Telemetry Table').click();
|
||||
await expect(page.getByRole('searchbox', { name: 'output filter input' })).toBeVisible();
|
||||
await page.getByLabel('Open the View Switcher Menu').click();
|
||||
await page.getByLabel('Conditions View').click();
|
||||
await expect(page.getByText('Current Output')).toBeVisible();
|
||||
});
|
||||
test('ConditionSet has correct outputs when telemetry is and is not available', async ({
|
||||
page
|
||||
@ -457,4 +467,11 @@ test.describe('Basic Condition Set Use', () => {
|
||||
|
||||
await page.goto(exampleTelemetry.url);
|
||||
});
|
||||
|
||||
test.fixme('Ensure condition sets work with telemetry like operator status', ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/7484'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -23,6 +23,7 @@ import { fileURLToPath } from 'url';
|
||||
|
||||
import {
|
||||
createDomainObjectWithDefaults,
|
||||
navigateToObjectWithFixedTimeBounds,
|
||||
setFixedTimeMode,
|
||||
setIndependentTimeConductorBounds,
|
||||
setRealTimeMode,
|
||||
@ -30,12 +31,120 @@ import {
|
||||
} from '../../../../appActions.js';
|
||||
import { expect, test } from '../../../../pluginFixtures.js';
|
||||
|
||||
const LOCALSTORAGE_PATH = fileURLToPath(
|
||||
const CHILD_LAYOUT_STORAGE_STATE_PATH = fileURLToPath(
|
||||
new URL('../../../../test-data/display_layout_with_child_layouts.json', import.meta.url)
|
||||
);
|
||||
const CHILD_PLOT_STORAGE_STATE_PATH = fileURLToPath(
|
||||
new URL('../../../../test-data/display_layout_with_child_overlay_plot.json', import.meta.url)
|
||||
);
|
||||
const TINY_IMAGE_BASE64 =
|
||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
|
||||
|
||||
test.describe('Display Layout Sub-object Actions @localStorage', () => {
|
||||
const INIT_ITC_START_BOUNDS = '2024-11-12 19:11:11.000Z';
|
||||
const INIT_ITC_END_BOUNDS = '2024-11-12 20:11:11.000Z';
|
||||
const NEW_GLOBAL_START_BOUNDS = '2024-11-11 19:11:11.000Z';
|
||||
const NEW_GLOBAL_END_BOUNDS = '2024-11-11 20:11:11.000Z';
|
||||
|
||||
test.use({
|
||||
storageState: CHILD_PLOT_STORAGE_STATE_PATH
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
await page.getByLabel('Expand My Items folder').click();
|
||||
const waitForMyItemsNavigation = page.waitForURL(`**/mine/?*`);
|
||||
await page
|
||||
.getByLabel('Main Tree')
|
||||
.getByLabel('Navigate to Parent Display Layout layout Object')
|
||||
.click();
|
||||
// Wait for the URL to change to the display layout
|
||||
await waitForMyItemsNavigation;
|
||||
});
|
||||
test('Open in New Tab action preserves time bounds @2p', async ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/7524'
|
||||
});
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/6982'
|
||||
});
|
||||
|
||||
const TEST_FIXED_START_TIME = 1731352271000; // 2024-11-11 19:11:11.000Z
|
||||
const TEST_FIXED_END_TIME = TEST_FIXED_START_TIME + 3600000; // 2024-11-11 20:11:11.000Z
|
||||
|
||||
// Verify the ITC has the expected initial bounds
|
||||
expect(
|
||||
await page
|
||||
.getByLabel('Child Overlay Plot 1 Frame Controls')
|
||||
.getByLabel('Start bounds')
|
||||
.textContent()
|
||||
).toEqual(INIT_ITC_START_BOUNDS);
|
||||
expect(
|
||||
await page
|
||||
.getByLabel('Child Overlay Plot 1 Frame Controls')
|
||||
.getByLabel('End bounds')
|
||||
.textContent()
|
||||
).toEqual(INIT_ITC_END_BOUNDS);
|
||||
|
||||
// Update the global fixed bounds to 2024-11-11 19:11:11.000Z / 2024-11-11 20:11:11.000Z
|
||||
const url = page.url().split('?')[0];
|
||||
await navigateToObjectWithFixedTimeBounds(
|
||||
page,
|
||||
url,
|
||||
TEST_FIXED_START_TIME,
|
||||
TEST_FIXED_END_TIME
|
||||
);
|
||||
|
||||
// ITC bounds should still match the initial ITC bounds
|
||||
expect(
|
||||
await page
|
||||
.getByLabel('Child Overlay Plot 1 Frame Controls')
|
||||
.getByLabel('Start bounds')
|
||||
.textContent()
|
||||
).toEqual(INIT_ITC_START_BOUNDS);
|
||||
expect(
|
||||
await page
|
||||
.getByLabel('Child Overlay Plot 1 Frame Controls')
|
||||
.getByLabel('End bounds')
|
||||
.textContent()
|
||||
).toEqual(INIT_ITC_END_BOUNDS);
|
||||
|
||||
// Open the Child Overlay Plot 1 in a new tab
|
||||
await page.getByLabel('View menu items').click();
|
||||
const pagePromise = page.context().waitForEvent('page');
|
||||
await page.getByLabel('Open In New Tab').click();
|
||||
|
||||
const newPage = await pagePromise;
|
||||
await newPage.waitForLoadState('domcontentloaded');
|
||||
|
||||
// Verify that the global time conductor bounds in the new page match the updated global bounds
|
||||
expect(
|
||||
await newPage.getByLabel('Global Time Conductor').getByLabel('Start bounds').textContent()
|
||||
).toEqual(NEW_GLOBAL_START_BOUNDS);
|
||||
expect(
|
||||
await newPage.getByLabel('Global Time Conductor').getByLabel('End bounds').textContent()
|
||||
).toEqual(NEW_GLOBAL_END_BOUNDS);
|
||||
|
||||
// Verify that the ITC is enabled in the new page
|
||||
await expect(newPage.getByLabel('Disable Independent Time Conductor')).toBeVisible();
|
||||
// Verify that the ITC bounds in the new page match the original ITC bounds
|
||||
expect(
|
||||
await newPage
|
||||
.getByLabel('Independent Time Conductor Panel')
|
||||
.getByLabel('Start bounds')
|
||||
.textContent()
|
||||
).toEqual(INIT_ITC_START_BOUNDS);
|
||||
expect(
|
||||
await newPage
|
||||
.getByLabel('Independent Time Conductor Panel')
|
||||
.getByLabel('End bounds')
|
||||
.textContent()
|
||||
).toEqual(INIT_ITC_END_BOUNDS);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Display Layout Toolbar Actions @localStorage', () => {
|
||||
const PARENT_DISPLAY_LAYOUT_NAME = 'Parent Display Layout';
|
||||
const CHILD_DISPLAY_LAYOUT_NAME1 = 'Child Layout 1';
|
||||
@ -50,7 +159,7 @@ test.describe('Display Layout Toolbar Actions @localStorage', () => {
|
||||
await page.getByLabel('Edit Object').click();
|
||||
});
|
||||
test.use({
|
||||
storageState: LOCALSTORAGE_PATH
|
||||
storageState: CHILD_LAYOUT_STORAGE_STATE_PATH
|
||||
});
|
||||
|
||||
test('can add/remove Text element to a single layout', async ({ page }) => {
|
||||
@ -163,7 +272,7 @@ test.describe('Display Layout', () => {
|
||||
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
||||
|
||||
// ensure we can right click on the alpha-numeric widget and view historical data
|
||||
await page.getByLabel('Sine', { exact: true }).click({
|
||||
await page.getByLabel(/Alpha-numeric telemetry value of.*/).click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.getByLabel('View Historical Data').click();
|
||||
@ -336,7 +445,7 @@ test.describe('Display Layout', () => {
|
||||
|
||||
const startDate = '2021-12-30 01:01:00.000Z';
|
||||
const endDate = '2021-12-30 01:11:00.000Z';
|
||||
await setIndependentTimeConductorBounds(page, startDate, endDate);
|
||||
await setIndependentTimeConductorBounds(page, { start: startDate, end: endDate });
|
||||
|
||||
// check image date
|
||||
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible();
|
||||
|
@ -248,11 +248,10 @@ test.describe('Flexible Layout', () => {
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// flip on independent time conductor
|
||||
await setIndependentTimeConductorBounds(
|
||||
page,
|
||||
'2021-12-30 01:01:00.000Z',
|
||||
'2021-12-30 01:11:00.000Z'
|
||||
);
|
||||
await setIndependentTimeConductorBounds(page, {
|
||||
start: '2021-12-30 01:01:00.000Z',
|
||||
end: '2021-12-30 01:11:00.000Z'
|
||||
});
|
||||
|
||||
// check image date
|
||||
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible();
|
||||
@ -290,7 +289,7 @@ test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
|
||||
await page.getByTitle('Add Container').click();
|
||||
expect(await containerHandles.count()).toEqual(3);
|
||||
await page.getByTitle('Remove Container').click();
|
||||
await expect(page.getByRole('dialog', { name: 'Overlay' })).toHaveText(
|
||||
await expect(page.getByRole('dialog', { name: 'Overlay' })).toContainText(
|
||||
'This action will permanently delete this container from this Flexible Layout. Do you want to continue?'
|
||||
);
|
||||
await page.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
@ -300,7 +299,7 @@ test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
|
||||
expect(await page.getByRole('group', { name: 'Frame' }).count()).toEqual(2);
|
||||
await page.getByRole('group', { name: 'Child Layout 1' }).click();
|
||||
await page.getByTitle('Remove Frame').click();
|
||||
await expect(page.getByRole('dialog', { name: 'Overlay' })).toHaveText(
|
||||
await expect(page.getByRole('dialog', { name: 'Overlay' })).toContainText(
|
||||
'This action will remove this frame from this Flexible Layout. Do you want to continue?'
|
||||
);
|
||||
await page.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
|
@ -175,13 +175,13 @@ test.describe('Gauge', () => {
|
||||
});
|
||||
|
||||
// Try to create a Folder into the Gauge. Should be disallowed.
|
||||
await page.getByRole('button', { name: /Create/ }).click();
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('menuitem', { name: /Folder/ }).click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.getByLabel('Cancel').click();
|
||||
|
||||
// Try to create a Display Layout into the Gauge. Should be disallowed.
|
||||
await page.getByRole('button', { name: /Create/ }).click();
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('menuitem', { name: /Display Layout/ }).click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
});
|
||||
|
@ -24,7 +24,7 @@
|
||||
This test suite is dedicated to tests which verify the basic operations surrounding imagery,
|
||||
but only assume that example imagery is present.
|
||||
*/
|
||||
/* globals process */
|
||||
|
||||
import { createDomainObjectWithDefaults, setRealTimeMode } from '../../../../appActions.js';
|
||||
import { waitForAnimations } from '../../../../baseFixtures.js';
|
||||
import { expect, test } from '../../../../pluginFixtures.js';
|
||||
@ -773,7 +773,7 @@ async function dragContrastSliderAndAssertFilterValues(page) {
|
||||
* Gets the filter:brightness value of the current background-image and
|
||||
* asserts against an expected value
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {String} expected The expected brightness value
|
||||
* @param {string} expected The expected brightness value
|
||||
*/
|
||||
async function assertBackgroundImageBrightness(page, expected) {
|
||||
const backgroundImage = page.locator('.c-imagery__main-image__background-image');
|
||||
@ -938,7 +938,7 @@ async function buttonZoomOnImageAndAssert(page) {
|
||||
* Gets the filter:contrast value of the current background-image and
|
||||
* asserts against an expected value
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {String} expected The expected contrast value
|
||||
* @param {string} expected The expected contrast value
|
||||
*/
|
||||
async function assertBackgroundImageContrast(page, expected) {
|
||||
const backgroundImage = page.locator('.c-imagery__main-image__background-image');
|
||||
|
@ -27,7 +27,6 @@ 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: fileURLToPath(
|
||||
new URL('../../../../helper/addInitDataVisualization.js', import.meta.url)
|
||||
@ -37,6 +36,8 @@ test.describe('Testing numeric data with inspector data visualization (i.e., dat
|
||||
});
|
||||
|
||||
test('Can click on telemetry and see data in inspector @2p', async ({ page, context }) => {
|
||||
const initStartBounds = await page.getByLabel('Start bounds').textContent();
|
||||
const initEndBounds = await page.getByLabel('End bounds').textContent();
|
||||
const exampleDataVisualizationSource = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Example Data Visualization Source'
|
||||
});
|
||||
@ -78,5 +79,9 @@ test.describe('Testing numeric data with inspector data visualization (i.e., dat
|
||||
await newPage.waitForLoadState();
|
||||
// expect new tab title to contain 'Second Sine Wave Generator'
|
||||
await expect(newPage).toHaveTitle('Second Sine Wave Generator');
|
||||
|
||||
// Verify that "Open in New Tab" preserves the time bounds
|
||||
expect(initStartBounds).toEqual(await newPage.getByLabel('Start bounds').textContent());
|
||||
expect(initEndBounds).toEqual(await newPage.getByLabel('End bounds').textContent());
|
||||
});
|
||||
});
|
||||
|
86
e2e/tests/functional/plugins/lad/ladTable.e2e.spec.js
Normal file
@ -0,0 +1,86 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
|
||||
import { expect, test } from '../../../../pluginFixtures.js';
|
||||
|
||||
test.describe('LAD Table', () => {
|
||||
let ladTable;
|
||||
let swg;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
ladTable = await createDomainObjectWithDefaults(page, {
|
||||
type: 'LAD Table'
|
||||
});
|
||||
|
||||
swg = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
parent: ladTable.uuid
|
||||
});
|
||||
|
||||
await page.goto(ladTable.url);
|
||||
});
|
||||
|
||||
test('Ensure we have numbers in cells', async ({ page }) => {
|
||||
// Wait for the initial value to show after mount
|
||||
await expect(page.getByLabel('lad value').first()).not.toContainText('---');
|
||||
|
||||
const valueFromFirstSineWave = await page.getByLabel('lad value').first().innerText();
|
||||
const firstSineWaveNumber = parseFloat(valueFromFirstSineWave);
|
||||
// ensure we have a float value in the cell and it's finite
|
||||
expect(Number.isFinite(firstSineWaveNumber)).toBeTruthy();
|
||||
|
||||
const valueFromSecondSineWave = await page.getByLabel('lad value').last().innerText();
|
||||
const secondSineWaveNumber = parseFloat(valueFromSecondSineWave);
|
||||
// ensure we have a float value in the cell and it's finite
|
||||
expect(Number.isFinite(secondSineWaveNumber)).toBeTruthy();
|
||||
});
|
||||
|
||||
test(
|
||||
'Can remove telemetry from composition',
|
||||
{
|
||||
annotation: {
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/7633'
|
||||
}
|
||||
},
|
||||
async ({ page }) => {
|
||||
// Assert that the table is initially populated
|
||||
await expect(page.getByLabel('lad row')).toHaveCount(1);
|
||||
|
||||
// Expand the tree so the SWG is visible
|
||||
await page.getByLabel('Expand My Items').click();
|
||||
await page.getByLabel('Expand LAD Table').click();
|
||||
|
||||
// Right-click the SWG treeitem context menu and click 'Remove' and confirm
|
||||
await page.getByRole('treeitem', { name: swg.name }).click({ button: 'right' });
|
||||
await page.getByRole('menuitem', { name: 'Remove' }).click();
|
||||
await page.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
|
||||
// Assert that the SWG is no longer in the tree and the table is empty
|
||||
await expect(page.getByRole('treeitem', { name: swg.name })).toBeHidden();
|
||||
await expect(page.getByLabel('lad row')).toHaveCount(0);
|
||||
}
|
||||
);
|
||||
});
|
@ -277,7 +277,6 @@ test.describe('Notebook entry tests', () => {
|
||||
// Create Notebook with URL Whitelist
|
||||
let notebookObject;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('../../../../helper/addInitNotebookWithUrls.js', import.meta.url))
|
||||
});
|
||||
|
@ -71,42 +71,89 @@ test.describe('Snapshot Container tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
//Navigate to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// Create Notebook
|
||||
// const notebook = await createDomainObjectWithDefaults(page, {
|
||||
// type: 'Notebook',
|
||||
// name: "Test Notebook"
|
||||
// });
|
||||
// // Create Overlay Plot
|
||||
// const snapShotObject = await createDomainObjectWithDefaults(page, {
|
||||
// type: 'Overlay Plot',
|
||||
// name: "Dropped Overlay Plot"
|
||||
// });
|
||||
|
||||
await page.getByLabel('Take a Notebook Snapshot').click();
|
||||
await page.getByLabel('Open the Notebook Snapshot Menu').click();
|
||||
await page.getByRole('menuitem', { name: 'Save to Notebook Snapshots' }).click();
|
||||
await page.getByLabel('Show Snapshots').click();
|
||||
});
|
||||
test('A snapshot can be Quick Viewed from Container with 3 dot action menu', async ({ page }) => {
|
||||
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More actions').click();
|
||||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click();
|
||||
await page.getByRole('menuitem', { name: 'Quick View' }).click();
|
||||
await expect(page.locator('.c-overlay__outer')).toBeVisible();
|
||||
await expect(page.getByLabel('Modal Overlay')).toBeVisible();
|
||||
await expect(page.getByLabel('Preview Container')).toBeVisible();
|
||||
});
|
||||
test('A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu', async ({
|
||||
page
|
||||
}) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/7552'
|
||||
});
|
||||
//Open Snapshot Object View
|
||||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click();
|
||||
await page.getByRole('menuitem', { name: 'View Snapshot' }).click();
|
||||
await expect(page.getByRole('dialog', { name: 'Modal Overlay' })).toBeVisible();
|
||||
await expect(page.locator('#snapshotDescriptor')).toHaveText(
|
||||
/SNAPSHOT \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/
|
||||
);
|
||||
// Open Annotation Editor with Painterro
|
||||
await page.getByLabel('Annotate this snapshot').click();
|
||||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
|
||||
// Clear the canvas
|
||||
await page.getByRole('button', { name: 'Put text [T]' }).click();
|
||||
// Click in the Painterro canvas to add a text annotation
|
||||
await page.locator('.ptro-crp-el').click();
|
||||
await page.locator('.ptro-text-tool-input').fill('...is there life on mars?');
|
||||
// When working with Painterro, we need to check that the Apply button is hidden after clicking
|
||||
await page.getByTitle('Apply').click();
|
||||
await expect(page.getByTitle('Apply')).toBeHidden();
|
||||
|
||||
// Save and exit annotation window
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
|
||||
// Open up annotation again
|
||||
await page.getByRole('img', { name: 'My Items thumbnail' }).click();
|
||||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible();
|
||||
});
|
||||
test('A snapshot can be Annotated and saved as a JPG and PNG', async ({ page }) => {
|
||||
//Open Snapshot Object View
|
||||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click();
|
||||
await page.getByRole('menuitem', { name: 'View Snapshot' }).click();
|
||||
await expect(page.getByRole('dialog', { name: 'Modal Overlay' })).toBeVisible();
|
||||
|
||||
// Open Annotation Editor with Painterro
|
||||
await page.getByLabel('Annotate this snapshot').click();
|
||||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
|
||||
// Clear the canvas
|
||||
await page.getByRole('button', { name: 'Put text [T]' }).click();
|
||||
// Click in the Painterro canvas to add a text annotation
|
||||
await page.locator('.ptro-crp-el').click();
|
||||
await page.locator('.ptro-text-tool-input').fill('...is there life on mars?');
|
||||
// When working with Painterro, we need to check that the Apply button is hidden after clicking
|
||||
await page.getByTitle('Apply').click();
|
||||
await expect(page.getByTitle('Apply')).toBeHidden();
|
||||
|
||||
// Save and exit annotation window
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
|
||||
// Open up annotation again
|
||||
await page.getByRole('img', { name: 'My Items thumbnail' }).click();
|
||||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible();
|
||||
|
||||
// Save as JPG
|
||||
await Promise.all([
|
||||
page.waitForEvent('download'), // Waits for the download event
|
||||
page.getByLabel('Export as JPG').click() // Triggers the download
|
||||
]);
|
||||
|
||||
// Save as PNG
|
||||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible();
|
||||
await Promise.all([
|
||||
page.waitForEvent('download'), // Waits for the download event
|
||||
page.getByLabel('Export as PNG').click() // Triggers the download
|
||||
]);
|
||||
});
|
||||
test.fixme(
|
||||
'A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu',
|
||||
async ({ page }) => {
|
||||
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More actions').click();
|
||||
await page.getByRole('menuitem', { name: ' View Snapshot' }).click();
|
||||
await expect(page.locator('.c-overlay__outer')).toBeVisible();
|
||||
await page.getByTitle('Annotate').click();
|
||||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
|
||||
await page.getByRole('button', { name: '' }).click();
|
||||
// await expect(page.locator('#snap-annotation-canvas')).not.toBeVisible();
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
//await expect(await page.locator)
|
||||
}
|
||||
);
|
||||
test.fixme('5 Snapshots can be added to a container', async ({ page }) => {});
|
||||
test.fixme(
|
||||
'5 Snapshots can be added to a container and Deleted with Delete All action',
|
||||
@ -116,10 +163,6 @@ test.describe('Snapshot Container tests', () => {
|
||||
'A snapshot can be Deleted from Container with 3 dot action menu',
|
||||
async ({ page }) => {}
|
||||
);
|
||||
test.fixme(
|
||||
'A snapshot can be Navigated To from Container with 3 dot action menu',
|
||||
async ({ page }) => {}
|
||||
);
|
||||
test.fixme(
|
||||
'A snapshot can be Navigated To Item in Time from Container with 3 dot action menu',
|
||||
async ({ page }) => {}
|
||||
@ -151,11 +194,4 @@ test.describe('Snapshot Container tests', () => {
|
||||
//Snapshot removed from container?
|
||||
}
|
||||
);
|
||||
test.fixme(
|
||||
'Verify Embedded options for PNG, JPG, and Annotate work correctly',
|
||||
async ({ page }) => {
|
||||
//Add snapshot to container
|
||||
//Verify PNG, JPG, and Annotate buttons work correctly
|
||||
}
|
||||
);
|
||||
});
|
||||
|
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 19 KiB |
@ -24,138 +24,60 @@
|
||||
Tests to verify log plot functionality when objects are missing
|
||||
*/
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
|
||||
import { expect, test } from '../../../../pluginFixtures.js';
|
||||
|
||||
test.describe('Handle missing object for plots', () => {
|
||||
test('Displays empty div for missing stacked plot item @unstable', async ({
|
||||
page,
|
||||
browserName,
|
||||
openmctConfig
|
||||
}) => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test('Displays empty div for missing stacked plot item', async ({ page, browserName }) => {
|
||||
// eslint-disable-next-line playwright/no-skipped-test
|
||||
test.skip(browserName === 'firefox', 'Firefox failing due to console events being missed');
|
||||
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
const errorLogs = [];
|
||||
let warningReceived = false;
|
||||
|
||||
page.on('console', (message) => {
|
||||
if (message.type() === 'warning' && message.text().includes('Missing domain object')) {
|
||||
errorLogs.push(message.text());
|
||||
warningReceived = true;
|
||||
}
|
||||
});
|
||||
|
||||
//Make stacked plot
|
||||
await makeStackedPlot(page, myItemsFolderName);
|
||||
const stackedPlot = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Stacked Plot'
|
||||
});
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
parent: stackedPlot.uuid
|
||||
});
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
parent: stackedPlot.uuid
|
||||
});
|
||||
|
||||
//Gets local storage and deletes the last sine wave generator in the stacked plot
|
||||
const localStorage = await page.evaluate(() => window.localStorage);
|
||||
const parsedData = JSON.parse(localStorage.mct);
|
||||
const keys = Object.keys(parsedData);
|
||||
const lastKey = keys[keys.length - 1];
|
||||
const mct = await page.evaluate(() => window.localStorage.getItem('mct'));
|
||||
const parsedData = JSON.parse(mct);
|
||||
const key = Object.entries(parsedData).find(([, value]) => value.type === 'generator')?.[0];
|
||||
|
||||
delete parsedData[lastKey];
|
||||
delete parsedData[key];
|
||||
|
||||
//Sets local storage with missing object
|
||||
await page.evaluate(`window.localStorage.setItem('mct', '${JSON.stringify(parsedData)}')`);
|
||||
const jsonData = JSON.stringify(parsedData);
|
||||
await page.evaluate((data) => {
|
||||
window.localStorage.setItem('mct', data);
|
||||
}, jsonData);
|
||||
|
||||
//Reloads page and clicks on stacked plot
|
||||
await Promise.all([page.reload(), page.waitForLoadState('networkidle')]);
|
||||
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||
await page.goto(stackedPlot.url);
|
||||
|
||||
//Verify Main section is there on load
|
||||
await expect
|
||||
.soft(page.locator('.l-browse-bar__object-name'))
|
||||
.toContainText('Unnamed Stacked Plot');
|
||||
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.locator('text=Unnamed Stacked Plot').first().click()
|
||||
]);
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(stackedPlot.name);
|
||||
|
||||
//Check that there is only one stacked item plot with a plot, the missing one will be empty
|
||||
await expect(page.locator('.c-plot--stacked-container:has(.gl-plot)')).toHaveCount(1);
|
||||
//Verify that console.warn is thrown
|
||||
expect(errorLogs).toHaveLength(1);
|
||||
await expect(page.getByLabel('Stacked Plot Item')).toHaveCount(1);
|
||||
//Verify that console.warn was thrown
|
||||
expect(warningReceived).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* This is used the create a stacked plot object
|
||||
* @private
|
||||
*/
|
||||
async function makeStackedPlot(page, myItemsFolderName) {
|
||||
// fresh page with time range from 2022-03-29 22:00:00.000Z to 2022-03-29 22:00:30.000Z
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// create stacked plot
|
||||
await page.locator('button.c-create-button').click();
|
||||
await page.locator('li[role="menuitem"]:has-text("Stacked Plot")').click();
|
||||
|
||||
await Promise.all([
|
||||
page.waitForNavigation({ waitUntil: 'networkidle' }),
|
||||
page.locator('button:has-text("OK")').click(),
|
||||
//Wait for Save Banner to appear
|
||||
page.waitForSelector('.c-message-banner__message')
|
||||
]);
|
||||
|
||||
// save the stacked plot
|
||||
await saveStackedPlot(page);
|
||||
|
||||
// create a sinewave generator
|
||||
await createSineWaveGenerator(page);
|
||||
|
||||
// click on stacked plot
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.locator('text=Unnamed Stacked Plot').first().click()
|
||||
]);
|
||||
|
||||
// create a second sinewave generator
|
||||
await createSineWaveGenerator(page);
|
||||
|
||||
// click on stacked plot
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.locator('text=Unnamed Stacked Plot').first().click()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to save a stacked plot object
|
||||
* @private
|
||||
*/
|
||||
async function saveStackedPlot(page) {
|
||||
// save stacked plot
|
||||
await page
|
||||
.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button')
|
||||
.nth(1)
|
||||
.click();
|
||||
|
||||
await Promise.all([
|
||||
page.locator('text=Save and Finish Editing').click(),
|
||||
//Wait for Save Banner to appear
|
||||
page.waitForSelector('.c-message-banner__message')
|
||||
]);
|
||||
//Wait until Save Banner is gone
|
||||
await page.locator('.c-message-banner__close-button').click();
|
||||
await page.waitForSelector('.c-message-banner__message', { state: 'detached' });
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used to create a sine wave generator object
|
||||
* @private
|
||||
*/
|
||||
async function createSineWaveGenerator(page) {
|
||||
//Create sine wave generator
|
||||
await page.locator('button.c-create-button').click();
|
||||
await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
|
||||
|
||||
await Promise.all([
|
||||
page.waitForNavigation({ waitUntil: 'networkidle' }),
|
||||
page.locator('button:has-text("OK")').click(),
|
||||
//Wait for Save Banner to appear
|
||||
page.waitForSelector('.c-message-banner__message')
|
||||
]);
|
||||
}
|
||||
|
@ -54,7 +54,9 @@ test.describe('Plots work in Previews', () => {
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// right click on the plot and select view large
|
||||
await page.getByLabel('Sine', { exact: true }).click({ button: 'right' });
|
||||
await page.getByLabel(/Alpha-numeric telemetry value of.*/).click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.getByLabel('View Historical Data').click();
|
||||
await expect(page.getByLabel('Preview Container').getByLabel('Plot Canvas')).toBeVisible();
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
|
@ -122,4 +122,14 @@ test.describe('Reload action', () => {
|
||||
expect(fullReloadAlphaTelemetryValue).not.toEqual(afterReloadAlphaTelemetryValue);
|
||||
expect(fullReloadBetaTelemetryValue).not.toEqual(afterReloadBetaTelemetryValue);
|
||||
});
|
||||
|
||||
test('is disabled in Previews', async ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/7638'
|
||||
});
|
||||
await page.getByLabel('Alpha Table Frame Controls').getByLabel('Large View').click();
|
||||
await page.getByLabel('Modal Overlay').getByLabel('More actions').click();
|
||||
await expect(page.getByLabel('Reload')).toBeHidden();
|
||||
});
|
||||
});
|
||||
|
@ -114,7 +114,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultFrameBorderColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2. Note: https://github.com/nasa/openmct/issues/7337
|
||||
@ -122,7 +124,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultFrameBorderColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
});
|
||||
|
||||
@ -143,7 +147,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(defaultTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2
|
||||
@ -151,7 +157,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(defaultTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Set styles using setStyles function on StackedPlot1 but not StackedPlot2
|
||||
@ -160,7 +168,7 @@ test.describe('Flexible Layout styling', () => {
|
||||
setBorderColor,
|
||||
setBackgroundColor,
|
||||
setTextColor,
|
||||
page.getByLabel('StackedPlot1 Frame')
|
||||
page.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot1
|
||||
@ -168,7 +176,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2
|
||||
@ -176,7 +186,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(defaultTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Save Flexible Layout
|
||||
@ -191,7 +203,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2
|
||||
@ -199,7 +213,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(defaultTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
});
|
||||
|
||||
@ -241,7 +257,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2 to verify they are the default
|
||||
@ -249,7 +267,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(defaultTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Set styles using setStyles function on StackedPlot2
|
||||
@ -258,7 +278,7 @@ test.describe('Flexible Layout styling', () => {
|
||||
setBorderColor,
|
||||
setBackgroundColor,
|
||||
setTextColor,
|
||||
page.getByLabel('StackedPlot2 Frame')
|
||||
page.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2
|
||||
@ -266,7 +286,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Save Flexible Layout
|
||||
@ -281,7 +303,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2
|
||||
@ -289,7 +313,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Directly navigate to the flexible layout
|
||||
@ -326,7 +352,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Check styles on StackedPlot2 matches previous set colors
|
||||
@ -334,7 +362,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot2 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot2 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
});
|
||||
|
||||
@ -356,7 +386,7 @@ test.describe('Flexible Layout styling', () => {
|
||||
setBorderColor,
|
||||
setBackgroundColor,
|
||||
setTextColor,
|
||||
page.getByLabel('StackedPlot1 Frame')
|
||||
page.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
);
|
||||
|
||||
// Check styles using checkStyles function
|
||||
@ -364,7 +394,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(setBorderColor),
|
||||
hexToRGB(setBackgroundColor),
|
||||
hexToRGB(setTextColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
|
||||
// Save Flexible Layout
|
||||
@ -386,7 +418,7 @@ test.describe('Flexible Layout styling', () => {
|
||||
'No Style',
|
||||
'No Style',
|
||||
'No Style',
|
||||
page.getByLabel('StackedPlot1 Frame')
|
||||
page.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
);
|
||||
|
||||
// Check styles using checkStyles function
|
||||
@ -394,7 +426,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(inheritedColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
// Save Flexible Layout
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
@ -408,7 +442,9 @@ test.describe('Flexible Layout styling', () => {
|
||||
hexToRGB(defaultBorderTargetColor),
|
||||
NO_STYLE_RGBA,
|
||||
hexToRGB(inheritedColor),
|
||||
page.getByLabel('StackedPlot1 Frame').getByLabel('Stacked Plot Style Target')
|
||||
page
|
||||
.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
.getByLabel('Stacked Plot Style Target')
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -67,7 +67,7 @@ test.describe('Style Inspector Options', () => {
|
||||
await expect(page.getByRole('tab', { name: 'Styles' })).toBeVisible();
|
||||
|
||||
// Select Stacked Layout Column
|
||||
await page.getByLabel('Stacked Plot Frame').click();
|
||||
await page.getByRole('group', { name: 'Stacked Plot Frame' }).click();
|
||||
|
||||
// The overall Flex Layout or Stacked Plot itself MUST be style-able.
|
||||
await expect(page.getByRole('tab', { name: 'Styles' })).toBeVisible();
|
||||
|
@ -69,5 +69,9 @@ test.describe('Preview mode', () => {
|
||||
await page.getByLabel('Overlay').getByLabel('More actions').click();
|
||||
await expect(page.getByLabel('Export Table Data')).toBeVisible();
|
||||
await expect(page.getByLabel('Export Marked Rows')).toBeVisible();
|
||||
await expect(page.getByLabel('Export Marked Rows')).toBeDisabled();
|
||||
await page.getByLabel('Pause').click();
|
||||
const tableWrapper = page.getByLabel('Preview Container').locator('div.c-table-wrapper');
|
||||
await expect(tableWrapper).toHaveClass(/is-paused/);
|
||||
});
|
||||
});
|
||||
|
@ -20,10 +20,31 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { createDomainObjectWithDefaults, setTimeConductorBounds } from '../../../../appActions.js';
|
||||
import {
|
||||
createDomainObjectWithDefaults,
|
||||
setTimeConductorBounds,
|
||||
setTimeConductorMode
|
||||
} from '../../../../appActions.js';
|
||||
import { expect, test } from '../../../../pluginFixtures.js';
|
||||
|
||||
test.describe('Telemetry Table', () => {
|
||||
let table;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
table = await createDomainObjectWithDefaults(page, { type: 'Telemetry Table' });
|
||||
});
|
||||
|
||||
test('Limits to 50 rows by default', async ({ page }) => {
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
parent: table.uuid
|
||||
});
|
||||
await page.goto(table.url);
|
||||
await setTimeConductorMode(page, false);
|
||||
const rows = page.getByLabel('table content').getByLabel('Table Row');
|
||||
await expect(rows).toHaveCount(50);
|
||||
});
|
||||
|
||||
test('unpauses and filters data when paused by button and user changes bounds', async ({
|
||||
page
|
||||
}) => {
|
||||
@ -34,7 +55,6 @@ test.describe('Telemetry Table', () => {
|
||||
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
const table = await createDomainObjectWithDefaults(page, { type: 'Telemetry Table' });
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
parent: table.uuid
|
||||
@ -78,7 +98,6 @@ test.describe('Telemetry Table', () => {
|
||||
test('Supports filtering telemetry by regular text search', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
const table = await createDomainObjectWithDefaults(page, { type: 'Telemetry Table' });
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Event Message Generator',
|
||||
parent: table.uuid
|
||||
@ -121,7 +140,6 @@ test.describe('Telemetry Table', () => {
|
||||
test('Supports filtering using Regex', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
const table = await createDomainObjectWithDefaults(page, { type: 'Telemetry Table' });
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Event Message Generator',
|
||||
parent: table.uuid
|
||||
|
@ -0,0 +1,64 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import {
|
||||
createDomainObjectWithDefaults,
|
||||
setIndependentTimeConductorBounds
|
||||
} from '../../../../appActions.js';
|
||||
import { expect, test } from '../../../../pluginFixtures.js';
|
||||
|
||||
const FIXED_TIME =
|
||||
'./#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
|
||||
test.describe('Datepicker operations', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(FIXED_TIME);
|
||||
});
|
||||
test('Verify that user can use the datepicker in the TC', async ({ page }) => {
|
||||
await page.getByLabel('Time Conductor Mode').click();
|
||||
// Click on the date picker that is left-most on the screen
|
||||
await page.getByLabel('Global Time Conductor').locator('a').first().click();
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
// Click on the first cell
|
||||
await page.getByText('27 239').click();
|
||||
// Expect datepicker to close and time conductor date setting to be changed
|
||||
await expect(page.getByRole('dialog')).toHaveCount(0);
|
||||
});
|
||||
test('Verify that user can use the datepicker in the ITC', async ({ page }) => {
|
||||
const createdTimeList = await createDomainObjectWithDefaults(page, { type: 'Time List' });
|
||||
|
||||
await page.goto(createdTimeList.url, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await setIndependentTimeConductorBounds(page, {
|
||||
start: '2024-11-12 19:11:11.000Z',
|
||||
end: '2024-11-12 20:11:11.000Z'
|
||||
});
|
||||
// Open ITC
|
||||
await page.getByLabel('Start bounds').nth(0).click();
|
||||
// Click on the datepicker icon
|
||||
await page.locator('form a').first().click();
|
||||
await expect(page.getByRole('dialog')).toBeVisible();
|
||||
// Click on the first cell
|
||||
await page.getByText('7 342').click();
|
||||
// Expect datepicker to close and time conductor date setting to be changed
|
||||
await expect(page.getByRole('dialog')).toHaveCount(0);
|
||||
});
|
||||
});
|
@ -48,7 +48,7 @@ test.describe('Time conductor operations', () => {
|
||||
await setTimeConductorBounds(page, startDate);
|
||||
|
||||
// Bring up the time conductor popup
|
||||
const timeConductorMode = await page.locator('.c-compact-tc');
|
||||
const timeConductorMode = page.locator('.c-compact-tc');
|
||||
await timeConductorMode.click();
|
||||
const startDateLocator = page.locator('input[type="text"]').first();
|
||||
const endDateLocator = page.locator('input[type="text"]').nth(2);
|
||||
|
@ -109,7 +109,7 @@ test.describe('Verify tooltips', () => {
|
||||
|
||||
async function getToolTip(object) {
|
||||
await page.locator('.c-create-button').hover();
|
||||
await page.getByRole('cell', { name: object.name }).hover();
|
||||
await page.getByLabel('lad name').getByText(object.name).hover();
|
||||
let tooltipText = await page.locator('.c-tooltip').textContent();
|
||||
return tooltipText.replace('\n', '').trim();
|
||||
}
|
||||
|
75
e2e/tests/functional/ui/inspector.e2e.spec.js
Normal file
@ -0,0 +1,75 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
import { createDomainObjectWithDefaults } from '../../../appActions.js';
|
||||
import { expect, test } from '../../../baseFixtures.js';
|
||||
|
||||
// We don't need cspell to check this. It doesn't know latin.
|
||||
/* cSpell:disable */
|
||||
const loremIpsum = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Molestie at elementum eu facilisis sed. Feugiat pretium nibh ipsum consequat. Amet consectetur adipiscing elit duis tristique sollicitudin nibh sit amet. Eget nullam non nisi est sit amet. A pellentesque sit amet porttitor eget dolor morbi non arcu. Ullamcorper sit amet risus nullam eget felis eget nunc. In tellus integer feugiat scelerisque varius morbi enim nunc. Ac feugiat sed lectus vestibulum mattis ullamcorper. Nulla facilisi morbi tempus iaculis urna id volutpat. Massa vitae tortor condimentum lacinia quis vel eros donec. Ornare quam viverra orci sagittis eu. Vestibulum sed arcu non odio. In egestas erat imperdiet sed euismod nisi porta lorem. Vitae auctor eu augue ut lectus arcu bibendum at. Donec adipiscing tristique risus nec feugiat in fermentum posuere urna. Velit euismod in pellentesque massa placerat duis ultricies. Nulla facilisi nullam vehicula ipsum a arcu cursus vitae. Aliquam malesuada bibendum arcu vitae elementum curabitur.
|
||||
Vel eros donec ac odio tempor orci. Et netus et malesuada fames ac turpis egestas sed tempus. Turpis egestas pretium aenean pharetra magna ac placerat. Euismod elementum nisi quis eleifend. Vitae auctor eu augue ut lectus arcu. At imperdiet dui accumsan sit amet nulla facilisi. Est velit egestas dui id ornare arcu odio ut sem. Ornare arcu dui vivamus arcu felis. Luctus venenatis lectus magna fringilla. At elementum eu facilisis sed. Tristique et egestas quis ipsum suspendisse ultrices gravida dictum. Enim eu turpis egestas pretium aenean pharetra magna ac placerat. Lobortis scelerisque fermentum dui faucibus in. Tempor orci eu lobortis elementum nibh tellus molestie nunc non. Dignissim convallis aenean et tortor at risus. Enim tortor at auctor urna nunc id cursus. Libero volutpat sed cras ornare arcu dui vivamus. Scelerisque fermentum dui faucibus in ornare quam viverra.
|
||||
Odio ut sem nulla pharetra. Neque vitae tempus quam pellentesque nec. A arcu cursus vitae congue mauris. Turpis nunc eget lorem dolor sed viverra ipsum nunc aliquet. Nibh tellus molestie nunc non blandit massa enim nec. Risus feugiat in ante metus dictum at tempor commodo ullamcorper. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida. Pulvinar elementum integer enim neque. Bibendum ut tristique et egestas. Nibh praesent tristique magna sit. Lectus magna fringilla urna porttitor. Eu non diam phasellus vestibulum lorem sed risus. Rhoncus mattis rhoncus urna neque. Rutrum tellus pellentesque eu tincidunt tortor aliquam. Pharetra convallis posuere morbi leo urna molestie at elementum. Quis commodo odio aenean sed adipiscing. Enim sit amet venenatis urna cursus eget nunc.
|
||||
Enim nec dui nunc mattis. Cursus turpis massa tincidunt dui ut. Donec adipiscing tristique risus nec feugiat in. Eleifend mi in nulla posuere sollicitudin. Donec enim diam vulputate ut pharetra sit. Ultricies mi eget mauris pharetra et ultrices neque. Eros in cursus turpis massa tincidunt dui. Cursus risus at ultrices mi tempus imperdiet nulla malesuada. Morbi enim nunc faucibus a pellentesque sit. Porttitor rhoncus dolor purus non. Ac tortor vitae purus faucibus.
|
||||
Proin libero nunc consequat interdum varius sit amet mattis vulputate. Metus dictum at tempor commodo ullamcorper a lacus vestibulum sed. Quisque non tellus orci ac auctor augue mauris. Id ornare arcu odio ut. Rhoncus est pellentesque elit ullamcorper dignissim. Senectus et netus et malesuada fames ac turpis egestas. Volutpat ac tincidunt vitae semper quis lectus nulla. Adipiscing elit duis tristique sollicitudin. Ipsum faucibus vitae aliquet nec ullamcorper sit. Gravida neque convallis a cras semper auctor neque vitae tempus. Porttitor leo a diam sollicitudin tempor id. Dictum non consectetur a erat nam at lectus. At volutpat diam ut venenatis tellus in. Morbi enim nunc faucibus a pellentesque sit amet. Cursus in hac habitasse platea. Sed augue lacus viverra vitae.
|
||||
`;
|
||||
|
||||
test.describe('Inspector tests', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Content in inspector can be scrolled to vertically', async ({ page }) => {
|
||||
const folderWithOverflowingTitle = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: loremIpsum
|
||||
});
|
||||
|
||||
await page.goto(folderWithOverflowingTitle.url);
|
||||
|
||||
const inspectorPropertiesLocator = page
|
||||
.getByRole('tabpanel', { name: 'Inspector Views' })
|
||||
.getByLabel('Inspector Properties Details');
|
||||
const inspectorPropertiesList = inspectorPropertiesLocator.getByRole('list');
|
||||
const firstInspectorPropertyValue = inspectorPropertiesList
|
||||
.getByRole('listitem')
|
||||
.first()
|
||||
.getByLabel('value', { exact: false });
|
||||
const lastInspectorPropertyValue = inspectorPropertiesList
|
||||
.getByRole('listitem')
|
||||
.last()
|
||||
.getByLabel('value', { exact: false });
|
||||
|
||||
// inspector content partially in viewport, but not all the way in viewport
|
||||
await expect(inspectorPropertiesLocator).toBeInViewport();
|
||||
await expect(inspectorPropertiesLocator).not.toBeInViewport({ ratio: 0.9 });
|
||||
|
||||
await expect(firstInspectorPropertyValue).toBeInViewport();
|
||||
await expect(lastInspectorPropertyValue).not.toBeInViewport();
|
||||
|
||||
// using page.mouse.wheel to scroll the inspector content by the height of the content
|
||||
// because click and scrollIntoView will scroll even if scrollbar not available
|
||||
await inspectorPropertiesLocator.hover();
|
||||
const offset = await inspectorPropertiesLocator.evaluate((el) => el.offsetHeight);
|
||||
await page.mouse.wheel(0, offset);
|
||||
|
||||
await expect(lastInspectorPropertyValue).toBeInViewport();
|
||||
});
|
||||
});
|
@ -178,7 +178,7 @@ test.describe('Performance tests', () => {
|
||||
console.log('jpgResourceTiming ' + JSON.stringify(jpgResourceTiming));
|
||||
|
||||
// Click Close Icon
|
||||
await page.locator('[aria-label="Close"]').click();
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
await page.evaluate(() => window.performance.mark('view-large-close-button'));
|
||||
|
||||
//await client.send('HeapProfiler.enable');
|
||||
|
@ -299,7 +299,6 @@ test.describe('Navigation memory leak is not detected in', () => {
|
||||
// for detecting memory leaks.
|
||||
await page.evaluate(() => {
|
||||
window.gcPromise = new Promise((resolve) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
window.fr = new FinalizationRegistry(resolve);
|
||||
window.fr.register(
|
||||
window.openmct.layout.$refs.browseObject.$refs.objectViewWrapper.firstChild,
|
||||
|
@ -21,14 +21,13 @@
|
||||
*****************************************************************************/
|
||||
|
||||
import { test } from '../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
|
||||
test.describe('a11y - Default', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test('main view', async ({ page }, testInfo) => {
|
||||
await page.goto('./');
|
||||
//Skipping for https://github.com/nasa/openmct/issues/7421
|
||||
//await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
|
@ -27,12 +27,12 @@ Tests the branding associated with the default deployment. At least the about mo
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { expect, scanForA11yViolations, test } from '../../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../../constants.js';
|
||||
|
||||
test.describe('Visual - Branding @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
//Go to baseURL and Hide Tree
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Visual - About Modal', async ({ page, theme }) => {
|
||||
|
@ -28,7 +28,7 @@ import percySnapshot from '@percy/playwright';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
import { expect, test } from '../../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../../constants.js';
|
||||
|
||||
//Declare the component scope of the visual test for Percy
|
||||
const header = '.l-shell__head';
|
||||
@ -36,7 +36,7 @@ const header = '.l-shell__head';
|
||||
test.describe('Visual - Header @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
//Go to baseURL and Hide Tree
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
// Wait for status bar to load
|
||||
await expect(
|
||||
page.getByRole('status', {
|
||||
@ -69,14 +69,14 @@ test.describe('Visual - Header @a11y', () => {
|
||||
});
|
||||
|
||||
test('show snapshot button', async ({ page, theme }) => {
|
||||
await page.getByLabel('Take a Notebook Snapshot').click();
|
||||
await page.getByLabel('Open the Notebook Snapshot Menu').click();
|
||||
|
||||
await page.getByRole('menuitem', { name: 'Save to Notebook Snapshots' }).click();
|
||||
|
||||
await percySnapshot(page, `Notebook Snapshot Show button (theme: '${theme}')`, {
|
||||
scope: header
|
||||
});
|
||||
await expect(await page.getByLabel('Show Snapshots')).toBeVisible();
|
||||
await expect(page.getByLabel('Show Snapshots')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -23,14 +23,14 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { test } from '../../../avpFixtures.js';
|
||||
import { MISSION_TIME, VISUAL_URL } from '../../../constants.js';
|
||||
import { MISSION_TIME, VISUAL_FIXED_URL } from '../../../constants.js';
|
||||
|
||||
//Declare the scope of the visual test
|
||||
const inspectorPane = '.l-shell__pane-inspector';
|
||||
|
||||
test.describe('Visual - Inspector @ally @clock', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test.use({
|
||||
storageState: './e2e/test-data/overlay_plot_with_delay_storage.json',
|
||||
|
116
e2e/tests/visual-a11y/components/timeConductor.visual.spec.js
Normal file
@ -0,0 +1,116 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
Tests the visual appearance of the Time Conductor component
|
||||
*/
|
||||
|
||||
import { expect, test } from '../../../avpFixtures.js';
|
||||
import {
|
||||
MISSION_TIME,
|
||||
MISSION_TIME_FIXED_END,
|
||||
MISSION_TIME_FIXED_START,
|
||||
VISUAL_REALTIME_URL
|
||||
} from '../../../constants.js';
|
||||
|
||||
test.describe('Visual - Time Conductor', () => {
|
||||
test.use({
|
||||
clockOptions: {
|
||||
now: MISSION_TIME,
|
||||
shouldAdvanceTime: false
|
||||
}
|
||||
});
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
// FIXME: checking for a11y violations times out. Might have something to do with the frozen clock.
|
||||
// test.afterEach(async ({ page }, testInfo) => {
|
||||
// await scanForA11yViolations(page, testInfo.title);
|
||||
// });
|
||||
|
||||
test('Visual - Time Conductor (Fixed time) @clock @snapshot', async ({ page }) => {
|
||||
// Navigate to a specific view that uses the Time Conductor in Fixed Time mode with inspect and browse panes collapsed
|
||||
await page.goto(
|
||||
`./#/browse/mine?tc.mode=fixed&tc.startBound=${MISSION_TIME_FIXED_START}&tc.endBound=${MISSION_TIME_FIXED_END}&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true`,
|
||||
{
|
||||
waitUntil: 'domcontentloaded'
|
||||
}
|
||||
);
|
||||
|
||||
// Take a snapshot for comparison
|
||||
const snapshot = await page.screenshot({
|
||||
mask: []
|
||||
});
|
||||
expect(snapshot).toMatchSnapshot('time-conductor-fixed-time.png');
|
||||
});
|
||||
|
||||
test('Visual - Time Conductor (Realtime) @clock @snapshot', async ({ page }) => {
|
||||
// Navigate to a specific view that uses the Time Conductor in Fixed Time mode with inspect and browse panes collapsed
|
||||
await page.goto(VISUAL_REALTIME_URL, {
|
||||
waitUntil: 'domcontentloaded'
|
||||
});
|
||||
|
||||
const mask = [];
|
||||
|
||||
// Take a snapshot for comparison
|
||||
const snapshot = await page.screenshot({
|
||||
mask
|
||||
});
|
||||
expect(snapshot).toMatchSnapshot('time-conductor-realtime.png');
|
||||
});
|
||||
test(
|
||||
'Visual - Time Conductor Axis Resized @clock @snapshot',
|
||||
{ annotation: [{ type: 'issue', description: 'https://github.com/nasa/openmct/issues/7623' }] },
|
||||
async ({ page, tick }) => {
|
||||
const VISUAL_REALTIME_WITH_PANES = VISUAL_REALTIME_URL.replace(
|
||||
'hideTree=true',
|
||||
'hideTree=false'
|
||||
).replace('hideInspector=true', 'hideInspector=false');
|
||||
// Navigate to a specific view that uses the Time Conductor in Fixed Time mode with inspect
|
||||
await page.goto(VISUAL_REALTIME_WITH_PANES, {
|
||||
waitUntil: 'domcontentloaded'
|
||||
});
|
||||
|
||||
// Set the time conductor to fixed time mode
|
||||
await page.getByLabel('Time Conductor Mode').click();
|
||||
await page.getByLabel('Time Conductor Mode Menu').click();
|
||||
await page.getByLabel('Fixed Timespan').click();
|
||||
await page.getByLabel('Submit time bounds').click();
|
||||
|
||||
// Collapse the inspect and browse panes to trigger a resize of the conductor axis
|
||||
await page.getByLabel('Collapse Inspect Pane').click();
|
||||
await page.getByLabel('Collapse Browse Pane').click();
|
||||
|
||||
// manually tick the clock to trigger the resize / re-render
|
||||
await tick(1000 * 2);
|
||||
|
||||
const mask = [];
|
||||
|
||||
// Take a snapshot for comparison
|
||||
const snapshot = await page.screenshot({
|
||||
mask
|
||||
});
|
||||
expect(snapshot).toMatchSnapshot('time-conductor-axis-resized.png');
|
||||
}
|
||||
);
|
||||
});
|
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 29 KiB |
@ -23,7 +23,7 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults, expandTreePaneItemByName } from '../../../appActions.js';
|
||||
import { VISUAL_URL } from '../../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../../constants.js';
|
||||
import { test } from '../../../pluginFixtures.js';
|
||||
|
||||
//Declare the scope of the visual test
|
||||
@ -32,7 +32,7 @@ const treePane = "[role=tree][aria-label='Main Tree']";
|
||||
test.describe('Visual - Tree Pane', () => {
|
||||
test('Tree pane in various states', async ({ page, theme, openmctConfig }) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Open Tree
|
||||
await page.getByRole('button', { name: 'Browse' }).click();
|
||||
|
@ -27,12 +27,12 @@ clockOptions plugin fixture.
|
||||
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { MISSION_TIME, VISUAL_URL } from '../../constants.js';
|
||||
import { MISSION_TIME, VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Visual - Controlled Clock @clock', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test.use({
|
||||
storageState: './e2e/test-data/overlay_plot_with_delay_storage.json',
|
||||
@ -43,7 +43,7 @@ test.describe('Visual - Controlled Clock @clock', () => {
|
||||
});
|
||||
|
||||
test('Overlay Plot Loading Indicator @localStorage', async ({ page, theme }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page
|
||||
.getByRole('gridcell', { hasText: 'Overlay Plot with 5s Delay Overlay Plot' })
|
||||
.click();
|
||||
|
@ -30,11 +30,11 @@ import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
|
||||
test.describe('Visual - Default @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Visual - Default Dashboard', async ({ page, theme }) => {
|
||||
|
@ -23,12 +23,18 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { MISSION_TIME, VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import { test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Visual - Display Layout', () => {
|
||||
test.beforeEach(async ({ page, theme }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
test.describe('Visual - Display Layout @clock', () => {
|
||||
test.use({
|
||||
clockOptions: {
|
||||
now: MISSION_TIME,
|
||||
shouldAdvanceTime: true
|
||||
}
|
||||
});
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
const parentLayout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
@ -59,12 +65,15 @@ test.describe('Visual - Display Layout', () => {
|
||||
await page.goto(parentLayout.url, { waitUntil: 'domcontentloaded' });
|
||||
await page.getByRole('button', { name: 'Edit Object' }).click();
|
||||
|
||||
//Move the Child Right Layout to the Right. It should be on top of the Left Layout at this point.
|
||||
// Select the child right layout
|
||||
await page
|
||||
.getByLabel('Child Right Layout Layout', { exact: true })
|
||||
.getByLabel('Move Sub-object Frame')
|
||||
.click();
|
||||
await page.getByLabel('Move Sub-object Frame').nth(3).click(); //I'm not sure why this step is necessary
|
||||
// FIXME: Click to select the parent object (layout)
|
||||
await page.getByLabel('Move Sub-object Frame').nth(3).click();
|
||||
|
||||
// Move the second layout element to the right
|
||||
await page.getByLabel('X:').click();
|
||||
await page.getByLabel('X:').fill('35');
|
||||
});
|
||||
|
@ -84,6 +84,12 @@ test.describe('Fault Management Visual Tests', () => {
|
||||
await shelveFault(page, 1);
|
||||
await changeViewTo(page, 'shelved');
|
||||
|
||||
/* cspell:disable-next-line */
|
||||
// Since fault management is heavily dependent on events (bleh), we need to wait for the correct
|
||||
// element counts
|
||||
await expect(page.getByLabel('Select fault:')).toHaveCount(1);
|
||||
await expect(page.getByLabel('Disposition Actions')).toHaveCount(1);
|
||||
|
||||
await percySnapshot(page, `Shelved faults appear in the shelved view (theme: '${theme}')`);
|
||||
|
||||
await openFaultRowMenu(page, 1);
|
||||
|
@ -23,7 +23,8 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults, setRealTimeMode } from '../../appActions.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { waitForAnimations } from '../../baseFixtures.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Visual - Example Imagery', () => {
|
||||
@ -31,7 +32,7 @@ test.describe('Visual - Example Imagery', () => {
|
||||
let parentLayout;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
parentLayout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
@ -75,11 +76,10 @@ test.describe('Visual - Example Imagery', () => {
|
||||
await page.goto(exampleImagery.url, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await setRealTimeMode(page, true);
|
||||
//Temporary to close the dialog
|
||||
await page.getByLabel('Submit time offsets').click();
|
||||
|
||||
await expect(page.getByLabel('Image Wrapper')).toBeVisible();
|
||||
|
||||
await waitForAnimations(page.locator('.animate-scroll'));
|
||||
await percySnapshot(page, `Example Imagery in Real Time (theme: ${theme})`);
|
||||
});
|
||||
|
||||
|
@ -23,14 +23,14 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Visual - LAD Table', () => {
|
||||
let ladTable;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// Create LAD Table
|
||||
ladTable = await createDomainObjectWithDefaults(page, {
|
||||
|
@ -23,8 +23,8 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults, expandTreePaneItemByName } from '../../appActions.js';
|
||||
import { test } from '../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { expect, test } from '../../avpFixtures.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import { enterTextEntry, startAndAddRestrictedNotebookObject } from '../../helper/notebookUtils.js';
|
||||
|
||||
test.describe('Visual - Restricted Notebook @a11y', () => {
|
||||
@ -39,10 +39,48 @@ test.describe('Visual - Restricted Notebook @a11y', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Visual - Notebook Snapshot @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./?hideTree=true&hideInspector=true', { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test('Visual check for Snapshot Annotation', async ({ page, theme }) => {
|
||||
await page.getByLabel('Open the Notebook Snapshot Menu').click();
|
||||
await page.getByRole('menuitem', { name: 'Save to Notebook Snapshots' }).click();
|
||||
await page.getByLabel('Show Snapshots').click();
|
||||
|
||||
await page.getByLabel('My Items Notebook Embed').getByLabel('More actions').click();
|
||||
await page.getByRole('menuitem', { name: 'View Snapshot' }).click();
|
||||
|
||||
await page.getByLabel('Annotate this snapshot').click();
|
||||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
|
||||
// Clear the canvas
|
||||
await page.getByRole('button', { name: 'Put text [T]' }).click();
|
||||
// Click in the Painterro canvas to add a text annotation
|
||||
await page.locator('.ptro-crp-el').click();
|
||||
await page.locator('.ptro-text-tool-input').fill('...is there life on mars?');
|
||||
await percySnapshot(page, `Notebook Snapshot with text entry open (theme: '${theme}')`);
|
||||
|
||||
// When working with Painterro, we need to check that the Apply button is hidden after clicking
|
||||
await page.getByTitle('Apply').click();
|
||||
await expect(page.getByTitle('Apply')).toBeHidden();
|
||||
|
||||
// Save and exit annotation window
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('button', { name: 'Done' }).click();
|
||||
|
||||
// Open up annotation again
|
||||
await page.getByRole('img', { name: 'My Items thumbnail' }).click();
|
||||
await expect(page.getByLabel('Modal Overlay').getByRole('img')).toBeVisible();
|
||||
|
||||
// Take a snapshot
|
||||
await percySnapshot(page, `Notebook Snapshot with annotation (theme: '${theme}')`);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Visual - Notebook @a11y', () => {
|
||||
let notebook;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
notebook = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Notebook',
|
||||
name: 'Test Notebook'
|
||||
|
@ -28,11 +28,11 @@ import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createNotification } from '../../appActions.js';
|
||||
import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
|
||||
test.describe('Visual - Notifications @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Alert Levels and Notification List Modal', async ({ page, theme }) => {
|
||||
|
@ -25,7 +25,7 @@ import fs from 'fs';
|
||||
|
||||
import { createDomainObjectWithDefaults, createPlanFromJSON } from '../../appActions.js';
|
||||
import { test } from '../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import {
|
||||
createTimelistWithPlanAndSetActivityInProgress,
|
||||
getFirstActivity,
|
||||
@ -64,7 +64,7 @@ test.describe('Visual - Timelist progress bar @clock', () => {
|
||||
|
||||
test.describe('Visual - Planning', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Plan View', async ({ page, theme }) => {
|
||||
@ -72,17 +72,35 @@ test.describe('Visual - Planning', () => {
|
||||
name: 'Plan Visual Test',
|
||||
json: examplePlanSmall2
|
||||
});
|
||||
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall2, plan.url);
|
||||
await percySnapshot(page, `Plan View (theme: ${theme})`);
|
||||
});
|
||||
|
||||
test('Resize Plan View @2p', async ({ browser, theme }) => {
|
||||
// need to set viewport to null to allow for resizing
|
||||
const newContext = await browser.newContext({
|
||||
viewport: null
|
||||
});
|
||||
const newPage = await newContext.newPage();
|
||||
|
||||
await newPage.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
const plan = await createPlanFromJSON(newPage, {
|
||||
name: 'Plan Visual Test',
|
||||
json: examplePlanSmall2
|
||||
});
|
||||
|
||||
await setBoundsToSpanAllActivities(newPage, examplePlanSmall2, plan.url);
|
||||
// resize the window
|
||||
await newPage.setViewportSize({ width: 800, height: 600 });
|
||||
await percySnapshot(newPage, `Plan View resized (theme: ${theme})`);
|
||||
});
|
||||
|
||||
test('Plan View w/ draft status', async ({ page, theme }) => {
|
||||
const plan = await createPlanFromJSON(page, {
|
||||
name: 'Plan Visual Test (Draft)',
|
||||
json: examplePlanSmall2
|
||||
});
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
await setDraftStatusForPlan(page, plan);
|
||||
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall2, plan.url);
|
||||
@ -92,7 +110,7 @@ test.describe('Visual - Planning', () => {
|
||||
|
||||
test.describe('Visual - Gantt Chart', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test('Gantt Chart View', async ({ page, theme }) => {
|
||||
const ganttChart = await createDomainObjectWithDefaults(page, {
|
||||
@ -135,7 +153,7 @@ test.describe('Visual - Gantt Chart', () => {
|
||||
|
||||
await setDraftStatusForPlan(page, plan);
|
||||
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall2, ganttChart.url);
|
||||
await percySnapshot(page, `Gantt Chart View w/ draft status (theme: ${theme})`);
|
||||
|
@ -28,13 +28,13 @@ import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
|
||||
test.describe('Grand Search @a11y', () => {
|
||||
let conditionWidget;
|
||||
let displayLayout;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
displayLayout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
|
@ -91,7 +91,7 @@ test.describe('Flexible Layout styling @a11y', () => {
|
||||
setBorderColor,
|
||||
setBackgroundColor,
|
||||
setTextColor,
|
||||
page.getByLabel('StackedPlot1 Frame')
|
||||
page.getByRole('group', { name: 'StackedPlot1 Frame' })
|
||||
);
|
||||
|
||||
await percySnapshot(
|
||||
|
@ -23,14 +23,14 @@
|
||||
import percySnapshot from '@percy/playwright';
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { VISUAL_URL } from '../../constants.js';
|
||||
import { VISUAL_FIXED_URL } from '../../constants.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Visual - Telemetry Views', () => {
|
||||
let telemetry;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// Create SWG inside of LAD Table
|
||||
telemetry = await createDomainObjectWithDefaults(page, {
|
||||
@ -53,11 +53,11 @@ test.describe('Visual - Telemetry Views', () => {
|
||||
await page.goto(telemetry.url, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Click this button to see telemetry display options
|
||||
await page.getByRole('button', { name: 'Plot' }).click();
|
||||
await page.getByLabel('Open the View Switcher Menu').click();
|
||||
await page.getByLabel('Telemetry Table').click();
|
||||
|
||||
//Get Table View in place
|
||||
expect(await page.getByLabel('Expand Columns')).toBeInViewport();
|
||||
await expect(page.getByLabel('Expand Columns')).toBeInViewport();
|
||||
|
||||
await percySnapshot(page, `Default Telemetry Table View (theme: ${theme})`);
|
||||
|
||||
|
@ -55,6 +55,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const ONE_HOUR = 60 * 60 * 1000;
|
||||
export default {
|
||||
inject: ['openmct', 'domainObject'],
|
||||
data() {
|
||||
@ -77,6 +78,10 @@ export default {
|
||||
selectItem(item, event) {
|
||||
event.stopPropagation();
|
||||
const bounds = this.openmct.time.getBounds();
|
||||
const otherBounds = {
|
||||
start: bounds.start - ONE_HOUR,
|
||||
end: bounds.end + ONE_HOUR
|
||||
};
|
||||
const selection = [
|
||||
{
|
||||
element: this.$el,
|
||||
@ -88,6 +93,9 @@ export default {
|
||||
icon: item.type.cssClass
|
||||
},
|
||||
dataRanges: [
|
||||
{
|
||||
bounds: otherBounds
|
||||
},
|
||||
{
|
||||
bounds
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
this source code distribution or the Licensing information page available
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
@ -20,26 +20,32 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*global module,process*/
|
||||
// eslint-disable-next-line func-style
|
||||
const loadWebpackConfig = async () => {
|
||||
if (process.env.KARMA_DEBUG) {
|
||||
return {
|
||||
config: (await import('./.webpack/webpack.dev.js')).default,
|
||||
browsers: ['ChromeDebugging'],
|
||||
singleRun: false
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
config: (await import('./.webpack/webpack.coverage.js')).default,
|
||||
browsers: ['ChromeHeadless'],
|
||||
singleRun: true
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = async (config) => {
|
||||
let webpackConfig;
|
||||
let browsers;
|
||||
let singleRun;
|
||||
|
||||
if (process.env.KARMA_DEBUG) {
|
||||
webpackConfig = (await import('./.webpack/webpack.dev.js')).default;
|
||||
browsers = ['ChromeDebugging'];
|
||||
singleRun = false;
|
||||
} else {
|
||||
webpackConfig = (await import('./.webpack/webpack.coverage.js')).default;
|
||||
browsers = ['ChromeHeadless'];
|
||||
singleRun = true;
|
||||
}
|
||||
const { config: webpackConfig, browsers, singleRun } = await loadWebpackConfig();
|
||||
|
||||
// Adjust webpack config for Karma
|
||||
delete webpackConfig.output;
|
||||
// karma doesn't support webpack entry
|
||||
delete webpackConfig.entry;
|
||||
delete webpackConfig.entry; // Karma doesn't support webpack entry
|
||||
|
||||
// Ensure source maps are enabled for better debugging
|
||||
webpackConfig.devtool = 'inline-source-map';
|
||||
|
||||
config.set({
|
||||
basePath: '',
|
||||
@ -106,7 +112,7 @@ module.exports = async (config) => {
|
||||
},
|
||||
webpack: webpackConfig,
|
||||
webpackMiddleware: {
|
||||
stats: 'errors-warnings'
|
||||
stats: 'detailed' // Changed to 'detailed' for more debugging info
|
||||
},
|
||||
concurrency: 1,
|
||||
singleRun,
|
||||
|
18
openmct.js
@ -30,23 +30,22 @@ if (document.currentScript) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} BuildInfo
|
||||
* @typedef {Object} BuildInfo
|
||||
* @property {string} version
|
||||
* @property {string} buildDate
|
||||
* @property {string} revision
|
||||
* @property {string} branch
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} OpenMCT
|
||||
* @typedef {Object} OpenMCT
|
||||
* @property {BuildInfo} buildInfo
|
||||
* @property {*} selection
|
||||
* @property {import('./src/selection/Selection').default} selection
|
||||
* @property {import('./src/api/time/TimeAPI').default} time
|
||||
* @property {import('./src/api/composition/CompositionAPI').default} composition
|
||||
* @property {*} objectViews
|
||||
* @property {*} inspectorViews
|
||||
* @property {*} propertyEditors
|
||||
* @property {*} toolbars
|
||||
* @property {import('./src/ui/registries/ViewRegistry').default} objectViews
|
||||
* @property {import('./src/ui/registries/InspectorViewRegistry').default} inspectorViews
|
||||
* @property {import('./src/ui/registries/ViewRegistry').default} propertyEditors
|
||||
* @property {import('./src/ui/registries/ToolbarRegistry').default} toolbars
|
||||
* @property {import('./src/api/types/TypeRegistry').default} types
|
||||
* @property {import('./src/api/objects/ObjectAPI').default} objects
|
||||
* @property {import('./src/api/telemetry/TelemetryAPI').default} telemetry
|
||||
@ -59,7 +58,7 @@ if (document.currentScript) {
|
||||
* @property {import('./src/api/menu/MenuAPI').default} menus
|
||||
* @property {import('./src/api/actions/ActionsAPI').default} actions
|
||||
* @property {import('./src/api/status/StatusAPI').default} status
|
||||
* @property {*} priority
|
||||
* @property {import('./src/api/priority/PriorityAPI').default} priority
|
||||
* @property {import('./src/ui/router/ApplicationRouter')} router
|
||||
* @property {import('./src/api/faultmanagement/FaultManagementAPI').default} faults
|
||||
* @property {import('./src/api/forms/FormsAPI').default} forms
|
||||
@ -74,7 +73,6 @@ if (document.currentScript) {
|
||||
* @property {OpenMCTPlugin[]} plugins
|
||||
* @property {OpenMCTComponent[]} components
|
||||
*/
|
||||
|
||||
import { MCT } from './src/MCT.js';
|
||||
|
||||
/** @type {OpenMCT} */
|
||||
|
12279
package-lock.json
generated
Normal file
23
package.json
@ -10,26 +10,27 @@
|
||||
"@braintree/sanitize-url": "6.0.4",
|
||||
"@percy/cli": "1.27.4",
|
||||
"@percy/playwright": "1.0.4",
|
||||
"@playwright/test": "1.39.0",
|
||||
"@playwright/test": "1.42.1",
|
||||
"@types/d3-axis": "3.0.6",
|
||||
"@types/d3-shape": "3.0.0",
|
||||
"@types/d3-scale": "4.0.8",
|
||||
"@types/d3-selection": "3.0.10",
|
||||
"@types/d3-shape": "3.0.0",
|
||||
"@types/eventemitter3": "1.2.0",
|
||||
"@types/jasmine": "5.1.2",
|
||||
"@types/lodash": "4.14.192",
|
||||
"@types/lodash": "4.17.0",
|
||||
"@types/sinonjs__fake-timers": "8.1.5",
|
||||
"@vue/compiler-sfc": "3.4.3",
|
||||
"babel-loader": "9.1.0",
|
||||
"babel-plugin-istanbul": "6.1.1",
|
||||
"codecov": "3.8.3",
|
||||
"comma-separated-values": "3.6.4",
|
||||
"copy-webpack-plugin": "11.0.0",
|
||||
"copy-webpack-plugin": "12.0.2",
|
||||
"cspell": "7.3.8",
|
||||
"css-loader": "6.10.0",
|
||||
"d3-axis": "3.0.0",
|
||||
"d3-shape": "3.0.0",
|
||||
"d3-scale": "4.0.2",
|
||||
"d3-selection": "3.0.0",
|
||||
"d3-shape": "3.0.0",
|
||||
"eslint": "8.56.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
"eslint-plugin-compat": "4.2.0",
|
||||
@ -45,7 +46,7 @@
|
||||
"flatbush": "4.2.0",
|
||||
"git-rev-sync": "3.0.2",
|
||||
"html2canvas": "1.4.1",
|
||||
"imports-loader": "4.0.1",
|
||||
"imports-loader": "5.0.0",
|
||||
"jasmine-core": "5.1.1",
|
||||
"karma": "6.4.2",
|
||||
"karma-chrome-launcher": "3.2.0",
|
||||
@ -56,7 +57,7 @@
|
||||
"karma-junit-reporter": "2.0.1",
|
||||
"karma-sourcemap-loader": "0.4.0",
|
||||
"karma-spec-reporter": "0.0.36",
|
||||
"karma-webpack": "5.0.0",
|
||||
"karma-webpack": "5.0.1",
|
||||
"location-bar": "3.0.1",
|
||||
"lodash": "4.17.21",
|
||||
"marked": "12.0.0",
|
||||
@ -64,7 +65,7 @@
|
||||
"moment": "2.30.1",
|
||||
"moment-duration-format": "2.3.2",
|
||||
"moment-timezone": "0.5.41",
|
||||
"npm-run-all2": "6.1.1",
|
||||
"npm-run-all2": "6.1.2",
|
||||
"nyc": "15.1.0",
|
||||
"painterro": "1.2.87",
|
||||
"plotly.js-basic-dist-min": "2.29.1",
|
||||
@ -74,7 +75,7 @@
|
||||
"printj": "1.3.1",
|
||||
"resolve-url-loader": "5.0.0",
|
||||
"sanitize-html": "2.12.1",
|
||||
"sass": "1.68.0",
|
||||
"sass": "1.71.1",
|
||||
"sass-loader": "14.1.1",
|
||||
"sinon": "17.0.0",
|
||||
"style-loader": "3.3.3",
|
||||
@ -91,7 +92,7 @@
|
||||
"webpack-merge": "5.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rm -rf ./dist ./node_modules ./package-lock.json ./coverage ./html-test-results ./test-results ./.nyc_output ",
|
||||
"clean": "rm -rf ./dist ./node_modules ./coverage ./html-test-results ./test-results ./.nyc_output ",
|
||||
"start": "npx webpack serve --config ./.webpack/webpack.dev.js",
|
||||
"start:prod": "npx webpack serve --config ./.webpack/webpack.prod.js",
|
||||
"start:coverage": "npx webpack serve --config ./.webpack/webpack.coverage.js",
|
||||
@ -156,4 +157,4 @@
|
||||
"keywords": [
|
||||
"nasa"
|
||||
]
|
||||
}
|
||||
}
|
@ -74,6 +74,7 @@ import Browse from './ui/router/Browse.js';
|
||||
* or registering extensions before the application is started.
|
||||
* @constructor
|
||||
* @memberof module:openmct
|
||||
* @extends EventEmitter
|
||||
*/
|
||||
export class MCT extends EventEmitter {
|
||||
constructor() {
|
||||
|
@ -23,7 +23,7 @@
|
||||
let brandingOptions = {};
|
||||
|
||||
/**
|
||||
* @typedef {object} BrandingOptions
|
||||
* @typedef {Object} BrandingOptions
|
||||
* @property {string} smallLogoImage URL to the image to use as the applications logo.
|
||||
* This logo will appear on every screen and when clicked will launch the about dialog.
|
||||
* @property {string} aboutHtml Custom content for the about screen. When defined the
|
||||
|
@ -26,12 +26,12 @@ import { v4 as uuid } from 'uuid';
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @enum {String} AnnotationType
|
||||
* @property {String} NOTEBOOK The notebook annotation type
|
||||
* @property {String} GEOSPATIAL The geospatial annotation type
|
||||
* @property {String} PIXEL_SPATIAL The pixel-spatial annotation type
|
||||
* @property {String} TEMPORAL The temporal annotation type
|
||||
* @property {String} PLOT_SPATIAL The plot-spatial annotation type
|
||||
* @enum {string} AnnotationType
|
||||
* @property {string} NOTEBOOK The notebook annotation type
|
||||
* @property {string} GEOSPATIAL The geospatial annotation type
|
||||
* @property {string} PIXEL_SPATIAL The pixel-spatial annotation type
|
||||
* @property {string} TEMPORAL The temporal annotation type
|
||||
* @property {string} PLOT_SPATIAL The plot-spatial annotation type
|
||||
*/
|
||||
const ANNOTATION_TYPES = Object.freeze({
|
||||
NOTEBOOK: 'NOTEBOOK',
|
||||
@ -47,9 +47,9 @@ const ANNOTATION_LAST_CREATED = 'annotationLastCreated';
|
||||
|
||||
/**
|
||||
* @typedef {Object} Tag
|
||||
* @property {String} key a unique identifier for the tag
|
||||
* @property {String} backgroundColor eg. "#cc0000"
|
||||
* @property {String} foregroundColor eg. "#ffffff"
|
||||
* @property {string} key a unique identifier for the tag
|
||||
* @property {string} backgroundColor eg. "#cc0000"
|
||||
* @property {string} foregroundColor eg. "#ffffff"
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -112,11 +112,11 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
/**
|
||||
* Creates an annotation on a given domain object (e.g., a plot) and a set of targets (e.g., telemetry objects)
|
||||
* @typedef {Object} CreateAnnotationOptions
|
||||
* @property {String} name a name for the new annotation (e.g., "Plot annnotation")
|
||||
* @property {string} name a name for the new annotation (e.g., "Plot annnotation")
|
||||
* @property {DomainObject} domainObject the domain object this annotation was created with
|
||||
* @property {ANNOTATION_TYPES} annotationType the type of annotation to create (e.g., PLOT_SPATIAL)
|
||||
* @property {Tag[]} tags tags to add to the annotation, e.g., SCIENCE for science related annotations
|
||||
* @property {String} contentText Some text to add to the annotation, e.g. ("This annotation is about science")
|
||||
* @property {string} contentText Some text to add to the annotation, e.g. ("This annotation is about science")
|
||||
* @property {Array<Object>} targets The targets ID keystrings and their specific properties.
|
||||
* For plots, this will be a bounding box, e.g.: {keyString: "d8385009-789d-457b-acc7-d50ba2fd55ea", maxY: 100, minY: 0, maxX: 100, minX: 0}
|
||||
* For notebooks, this will be an entry ID, e.g.: {entryId: "entry-ecb158f5-d23c-45e1-a704-649b382622ba"}
|
||||
@ -208,7 +208,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* @method defineTag
|
||||
* @param {String} key a unique identifier for the tag
|
||||
* @param {string} key a unique identifier for the tag
|
||||
* @param {Tag} tagsDefinition the definition of the tag to add
|
||||
*/
|
||||
defineTag(tagKey, tagsDefinition) {
|
||||
@ -217,7 +217,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* @method setNamespaceToSaveAnnotations
|
||||
* @param {String} namespace the namespace to save new annotations to
|
||||
* @param {string} namespace the namespace to save new annotations to
|
||||
*/
|
||||
setNamespaceToSaveAnnotations(namespace) {
|
||||
this.namespaceToSaveAnnotations = namespace;
|
||||
@ -226,7 +226,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
/**
|
||||
* @method isAnnotation
|
||||
* @param {DomainObject} domainObject the domainObject in question
|
||||
* @returns {Boolean} Returns true if the domain object is an annotation
|
||||
* @returns {boolean} Returns true if the domain object is an annotation
|
||||
*/
|
||||
isAnnotation(domainObject) {
|
||||
return domainObject && domainObject.type === ANNOTATION_TYPE;
|
||||
@ -442,7 +442,7 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* @method searchForTags
|
||||
* @param {String} query A query to match against tags. E.g., "dr" will match the tags "drilling" and "driving"
|
||||
* @param {string} query A query to match against tags. E.g., "dr" will match the tags "drilling" and "driving"
|
||||
* @param {Object} [abortController] An optional abort method to stop the query
|
||||
* @returns {Promise} returns a model of matching tags with their target domain objects attached
|
||||
*/
|
||||
|
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ListenerMap
|
||||
* @typedef {Object} ListenerMap
|
||||
* @property {Array.<any>} add
|
||||
* @property {Array.<any>} remove
|
||||
* @property {Array.<any>} load
|
||||
@ -271,7 +271,7 @@ export default class CompositionCollection {
|
||||
/**
|
||||
* Handle reorder from provider.
|
||||
* @private
|
||||
* @param {object} reorderMap
|
||||
* @param {Object} reorderMap
|
||||
*/
|
||||
#onProviderReorder(reorderMap) {
|
||||
this.#emit('reorder', reorderMap);
|
||||
|
@ -88,21 +88,21 @@ export default class FaultManagementAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} TriggerValueInfo
|
||||
* @typedef {Object} TriggerValueInfo
|
||||
* @property {number} value
|
||||
* @property {string} rangeCondition
|
||||
* @property {string} monitoringResult
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} CurrentValueInfo
|
||||
* @typedef {Object} CurrentValueInfo
|
||||
* @property {number} value
|
||||
* @property {string} rangeCondition
|
||||
* @property {string} monitoringResult
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Fault
|
||||
* @typedef {Object} Fault
|
||||
* @property {boolean} acknowledged
|
||||
* @property {CurrentValueInfo} currentValueInfo
|
||||
* @property {string} id
|
||||
@ -117,7 +117,7 @@ export default class FaultManagementAPI {
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} FaultAPIResponse
|
||||
* @typedef {Object} FaultAPIResponse
|
||||
* @property {string} type
|
||||
* @property {Fault} fault
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ export default class FormsAPI {
|
||||
* this formControlViewProvider is used inside form overlay to show/render a form row
|
||||
*
|
||||
* @public
|
||||
* @param {String} controlName a form structure, array of section
|
||||
* @param {string} controlName a form structure, array of section
|
||||
* @param {ControlViewProvider} controlViewProvider
|
||||
*/
|
||||
addNewFormControl(controlName, controlViewProvider) {
|
||||
@ -59,7 +59,7 @@ export default class FormsAPI {
|
||||
* Get a ControlViewProvider for a given/stored form controlName
|
||||
*
|
||||
* @public
|
||||
* @param {String} controlName a form structure, array of section
|
||||
* @param {string} controlName a form structure, array of section
|
||||
* @return {ControlViewProvider}
|
||||
*/
|
||||
getFormControl(controlName) {
|
||||
@ -69,7 +69,7 @@ export default class FormsAPI {
|
||||
/**
|
||||
* Section definition for formStructure
|
||||
* @typedef Section
|
||||
* @property {object} name Name of the section to display on Form
|
||||
* @property {Object} name Name of the section to display on Form
|
||||
* @property {string} cssClass class name for styling section
|
||||
* @property {array<Row>} rows collection of rows inside a section
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ import Menu, { MENU_PLACEMENT } from './menu.js';
|
||||
/**
|
||||
* Popup Menu options
|
||||
* @typedef {Object} MenuOptions
|
||||
* @property {String} menuClass Class for popup menu
|
||||
* @property {string} menuClass Class for popup menu
|
||||
* @property {MENU_PLACEMENT} placement Placement for menu relative to click
|
||||
* @property {Function} onDestroy callback function: invoked when menu is destroyed
|
||||
*/
|
||||
@ -33,10 +33,10 @@ import Menu, { MENU_PLACEMENT } from './menu.js';
|
||||
/**
|
||||
* Popup Menu Item/action
|
||||
* @typedef {Object} Action
|
||||
* @property {String} cssClass Class for menu item
|
||||
* @property {Boolean} isDisabled adds disable class if true
|
||||
* @property {String} name Menu item text
|
||||
* @property {String} description Menu item description
|
||||
* @property {string} cssClass Class for menu item
|
||||
* @property {boolean} isDisabled adds disable class if true
|
||||
* @property {string} name Menu item text
|
||||
* @property {string} description Menu item description
|
||||
* @property {Function} onItemClicked callback function: invoked when item is clicked
|
||||
*/
|
||||
|
||||
|
@ -29,10 +29,13 @@
|
||||
:key="action.name"
|
||||
role="menuitem"
|
||||
:aria-disabled="action.isDisabled"
|
||||
:class="action.cssClass"
|
||||
:aria-label="action.name"
|
||||
aria-describedby="item-description"
|
||||
:class="action.cssClass"
|
||||
:title="action.description"
|
||||
@click="action.onItemClicked"
|
||||
@mouseover="toggleItem(action)"
|
||||
@mouseleave="toggleItem()"
|
||||
>
|
||||
{{ action.name }}
|
||||
</li>
|
||||
@ -52,16 +55,23 @@
|
||||
v-for="action in options.actions"
|
||||
:key="action.name"
|
||||
role="menuitem"
|
||||
aria-describedby="item-description"
|
||||
:aria-disabled="action.isDisabled"
|
||||
:class="action.cssClass"
|
||||
:aria-label="action.name"
|
||||
:title="action.description"
|
||||
@click="action.onItemClicked"
|
||||
@mouseover="toggleItem(action)"
|
||||
@mouseleave="toggleItem()"
|
||||
>
|
||||
{{ action.name }}
|
||||
</li>
|
||||
<li v-if="options.actions.length === 0">No actions defined.</li>
|
||||
</ul>
|
||||
<div v-if="hoveredItem" id="item-description" class="visually-hidden" aria-live="polite">
|
||||
<span v-if="hoveredItem.name">{{ hoveredItem.name }}</span>
|
||||
<span v-if="hoveredItem.description">: {{ hoveredItem.description }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -70,11 +80,21 @@ import popupMenuMixin from '../mixins/popupMenuMixin.js';
|
||||
export default {
|
||||
mixins: [popupMenuMixin],
|
||||
inject: ['options'],
|
||||
data() {
|
||||
return {
|
||||
hoveredItem: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
optionsLabel() {
|
||||
const label = this.options.label ? `${this.options.label} Menu` : 'Menu';
|
||||
const label = this.options.label ? `${this.options.label} Context Menu` : 'Context Menu';
|
||||
return label;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleItem(action) {
|
||||
this.hoveredItem = action ?? null;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -38,8 +38,8 @@
|
||||
:key="action.name"
|
||||
role="menuitem"
|
||||
:aria-disabled="action.isDisabled"
|
||||
aria-describedby="item-description"
|
||||
:class="action.cssClass"
|
||||
:title="action.description"
|
||||
@click="action.onItemClicked"
|
||||
@mouseover="toggleItemDescription(action)"
|
||||
@mouseleave="toggleItemDescription()"
|
||||
@ -64,7 +64,7 @@
|
||||
role="menuitem"
|
||||
:class="action.cssClass"
|
||||
:aria-label="action.name"
|
||||
:title="action.description"
|
||||
aria-describedby="item-description"
|
||||
@click="action.onItemClicked"
|
||||
@mouseover="toggleItemDescription(action)"
|
||||
@mouseleave="toggleItemDescription()"
|
||||
@ -74,13 +74,13 @@
|
||||
<li v-if="options.actions.length === 0">No actions defined.</li>
|
||||
</ul>
|
||||
|
||||
<div class="c-super-menu__item-description">
|
||||
<div :class="['l-item-description__icon', 'bg-' + hoveredItem.cssClass]"></div>
|
||||
<div aria-live="polite" class="c-super-menu__item-description">
|
||||
<div :class="itemDescriptionIconClass"></div>
|
||||
<div class="l-item-description__name">
|
||||
{{ hoveredItem.name }}
|
||||
{{ hoveredItemName }}
|
||||
</div>
|
||||
<div class="l-item-description__description">
|
||||
{{ hoveredItem.description }}
|
||||
<div id="item-description" class="l-item-description__description">
|
||||
{{ hoveredItemDescription }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -90,26 +90,39 @@ import popupMenuMixin from '../mixins/popupMenuMixin.js';
|
||||
export default {
|
||||
mixins: [popupMenuMixin],
|
||||
inject: ['options'],
|
||||
data: function () {
|
||||
data() {
|
||||
return {
|
||||
hoveredItem: {}
|
||||
hoveredItem: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
optionsLabel() {
|
||||
const label = this.options.label ? `${this.options.label} Super Menu` : 'Super Menu';
|
||||
return label;
|
||||
},
|
||||
itemDescriptionIconClass() {
|
||||
const iconClass = ['l-item-description__icon'];
|
||||
if (this.hoveredItem) {
|
||||
iconClass.push('bg-' + this.hoveredItem.cssClass);
|
||||
}
|
||||
return iconClass;
|
||||
},
|
||||
hoveredItemName() {
|
||||
return this.hoveredItem?.name ?? '';
|
||||
},
|
||||
hoveredItemDescription() {
|
||||
return this.hoveredItem?.description ?? '';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleItemDescription(action = {}) {
|
||||
toggleItemDescription(action = null) {
|
||||
const hoveredItem = {
|
||||
name: action.name,
|
||||
description: action.description,
|
||||
cssClass: action.cssClass
|
||||
name: action?.name,
|
||||
description: action?.description,
|
||||
cssClass: action?.cssClass
|
||||
};
|
||||
|
||||
this.hoveredItem = Object.assign({}, this.hoveredItem, hoveredItem);
|
||||
this.hoveredItem = hoveredItem;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -34,7 +34,7 @@ import EventEmitter from 'eventemitter3';
|
||||
import moment from 'moment';
|
||||
|
||||
/**
|
||||
* @typedef {object} NotificationProperties
|
||||
* @typedef {Object} NotificationProperties
|
||||
* @property {function} dismiss Dismiss the notification
|
||||
* @property {NotificationModel} model The Notification model
|
||||
* @property {(progressPerc: number, progressText: string) => void} [progress] Update the progress of the notification
|
||||
@ -45,14 +45,14 @@ import moment from 'moment';
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} NotificationLink
|
||||
* @typedef {Object} NotificationLink
|
||||
* @property {function} onClick The function to be called when the link is clicked
|
||||
* @property {string} cssClass A CSS class name to style the link
|
||||
* @property {string} text The text to be displayed for the link
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} NotificationOptions
|
||||
* @typedef {Object} NotificationOptions
|
||||
* @property {number} [autoDismissTimeout] Milliseconds to wait before automatically dismissing the notification
|
||||
* @property {boolean} [minimized] Allows for a notification to be minimized into the indicator by default
|
||||
* @property {NotificationLink} [link] A link for the notification
|
||||
@ -66,7 +66,7 @@ import moment from 'moment';
|
||||
* and then minimized to a banner notification if needed, or vice-versa.
|
||||
*
|
||||
* @see DialogModel
|
||||
* @typedef {object} NotificationModel
|
||||
* @typedef {Object} NotificationModel
|
||||
* @property {string} message The message to be displayed by the notification
|
||||
* @property {number | 'unknown'} [progress] The progress of some ongoing task. Should be a number between 0 and 100, or
|
||||
* with the string literal 'unknown'.
|
||||
|
@ -391,7 +391,7 @@ class InMemorySearchProvider {
|
||||
* Dispatch a search query to the worker and return a queryId.
|
||||
*
|
||||
* @private
|
||||
* @returns {String} a unique query Id for the query.
|
||||
* @returns {string} a unique query Id for the query.
|
||||
*/
|
||||
#dispatchSearchToWorker({ queryId, searchType, query, maxResults }) {
|
||||
const message = {
|
||||
|
@ -34,7 +34,7 @@ import Transaction from './Transaction.js';
|
||||
/**
|
||||
* Uniquely identifies a domain object.
|
||||
*
|
||||
* @typedef {object} Identifier
|
||||
* @typedef {Object} Identifier
|
||||
* @property {string} namespace the namespace to/from which this domain
|
||||
* object should be loaded/stored.
|
||||
* @property {string} key a unique identifier for the domain object
|
||||
@ -51,7 +51,7 @@ import Transaction from './Transaction.js';
|
||||
* A few common properties are defined for domain objects. Beyond these,
|
||||
* individual types of domain objects may add more as they see fit.
|
||||
*
|
||||
* @typedef {object} DomainObject
|
||||
* @typedef {Object} DomainObject
|
||||
* @property {Identifier} identifier a key/namespace pair which
|
||||
* uniquely identifies this domain object
|
||||
* @property {string} type the type of domain object
|
||||
@ -249,7 +249,7 @@ export default class ObjectAPI {
|
||||
.get(identifier, abortSignal)
|
||||
.then((domainObject) => {
|
||||
delete this.cache[keystring];
|
||||
if (!domainObject && abortSignal.aborted) {
|
||||
if (!domainObject && abortSignal?.aborted) {
|
||||
// we've aborted the request
|
||||
return;
|
||||
}
|
||||
@ -572,8 +572,8 @@ export default class ObjectAPI {
|
||||
|
||||
/**
|
||||
* Return path of telemetry objects in the object composition
|
||||
* @param {object} identifier the identifier for the domain object to query for
|
||||
* @param {object} [telemetryIdentifier] the specific identifier for the telemetry
|
||||
* @param {Object} identifier the identifier for the domain object to query for
|
||||
* @param {Object} [telemetryIdentifier] the specific identifier for the telemetry
|
||||
* to look for in the composition, uses first object in composition otherwise
|
||||
* @returns {Array} path of telemetry object in object composition
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@ class OverlayAPI {
|
||||
* displaying messages that require the user's
|
||||
* immediate attention.
|
||||
* @param {model} options defines options for the dialog
|
||||
* @returns {object} with an object with a dismiss function that can be called from the calling code
|
||||
* @returns {Object} with an object with a dismiss function that can be called from the calling code
|
||||
* to dismiss/destroy the dialog
|
||||
*
|
||||
* A description of the model options that may be passed to the
|
||||
@ -134,7 +134,7 @@ class OverlayAPI {
|
||||
* Displays a blocking (modal) progress dialog. This dialog can be used for
|
||||
* displaying messages that require the user's attention, and show progress
|
||||
* @param {model} options defines options for the dialog
|
||||
* @returns {object} with an object with a dismiss function that can be called from the calling code
|
||||
* @returns {Object} with an object with a dismiss function that can be called from the calling code
|
||||
* to dismiss/destroy the dialog and an updateProgress function that takes progressPercentage(Number 0-100)
|
||||
* and progressText (string)
|
||||
*
|
||||
|
@ -20,7 +20,7 @@
|
||||
at runtime from the About dialog for additional information.
|
||||
-->
|
||||
<template>
|
||||
<div class="c-overlay js-overlay">
|
||||
<div class="c-overlay js-overlay" role="dialog" aria-modal="true" aria-label="Modal Overlay">
|
||||
<div class="c-overlay__blocker" @click="destroy"></div>
|
||||
<div class="c-overlay__outer">
|
||||
<button
|
||||
@ -34,9 +34,6 @@
|
||||
ref="element"
|
||||
class="c-overlay__contents js-notebook-snapshot-item-wrapper"
|
||||
tabindex="0"
|
||||
aria-modal="true"
|
||||
aria-label="Overlay"
|
||||
role="dialog"
|
||||
></div>
|
||||
<div v-if="buttons" class="c-overlay__button-bar">
|
||||
<button
|
||||
@ -61,7 +58,7 @@
|
||||
export default {
|
||||
inject: ['dismiss', 'element', 'buttons', 'dismissable'],
|
||||
emits: ['destroy'],
|
||||
data: function () {
|
||||
data() {
|
||||
return {
|
||||
focusIndex: -1
|
||||
};
|
||||
|
@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
import installWorker from './WebSocketWorker.js';
|
||||
const DEFAULT_RATE_MS = 1000;
|
||||
/**
|
||||
* Describes the strategy to be used when batching WebSocket messages
|
||||
*
|
||||
@ -51,11 +50,21 @@ const DEFAULT_RATE_MS = 1000;
|
||||
*
|
||||
* @memberof module:openmct.telemetry
|
||||
*/
|
||||
// Shim for Internet Explorer, I mean Safari. It doesn't support requestIdleCallback, but it's in a tech preview, so it will be dropping soon.
|
||||
const requestIdleCallback =
|
||||
// eslint-disable-next-line compat/compat
|
||||
window.requestIdleCallback ?? ((fn, { timeout }) => setTimeout(fn, timeout));
|
||||
const ONE_SECOND = 1000;
|
||||
const FIVE_SECONDS = 5 * ONE_SECOND;
|
||||
|
||||
class BatchingWebSocket extends EventTarget {
|
||||
#worker;
|
||||
#openmct;
|
||||
#showingRateLimitNotification;
|
||||
#rate;
|
||||
#maxBatchSize;
|
||||
#applicationIsInitializing;
|
||||
#maxBatchWait;
|
||||
#firstBatchReceived;
|
||||
|
||||
constructor(openmct) {
|
||||
super();
|
||||
@ -66,7 +75,10 @@ class BatchingWebSocket extends EventTarget {
|
||||
this.#worker = new Worker(workerUrl);
|
||||
this.#openmct = openmct;
|
||||
this.#showingRateLimitNotification = false;
|
||||
this.#rate = DEFAULT_RATE_MS;
|
||||
this.#maxBatchSize = Number.POSITIVE_INFINITY;
|
||||
this.#maxBatchWait = ONE_SECOND;
|
||||
this.#applicationIsInitializing = true;
|
||||
this.#firstBatchReceived = false;
|
||||
|
||||
const routeMessageToHandler = this.#routeMessageToHandler.bind(this);
|
||||
this.#worker.addEventListener('message', routeMessageToHandler);
|
||||
@ -78,6 +90,20 @@ class BatchingWebSocket extends EventTarget {
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
openmct.once('start', () => {
|
||||
// An idle callback is a pretty good indication that a complex display is done loading. At that point set the batch size more conservatively.
|
||||
// Force it after 5 seconds if it hasn't happened yet.
|
||||
requestIdleCallback(
|
||||
() => {
|
||||
this.#applicationIsInitializing = false;
|
||||
this.setMaxBatchSize(this.#maxBatchSize);
|
||||
},
|
||||
{
|
||||
timeout: FIVE_SECONDS
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,15 +156,7 @@ class BatchingWebSocket extends EventTarget {
|
||||
}
|
||||
|
||||
/**
|
||||
* When using batching, sets the rate at which batches of messages are released.
|
||||
* @param {Number} rate the amount of time to wait, in ms, between batches.
|
||||
*/
|
||||
setRate(rate) {
|
||||
this.#rate = rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Number} maxBatchSize the maximum length of a batch of messages. For example,
|
||||
* @param {number} maxBatchSize the maximum length of a batch of messages. For example,
|
||||
* the maximum number of telemetry values to batch before dropping them
|
||||
* Note that this is a fail-safe that is only invoked if performance drops to the
|
||||
* point where Open MCT cannot keep up with the amount of telemetry it is receiving.
|
||||
@ -151,12 +169,29 @@ class BatchingWebSocket extends EventTarget {
|
||||
* 15 would probably be a better batch size.
|
||||
*/
|
||||
setMaxBatchSize(maxBatchSize) {
|
||||
this.#maxBatchSize = maxBatchSize;
|
||||
if (!this.#applicationIsInitializing) {
|
||||
this.#sendMaxBatchSizeToWorker(this.#maxBatchSize);
|
||||
}
|
||||
}
|
||||
setMaxBatchWait(wait) {
|
||||
this.#maxBatchWait = wait;
|
||||
this.#sendBatchWaitToWorker(this.#maxBatchWait);
|
||||
}
|
||||
#sendMaxBatchSizeToWorker(maxBatchSize) {
|
||||
this.#worker.postMessage({
|
||||
type: 'setMaxBatchSize',
|
||||
maxBatchSize
|
||||
});
|
||||
}
|
||||
|
||||
#sendBatchWaitToWorker(maxBatchWait) {
|
||||
this.#worker.postMessage({
|
||||
type: 'setMaxBatchWait',
|
||||
maxBatchWait
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Disconnect the associated WebSocket. Generally speaking there is no need to call
|
||||
* this manually.
|
||||
@ -169,7 +204,9 @@ class BatchingWebSocket extends EventTarget {
|
||||
|
||||
#routeMessageToHandler(message) {
|
||||
if (message.data.type === 'batch') {
|
||||
if (message.data.batch.dropped === true && !this.#showingRateLimitNotification) {
|
||||
this.start = Date.now();
|
||||
const batch = message.data.batch;
|
||||
if (batch.dropped === true && !this.#showingRateLimitNotification) {
|
||||
const notification = this.#openmct.notifications.alert(
|
||||
'Telemetry dropped due to client rate limiting.',
|
||||
{ hint: 'Refresh individual telemetry views to retrieve dropped telemetry if needed.' }
|
||||
@ -179,16 +216,45 @@ class BatchingWebSocket extends EventTarget {
|
||||
this.#showingRateLimitNotification = false;
|
||||
});
|
||||
}
|
||||
this.dispatchEvent(new CustomEvent('batch', { detail: message.data.batch }));
|
||||
setTimeout(() => {
|
||||
this.#readyForNextBatch();
|
||||
}, this.#rate);
|
||||
|
||||
this.dispatchEvent(new CustomEvent('batch', { detail: batch }));
|
||||
this.#waitUntilIdleAndRequestNextBatch(batch);
|
||||
} else if (message.data.type === 'message') {
|
||||
this.dispatchEvent(new CustomEvent('message', { detail: message.data.message }));
|
||||
} else if (message.data.type === 'reconnected') {
|
||||
this.dispatchEvent(new CustomEvent('reconnected'));
|
||||
} else {
|
||||
throw new Error(`Unknown message type: ${message.data.type}`);
|
||||
}
|
||||
}
|
||||
|
||||
#waitUntilIdleAndRequestNextBatch(batch) {
|
||||
requestIdleCallback(
|
||||
(state) => {
|
||||
if (this.#firstBatchReceived === false) {
|
||||
this.#firstBatchReceived = true;
|
||||
}
|
||||
const now = Date.now();
|
||||
const waitedFor = now - this.start;
|
||||
if (state.didTimeout === true) {
|
||||
if (document.visibilityState === 'visible') {
|
||||
console.warn(`Event loop is too busy to process batch.`);
|
||||
this.#waitUntilIdleAndRequestNextBatch(batch);
|
||||
} else {
|
||||
// After ingesting a telemetry batch, wait until the event loop is idle again before
|
||||
// informing the worker we are ready for another batch.
|
||||
this.#readyForNextBatch();
|
||||
}
|
||||
} else {
|
||||
if (waitedFor > ONE_SECOND) {
|
||||
console.warn(`Warning, batch processing took ${waitedFor}ms`);
|
||||
}
|
||||
this.#readyForNextBatch();
|
||||
}
|
||||
},
|
||||
{ timeout: ONE_SECOND }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default BatchingWebSocket;
|
||||
|