mirror of
https://github.com/nasa/openmct.git
synced 2025-06-28 19:53:02 +00:00
Compare commits
299 Commits
omm-large-
...
a11y-impro
Author | SHA1 | Date | |
---|---|---|---|
429e0a90c6 | |||
715a44864e | |||
0d97675a0a | |||
ec910dcbdc | |||
0ce36c8297 | |||
3fccac0bfc | |||
2675220452 | |||
4075a31d96 | |||
7f95325816 | |||
e07ba61c4c | |||
97bffc554f | |||
250db8d7f9 | |||
3520a929a9 | |||
800b03ad60 | |||
902ed0274a | |||
9ed8d4f5a5 | |||
93e5219917 | |||
2d9c0414f7 | |||
a3e0a0f694 | |||
5ec155c7ce | |||
cfb190fb68 | |||
72e0621ecd | |||
e7b9481aa9 | |||
2dc1388737 | |||
41bee3111c | |||
97cb783c4b | |||
39a31617b8 | |||
415b65237b | |||
28bfc90036 | |||
7ce3ed5597 | |||
b9ae461b7d | |||
15ee8303e4 | |||
a914e4f1f7 | |||
cdd772aa87 | |||
7f8262b882 | |||
deacd91078 | |||
29b7c389ad | |||
591b5745a8 | |||
4b0abdf54f | |||
0c19260028 | |||
2cc00271b1 | |||
3c933eaa19 | |||
b829735d64 | |||
51eb2a4f59 | |||
09b7873fbd | |||
c3eef44beb | |||
34d3ba0cff | |||
5fd24cb689 | |||
a64faae394 | |||
d44e06d598 | |||
bfcab6b327 | |||
1f24cbed1f | |||
da7d0df736 | |||
8e7c02069e | |||
4dbca9cb09 | |||
bc0c0d63c1 | |||
0d27938843 | |||
02f1013770 | |||
bdff210a9c | |||
ae22920576 | |||
a0fd1f0171 | |||
c7fd584b58 | |||
16ca994cfa | |||
ebe5323f82 | |||
7a8a6d3649 | |||
25e7a16c77 | |||
141939295a | |||
2c1040c7c0 | |||
d94fe8806b | |||
7bf983210c | |||
8f92cd4206 | |||
13311b9fc8 | |||
2daec448da | |||
5bd8d17592 | |||
954c72b100 | |||
43338f3980 | |||
1414f54c17 | |||
9849e0398e | |||
76889cf60d | |||
26d3bd1e69 | |||
a16a1d35b6 | |||
97b2ebc0bb | |||
6b32c63039 | |||
084784a409 | |||
734a8dd592 | |||
5eed5de3bb | |||
ce59c0f50a | |||
d53d8d562e | |||
d973140906 | |||
b1169ffd7d | |||
ede93d881c | |||
6947c912a7 | |||
2243381d52 | |||
3c7d3397d6 | |||
9f8338124f | |||
ab0e2d2c96 | |||
c3b5e4e1e3 | |||
8fc5aa6ed5 | |||
5592d20ab1 | |||
ce2305455a | |||
ff2c8b35b0 | |||
482f1f68dd | |||
05c7a81630 | |||
b8949db767 | |||
61e7050391 | |||
3f51516da9 | |||
541a022f36 | |||
c7b5ecbd68 | |||
6776cc308f | |||
95ac919ddf | |||
2a1064cbab | |||
8e917b2679 | |||
0be106f29e | |||
9f7b3b9225 | |||
e9b94c308b | |||
64740e133f | |||
c27ad469f6 | |||
e09a7aebae | |||
b87459dfd7 | |||
ca06a6a047 | |||
95e3ab25a4 | |||
f9db6433a1 | |||
cbac2c1c82 | |||
a8678aa739 | |||
244e3b7938 | |||
42b13c4dfb | |||
351800b32a | |||
6db390a71a | |||
9ece4e55dc | |||
0a497483f2 | |||
a52577e729 | |||
a495e86231 | |||
bada228b8f | |||
3f80b53ea6 | |||
99a3e3fc32 | |||
2d92223e16 | |||
f21685e216 | |||
6c92e31036 | |||
82b1760b0e | |||
87feb0db34 | |||
c53073b339 | |||
57743e5918 | |||
f3b819a786 | |||
50694f600c | |||
10f3e13e4d | |||
9be9c5e28e | |||
58aeac94ac | |||
1e3097f54b | |||
6a9ff91d93 | |||
accfbc96ab | |||
9942bbbc0f | |||
4287cd5413 | |||
ee6ca11558 | |||
676bb81eab | |||
c6305697c0 | |||
0421936874 | |||
95e686038d | |||
f705bf9a61 | |||
50559ac502 | |||
f0ef93dd3f | |||
3ae14cf786 | |||
194eb43607 | |||
3c2b032526 | |||
d4e51cbaf1 | |||
7c58b19c3e | |||
16e1ac2529 | |||
4885c816dc | |||
42b545917c | |||
85974fc5f1 | |||
761d4ce7e4 | |||
5b1298f221 | |||
662d14354c | |||
e386036dbf | |||
6e79e5e2b0 | |||
32529ff6b2 | |||
92329b3d8e | |||
cde8fbbb0d | |||
795d7a7ec7 | |||
5031010a00 | |||
ac22bebe76 | |||
d08ea62932 | |||
293f25df19 | |||
9c22bcfb3e | |||
3b0e05ed14 | |||
ff7f55574d | |||
58f869b21b | |||
834a19f996 | |||
1d7cd64652 | |||
68ed7bf0e5 | |||
4b39ef3235 | |||
b685b9582e | |||
d8ac209a96 | |||
f254d4f078 | |||
c75a82dca5 | |||
9423591e4d | |||
5a7174bf2a | |||
d305443445 | |||
bd5cb8139c | |||
022dffd419 | |||
4c5de37cff | |||
fb5bbde154 | |||
9a01cee5fa | |||
8b2d3b0622 | |||
60df9e79c1 | |||
5a1e544a4c | |||
040ef0b998 | |||
f77287530b | |||
3cc93c0656 | |||
d71287b318 | |||
943a40680f | |||
351e6a0fbf | |||
1f514dde3d | |||
47121cfbe8 | |||
44c4d4ff47 | |||
dc1d046822 | |||
cdb20b9950 | |||
a9158a90d5 | |||
07373817b0 | |||
9247951456 | |||
47c5863edf | |||
295bfe9294 | |||
1c6214fe79 | |||
4cab97cb4b | |||
0bafdad605 | |||
4d375ec765 | |||
47b44cebba | |||
fea68381a7 | |||
356c90ca45 | |||
7e12a45960 | |||
804dbf0cab | |||
caa7bc6fae | |||
172e0b23fd | |||
5df7971438 | |||
b39d5e8bcc | |||
c5188397e4 | |||
225fa22c72 | |||
2c3b6fa540 | |||
496ab4d5a3 | |||
aad9e51262 | |||
ba4353aacb | |||
9f079255f1 | |||
f5eacc504b | |||
26fa1653e3 | |||
b7c68f715b | |||
549a579bf3 | |||
fe677fa359 | |||
1bbc3789ec | |||
636849885b | |||
6f2b20eee9 | |||
e38821cc1f | |||
4345d216f7 | |||
84a12c7833 | |||
ad8445114f | |||
bcd50dfa35 | |||
a798ddf05e | |||
7af7e68779 | |||
c200999659 | |||
ddeeff4822 | |||
5610846147 | |||
88fde47932 | |||
2a0faba35f | |||
a47abf5f96 | |||
968eee6698 | |||
43d56a68bb | |||
f055a8a0c7 | |||
2820237d60 | |||
dbdc9bb4e2 | |||
a9a98380f2 | |||
e3ab085dd5 | |||
519135527b | |||
fc37f6e05b | |||
ab1df89396 | |||
9ee5ab96f3 | |||
8b2c6e3fb3 | |||
b8b0a08eeb | |||
633b6be2fd | |||
4963aff8a0 | |||
6786be54fa | |||
b081389e68 | |||
7a3ec3a241 | |||
c0c383bf18 | |||
fe1c99de12 | |||
2e60da0401 | |||
bc3a5408b4 | |||
344bf8eed3 | |||
cbb3368937 | |||
b7a671d392 | |||
4f10a93ef5 | |||
f8186e4b4e | |||
4e0c364d89 | |||
f3bed9c651 | |||
4d93907d58 | |||
6f656a6783 | |||
767fb6c5fd | |||
b0a0b4bb58 | |||
340f4a9e79 | |||
3007b28b0f | |||
20789601b4 | |||
a56cfed732 |
@ -2,19 +2,23 @@ version: 2.1
|
|||||||
executors:
|
executors:
|
||||||
pw-focal-development:
|
pw-focal-development:
|
||||||
docker:
|
docker:
|
||||||
- image: mcr.microsoft.com/playwright:v1.29.0-focal
|
- image: mcr.microsoft.com/playwright:v1.39.0-focal
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
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_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_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||||
|
ubuntu:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2204:current
|
||||||
|
docker_layer_caching: true
|
||||||
parameters:
|
parameters:
|
||||||
BUST_CACHE:
|
BUST_CACHE:
|
||||||
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
description: 'Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!'
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
commands:
|
commands:
|
||||||
build_and_install:
|
build_and_install:
|
||||||
description: "All steps used to build and install. Will use cache if found"
|
description: 'All steps used to build and install. Will use cache if found'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
@ -23,53 +27,52 @@ commands:
|
|||||||
- restore_cache_cmd:
|
- restore_cache_cmd:
|
||||||
node-version: << parameters.node-version >>
|
node-version: << parameters.node-version >>
|
||||||
- node/install:
|
- node/install:
|
||||||
install-npm: true
|
|
||||||
node-version: << parameters.node-version >>
|
node-version: << parameters.node-version >>
|
||||||
- run: npm install --prefer-offline --no-audit --progress=false
|
- run: npm install --no-audit --progress=false
|
||||||
restore_cache_cmd:
|
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"
|
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:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- when:
|
- when:
|
||||||
condition:
|
condition:
|
||||||
equal: [false, << pipeline.parameters.BUST_CACHE >> ]
|
equal: [false, << pipeline.parameters.BUST_CACHE >>]
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||||
save_cache_cmd:
|
save_cache_cmd:
|
||||||
description: "Custom command for saving cache."
|
description: 'Custom command for saving cache.'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||||
paths:
|
paths:
|
||||||
- ~/.npm
|
- ~/.npm
|
||||||
- node_modules
|
- node_modules
|
||||||
generate_and_store_version_and_filesystem_artifacts:
|
generate_and_store_version_and_filesystem_artifacts:
|
||||||
description: "Track important packages and files"
|
description: 'Track important packages and files'
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
mkdir /tmp/artifacts
|
[[ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
|
||||||
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt
|
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt || true
|
||||||
npm -v >> /tmp/artifacts/npm-version.txt
|
npm -v >> /tmp/artifacts/npm-version.txt
|
||||||
node -v >> /tmp/artifacts/node-version.txt
|
node -v >> /tmp/artifacts/node-version.txt
|
||||||
ls -latR >> /tmp/artifacts/dir.txt
|
ls -latR >> /tmp/artifacts/dir.txt
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/artifacts/
|
path: /tmp/artifacts/
|
||||||
generate_e2e_code_cov_report:
|
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:
|
parameters:
|
||||||
suite:
|
suite:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- run: npm run cov:e2e:report || true
|
- run: npm run cov:e2e:report || true
|
||||||
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
||||||
orbs:
|
orbs:
|
||||||
node: circleci/node@4.9.0
|
node: circleci/node@5.1.0
|
||||||
browser-tools: circleci/browser-tools@1.3.0
|
browser-tools: circleci/browser-tools@1.3.0
|
||||||
jobs:
|
jobs:
|
||||||
npm-audit:
|
npm-audit:
|
||||||
@ -110,26 +113,32 @@ jobs:
|
|||||||
path: dist/reports/tests/
|
path: dist/reports/tests/
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: coverage
|
path: coverage
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts 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
|
||||||
e2e-test:
|
e2e-test:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
|
||||||
type: string
|
|
||||||
suite: #stable or full
|
suite: #stable or full
|
||||||
type: string
|
type: string
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
parallelism: 4
|
parallelism: 6
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: lts/hydrogen
|
||||||
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
||||||
condition:
|
condition:
|
||||||
equal: [ "full", <<parameters.suite>> ]
|
equal: ['full', <<parameters.suite>>]
|
||||||
steps:
|
steps:
|
||||||
- run: npx playwright install chrome-beta
|
- run: npx playwright install chrome-beta
|
||||||
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
||||||
- generate_e2e_code_cov_report:
|
- when:
|
||||||
suite: <<parameters.suite>>
|
condition:
|
||||||
|
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_e2e_code_cov_report:
|
||||||
|
suite: <<parameters.suite>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
@ -138,81 +147,138 @@ jobs:
|
|||||||
path: coverage
|
path: coverage
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts 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
|
||||||
|
e2e-couchdb:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- build_and_install:
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- run: npx playwright@1.39.0 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
|
||||||
|
sleep 3
|
||||||
|
bash src/plugins/persistence/couch/setup-couchdb.sh
|
||||||
|
- run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh #Replace LocalStorage Plugin with CouchDB
|
||||||
|
- run: npm run test:e2e:couchdb
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
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_e2e_code_cov_report:
|
||||||
|
suite: full #add to full suite
|
||||||
|
- store_test_results:
|
||||||
|
path: test-results/results.xml
|
||||||
|
- store_artifacts:
|
||||||
|
path: test-results
|
||||||
|
- store_artifacts:
|
||||||
|
path: coverage
|
||||||
|
- store_artifacts:
|
||||||
|
path: html-test-results
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts 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
|
||||||
|
mem-test:
|
||||||
|
executor: pw-focal-development
|
||||||
|
steps:
|
||||||
|
- build_and_install:
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- run: npm run test:perf:memory
|
||||||
|
- store_test_results:
|
||||||
|
path: test-results/results.xml
|
||||||
|
- store_artifacts:
|
||||||
|
path: test-results
|
||||||
|
- store_artifacts:
|
||||||
|
path: html-test-results
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
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
|
||||||
perf-test:
|
perf-test:
|
||||||
parameters:
|
|
||||||
node-version:
|
|
||||||
type: string
|
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: lts/hydrogen
|
||||||
- run: npm run test:perf
|
- run: npm run test:perf:localhost
|
||||||
|
- run: npm run test:perf:contract
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
visual-test:
|
condition:
|
||||||
|
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:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
suite:
|
||||||
type: string
|
type: string # ci or full
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: lts/hydrogen
|
||||||
- run: npm run test:e2e:visual
|
- run: npm run test:e2e:visual:<<parameters.suite>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts 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
|
||||||
workflows:
|
workflows:
|
||||||
overall-circleci-commit-status: #These jobs run on every commit
|
overall-circleci-commit-status: #These jobs run on every commit
|
||||||
jobs:
|
jobs:
|
||||||
- lint:
|
- lint:
|
||||||
name: node14-lint
|
name: node20-lint
|
||||||
node-version: lts/fermium
|
node-version: lts/iron
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-stable
|
name: e2e-stable
|
||||||
node-version: lts/gallium
|
|
||||||
suite: stable
|
suite: stable
|
||||||
- perf-test:
|
- mem-test
|
||||||
node-version: lts/gallium
|
- perf-test
|
||||||
- visual-test:
|
- visual-a11y-tests:
|
||||||
node-version: lts/gallium
|
name: visual-test-ci
|
||||||
|
suite: ci
|
||||||
|
|
||||||
the-nightly: #These jobs do not run on PRs, but against master at night
|
the-nightly: #These jobs do not run on PRs, but against master at night
|
||||||
jobs:
|
jobs:
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node14-chrome-nightly
|
name: node20-chrome-nightly
|
||||||
node-version: lts/fermium
|
node-version: lts/iron
|
||||||
- unit-test:
|
|
||||||
name: node16-chrome-nightly
|
|
||||||
node-version: lts/gallium
|
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
- npm-audit:
|
- npm-audit:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-full-nightly
|
name: e2e-full-nightly
|
||||||
node-version: lts/gallium
|
|
||||||
suite: full
|
suite: full
|
||||||
- perf-test:
|
- mem-test
|
||||||
node-version: lts/gallium
|
- perf-test
|
||||||
- visual-test:
|
- visual-a11y-tests:
|
||||||
node-version: lts/gallium
|
name: visual-test-nightly
|
||||||
|
suite: full
|
||||||
|
- e2e-couchdb
|
||||||
triggers:
|
triggers:
|
||||||
- schedule:
|
- schedule:
|
||||||
cron: "0 0 * * *"
|
cron: '0 0 * * *'
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
507
.cspell.json
Normal file
507
.cspell.json
Normal file
@ -0,0 +1,507 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2",
|
||||||
|
"language": "en,en-us",
|
||||||
|
"words": [
|
||||||
|
"gress",
|
||||||
|
"doctoc",
|
||||||
|
"minmax",
|
||||||
|
"openmct",
|
||||||
|
"datasources",
|
||||||
|
"recieved",
|
||||||
|
"evalute",
|
||||||
|
"Sinewave",
|
||||||
|
"deregistration",
|
||||||
|
"unregisters",
|
||||||
|
"configutation",
|
||||||
|
"configuation",
|
||||||
|
"codecov",
|
||||||
|
"carryforward",
|
||||||
|
"Chacon",
|
||||||
|
"Straub",
|
||||||
|
"OWASP",
|
||||||
|
"Testathon",
|
||||||
|
"exploratorily",
|
||||||
|
"Testathons",
|
||||||
|
"testathon",
|
||||||
|
"npmjs",
|
||||||
|
"publishj",
|
||||||
|
"treeitem",
|
||||||
|
"timespan",
|
||||||
|
"Timespan",
|
||||||
|
"spinbutton",
|
||||||
|
"popout",
|
||||||
|
"textbox",
|
||||||
|
"tablist",
|
||||||
|
"Telem",
|
||||||
|
"codecoverage",
|
||||||
|
"browserless",
|
||||||
|
"networkidle",
|
||||||
|
"nums",
|
||||||
|
"mgmt",
|
||||||
|
"faultname",
|
||||||
|
"gantt",
|
||||||
|
"sharded",
|
||||||
|
"perfromance",
|
||||||
|
"MMOC",
|
||||||
|
"deploysentinel",
|
||||||
|
"codegen",
|
||||||
|
"Unfortuantely",
|
||||||
|
"viewports",
|
||||||
|
"updatesnapshots",
|
||||||
|
"excercised",
|
||||||
|
"Circel",
|
||||||
|
"browsercontexts",
|
||||||
|
"miminum",
|
||||||
|
"testcase",
|
||||||
|
"testsuite",
|
||||||
|
"domcontentloaded",
|
||||||
|
"Tracefile",
|
||||||
|
"lcov",
|
||||||
|
"linecov",
|
||||||
|
"Browserless",
|
||||||
|
"webserver",
|
||||||
|
"yamcs",
|
||||||
|
"quickstart",
|
||||||
|
"subobject",
|
||||||
|
"autosize",
|
||||||
|
"Horz",
|
||||||
|
"vehicula",
|
||||||
|
"Praesent",
|
||||||
|
"pharetra",
|
||||||
|
"Duis",
|
||||||
|
"eget",
|
||||||
|
"arcu",
|
||||||
|
"elementum",
|
||||||
|
"mauris",
|
||||||
|
"Donec",
|
||||||
|
"nunc",
|
||||||
|
"quis",
|
||||||
|
"Proin",
|
||||||
|
"elit",
|
||||||
|
"Nunc",
|
||||||
|
"Aenean",
|
||||||
|
"mollis",
|
||||||
|
"hendrerit",
|
||||||
|
"Vestibulum",
|
||||||
|
"placerat",
|
||||||
|
"velit",
|
||||||
|
"augue",
|
||||||
|
"Quisque",
|
||||||
|
"mattis",
|
||||||
|
"lectus",
|
||||||
|
"rutrum",
|
||||||
|
"Fusce",
|
||||||
|
"tincidunt",
|
||||||
|
"nibh",
|
||||||
|
"blandit",
|
||||||
|
"urna",
|
||||||
|
"Nullam",
|
||||||
|
"congue",
|
||||||
|
"enim",
|
||||||
|
"Morbi",
|
||||||
|
"bibendum",
|
||||||
|
"Vivamus",
|
||||||
|
"imperdiet",
|
||||||
|
"Pellentesque",
|
||||||
|
"cursus",
|
||||||
|
"Aliquam",
|
||||||
|
"orci",
|
||||||
|
"Suspendisse",
|
||||||
|
"amet",
|
||||||
|
"justo",
|
||||||
|
"Etiam",
|
||||||
|
"vestibulum",
|
||||||
|
"ullamcorper",
|
||||||
|
"Cras",
|
||||||
|
"aliquet",
|
||||||
|
"Mauris",
|
||||||
|
"Nulla",
|
||||||
|
"scelerisque",
|
||||||
|
"viverra",
|
||||||
|
"metus",
|
||||||
|
"condimentum",
|
||||||
|
"varius",
|
||||||
|
"nulla",
|
||||||
|
"sapien",
|
||||||
|
"Curabitur",
|
||||||
|
"tristique",
|
||||||
|
"Nonsectetur",
|
||||||
|
"convallis",
|
||||||
|
"accumsan",
|
||||||
|
"lacus",
|
||||||
|
"posuere",
|
||||||
|
"turpis",
|
||||||
|
"egestas",
|
||||||
|
"feugiat",
|
||||||
|
"tortor",
|
||||||
|
"faucibus",
|
||||||
|
"euismod",
|
||||||
|
"pratices",
|
||||||
|
"pathing",
|
||||||
|
"pases",
|
||||||
|
"testcases",
|
||||||
|
"Noneditable",
|
||||||
|
"listitem",
|
||||||
|
"Gantt",
|
||||||
|
"timelist",
|
||||||
|
"timestrip",
|
||||||
|
"networkevents",
|
||||||
|
"fetchpriority",
|
||||||
|
"persistable",
|
||||||
|
"Persistable",
|
||||||
|
"persistability",
|
||||||
|
"Persistability",
|
||||||
|
"testdata",
|
||||||
|
"Testdata",
|
||||||
|
"metdata",
|
||||||
|
"timeconductor",
|
||||||
|
"contenteditable",
|
||||||
|
"autoscale",
|
||||||
|
"Autoscale",
|
||||||
|
"prepan",
|
||||||
|
"sinewave",
|
||||||
|
"cyanish",
|
||||||
|
"driv",
|
||||||
|
"searchbox",
|
||||||
|
"datetime",
|
||||||
|
"timeframe",
|
||||||
|
"recents",
|
||||||
|
"recentobjects",
|
||||||
|
"gsearch",
|
||||||
|
"Disp",
|
||||||
|
"Cloc",
|
||||||
|
"noselect",
|
||||||
|
"requestfailed",
|
||||||
|
"viewlarge",
|
||||||
|
"Imageurl",
|
||||||
|
"thumbstrip",
|
||||||
|
"checkmark",
|
||||||
|
"Unshelve",
|
||||||
|
"autosized",
|
||||||
|
"chacskaylo",
|
||||||
|
"numberfield",
|
||||||
|
"OPENMCT",
|
||||||
|
"Autoflow",
|
||||||
|
"Timelist",
|
||||||
|
"faultmanagement",
|
||||||
|
"GEOSPATIAL",
|
||||||
|
"geospatial",
|
||||||
|
"plotspatial",
|
||||||
|
"annnotation",
|
||||||
|
"keystrings",
|
||||||
|
"undelete",
|
||||||
|
"sometag",
|
||||||
|
"containee",
|
||||||
|
"composability",
|
||||||
|
"mutables",
|
||||||
|
"Mutables",
|
||||||
|
"composee",
|
||||||
|
"handleoutsideclick",
|
||||||
|
"Datetime",
|
||||||
|
"Perc",
|
||||||
|
"autodismiss",
|
||||||
|
"filetree",
|
||||||
|
"deeptailor",
|
||||||
|
"keystring",
|
||||||
|
"reindex",
|
||||||
|
"unlisten",
|
||||||
|
"symbolsfont",
|
||||||
|
"ellipsize",
|
||||||
|
"dismissable",
|
||||||
|
"TIMESYSTEM",
|
||||||
|
"Metadatas",
|
||||||
|
"stalenes",
|
||||||
|
"receieves",
|
||||||
|
"unsub",
|
||||||
|
"callbacktwo",
|
||||||
|
"unsubscribetwo",
|
||||||
|
"telem",
|
||||||
|
"Telemetery",
|
||||||
|
"unemitted",
|
||||||
|
"granually",
|
||||||
|
"timesystem",
|
||||||
|
"metadatas",
|
||||||
|
"iteratees",
|
||||||
|
"metadatum",
|
||||||
|
"printj",
|
||||||
|
"sprintf",
|
||||||
|
"unlisteners",
|
||||||
|
"amts",
|
||||||
|
"reregistered",
|
||||||
|
"hudsonfoo",
|
||||||
|
"onclone",
|
||||||
|
"autoflow",
|
||||||
|
"xdescribe",
|
||||||
|
"mockmct",
|
||||||
|
"Autoflowed",
|
||||||
|
"plotly",
|
||||||
|
"relayout",
|
||||||
|
"Plotly",
|
||||||
|
"Yaxis",
|
||||||
|
"showlegend",
|
||||||
|
"textposition",
|
||||||
|
"xaxis",
|
||||||
|
"automargin",
|
||||||
|
"fixedrange",
|
||||||
|
"yaxis",
|
||||||
|
"Axistype",
|
||||||
|
"showline",
|
||||||
|
"bglayer",
|
||||||
|
"autorange",
|
||||||
|
"hoverinfo",
|
||||||
|
"dotful",
|
||||||
|
"Dotful",
|
||||||
|
"cartesianlayer",
|
||||||
|
"scatterlayer",
|
||||||
|
"textfont",
|
||||||
|
"ampm",
|
||||||
|
"cdef",
|
||||||
|
"horz",
|
||||||
|
"STYLEABLE",
|
||||||
|
"styleable",
|
||||||
|
"afff",
|
||||||
|
"shdw",
|
||||||
|
"braintree",
|
||||||
|
"vals",
|
||||||
|
"Subobject",
|
||||||
|
"Shdw",
|
||||||
|
"Movebar",
|
||||||
|
"inspectable",
|
||||||
|
"Stringformatter",
|
||||||
|
"sclk",
|
||||||
|
"Objectpath",
|
||||||
|
"Keystring",
|
||||||
|
"duplicatable",
|
||||||
|
"composees",
|
||||||
|
"Composees",
|
||||||
|
"Composee",
|
||||||
|
"callthrough",
|
||||||
|
"objectpath",
|
||||||
|
"createable",
|
||||||
|
"noneditable",
|
||||||
|
"Classname",
|
||||||
|
"classname",
|
||||||
|
"selectedfaults",
|
||||||
|
"accum",
|
||||||
|
"newpersisted",
|
||||||
|
"Metadatum",
|
||||||
|
"MCWS",
|
||||||
|
"YAMCS",
|
||||||
|
"frameid",
|
||||||
|
"containerid",
|
||||||
|
"mmgis",
|
||||||
|
"PERC",
|
||||||
|
"curval",
|
||||||
|
"viewbox",
|
||||||
|
"mutablegauge",
|
||||||
|
"Flatbush",
|
||||||
|
"flatbush",
|
||||||
|
"Indicies",
|
||||||
|
"Marqueed",
|
||||||
|
"NSEW",
|
||||||
|
"nsew",
|
||||||
|
"vrover",
|
||||||
|
"gimbled",
|
||||||
|
"Pannable",
|
||||||
|
"unsynced",
|
||||||
|
"Unsynced",
|
||||||
|
"pannable",
|
||||||
|
"autoscroll",
|
||||||
|
"TIMESTRIP",
|
||||||
|
"TWENTYFOUR",
|
||||||
|
"FULLSIZE",
|
||||||
|
"intialize",
|
||||||
|
"Timestrip",
|
||||||
|
"spyon",
|
||||||
|
"Unlistener",
|
||||||
|
"multipane",
|
||||||
|
"DATESTRING",
|
||||||
|
"akhenry",
|
||||||
|
"Niklas",
|
||||||
|
"Hertzen",
|
||||||
|
"Kash",
|
||||||
|
"Nouroozi",
|
||||||
|
"Bostock",
|
||||||
|
"BOSTOCK",
|
||||||
|
"Arnout",
|
||||||
|
"Kazemier",
|
||||||
|
"Karolis",
|
||||||
|
"Narkevicius",
|
||||||
|
"Ashkenas",
|
||||||
|
"Madhavan",
|
||||||
|
"Iskren",
|
||||||
|
"Ivov",
|
||||||
|
"Chernev",
|
||||||
|
"Borshchov",
|
||||||
|
"painterro",
|
||||||
|
"sheetjs",
|
||||||
|
"Yuxi",
|
||||||
|
"ACITON",
|
||||||
|
"localstorage",
|
||||||
|
"Linkto",
|
||||||
|
"Painterro",
|
||||||
|
"Editability",
|
||||||
|
"filteredsnapshots",
|
||||||
|
"Fromimage",
|
||||||
|
"muliple",
|
||||||
|
"notebookstorage",
|
||||||
|
"Andpage",
|
||||||
|
"pixelize",
|
||||||
|
"Quickstart",
|
||||||
|
"indexhtml",
|
||||||
|
"youradminpassword",
|
||||||
|
"chttpd",
|
||||||
|
"sourcefiles",
|
||||||
|
"USERPASS",
|
||||||
|
"XPUT",
|
||||||
|
"adipiscing",
|
||||||
|
"eiusmod",
|
||||||
|
"tempor",
|
||||||
|
"incididunt",
|
||||||
|
"labore",
|
||||||
|
"dolore",
|
||||||
|
"aliqua",
|
||||||
|
"perspiciatis",
|
||||||
|
"iteree",
|
||||||
|
"submodels",
|
||||||
|
"symlog",
|
||||||
|
"Plottable",
|
||||||
|
"antisymlog",
|
||||||
|
"docstrings",
|
||||||
|
"webglcontextlost",
|
||||||
|
"gridlines",
|
||||||
|
"Xaxis",
|
||||||
|
"Crosshairs",
|
||||||
|
"telemetrylimit",
|
||||||
|
"xscale",
|
||||||
|
"yscale",
|
||||||
|
"untracks",
|
||||||
|
"swatched",
|
||||||
|
"NULLVALUE",
|
||||||
|
"unobserver",
|
||||||
|
"unsubscriber",
|
||||||
|
"drap",
|
||||||
|
"Averager",
|
||||||
|
"averager",
|
||||||
|
"movecolumnfromindex",
|
||||||
|
"callout",
|
||||||
|
"Konqueror",
|
||||||
|
"unmark",
|
||||||
|
"hitarea",
|
||||||
|
"Hitarea",
|
||||||
|
"Unmark",
|
||||||
|
"controlbar",
|
||||||
|
"reactified",
|
||||||
|
"perc",
|
||||||
|
"DHMS",
|
||||||
|
"timespans",
|
||||||
|
"timeframes",
|
||||||
|
"Timesystems",
|
||||||
|
"Hilite",
|
||||||
|
"datetimes",
|
||||||
|
"momentified",
|
||||||
|
"ucontents",
|
||||||
|
"TIMELIST",
|
||||||
|
"Timeframe",
|
||||||
|
"Guirk",
|
||||||
|
"resizeable",
|
||||||
|
"iframing",
|
||||||
|
"Btns",
|
||||||
|
"Ctrls",
|
||||||
|
"Chakra",
|
||||||
|
"Petch",
|
||||||
|
"propor",
|
||||||
|
"phoneandtablet",
|
||||||
|
"desktopandtablet",
|
||||||
|
"Imgs",
|
||||||
|
"UNICODES",
|
||||||
|
"datatable",
|
||||||
|
"csvg",
|
||||||
|
"cpath",
|
||||||
|
"cellipse",
|
||||||
|
"xlink",
|
||||||
|
"cstyle",
|
||||||
|
"bfill",
|
||||||
|
"ctitle",
|
||||||
|
"eicon",
|
||||||
|
"interactability",
|
||||||
|
"AFFORDANCES",
|
||||||
|
"affordance",
|
||||||
|
"scrollcontainer",
|
||||||
|
"Icomoon",
|
||||||
|
"icomoon",
|
||||||
|
"configurability",
|
||||||
|
"btns",
|
||||||
|
"AUTOFLOW",
|
||||||
|
"DATETIME",
|
||||||
|
"infobubble",
|
||||||
|
"thumbsbubble",
|
||||||
|
"codehilite",
|
||||||
|
"vscroll",
|
||||||
|
"bgsize",
|
||||||
|
"togglebutton",
|
||||||
|
"Hacskaylo",
|
||||||
|
"noie",
|
||||||
|
"fullscreen",
|
||||||
|
"horiz",
|
||||||
|
"menubutton",
|
||||||
|
"SNAPSHOTTING",
|
||||||
|
"snapshotting",
|
||||||
|
"PAINTERRO",
|
||||||
|
"ptro",
|
||||||
|
"PLOTLY",
|
||||||
|
"gridlayer",
|
||||||
|
"xtick",
|
||||||
|
"ytick",
|
||||||
|
"subobjects",
|
||||||
|
"Ucontents",
|
||||||
|
"Userand",
|
||||||
|
"Userbefore",
|
||||||
|
"brdr",
|
||||||
|
"pushs",
|
||||||
|
"ALPH",
|
||||||
|
"Recents",
|
||||||
|
"Qbert",
|
||||||
|
"Infobubble",
|
||||||
|
"haslink",
|
||||||
|
"VPID",
|
||||||
|
"vpid",
|
||||||
|
"updatedtest",
|
||||||
|
"KHTML",
|
||||||
|
"Chromezilla",
|
||||||
|
"Safarifox",
|
||||||
|
"deregistering",
|
||||||
|
"hundredtized",
|
||||||
|
"dhms",
|
||||||
|
"unthrottled",
|
||||||
|
"Codecov",
|
||||||
|
"dont",
|
||||||
|
"mediump",
|
||||||
|
"sinonjs",
|
||||||
|
"generatedata",
|
||||||
|
"grandsearch",
|
||||||
|
"websockets",
|
||||||
|
"swgs",
|
||||||
|
"memlab",
|
||||||
|
"devmode",
|
||||||
|
"blockquote",
|
||||||
|
"blockquotes",
|
||||||
|
"Blockquote",
|
||||||
|
"Blockquotes",
|
||||||
|
"oger",
|
||||||
|
"lcovonly",
|
||||||
|
"gcov",
|
||||||
|
"WCAG"
|
||||||
|
],
|
||||||
|
"dictionaries": ["npm", "softwareTerms", "node", "html", "css", "bash", "en_US"],
|
||||||
|
"ignorePaths": [
|
||||||
|
"package.json",
|
||||||
|
"dist/**",
|
||||||
|
"package-lock.json",
|
||||||
|
"node_modules",
|
||||||
|
"coverage",
|
||||||
|
"*.log",
|
||||||
|
"html-test-results",
|
||||||
|
"test-results"
|
||||||
|
]
|
||||||
|
}
|
440
.eslintrc.js
440
.eslintrc.js
@ -1,271 +1,181 @@
|
|||||||
const LEGACY_FILES = ["example/**"];
|
const LEGACY_FILES = ['example/**'];
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"env": {
|
env: {
|
||||||
"browser": true,
|
browser: true,
|
||||||
"es6": true,
|
es6: true,
|
||||||
"jasmine": true,
|
jasmine: true,
|
||||||
"amd": true
|
amd: true
|
||||||
},
|
},
|
||||||
"globals": {
|
globals: {
|
||||||
"_": "readonly"
|
_: 'readonly'
|
||||||
},
|
},
|
||||||
"extends": [
|
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
|
||||||
"eslint:recommended",
|
extends: [
|
||||||
"plugin:compat/recommended",
|
'eslint:recommended',
|
||||||
"plugin:vue/recommended",
|
'plugin:compat/recommended',
|
||||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
'plugin:vue/vue3-recommended',
|
||||||
|
'plugin:you-dont-need-lodash-underscore/compatible',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'plugin:no-unsanitized/DOM'
|
||||||
|
],
|
||||||
|
parser: 'vue-eslint-parser',
|
||||||
|
parserOptions: {
|
||||||
|
parser: '@babel/eslint-parser',
|
||||||
|
requireConfigFile: false,
|
||||||
|
allowImportExportEverywhere: true,
|
||||||
|
ecmaVersion: 2015,
|
||||||
|
ecmaFeatures: {
|
||||||
|
impliedStrict: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'simple-import-sort/imports': 'warn',
|
||||||
|
'simple-import-sort/exports': 'warn',
|
||||||
|
'vue/no-deprecated-dollar-listeners-api': 'warn',
|
||||||
|
'vue/no-deprecated-events-api': 'warn',
|
||||||
|
'vue/no-v-for-template-key': 'off',
|
||||||
|
'vue/no-v-for-template-key-on-child': 'error',
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'you-dont-need-lodash-underscore/omit': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/throttle': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/flatten': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/get': 'off',
|
||||||
|
'no-bitwise': 'error',
|
||||||
|
curly: 'error',
|
||||||
|
eqeqeq: 'error',
|
||||||
|
'guard-for-in': 'error',
|
||||||
|
'no-extend-native': 'error',
|
||||||
|
'no-inner-declarations': 'off',
|
||||||
|
'no-use-before-define': ['error', 'nofunc'],
|
||||||
|
'no-caller': 'error',
|
||||||
|
'no-irregular-whitespace': 'error',
|
||||||
|
'no-new': 'error',
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-undef': 'error',
|
||||||
|
'no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
args: 'none'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"parser": "vue-eslint-parser",
|
'no-console': 'off',
|
||||||
"parserOptions": {
|
'new-cap': [
|
||||||
"parser": "@babel/eslint-parser",
|
'error',
|
||||||
"requireConfigFile": false,
|
{
|
||||||
"allowImportExportEverywhere": true,
|
capIsNew: false,
|
||||||
"ecmaVersion": 2015,
|
properties: false
|
||||||
"ecmaFeatures": {
|
}
|
||||||
"impliedStrict": true
|
],
|
||||||
}
|
'dot-notation': 'error',
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"you-dont-need-lodash-underscore/omit": "off",
|
|
||||||
"you-dont-need-lodash-underscore/throttle": "off",
|
|
||||||
"you-dont-need-lodash-underscore/flatten": "off",
|
|
||||||
"you-dont-need-lodash-underscore/get": "off",
|
|
||||||
"no-bitwise": "error",
|
|
||||||
"curly": "error",
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"no-extend-native": "error",
|
|
||||||
"no-inner-declarations": "off",
|
|
||||||
"no-use-before-define": ["error", "nofunc"],
|
|
||||||
"no-caller": "error",
|
|
||||||
"no-irregular-whitespace": "error",
|
|
||||||
"no-new": "error",
|
|
||||||
"no-shadow": "error",
|
|
||||||
"no-undef": "error",
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-console": "off",
|
|
||||||
"no-trailing-spaces": "error",
|
|
||||||
"space-before-function-paren": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"anonymous": "always",
|
|
||||||
"asyncArrow": "always",
|
|
||||||
"named": "never"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"array-bracket-spacing": "error",
|
|
||||||
"space-in-parens": "error",
|
|
||||||
"space-before-blocks": "error",
|
|
||||||
"comma-dangle": "error",
|
|
||||||
"eol-last": "error",
|
|
||||||
"new-cap": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"capIsNew": false,
|
|
||||||
"properties": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dot-notation": "error",
|
|
||||||
"indent": ["error", 4],
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-case-declarations
|
// https://eslint.org/docs/rules/no-case-declarations
|
||||||
"no-case-declarations": "error",
|
'no-case-declarations': 'error',
|
||||||
// https://eslint.org/docs/rules/max-classes-per-file
|
// https://eslint.org/docs/rules/max-classes-per-file
|
||||||
"max-classes-per-file": ["error", 1],
|
'max-classes-per-file': ['error', 1],
|
||||||
// https://eslint.org/docs/rules/no-eq-null
|
// https://eslint.org/docs/rules/no-eq-null
|
||||||
"no-eq-null": "error",
|
'no-eq-null': 'error',
|
||||||
// https://eslint.org/docs/rules/no-eval
|
// https://eslint.org/docs/rules/no-eval
|
||||||
"no-eval": "error",
|
'no-eval': 'error',
|
||||||
// https://eslint.org/docs/rules/no-floating-decimal
|
// https://eslint.org/docs/rules/no-implicit-globals
|
||||||
"no-floating-decimal": "error",
|
'no-implicit-globals': 'error',
|
||||||
// https://eslint.org/docs/rules/no-implicit-globals
|
// https://eslint.org/docs/rules/no-implied-eval
|
||||||
"no-implicit-globals": "error",
|
'no-implied-eval': 'error',
|
||||||
// https://eslint.org/docs/rules/no-implied-eval
|
// https://eslint.org/docs/rules/no-lone-blocks
|
||||||
"no-implied-eval": "error",
|
'no-lone-blocks': 'error',
|
||||||
// https://eslint.org/docs/rules/no-lone-blocks
|
// https://eslint.org/docs/rules/no-loop-func
|
||||||
"no-lone-blocks": "error",
|
'no-loop-func': 'error',
|
||||||
// https://eslint.org/docs/rules/no-loop-func
|
// https://eslint.org/docs/rules/no-new-func
|
||||||
"no-loop-func": "error",
|
'no-new-func': 'error',
|
||||||
// https://eslint.org/docs/rules/no-new-func
|
// https://eslint.org/docs/rules/no-new-wrappers
|
||||||
"no-new-func": "error",
|
'no-new-wrappers': 'error',
|
||||||
// https://eslint.org/docs/rules/no-new-wrappers
|
// https://eslint.org/docs/rules/no-octal-escape
|
||||||
"no-new-wrappers": "error",
|
'no-octal-escape': 'error',
|
||||||
// https://eslint.org/docs/rules/no-octal-escape
|
// https://eslint.org/docs/rules/no-proto
|
||||||
"no-octal-escape": "error",
|
'no-proto': 'error',
|
||||||
// https://eslint.org/docs/rules/no-proto
|
// https://eslint.org/docs/rules/no-return-await
|
||||||
"no-proto": "error",
|
'no-return-await': 'error',
|
||||||
// https://eslint.org/docs/rules/no-return-await
|
// https://eslint.org/docs/rules/no-script-url
|
||||||
"no-return-await": "error",
|
'no-script-url': 'error',
|
||||||
// https://eslint.org/docs/rules/no-script-url
|
// https://eslint.org/docs/rules/no-self-compare
|
||||||
"no-script-url": "error",
|
'no-self-compare': 'error',
|
||||||
// https://eslint.org/docs/rules/no-self-compare
|
// https://eslint.org/docs/rules/no-sequences
|
||||||
"no-self-compare": "error",
|
'no-sequences': 'error',
|
||||||
// https://eslint.org/docs/rules/no-sequences
|
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||||
"no-sequences": "error",
|
'no-unmodified-loop-condition': 'error',
|
||||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
// https://eslint.org/docs/rules/no-useless-call
|
||||||
"no-unmodified-loop-condition": "error",
|
'no-useless-call': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-call
|
// https://eslint.org/docs/rules/no-nested-ternary
|
||||||
"no-useless-call": "error",
|
'no-nested-ternary': 'error',
|
||||||
// https://eslint.org/docs/rules/wrap-iife
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||||
"wrap-iife": "error",
|
'no-useless-computed-key': 'error',
|
||||||
// https://eslint.org/docs/rules/no-nested-ternary
|
// https://eslint.org/docs/rules/no-var
|
||||||
"no-nested-ternary": "error",
|
'no-var': 'error',
|
||||||
// https://eslint.org/docs/rules/switch-colon-spacing
|
// https://eslint.org/docs/rules/one-var
|
||||||
"switch-colon-spacing": "error",
|
'one-var': ['error', 'never'],
|
||||||
// https://eslint.org/docs/rules/no-useless-computed-key
|
// https://eslint.org/docs/rules/default-case-last
|
||||||
"no-useless-computed-key": "error",
|
'default-case-last': 'error',
|
||||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
// https://eslint.org/docs/rules/default-param-last
|
||||||
"rest-spread-spacing": ["error"],
|
'default-param-last': 'error',
|
||||||
// https://eslint.org/docs/rules/no-var
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||||
"no-var": "error",
|
'grouped-accessor-pairs': 'error',
|
||||||
// https://eslint.org/docs/rules/one-var
|
// https://eslint.org/docs/rules/no-constructor-return
|
||||||
"one-var": ["error", "never"],
|
'no-constructor-return': 'error',
|
||||||
// https://eslint.org/docs/rules/default-case-last
|
// https://eslint.org/docs/rules/array-callback-return
|
||||||
"default-case-last": "error",
|
'array-callback-return': 'error',
|
||||||
// https://eslint.org/docs/rules/default-param-last
|
// https://eslint.org/docs/rules/no-invalid-this
|
||||||
"default-param-last": "error",
|
'no-invalid-this': 'error', // Believe this one actually surfaces some bugs
|
||||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
// https://eslint.org/docs/rules/func-style
|
||||||
"grouped-accessor-pairs": "error",
|
'func-style': ['error', 'declaration'],
|
||||||
// https://eslint.org/docs/rules/no-constructor-return
|
// https://eslint.org/docs/rules/no-unused-expressions
|
||||||
"no-constructor-return": "error",
|
'no-unused-expressions': 'error',
|
||||||
// https://eslint.org/docs/rules/array-callback-return
|
// https://eslint.org/docs/rules/no-useless-concat
|
||||||
"array-callback-return": "error",
|
'no-useless-concat': 'error',
|
||||||
// https://eslint.org/docs/rules/no-invalid-this
|
// https://eslint.org/docs/rules/radix
|
||||||
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
|
radix: 'error',
|
||||||
// https://eslint.org/docs/rules/func-style
|
// https://eslint.org/docs/rules/require-await
|
||||||
"func-style": ["error", "declaration"],
|
'require-await': 'error',
|
||||||
// https://eslint.org/docs/rules/no-unused-expressions
|
// https://eslint.org/docs/rules/no-alert
|
||||||
"no-unused-expressions": "error",
|
'no-alert': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-concat
|
// https://eslint.org/docs/rules/no-useless-constructor
|
||||||
"no-useless-concat": "error",
|
'no-useless-constructor': 'error',
|
||||||
// https://eslint.org/docs/rules/radix
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
||||||
"radix": "error",
|
'no-duplicate-imports': 'error',
|
||||||
// https://eslint.org/docs/rules/require-await
|
|
||||||
"require-await": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-alert
|
|
||||||
"no-alert": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-useless-constructor
|
|
||||||
"no-useless-constructor": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-coercion
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
||||||
"no-implicit-coercion": "error",
|
'no-implicit-coercion': 'error',
|
||||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||||
"no-unneeded-ternary": "error",
|
'no-unneeded-ternary': 'error',
|
||||||
// https://eslint.org/docs/rules/semi
|
'unicorn/filename-case': [
|
||||||
"semi": ["error", "always"],
|
'error',
|
||||||
// https://eslint.org/docs/rules/no-multi-spaces
|
{
|
||||||
"no-multi-spaces": "error",
|
cases: {
|
||||||
// https://eslint.org/docs/rules/key-spacing
|
pascalCase: true
|
||||||
"key-spacing": ["error", {
|
},
|
||||||
"afterColon": true
|
ignore: ['^.*\\.js$']
|
||||||
}],
|
}
|
||||||
// https://eslint.org/docs/rules/keyword-spacing
|
],
|
||||||
"keyword-spacing": ["error", {
|
'vue/first-attribute-linebreak': 'error',
|
||||||
"before": true,
|
'vue/multiline-html-element-content-newline': 'off',
|
||||||
"after": true
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
}],
|
'vue/no-mutating-props': 'off' // TODO: Remove this rule and fix resulting errors
|
||||||
// https://eslint.org/docs/rules/comma-spacing
|
},
|
||||||
// Also requires one line code fix
|
overrides: [
|
||||||
"comma-spacing": ["error", {
|
{
|
||||||
"after": true
|
files: LEGACY_FILES,
|
||||||
}],
|
rules: {
|
||||||
//https://eslint.org/docs/rules/no-whitespace-before-property
|
'no-unused-vars': [
|
||||||
"no-whitespace-before-property": "error",
|
'error',
|
||||||
// https://eslint.org/docs/rules/object-curly-newline
|
{
|
||||||
"object-curly-newline": ["error", {
|
vars: 'all',
|
||||||
"consistent": true,
|
args: 'none',
|
||||||
"multiline": true
|
varsIgnorePattern: 'controller'
|
||||||
}],
|
}
|
||||||
// https://eslint.org/docs/rules/object-property-newline
|
|
||||||
"object-property-newline": "error",
|
|
||||||
// https://eslint.org/docs/rules/brace-style
|
|
||||||
"brace-style": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
||||||
"no-multiple-empty-lines": ["error", {"max": 1}],
|
|
||||||
// https://eslint.org/docs/rules/operator-linebreak
|
|
||||||
"operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}],
|
|
||||||
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
||||||
"padding-line-between-statements": ["error", {
|
|
||||||
"blankLine": "always",
|
|
||||||
"prev": "multiline-block-like",
|
|
||||||
"next": "*"
|
|
||||||
}, {
|
|
||||||
"blankLine": "always",
|
|
||||||
"prev": "*",
|
|
||||||
"next": "return"
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/space-infix-ops
|
|
||||||
"space-infix-ops": "error",
|
|
||||||
// https://eslint.org/docs/rules/space-unary-ops
|
|
||||||
"space-unary-ops": ["error", {
|
|
||||||
"words": true,
|
|
||||||
"nonwords": false
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/arrow-spacing
|
|
||||||
"arrow-spacing": "error",
|
|
||||||
// https://eslint.org/docs/rules/semi-spacing
|
|
||||||
"semi-spacing": ["error", {
|
|
||||||
"before": false,
|
|
||||||
"after": true
|
|
||||||
}],
|
|
||||||
|
|
||||||
"vue/html-indent": [
|
|
||||||
"error",
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
"attribute": 1,
|
|
||||||
"baseIndent": 0,
|
|
||||||
"closeBracket": 0,
|
|
||||||
"alignAttributesVertically": true,
|
|
||||||
"ignores": []
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"vue/html-self-closing": ["error",
|
'no-nested-ternary': 'off',
|
||||||
{
|
'no-var': 'off',
|
||||||
"html": {
|
'one-var': 'off'
|
||||||
"void": "never",
|
}
|
||||||
"normal": "never",
|
}
|
||||||
"component": "always"
|
]
|
||||||
},
|
|
||||||
"svg": "always",
|
|
||||||
"math": "always"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/max-attributes-per-line": ["error", {
|
|
||||||
"singleline": 1,
|
|
||||||
"multiline": 1,
|
|
||||||
}],
|
|
||||||
"vue/first-attribute-linebreak": "error",
|
|
||||||
"vue/multiline-html-element-content-newline": "off",
|
|
||||||
"vue/singleline-html-element-content-newline": "off",
|
|
||||||
"vue/multi-word-component-names": "off", // TODO enable, align with conventions
|
|
||||||
"vue/no-mutating-props": "off"
|
|
||||||
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": LEGACY_FILES,
|
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none",
|
|
||||||
"varsIgnorePattern": "controller"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-nested-ternary": "off",
|
|
||||||
"no-var": "off",
|
|
||||||
"one-var": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
12
.git-blame-ignore-revs
Normal file
12
.git-blame-ignore-revs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# git-blame ignored revisions
|
||||||
|
# To configure, run:
|
||||||
|
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
|
# Requires Git > 2.23
|
||||||
|
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
|
||||||
|
|
||||||
|
# Copyright year update 2022
|
||||||
|
4a9744e916d24122a81092f6b7950054048ba860
|
||||||
|
# Copyright year update 2023
|
||||||
|
8040b275fcf2ba71b42cd72d4daa64bb25c19c2d
|
||||||
|
# Apply `prettier` formatting
|
||||||
|
caa7bc6faebc204f67aedae3e35fb0d0d3ce27a7
|
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -14,8 +14,10 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
|||||||
|
|
||||||
* [ ] Changes address original issue?
|
* [ ] Changes address original issue?
|
||||||
* [ ] Tests included and/or updated with changes?
|
* [ ] Tests included and/or updated with changes?
|
||||||
* [ ] Command line build passes?
|
|
||||||
* [ ] Has this been smoke tested?
|
* [ ] 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?
|
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
||||||
|
|
||||||
### Reviewer Checklist
|
### Reviewer Checklist
|
||||||
@ -25,5 +27,3 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
|||||||
* [ ] Changes appear not to be breaking changes?
|
* [ ] Changes appear not to be breaking changes?
|
||||||
* [ ] Appropriate automated tests included?
|
* [ ] Appropriate automated tests included?
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
* [ ] Code style and in-line documentation are appropriate?
|
||||||
* [ ] Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
|
|
||||||
* [ ] Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)
|
|
||||||
|
57
.github/dependabot.yml
vendored
57
.github/dependabot.yml
vendored
@ -1,35 +1,42 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: 'npm'
|
||||||
directory: "/"
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'weekly'
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
rebase-strategy: 'disabled'
|
||||||
labels:
|
labels:
|
||||||
- "pr:e2e"
|
- 'pr:daveit'
|
||||||
- "type:maintenance"
|
- 'pr:e2e'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
- "pr:platform"
|
- 'pr:platform'
|
||||||
ignore:
|
ignore:
|
||||||
#We have to source the playwright container which is not detected by Dependabot
|
#We have to source the playwright container which is not detected by Dependabot
|
||||||
- dependency-name: "@playwright/test"
|
- dependency-name: '@playwright/test'
|
||||||
- dependency-name: "playwright-core"
|
- dependency-name: 'playwright-core'
|
||||||
#Lots of noise in these type patch releases.
|
#Lots of noise in these type patch releases.
|
||||||
- dependency-name: "@babel/eslint-parser"
|
- dependency-name: '@babel/eslint-parser'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- dependency-name: "eslint-plugin-vue"
|
- dependency-name: 'eslint-plugin-vue'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- dependency-name: "babel-loader"
|
- dependency-name: 'babel-loader'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- dependency-name: "sinon"
|
- dependency-name: 'sinon'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- package-ecosystem: "github-actions"
|
- dependency-name: 'moment-timezone'
|
||||||
directory: "/"
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: '@types/lodash'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: 'marked'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- package-ecosystem: 'github-actions'
|
||||||
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'daily'
|
||||||
|
rebase-strategy: 'disabled'
|
||||||
labels:
|
labels:
|
||||||
- "type:maintenance"
|
- 'pr:daveit'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
|
23
.github/release.yml
vendored
Normal file
23
.github/release.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
changelog:
|
||||||
|
categories:
|
||||||
|
- title: 🏕 Features
|
||||||
|
labels:
|
||||||
|
- type:feature
|
||||||
|
- title: 🎉 Enhancements
|
||||||
|
labels:
|
||||||
|
- type:enhancement
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- type:feature
|
||||||
|
- title: 🔧 Maintenance
|
||||||
|
labels:
|
||||||
|
- type:maintenance
|
||||||
|
- title: ⚡ Performance
|
||||||
|
labels:
|
||||||
|
- performance
|
||||||
|
- title: 👒 Dependencies
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
- title: 🐛 Bug Fixes
|
||||||
|
labels:
|
||||||
|
- '*'
|
8
.github/workflows/codeql-analysis.yml
vendored
8
.github/workflows/codeql-analysis.yml
vendored
@ -27,18 +27,18 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
config-file: ./.github/codeql/codeql-config.yml
|
config-file: ./.github/codeql/codeql-config.yml
|
||||||
languages: javascript
|
languages: javascript
|
||||||
queries: security-and-quality
|
queries: security-and-quality
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
89
.github/workflows/e2e-couchdb.yml
vendored
89
.github/workflows/e2e-couchdb.yml
vendored
@ -1,38 +1,89 @@
|
|||||||
name: "e2e-couchdb"
|
name: 'e2e-couchdb'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
env:
|
schedule:
|
||||||
OPENMCT_DATABASE_NAME: openmct
|
- cron: '0 0 * * *'
|
||||||
COUCH_ADMIN_USER: admin
|
|
||||||
COUCH_ADMIN_PASSWORD: password
|
|
||||||
COUCH_BASE_LOCAL: http://localhost:5984
|
|
||||||
COUCH_NODE_NAME: nonode@nohost
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e-couchdb:
|
e2e-couchdb:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e:couchdb' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e:couchdb') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.action == 'opened'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run : docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
- uses: actions/setup-node@v4
|
||||||
- run : sleep 3 # wait until CouchDB has started (TODO: there must be a better way)
|
|
||||||
- run : bash src/plugins/persistence/couch/setup-couchdb.sh
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: 'lts/hydrogen'
|
||||||
- run: npx playwright@1.29.0 install
|
|
||||||
- run: npm install
|
- name: Cache NPM dependencies
|
||||||
- run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
uses: actions/cache@v3
|
||||||
- run: npm run test:e2e:couchdb
|
with:
|
||||||
- run: ls -latr
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- run: npx playwright@1.39.0 install
|
||||||
|
|
||||||
|
- name: Start CouchDB Docker Container and Init with Setup Scripts
|
||||||
|
run: |
|
||||||
|
export $(cat src/plugins/persistence/couch/.env.ci | xargs)
|
||||||
|
docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
||||||
|
sleep 3
|
||||||
|
bash src/plugins/persistence/couch/setup-couchdb.sh
|
||||||
|
bash src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
||||||
|
|
||||||
|
- name: Run CouchDB Tests and publish to deploysentinel
|
||||||
|
env:
|
||||||
|
DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }}
|
||||||
|
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha }}
|
||||||
|
run: npm run test:e2e:couchdb
|
||||||
|
|
||||||
|
- name: Publish Results to Codecov.io
|
||||||
|
env:
|
||||||
|
SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: npm run cov:e2e:full:publish
|
||||||
|
|
||||||
- name: Archive test results
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: test-results
|
path: test-results
|
||||||
|
|
||||||
- name: Archive html test results
|
- name: Archive html test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
|
|
||||||
|
- name: Remove pr:e2e:couchdb label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:e2e:couchdb';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
||||||
|
80
.github/workflows/e2e-pr.yml
vendored
80
.github/workflows/e2e-pr.yml
vendored
@ -1,62 +1,68 @@
|
|||||||
name: "e2e-pr"
|
name: 'e2e-pr'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
e2e-full:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger Success
|
- uses: actions/checkout@v4
|
||||||
uses: actions/github-script@v6
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
script: |
|
node-version: 'lts/hydrogen'
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
- name: Cache NPM dependencies
|
||||||
owner: "nasa",
|
uses: actions/cache@v3
|
||||||
repo: "openmct",
|
|
||||||
body: 'Started e2e Run. Follow along: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
|
||||||
})
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
path: ~/.npm
|
||||||
- run: npx playwright@1.29.0 install
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npx playwright@1.39.0 install
|
||||||
- run: npx playwright install chrome-beta
|
- run: npx playwright install chrome-beta
|
||||||
- run: npm install
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
- run: npm run test:e2e:full
|
- run: npm run test:e2e:full -- --max-failures=40
|
||||||
|
- run: npm run cov:e2e:report || true
|
||||||
|
- shell: bash
|
||||||
|
env:
|
||||||
|
SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: |
|
||||||
|
npm run cov:e2e:full:publish
|
||||||
- name: Archive test results
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: test-results
|
path: test-results
|
||||||
- name: Test success
|
|
||||||
if: ${{ success() }}
|
- name: Remove pr:e2e label (if present)
|
||||||
|
if: always()
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
github.rest.issues.createComment({
|
const { owner, repo, number } = context.issue;
|
||||||
issue_number: context.issue.number,
|
const labelToRemove = 'pr:e2e';
|
||||||
owner: "nasa",
|
try {
|
||||||
repo: "openmct",
|
await github.rest.issues.removeLabel({
|
||||||
body: 'Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
owner,
|
||||||
})
|
repo,
|
||||||
- name: Test failure
|
issue_number: number,
|
||||||
if: ${{ failure() }}
|
name: labelToRemove
|
||||||
uses: actions/github-script@v6
|
});
|
||||||
with:
|
} catch (error) {
|
||||||
script: |
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
github.rest.issues.createComment({
|
}
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: "nasa",
|
|
||||||
repo: "openmct",
|
|
||||||
body: 'Failure ❌ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
|
||||||
})
|
|
||||||
|
21
.github/workflows/e2e.yml
vendored
21
.github/workflows/e2e.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
name: "e2e"
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'Which branch do you want to test?' # Limited to branch for now
|
|
||||||
required: false
|
|
||||||
default: 'master'
|
|
||||||
jobs:
|
|
||||||
e2e:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.version }}
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- run: npm install
|
|
||||||
- name: Run the e2e tests
|
|
||||||
run: npm run test:e2e:ci
|
|
12
.github/workflows/npm-prerelease.yml
vendored
12
.github/workflows/npm-prerelease.yml
vendored
@ -11,10 +11,10 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: lts/hydrogen
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: |
|
- run: |
|
||||||
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
||||||
@ -26,10 +26,10 @@ jobs:
|
|||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: lts/hydrogen
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm publish --access=public --tag unstable
|
- run: npm publish --access=public --tag unstable
|
||||||
|
58
.github/workflows/pr-platform.yml
vendored
58
.github/workflows/pr-platform.yml
vendored
@ -1,13 +1,19 @@
|
|||||||
name: "pr-platform"
|
name: 'pr-platform'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ labeled ]
|
types:
|
||||||
|
- labeled
|
||||||
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
pr-platform:
|
||||||
if: ${{ github.event.label.name == 'pr:platform' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:platform') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -16,19 +22,49 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
node_version:
|
node_version:
|
||||||
- 14
|
- lts/iron
|
||||||
- 16
|
- lts/hydrogen
|
||||||
- 18
|
|
||||||
architecture:
|
architecture:
|
||||||
- x64
|
- x64
|
||||||
|
|
||||||
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
- run: npm install
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ matrix.node_version }}-
|
||||||
|
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
- run: npm run lint -- --quiet
|
- run: npm run lint -- --quiet
|
||||||
|
|
||||||
|
- name: Remove pr:platform label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:platform';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
||||||
|
24
.github/workflows/prcop.yml
vendored
24
.github/workflows/prcop.yml
vendored
@ -3,17 +3,17 @@ name: PRCop
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
|
- labeled
|
||||||
|
- unlabeled
|
||||||
- opened
|
- opened
|
||||||
- reopened
|
- reopened
|
||||||
- edited
|
|
||||||
- synchronize
|
- synchronize
|
||||||
- ready_for_review
|
- edited
|
||||||
- review_requested
|
|
||||||
- review_request_removed
|
|
||||||
pull_request_review_comment:
|
pull_request_review_comment:
|
||||||
types:
|
types:
|
||||||
- created
|
- created
|
||||||
|
env:
|
||||||
|
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }}
|
||||||
jobs:
|
jobs:
|
||||||
prcop:
|
prcop:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -22,5 +22,17 @@ jobs:
|
|||||||
- name: Linting Pull Request
|
- name: Linting Pull Request
|
||||||
uses: makaroni4/prcop@v1.0.35
|
uses: makaroni4/prcop@v1.0.35
|
||||||
with:
|
with:
|
||||||
config-file: ".github/workflows/prcop-config.json"
|
config-file: '.github/workflows/prcop-config.json'
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
check-type-label:
|
||||||
|
name: Check type Label
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- if: contains( env.LABELS, 'type:' ) == false
|
||||||
|
run: exit 1
|
||||||
|
check-milestone:
|
||||||
|
name: Check Milestone
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- if: github.event.pull_request.milestone == null && contains( env.LABELS, 'no milestone' ) == false
|
||||||
|
run: exit 1
|
||||||
|
5
.npmrc
5
.npmrc
@ -1,4 +1,7 @@
|
|||||||
loglevel=warn
|
loglevel=warn
|
||||||
|
|
||||||
#Prevent folks from ignoring an important error when building from source
|
#Prevent folks from ignoring an important error when building from source
|
||||||
engine-strict=true
|
engine-strict=true
|
||||||
|
|
||||||
|
# Dont include lockfile
|
||||||
|
package-lock=false
|
27
.prettierignore
Normal file
27
.prettierignore
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Docs
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
target
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Mac OS X Finder
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Node dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# npm-debug log
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
# karma reports
|
||||||
|
report.*.json
|
||||||
|
|
||||||
|
# e2e test artifacts
|
||||||
|
test-results
|
||||||
|
html-test-results
|
||||||
|
|
||||||
|
# codecov artifacts
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
|
codecov
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "none",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 100,
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
@ -8,169 +8,178 @@ This is the OpenMCT common webpack file. It is imported by the other three webpa
|
|||||||
There are separate npm scripts to use these configurations, though simply running `npm install`
|
There are separate npm scripts to use these configurations, though simply running `npm install`
|
||||||
will use the default production configuration.
|
will use the default production configuration.
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const packageDefinition = require("../package.json");
|
const packageDefinition = require('../package.json');
|
||||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const webpack = require("webpack");
|
const webpack = require('webpack');
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
|
||||||
const { VueLoaderPlugin } = require("vue-loader");
|
const { VueLoaderPlugin } = require('vue-loader');
|
||||||
let gitRevision = "error-retrieving-revision";
|
let gitRevision = 'error-retrieving-revision';
|
||||||
let gitBranch = "error-retrieving-branch";
|
let gitBranch = 'error-retrieving-branch';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gitRevision = require("child_process")
|
gitRevision = require('child_process').execSync('git rev-parse HEAD').toString().trim();
|
||||||
.execSync("git rev-parse HEAD")
|
gitBranch = require('child_process')
|
||||||
.toString()
|
.execSync('git rev-parse --abbrev-ref HEAD')
|
||||||
.trim();
|
.toString()
|
||||||
gitBranch = require("child_process")
|
.trim();
|
||||||
.execSync("git rev-parse --abbrev-ref HEAD")
|
|
||||||
.toString()
|
|
||||||
.trim();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
const projectRootDir = path.resolve(__dirname, "..");
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
/** @type {import('webpack').Configuration} */
|
/** @type {import('webpack').Configuration} */
|
||||||
const config = {
|
const config = {
|
||||||
context: projectRootDir,
|
context: projectRootDir,
|
||||||
entry: {
|
devServer: {
|
||||||
openmct: "./openmct.js",
|
client: {
|
||||||
generatorWorker: "./example/generator/generatorWorker.js",
|
progress: true,
|
||||||
couchDBChangesFeed:
|
overlay: {
|
||||||
"./src/plugins/persistence/couch/CouchChangesFeed.js",
|
// Disable overlay for runtime errors.
|
||||||
inMemorySearchWorker: "./src/api/objects/InMemorySearchWorker.js",
|
// See: https://github.com/webpack/webpack-dev-server/issues/4771
|
||||||
espressoTheme: "./src/plugins/themes/espresso-theme.scss",
|
runtimeErrors: false
|
||||||
snowTheme: "./src/plugins/themes/snow-theme.scss"
|
}
|
||||||
},
|
|
||||||
output: {
|
|
||||||
globalObject: "this",
|
|
||||||
filename: "[name].js",
|
|
||||||
path: path.resolve(projectRootDir, "dist"),
|
|
||||||
library: "openmct",
|
|
||||||
libraryTarget: "umd",
|
|
||||||
publicPath: "",
|
|
||||||
hashFunction: "xxhash64",
|
|
||||||
clean: true
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
"@": path.join(projectRootDir, "src"),
|
|
||||||
legacyRegistry: path.join(projectRootDir, "src/legacyRegistry"),
|
|
||||||
saveAs: "file-saver/src/FileSaver.js",
|
|
||||||
csv: "comma-separated-values",
|
|
||||||
EventEmitter: "eventemitter3",
|
|
||||||
bourbon: "bourbon.scss",
|
|
||||||
"plotly-basic": "plotly.js-basic-dist",
|
|
||||||
"plotly-gl2d": "plotly.js-gl2d-dist",
|
|
||||||
"d3-scale": path.join(
|
|
||||||
projectRootDir,
|
|
||||||
"node_modules/d3-scale/dist/d3-scale.min.js"
|
|
||||||
),
|
|
||||||
printj: path.join(
|
|
||||||
projectRootDir,
|
|
||||||
"node_modules/printj/dist/printj.min.js"
|
|
||||||
),
|
|
||||||
styles: path.join(projectRootDir, "src/styles"),
|
|
||||||
MCT: path.join(projectRootDir, "src/MCT"),
|
|
||||||
testUtils: path.join(projectRootDir, "src/utils/testUtils.js"),
|
|
||||||
objectUtils: path.join(
|
|
||||||
projectRootDir,
|
|
||||||
"src/api/objects/object-utils.js"
|
|
||||||
),
|
|
||||||
"kdbush": path.join(projectRootDir, "node_modules/kdbush/kdbush.min.js"),
|
|
||||||
utils: path.join(projectRootDir, "src/utils")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
|
||||||
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
|
||||||
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
|
||||||
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
|
|
||||||
}),
|
|
||||||
new VueLoaderPlugin(),
|
|
||||||
new CopyWebpackPlugin({
|
|
||||||
patterns: [
|
|
||||||
{
|
|
||||||
from: "src/images/favicons",
|
|
||||||
to: "favicons"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "./index.html",
|
|
||||||
transform: function (content) {
|
|
||||||
return content.toString().replace(/dist\//g, "");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "src/plugins/imagery/layers",
|
|
||||||
to: "imagery"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: "[name].css",
|
|
||||||
chunkFilename: "[name].css"
|
|
||||||
})
|
|
||||||
],
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(sc|sa|c)ss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{
|
|
||||||
loader: "css-loader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: "resolve-url-loader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: "sass-loader",
|
|
||||||
options: { sourceMap: true }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
use: "vue-loader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
type: "asset/source"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(jpg|jpeg|png|svg)$/,
|
|
||||||
type: "asset/resource",
|
|
||||||
generator: {
|
|
||||||
filename: "images/[name][ext]"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.ico$/,
|
|
||||||
type: "asset/resource",
|
|
||||||
generator: {
|
|
||||||
filename: "icons/[name][ext]"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2?|eot|ttf)$/,
|
|
||||||
type: "asset/resource",
|
|
||||||
generator: {
|
|
||||||
filename: "fonts/[name][ext]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
stats: "errors-warnings",
|
|
||||||
performance: {
|
|
||||||
// We should eventually consider chunking to decrease
|
|
||||||
// these values
|
|
||||||
maxEntrypointSize: 27000000,
|
|
||||||
maxAssetSize: 27000000
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
openmct: './openmct.js',
|
||||||
|
generatorWorker: './example/generator/generatorWorker.js',
|
||||||
|
couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js',
|
||||||
|
inMemorySearchWorker: './src/api/objects/InMemorySearchWorker.js',
|
||||||
|
espressoTheme: './src/plugins/themes/espresso-theme.scss',
|
||||||
|
snowTheme: './src/plugins/themes/snow-theme.scss'
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
globalObject: 'this',
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(projectRootDir, 'dist'),
|
||||||
|
library: 'openmct',
|
||||||
|
libraryTarget: 'umd',
|
||||||
|
publicPath: '',
|
||||||
|
hashFunction: 'xxhash64',
|
||||||
|
clean: true
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.join(projectRootDir, 'src'),
|
||||||
|
legacyRegistry: path.join(projectRootDir, 'src/legacyRegistry'),
|
||||||
|
saveAs: 'file-saver/src/FileSaver.js',
|
||||||
|
csv: 'comma-separated-values',
|
||||||
|
EventEmitter: 'eventemitter3',
|
||||||
|
bourbon: 'bourbon.scss',
|
||||||
|
'plotly-basic': 'plotly.js-basic-dist-min',
|
||||||
|
'plotly-gl2d': 'plotly.js-gl2d-dist-min',
|
||||||
|
printj: 'printj/printj.mjs',
|
||||||
|
styles: path.join(projectRootDir, 'src/styles'),
|
||||||
|
MCT: path.join(projectRootDir, 'src/MCT'),
|
||||||
|
testUtils: path.join(projectRootDir, 'src/utils/testUtils.js'),
|
||||||
|
objectUtils: path.join(projectRootDir, 'src/api/objects/object-utils.js'),
|
||||||
|
utils: path.join(projectRootDir, 'src/utils')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
||||||
|
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
||||||
|
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
||||||
|
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`,
|
||||||
|
__VUE_OPTIONS_API__: true, // enable/disable Options API support, default: true
|
||||||
|
__VUE_PROD_DEVTOOLS__: false // enable/disable devtools support in production, default: false
|
||||||
|
}),
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: 'src/images/favicons',
|
||||||
|
to: 'favicons'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: './index.html',
|
||||||
|
transform: function (content) {
|
||||||
|
return content.toString().replace(/dist\//g, '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'src/plugins/imagery/layers',
|
||||||
|
to: 'imagery'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[name].css'
|
||||||
|
}),
|
||||||
|
// Add a UTF-8 BOM to CSS output to avoid random mojibake
|
||||||
|
new webpack.BannerPlugin({
|
||||||
|
test: /.*Theme\.css$/,
|
||||||
|
raw: true,
|
||||||
|
banner: '@charset "UTF-8";'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(sc|sa|c)ss$/,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
{
|
||||||
|
loader: 'css-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'resolve-url-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: { sourceMap: true }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
compilerOptions: {
|
||||||
|
hoistStatic: false,
|
||||||
|
whitespace: 'preserve'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
type: 'asset/source'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(jpg|jpeg|png|svg)$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'images/[name][ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.ico$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'icons/[name][ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(woff|woff2?|eot|ttf)$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'fonts/[name][ext]'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
stats: 'errors-warnings',
|
||||||
|
performance: {
|
||||||
|
// We should eventually consider chunking to decrease
|
||||||
|
// these values
|
||||||
|
maxEntrypointSize: 27000000,
|
||||||
|
maxAssetSize: 27000000
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -6,32 +6,32 @@ OpenMCT Continuous Integration servers use this configuration to add code covera
|
|||||||
information to pull requests.
|
information to pull requests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const config = require("./webpack.dev");
|
const config = require('./webpack.dev');
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const CI = process.env.CI === "true";
|
const CI = process.env.CI === 'true';
|
||||||
|
|
||||||
config.devtool = CI ? false : undefined;
|
config.devtool = CI ? false : undefined;
|
||||||
|
|
||||||
config.devServer.hot = false;
|
config.devServer.hot = false;
|
||||||
|
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /(Spec\.js$)|(node_modules)/,
|
exclude: /(Spec\.js$)|(node_modules)/,
|
||||||
use: {
|
use: {
|
||||||
loader: "babel-loader",
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
retainLines: true,
|
retainLines: true,
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
"babel-plugin-istanbul",
|
'babel-plugin-istanbul',
|
||||||
{
|
{
|
||||||
extension: [".js", ".vue"]
|
extension: ['.js', '.vue']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -5,55 +5,46 @@ This configuration should be used for development purposes. It contains full sou
|
|||||||
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
||||||
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const webpack = require("webpack");
|
const webpack = require('webpack');
|
||||||
const { merge } = require("webpack-merge");
|
const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
const common = require("./webpack.common");
|
const common = require('./webpack.common');
|
||||||
const projectRootDir = path.resolve(__dirname, "..");
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: "development",
|
mode: 'development',
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
// Since we use require.context, webpack is watching the entire directory.
|
// Since we use require.context, webpack is watching the entire directory.
|
||||||
// We need to exclude any files we don't want webpack to watch.
|
// We need to exclude any files we don't want webpack to watch.
|
||||||
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
||||||
ignored: [
|
ignored: [
|
||||||
"**/{node_modules,dist,docs,e2e}", // All files in node_modules, dist, docs, e2e,
|
'**/{node_modules,dist,docs,e2e}', // All files in node_modules, dist, docs, e2e,
|
||||||
"**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}", // Config files
|
'**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}', // Config files
|
||||||
"**/*.{sh,md,png,ttf,woff,svg}", // Non source files
|
'**/*.{sh,md,png,ttf,woff,svg}', // Non source files
|
||||||
"**/.*" // dotfiles and dotfolders
|
'**/.*' // dotfiles and dotfolders
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
resolve: {
|
plugins: [
|
||||||
alias: {
|
new webpack.DefinePlugin({
|
||||||
vue: path.join(projectRootDir, "node_modules/vue/dist/vue.js")
|
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
||||||
}
|
})
|
||||||
},
|
],
|
||||||
plugins: [
|
devtool: 'eval-source-map',
|
||||||
new webpack.DefinePlugin({
|
devServer: {
|
||||||
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
devMiddleware: {
|
||||||
})
|
writeToDisk: (filePathString) => {
|
||||||
],
|
const filePath = path.parse(filePathString);
|
||||||
devtool: "eval-source-map",
|
const shouldWrite = !filePath.base.includes('hot-update');
|
||||||
devServer: {
|
|
||||||
devMiddleware: {
|
|
||||||
writeToDisk: (filePathString) => {
|
|
||||||
const filePath = path.parse(filePathString);
|
|
||||||
const shouldWrite = !filePath.base.includes("hot-update");
|
|
||||||
|
|
||||||
return shouldWrite;
|
return shouldWrite;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watchFiles: ["**/*.css"],
|
watchFiles: ['**/*.css'],
|
||||||
static: {
|
static: {
|
||||||
directory: path.join(__dirname, "..", "/dist"),
|
directory: path.join(__dirname, '..', '/dist'),
|
||||||
publicPath: "/dist",
|
publicPath: '/dist',
|
||||||
watch: false
|
watch: false
|
||||||
},
|
|
||||||
client: {
|
|
||||||
progress: true,
|
|
||||||
overlay: true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,24 +4,19 @@
|
|||||||
This configuration should be used for production installs.
|
This configuration should be used for production installs.
|
||||||
It is the default webpack configuration.
|
It is the default webpack configuration.
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const webpack = require("webpack");
|
const webpack = require('webpack');
|
||||||
const { merge } = require("webpack-merge");
|
const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
const common = require("./webpack.common");
|
const common = require('./webpack.common');
|
||||||
const projectRootDir = path.resolve(__dirname, "..");
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: "production",
|
mode: 'production',
|
||||||
resolve: {
|
plugins: [
|
||||||
alias: {
|
new webpack.DefinePlugin({
|
||||||
vue: path.join(projectRootDir, "node_modules/vue/dist/vue.min.js")
|
__OPENMCT_ROOT_RELATIVE__: '""'
|
||||||
}
|
})
|
||||||
},
|
],
|
||||||
plugins: [
|
devtool: 'source-map'
|
||||||
new webpack.DefinePlugin({
|
|
||||||
__OPENMCT_ROOT_RELATIVE__: '""'
|
|
||||||
})
|
|
||||||
],
|
|
||||||
devtool: "source-map"
|
|
||||||
});
|
});
|
||||||
|
362
API.md
362
API.md
@ -2,7 +2,7 @@
|
|||||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
**Table of Contents**
|
**Table of Contents**
|
||||||
|
|
||||||
- [Building Applications With Open MCT](#developing-applications-with-open-mct)
|
- [Developing Applications With Open MCT](#developing-applications-with-open-mct)
|
||||||
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
||||||
- [Building From Source](#building-from-source)
|
- [Building From Source](#building-from-source)
|
||||||
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
||||||
@ -26,7 +26,7 @@
|
|||||||
- [Value Hints](#value-hints)
|
- [Value Hints](#value-hints)
|
||||||
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
||||||
- [Telemetry Providers](#telemetry-providers)
|
- [Telemetry Providers](#telemetry-providers)
|
||||||
- [Telemetry Requests and Responses.](#telemetry-requests-and-responses)
|
- [Telemetry Requests and Responses](#telemetry-requests-and-responses)
|
||||||
- [Request Strategies **draft**](#request-strategies-draft)
|
- [Request Strategies **draft**](#request-strategies-draft)
|
||||||
- [`latest` request strategy](#latest-request-strategy)
|
- [`latest` request strategy](#latest-request-strategy)
|
||||||
- [`minmax` request strategy](#minmax-request-strategy)
|
- [`minmax` request strategy](#minmax-request-strategy)
|
||||||
@ -44,8 +44,10 @@
|
|||||||
- [Clocks](#clocks)
|
- [Clocks](#clocks)
|
||||||
- [Defining and registering clocks](#defining-and-registering-clocks)
|
- [Defining and registering clocks](#defining-and-registering-clocks)
|
||||||
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
||||||
- [Stopping an active clock](#stopping-an-active-clock)
|
- [⚠️ \[DEPRECATED\] Stopping an active clock](#️-deprecated-stopping-an-active-clock)
|
||||||
- [Clock Offsets](#clock-offsets)
|
- [Clock Offsets](#clock-offsets)
|
||||||
|
- [Time Modes](#time-modes)
|
||||||
|
- [Time Mode Helper Methods](#time-mode-helper-methods)
|
||||||
- [Time Events](#time-events)
|
- [Time Events](#time-events)
|
||||||
- [List of Time Events](#list-of-time-events)
|
- [List of Time Events](#list-of-time-events)
|
||||||
- [The Time Conductor](#the-time-conductor)
|
- [The Time Conductor](#the-time-conductor)
|
||||||
@ -92,6 +94,9 @@ well as assets such as html, css, and images necessary for the UI.
|
|||||||
|
|
||||||
## Starting an Open MCT application
|
## Starting an Open MCT application
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Open MCT provides a development server via `webpack-dev-server` (`npm start`). **This should be used for development purposes only and should never be deployed to a production environment**.
|
||||||
|
|
||||||
To start a minimally functional Open MCT application, it is necessary to
|
To start a minimally functional Open MCT application, it is necessary to
|
||||||
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
||||||
the application. The tutorials walk through the process of getting Open MCT up
|
the application. The tutorials walk through the process of getting Open MCT up
|
||||||
@ -588,35 +593,108 @@ MinMax queries are issued by plots, and may be issued by other types as well. T
|
|||||||
#### Telemetry Formats
|
#### Telemetry Formats
|
||||||
|
|
||||||
Telemetry format objects define how to interpret and display telemetry data.
|
Telemetry format objects define how to interpret and display telemetry data.
|
||||||
They have a simple structure:
|
They have a simple structure, provided here as a TypeScript interface:
|
||||||
|
|
||||||
- `key`: A `string` that uniquely identifies this formatter.
|
```ts
|
||||||
- `format`: A `function` that takes a raw telemetry value, and returns a
|
interface Formatter {
|
||||||
human-readable `string` representation of that value. It has one required
|
key: string; // A string that uniquely identifies this formatter.
|
||||||
argument, and three optional arguments that provide context and can be used
|
|
||||||
for returning scaled representations of a value. An example of this is
|
format: (
|
||||||
representing time values in a scale such as the time conductor scale. There
|
value: any, // The raw telemetry value in its native type.
|
||||||
are multiple ways of representing a point in time, and by providing a minimum
|
minValue?: number, // An optional argument specifying the minimum displayed value.
|
||||||
scale value, maximum scale value, and a count, it's possible to provide more
|
maxValue?: number, // An optional argument specifying the maximum displayed value.
|
||||||
useful representations of time given the provided limitations.
|
count?: number // An optional argument specifying the number of displayed values.
|
||||||
- `value`: The raw telemetry value in its native type.
|
) => string; // Returns a human-readable string representation of the provided value.
|
||||||
- `minValue`: An **optional** argument specifying the minimum displayed
|
|
||||||
value.
|
parse: (
|
||||||
- `maxValue`: An **optional** argument specifying the maximum displayed
|
value: string | any // A string representation of a telemetry value or an already-parsed value.
|
||||||
value.
|
) => any; // Returns the value in its native type. This function should be idempotent.
|
||||||
- `count`: An **optional** argument specifying the number of displayed
|
|
||||||
values.
|
validate: (value: string) => boolean; // Takes a string representation of a telemetry value and returns a boolean indicating whether the provided string can be parsed.
|
||||||
- `parse`: A `function` that takes a `string` representation of a telemetry
|
}
|
||||||
value, and returns the value in its native type. **Note** parse might receive an already-parsed value. This function should be idempotent.
|
```
|
||||||
- `validate`: A `function` that takes a `string` representation of a telemetry
|
|
||||||
value, and returns a `boolean` value indicating whether the provided string
|
##### Built-in Formats
|
||||||
can be parsed.
|
|
||||||
|
Open MCT on its own defines a handful of built-in formats:
|
||||||
|
|
||||||
|
###### **Number Format (default):**
|
||||||
|
|
||||||
|
Applied to data with `format: 'number'`
|
||||||
|
```js
|
||||||
|
valueMetadata = {
|
||||||
|
format: 'number'
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface NumberFormatter extends Formatter {
|
||||||
|
parse: (x: any) => number;
|
||||||
|
format: (x: number) => string;
|
||||||
|
validate: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
###### **String Format**:
|
||||||
|
|
||||||
|
Applied to data with `format: 'string'`
|
||||||
|
```js
|
||||||
|
valueMetadata = {
|
||||||
|
format: 'string'
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
```ts
|
||||||
|
interface StringFormatter extends Formatter {
|
||||||
|
parse: (value: any) => string;
|
||||||
|
format: (value: string) => string;
|
||||||
|
validate: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
###### **Enum Format**:
|
||||||
|
Applied to data with `format: 'enum'`
|
||||||
|
```js
|
||||||
|
valueMetadata = {
|
||||||
|
format: 'enum',
|
||||||
|
enumerations: [
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
string: 'APPLE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
string: 'PEAR',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
string: 'ORANGE'
|
||||||
|
}]
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Creates a two-way mapping between enum string and value to be used in the `parse` and `format` methods.
|
||||||
|
Ex:
|
||||||
|
- `formatter.parse('APPLE') === 1;`
|
||||||
|
- `formatter.format(1) === 'APPLE';`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface EnumFormatter extends Formatter {
|
||||||
|
parse: (value: string) => string;
|
||||||
|
format: (value: number) => string;
|
||||||
|
validate: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
##### Registering Formats
|
##### Registering Formats
|
||||||
|
|
||||||
|
Formats implement the following interface (provided here as TypeScript for simplicity):
|
||||||
|
|
||||||
|
|
||||||
Formats are registered with the Telemetry API using the `addFormat` function. eg.
|
Formats are registered with the Telemetry API using the `addFormat` function. eg.
|
||||||
|
|
||||||
``` javascript
|
```javascript
|
||||||
openmct.telemetry.addFormat({
|
openmct.telemetry.addFormat({
|
||||||
key: 'number-to-string',
|
key: 'number-to-string',
|
||||||
format: function (number) {
|
format: function (number) {
|
||||||
@ -685,8 +763,9 @@ state of the application, and emits events to inform listeners when the state ch
|
|||||||
|
|
||||||
Because the data displayed tends to be time domain data, Open MCT must always
|
Because the data displayed tends to be time domain data, Open MCT must always
|
||||||
have at least one time system installed and activated. When you download Open
|
have at least one time system installed and activated. When you download Open
|
||||||
MCT, it will be pre-configured to use the UTC time system, which is installed and activated, along with other default plugins, in `index.html`. Installing and activating a time system is simple, and is covered
|
MCT, it will be pre-configured to use the UTC time system, which is installed and activated,
|
||||||
[in the next section](#defining-and-registering-time-systems).
|
along with other default plugins, in `index.html`. Installing and activating a time system
|
||||||
|
is simple, and is covered [in the next section](#defining-and-registering-time-systems).
|
||||||
|
|
||||||
### Time Systems and Bounds
|
### Time Systems and Bounds
|
||||||
|
|
||||||
@ -737,28 +816,38 @@ numbers in UTC terrestrial time.
|
|||||||
|
|
||||||
#### Getting and Setting the Active Time System
|
#### Getting and Setting the Active Time System
|
||||||
|
|
||||||
Once registered, a time system can be activated by calling `timeSystem` with
|
Once registered, a time system can be activated by calling `setTimeSystem` with
|
||||||
the timeSystem `key` or an instance of the time system. If you are not using a
|
the timeSystem `key` or an instance of the time system. You can also specify
|
||||||
[clock](#clocks), you must also specify valid [bounds](#time-bounds) for the
|
valid [bounds](#time-bounds) for the timeSystem.
|
||||||
timeSystem.
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.time.timeSystem('utc', bounds);
|
openmct.time.setTimeSystem('utc', bounds);
|
||||||
|
```
|
||||||
|
|
||||||
|
The current time system can be retrieved as well by calling `getTimeSystem`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
openmct.time.getTimeSystem();
|
||||||
```
|
```
|
||||||
|
|
||||||
A time system can be immediately activated after registration:
|
A time system can be immediately activated after registration:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.time.addTimeSystem(utcTimeSystem);
|
openmct.time.addTimeSystem(utcTimeSystem);
|
||||||
openmct.time.timeSystem(utcTimeSystem, bounds);
|
openmct.time.setTimeSystem(utcTimeSystem, bounds);
|
||||||
```
|
```
|
||||||
|
|
||||||
Setting the active time system will trigger a [`'timeSystem'`](#time-events)
|
Setting the active time system will trigger a [`'timeSystemChanged'`](#time-events)
|
||||||
event. If you supplied bounds, a [`'bounds'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
event. If you supplied bounds, a [`'boundsChanged'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `timeSystem()` is deprecated. Please use `getTimeSystem()` and `setTimeSystem()` as a replacement.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Time Bounds
|
#### Time Bounds
|
||||||
|
|
||||||
The TimeAPI provides a getter/setter for querying and setting time bounds. Time
|
The TimeAPI provides a getter and setter for querying and setting time bounds. Time
|
||||||
bounds are simply an object with a `start` and an end `end` attribute.
|
bounds are simply an object with a `start` and an end `end` attribute.
|
||||||
|
|
||||||
- `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
- `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
||||||
@ -768,26 +857,34 @@ telemetry views.
|
|||||||
This will be used as the end of the time period displayed by time-responsive
|
This will be used as the end of the time period displayed by time-responsive
|
||||||
telemetry views.
|
telemetry views.
|
||||||
|
|
||||||
If invoked with bounds, it will set the new time bounds system-wide. If invoked
|
New bounds can be set system wide by calling `setBounds` with [bounds](#time-bounds).
|
||||||
without any parameters, it will return the current application-wide time bounds.
|
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
const ONE_HOUR = 60 * 60 * 1000;
|
const ONE_HOUR = 60 * 60 * 1000;
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
openmct.time.bounds({start: now - ONE_HOUR, now);
|
openmct.time.setBounds({start: now - ONE_HOUR, now);
|
||||||
```
|
```
|
||||||
|
|
||||||
To respond to bounds change events, listen for the [`'bounds'`](#time-events)
|
Calling `getBounds` will return the current application-wide time bounds.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.getBounds();
|
||||||
|
```
|
||||||
|
|
||||||
|
To respond to bounds change events, listen for the [`'boundsChanged'`](#time-events)
|
||||||
event.
|
event.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `bounds()` is deprecated and will be removed in a future release. Please use `getBounds()` and `setBounds()` as a replacement.
|
||||||
|
|
||||||
### Clocks
|
### Clocks
|
||||||
|
|
||||||
The Time API can be set to follow a clock source which will cause the bounds
|
The Time API requires a clock source which will cause the bounds to be updated
|
||||||
to be updated automatically whenever the clock source "ticks". A clock is simply
|
automatically whenever the clock source "ticks". A clock is simply an object that
|
||||||
an object that supports registration of listeners and periodically invokes its
|
supports registration of listeners and periodically invokes its listeners with a
|
||||||
listeners with a number. Open MCT supports registration of new clock sources that
|
number. Open MCT supports registration of new clock sources that tick on almost
|
||||||
tick on almost anything. A tick occurs when the clock invokes callback functions
|
anything. A tick occurs when the clock invokes callback functions registered by its
|
||||||
registered by its listeners with a new time value.
|
listeners with a new time value.
|
||||||
|
|
||||||
An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js)
|
An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js)
|
||||||
which emits the current time in UTC every 100ms. Clocks can tick on anything. For
|
which emits the current time in UTC every 100ms. Clocks can tick on anything. For
|
||||||
@ -855,23 +952,31 @@ An example clock implementation is provided in the form of the [LocalClock](http
|
|||||||
|
|
||||||
#### Getting and setting active clock
|
#### Getting and setting active clock
|
||||||
|
|
||||||
Once registered a clock can be activated by calling the `clock` function on the
|
Once registered a clock can be activated by calling the `setClock` function on the
|
||||||
Time API passing in the key or instance of a registered clock. Only one clock
|
Time API passing in the key or instance of a registered clock. Only one clock
|
||||||
may be active at once, so activating a clock will deactivate any currently
|
may be active at once, so activating a clock will deactivate any currently
|
||||||
active clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock.
|
active clock and start the new clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock.
|
||||||
|
|
||||||
Setting the clock triggers a [`'clock'`](#time-events) event, followed by a [`'clockOffsets'`](#time-events) event, and then a [`'bounds'`](#time-events) event as the offsets are applied to the clock's currentValue().
|
Setting the clock triggers a [`'clockChanged'`](#time-events) event, followed by a [`'clockOffsetsChanged'`](#time-events) event, and then a [`'boundsChanged'`](#time-events) event as the offsets are applied to the clock's currentValue().
|
||||||
|
|
||||||
```
|
```
|
||||||
openmct.time.clock(someClock, clockOffsets);
|
openmct.time.setClock(someClock, clockOffsets);
|
||||||
```
|
```
|
||||||
|
|
||||||
Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`.
|
Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`.
|
||||||
|
|
||||||
The currently active clock (if any) can be retrieved by calling the same
|
The currently active clock can be retrieved by calling `getClock`.
|
||||||
function without any arguments.
|
|
||||||
|
|
||||||
#### Stopping an active clock
|
```
|
||||||
|
openmct.time.getClock();
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `clock()` is deprecated and will be removed in a future release. Please use `getClock()` and `setClock()` as a replacement.
|
||||||
|
|
||||||
|
#### ⚠️ [DEPRECATED] Stopping an active clock
|
||||||
|
|
||||||
|
_As of July 2023, this method will be deprecated. Open MCT will always have a ticking clock._
|
||||||
|
|
||||||
The `stopClock` method can be used to stop an active clock, and to clear it. It
|
The `stopClock` method can be used to stop an active clock, and to clear it. It
|
||||||
will stop the clock from ticking, and set the active clock to `undefined`.
|
will stop the clock from ticking, and set the active clock to `undefined`.
|
||||||
@ -880,12 +985,14 @@ will stop the clock from ticking, and set the active clock to `undefined`.
|
|||||||
openmct.time.stopClock();
|
openmct.time.stopClock();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `stopClock()` is deprecated and will be removed in a future release.
|
||||||
|
|
||||||
#### Clock Offsets
|
#### Clock Offsets
|
||||||
|
|
||||||
When a clock is active, the time bounds of the application will be updated
|
When in Real-time [mode](#time-modes), the time bounds of the application will be updated automatically each time the
|
||||||
automatically each time the clock "ticks". The bounds are calculated based on
|
clock "ticks". The bounds are calculated based on the current value provided by
|
||||||
the current value provided by the active clock (via its `tick` event, or its
|
the active clock (via its `tick` event, or its `currentValue()` method).
|
||||||
`currentValue()` method).
|
|
||||||
|
|
||||||
Unlike bounds, which represent absolute time values, clock offsets represent
|
Unlike bounds, which represent absolute time values, clock offsets represent
|
||||||
relative time spans. Offsets are defined as an object with two properties:
|
relative time spans. Offsets are defined as an object with two properties:
|
||||||
@ -896,21 +1003,77 @@ value provided by a clock's tick callback, or its `currentValue()` function.
|
|||||||
- `end`: A `number` that must be >= 0 and which is used to calculate the end
|
- `end`: A `number` that must be >= 0 and which is used to calculate the end
|
||||||
bounds on each clock tick.
|
bounds on each clock tick.
|
||||||
|
|
||||||
The `clockOffsets` function can be used to get or set clock offsets. For example,
|
The `setClockOffsets` function can be used to get or set clock offsets. For example,
|
||||||
to show the last fifteen minutes in a ms-based time system:
|
to show the last fifteen minutes in a ms-based time system:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
||||||
|
|
||||||
openmct.time.clockOffsets({
|
openmct.time.setClockOffsets({
|
||||||
start: -FIFTEEN_MINUTES,
|
start: -FIFTEEN_MINUTES,
|
||||||
end: 0
|
end: 0
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `getClockOffsets` method will return the currently set clock offsets.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
openmct.time.getClockOffsets()
|
||||||
|
```
|
||||||
|
|
||||||
**Note:** Setting the clock offsets will trigger an immediate bounds change, as
|
**Note:** Setting the clock offsets will trigger an immediate bounds change, as
|
||||||
new bounds will be calculated based on the `currentValue()` of the active clock.
|
new bounds will be calculated based on the `currentValue()` of the active clock.
|
||||||
Clock offsets are only relevant when a clock source is active.
|
Clock offsets are only relevant when in Real-time [mode](#time-modes).
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `clockOffsets()` is deprecated and will be removed in a future release. Please use `getClockOffsets()` and `setClockOffsets()` as a replacement.
|
||||||
|
|
||||||
|
### Time Modes
|
||||||
|
|
||||||
|
There are two time modes in Open MCT, "Fixed" and "Real-time". In Real-time mode the
|
||||||
|
time bounds of the application will be updated automatically each time the clock "ticks".
|
||||||
|
The bounds are calculated based on the current value provided by the active clock. In
|
||||||
|
Fixed mode, the time bounds are set for a specified time range. When Open MCT is first
|
||||||
|
initialized, it will be in Real-time mode.
|
||||||
|
|
||||||
|
The `setMode` method can be used to set the current time mode. It accepts a mode argument,
|
||||||
|
`'realtime'` or `'fixed'` and it also accepts an optional [offsets](#clock-offsets)/[bounds](#time-bounds) argument dependent
|
||||||
|
on the current mode.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.setMode('fixed');
|
||||||
|
openmct.time.setMode('fixed', bounds); // with optional bounds
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.setMode('realtime');
|
||||||
|
openmct.time.setMode('realtime', offsets); // with optional offsets
|
||||||
|
```
|
||||||
|
|
||||||
|
The `getMode` method will return the current time mode, either `'realtime'` or `'fixed'`.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.getMode();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Time Mode Helper Methods
|
||||||
|
|
||||||
|
There are two methods available to determine the current time mode in Open MCT programmatically,
|
||||||
|
`isRealTime` and `isFixed`. Each one will return a boolean value based on the current mode.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
if (openmct.time.isRealTime()) {
|
||||||
|
// do real-time stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
if (openmct.time.isFixed()) {
|
||||||
|
// do fixed-time stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Time Events
|
### Time Events
|
||||||
|
|
||||||
@ -919,7 +1082,7 @@ The Time API is a standard event emitter; you can register callbacks for events
|
|||||||
For example:
|
For example:
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
openmct.time.on('bounds', function callback (newBounds, tick) {
|
openmct.time.on('boundsChanged', function callback (newBounds, tick) {
|
||||||
// Do something with new bounds
|
// Do something with new bounds
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -928,7 +1091,7 @@ openmct.time.on('bounds', function callback (newBounds, tick) {
|
|||||||
|
|
||||||
The events emitted by the Time API are:
|
The events emitted by the Time API are:
|
||||||
|
|
||||||
- `bounds`: emitted whenever the bounds change. The callback will be invoked
|
- `boundsChanged`: emitted whenever the bounds change. The callback will be invoked
|
||||||
with two arguments:
|
with two arguments:
|
||||||
- `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
- `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
||||||
representing a new time period bound by the specified start and send times.
|
representing a new time period bound by the specified start and send times.
|
||||||
@ -943,15 +1106,24 @@ The events emitted by the Time API are:
|
|||||||
If `tick` is false,then the bounds change was not due to an automatic tick,
|
If `tick` is false,then the bounds change was not due to an automatic tick,
|
||||||
and a query for historical data may be necessary, depending on your data
|
and a query for historical data may be necessary, depending on your data
|
||||||
caching strategy, and how significantly the start bound has changed.
|
caching strategy, and how significantly the start bound has changed.
|
||||||
- `timeSystem`: emitted whenever the active time system changes. The callback will be invoked with a single argument:
|
- `timeSystemChanged`: emitted whenever the active time system changes. The callback will be invoked with a single argument:
|
||||||
- `timeSystem`: The newly active [time system](#defining-and-registering-time-systems).
|
- `timeSystem`: The newly active [time system](#defining-and-registering-time-systems).
|
||||||
- `clock`: emitted whenever the clock changes. The callback will be invoked
|
- `clockChanged`: emitted whenever the clock changes. The callback will be invoked
|
||||||
with a single argument:
|
with a single argument:
|
||||||
- `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
- `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
||||||
clock has been deactivated.
|
clock has been deactivated.
|
||||||
- `clockOffsets`: emitted whenever the active clock offsets change. The
|
- `clockOffsetsChanged`: emitted whenever the active clock offsets change. The
|
||||||
callback will be invoked with a single argument:
|
callback will be invoked with a single argument:
|
||||||
- `clockOffsets`: The new [clock offsets](#clock-offsets).
|
- `clockOffsets`: The new [clock offsets](#clock-offsets).
|
||||||
|
- `modeChanged`: emitted whenever the time [mode](#time-modes) changed. The callback will
|
||||||
|
be invoked with one argument:
|
||||||
|
- `mode`: A string representation of the current time mode, either `'realtime'` or `'fixed'`.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated Events** (These will be removed in a future release):
|
||||||
|
> - `bounds` → `boundsChanged`
|
||||||
|
> - `timeSystem` → `timeSystemChanged`
|
||||||
|
> - `clock` → `clockChanged`
|
||||||
|
> - `clockOffsets` → `clockOffsetsChanged`
|
||||||
|
|
||||||
### The Time Conductor
|
### The Time Conductor
|
||||||
|
|
||||||
@ -1132,3 +1304,61 @@ View provider Example:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 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).
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
|
||||||
|
The show function is responsible for the rendering of a view. An [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) is used internally to determine whether the view is visible. This observer drives the visibility-based rendering feature, accessed via the `renderWhenVisible` function provided in the `viewOptions` parameter.
|
||||||
|
|
||||||
|
### Implementing Visibility-Based Rendering
|
||||||
|
|
||||||
|
The `renderWhenVisible` function is passed to the show function as part of the `viewOptions` object. This function can be used for all rendering logic that would otherwise be executed within a `requestAnimationFrame` call. When called, `renderWhenVisible` will either execute the provided function immediately (via `requestAnimationFrame`) if the view is currently visible, or defer its execution until the view becomes visible.
|
||||||
|
|
||||||
|
Additionally, `renderWhenVisible` returns a boolean value indicating whether the provided function was executed immediately (`true`) or deferred (`false`).
|
||||||
|
|
||||||
|
Monitoring of visibility begins after the first call to `renderWhenVisible` is made.
|
||||||
|
|
||||||
|
Here’s the signature for the show function:
|
||||||
|
|
||||||
|
`show(element, isEditing, viewOptions)`
|
||||||
|
|
||||||
|
* `element` (HTMLElement) - The DOM element where the view should be rendered.
|
||||||
|
* `isEditing` (boolean) - Indicates whether the view is in editing mode.
|
||||||
|
* `viewOptions` (Object) - An object with configuration options for the view, including:
|
||||||
|
* `renderWhenVisible` (Function) - This function wraps the `requestAnimationFrame` and only triggers the provided render logic when the view is visible in the viewport.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
An OpenMCT view provider might implement the show function as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Define your view provider
|
||||||
|
const myViewProvider = {
|
||||||
|
// ... other properties and methods ...
|
||||||
|
show: function (element, isEditing, viewOptions) {
|
||||||
|
// Callback for rendering view content
|
||||||
|
const renderCallback = () => {
|
||||||
|
// Your view rendering logic goes here
|
||||||
|
};
|
||||||
|
|
||||||
|
// Use the renderWhenVisible function to ensure rendering only happens when view is visible
|
||||||
|
const wasRenderedImmediately = viewOptions.renderWhenVisible(renderCallback);
|
||||||
|
|
||||||
|
// Optionally handle the immediate rendering return value
|
||||||
|
if (wasRenderedImmediately) {
|
||||||
|
console.debug('🪞 Rendering triggered immediately as the view is visible.');
|
||||||
|
} else {
|
||||||
|
console.debug('🛑 Rendering has been deferred until the view becomes visible.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Note that `renderWhenVisible` defers rendering while the view is not visible and caters to the latest execution call. This provides responsiveness for dynamic content while ensuring performance optimizations.
|
||||||
|
|
||||||
|
Ensure your view logic is prepared to handle potentially multiple deferrals if using this API, as only the last call to renderWhenVisible will be queued for execution upon the view becoming visible.
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ The short version:
|
|||||||
for review.)
|
for review.)
|
||||||
4. Respond to any discussion. When the reviewer decides it's ready, they
|
4. Respond to any discussion. When the reviewer decides it's ready, they
|
||||||
will merge back `master` and fill out their own check list.
|
will merge back `master` and fill out their own check list.
|
||||||
5. If you are a first-time contributor, please see [this discussion](https://github.com/nasa/openmct/discussions/3821) for further information.
|
5. If you are a first-time contributor, please see [this discussion](https://github.com/nasa/openmct/discussions/3821) for further information.
|
||||||
|
|
||||||
## Contribution Process
|
## Contribution Process
|
||||||
|
|
||||||
Open MCT uses git for software version control, and for branching and
|
Open MCT uses git for software version control, and for branching and
|
||||||
merging. The central repository is at
|
merging. The central repository is at
|
||||||
https://github.com/nasa/openmct.git.
|
<https://github.com/nasa/openmct.git>.
|
||||||
|
|
||||||
### Roles
|
### Roles
|
||||||
|
|
||||||
@ -116,6 +116,7 @@ the pull request containing the reviewer checklist (from below) and complete
|
|||||||
the merge back to the master branch.
|
the merge back to the master branch.
|
||||||
|
|
||||||
Additionally:
|
Additionally:
|
||||||
|
|
||||||
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
||||||
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
||||||
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
||||||
@ -132,25 +133,26 @@ changes.
|
|||||||
|
|
||||||
### Code Standards
|
### Code Standards
|
||||||
|
|
||||||
JavaScript sources in Open MCT must satisfy the ESLint rules defined in
|
JavaScript sources in Open MCT must satisfy the [ESLint](https://eslint.org/) rules defined in
|
||||||
this repository. This is verified by the command line build.
|
this repository. [Prettier](https://prettier.io/) is used in conjunction with ESLint to enforce code style
|
||||||
|
via automated formatting. These are verified by the command line build.
|
||||||
|
|
||||||
#### Code Guidelines
|
#### Code Guidelines
|
||||||
|
|
||||||
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
||||||
|
|
||||||
1. Write clean code. Here’s a good summary - https://github.com/ryanmcdermott/clean-code-javascript.
|
1. Write clean code. Here’s a good summary - <https://github.com/ryanmcdermott/clean-code-javascript>.
|
||||||
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
||||||
1. Include non-JSDoc comments as-needed for explaining private variables,
|
1. Include non-JSDoc comments as-needed for explaining private variables,
|
||||||
methods, or algorithms when they are non-obvious. Otherwise code
|
methods, or algorithms when they are non-obvious. Otherwise code
|
||||||
should be self-documenting.
|
should be self-documenting.
|
||||||
1. Classes and Vue components should use camel case, first letter capitalized
|
1. Classes and Vue components should use camel case, first letter capitalized
|
||||||
(e.g. SomeClassName).
|
(e.g. SomeClassName).
|
||||||
1. Methods, variables, fields, events, and function names should use camelCase,
|
1. Methods, variables, fields, events, and function names should use camelCase,
|
||||||
first letter lower-case (e.g. someVariableName).
|
first letter lower-case (e.g. someVariableName).
|
||||||
1. Source files that export functions should use camelCase, first letter lower-case (eg. testTools.js)
|
1. Source files that export functions should use camelCase, first letter lower-case (eg. testTools.js)
|
||||||
1. Constants (variables or fields which are meant to be declared and
|
1. Constants (variables or fields which are meant to be declared and
|
||||||
initialized statically, and never changed) should use only capital
|
initialized statically, and never changed) should use only capital
|
||||||
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
||||||
1. File names should be the name of the exported class, plus a .js extension
|
1. File names should be the name of the exported class, plus a .js extension
|
||||||
(e.g. SomeClassName.js).
|
(e.g. SomeClassName.js).
|
||||||
@ -159,21 +161,25 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
||||||
1. Named functions are preferred over functions assigned to variables.
|
1. Named functions are preferred over functions assigned to variables.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
function renameObject(object, newName) {
|
function renameObject(object, newName) {
|
||||||
Object.name = newName;
|
Object.name = newName;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const rename = (object, newName) => {
|
const rename = (object, newName) => {
|
||||||
Object.name = newName;
|
Object.name = newName;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Avoid deep nesting (especially of functions), except where necessary
|
1. Avoid deep nesting (especially of functions), except where necessary
|
||||||
(e.g. due to closure scope).
|
(e.g. due to closure scope).
|
||||||
1. End with a single new-line character.
|
1. End with a single new-line character.
|
||||||
1. Always use ES6 `Class`es and inheritance rather than the pre-ES6 prototypal
|
1. Always use ES6 `Class`es and inheritance rather than the pre-ES6 prototypal
|
||||||
pattern.
|
pattern.
|
||||||
1. Within a given function's scope, do not mix declarations and imperative
|
1. Within a given function's scope, do not mix declarations and imperative
|
||||||
code, and present these in the following order:
|
code, and present these in the following order:
|
||||||
@ -182,19 +188,24 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
||||||
1. Avoid the use of "magic" values.
|
1. Avoid the use of "magic" values.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const UNAUTHORIZED = 401;
|
const UNAUTHORIZED = 401;
|
||||||
if (responseCode === UNAUTHORIZED)
|
if (responseCode === UNAUTHORIZED)
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
if (responseCode === 401)
|
if (responseCode === 401)
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
||||||
1. Test specs should reside alongside the source code they test, not in a separate directory.
|
1. Unit Test specs should reside alongside the source code they test, not in a separate directory.
|
||||||
1. Organize code by feature, not by type.
|
1. Organize code by feature, not by type.
|
||||||
eg.
|
eg.
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- row
|
- row
|
||||||
TableRow.js
|
TableRow.js
|
||||||
@ -206,8 +217,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- components
|
- components
|
||||||
TableRow.vue
|
TableRow.vue
|
||||||
@ -219,47 +232,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Deviations from Open MCT code style guidelines require two-party agreement,
|
Deviations from Open MCT code style guidelines require two-party agreement,
|
||||||
typically from the author of the change and its reviewer.
|
typically from the author of the change and its reviewer.
|
||||||
|
|
||||||
### Test Standards
|
|
||||||
|
|
||||||
Automated testing shall occur whenever changes are merged into the main
|
|
||||||
development branch and must be confirmed alongside any pull request.
|
|
||||||
|
|
||||||
Automated tests are tests which exercise plugins, API, and utility classes.
|
|
||||||
Tests are subject to code review along with the actual implementation, to
|
|
||||||
ensure that tests are applicable and useful.
|
|
||||||
|
|
||||||
Examples of useful tests:
|
|
||||||
* Tests which replicate bugs (or their root causes) to verify their
|
|
||||||
resolution.
|
|
||||||
* Tests which reflect details from software specifications.
|
|
||||||
* Tests which exercise edge or corner cases among inputs.
|
|
||||||
* Tests which verify expected interactions with other components in the
|
|
||||||
system.
|
|
||||||
|
|
||||||
#### Guidelines
|
|
||||||
* 100% statement coverage is achievable and desirable.
|
|
||||||
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
|
|
||||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
|
||||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
|
||||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
|
||||||
* Where builtin functions have been mocked, be sure to clear them between tests.
|
|
||||||
* Test at an appropriate level of isolation. Eg.
|
|
||||||
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
|
||||||
* You do not need to test that the view switcher works, there should be separate tests for that.
|
|
||||||
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
|
||||||
* Use your best judgement when deciding on appropriate scope.
|
|
||||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
|
||||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
|
||||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
|
||||||
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
|
|
||||||
|
|
||||||
#### Examples
|
|
||||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
|
||||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
|
||||||
|
|
||||||
### Commit Message Standards
|
### Commit Message Standards
|
||||||
|
|
||||||
Commit messages should:
|
Commit messages should:
|
||||||
@ -295,13 +271,13 @@ these standards.
|
|||||||
|
|
||||||
## Issue Reporting
|
## Issue Reporting
|
||||||
|
|
||||||
Issues are tracked at https://github.com/nasa/openmct/issues.
|
Issues are tracked at <https://github.com/nasa/openmct/issues>.
|
||||||
|
|
||||||
Issue severity is categorized as follows (in ascending order):
|
Issue severity is categorized as follows (in ascending order):
|
||||||
|
|
||||||
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
||||||
* _Medium_: Some impairment of use, but simple workarounds exist
|
* _Medium_: Some impairment of use, but simple workarounds exist
|
||||||
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though.
|
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though. Complex workarounds exist.
|
||||||
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
||||||
|
|
||||||
## Check Lists
|
## Check Lists
|
||||||
@ -310,22 +286,4 @@ The following check lists should be completed and attached to pull requests
|
|||||||
when they are filed (author checklist) and when they are merged (reviewer
|
when they are filed (author checklist) and when they are merged (reviewer
|
||||||
checklist).
|
checklist).
|
||||||
|
|
||||||
### Author Checklist
|
|
||||||
|
|
||||||
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
||||||
|
|
||||||
### Reviewer Checklist
|
|
||||||
|
|
||||||
* [ ] Changes appear to address issue?
|
|
||||||
* [ ] Changes appear not to be breaking changes?
|
|
||||||
* [ ] Appropriate unit tests included?
|
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
|
||||||
* [ ] Commit messages meet standards?
|
|
||||||
* [ ] Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)
|
|
||||||
* [ ] Has associated issue been labelled `bug`? (only applicable if this PR is for a bug fix)
|
|
||||||
* [ ] List of Acceptance Tests Performed.
|
|
||||||
|
|
||||||
Write out a small list of tests performed with just enough detail for another developer on the team
|
|
||||||
to execute.
|
|
||||||
|
|
||||||
i.e. ```When Clicking on Add button, new `object` appears in dropdown.```
|
|
||||||
|
63
README.md
63
README.md
@ -1,8 +1,10 @@
|
|||||||
# Open MCT [](http://www.apache.org/licenses/LICENSE-2.0) [](https://codecov.io/gh/nasa/openmct) [](https://percy.io/b2e34b17/openmct) [](https://www.npmjs.com/package/openmct)
|
# Open MCT [](http://www.apache.org/licenses/LICENSE-2.0) [](https://codecov.io/gh/nasa/openmct) [](https://percy.io/b2e34b17/openmct) [](https://www.npmjs.com/package/openmct) 
|
||||||
|
|
||||||
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
||||||
|
|
||||||
Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
> [!NOTE]
|
||||||
|
> Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
||||||
|
|
||||||
|
|
||||||
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
||||||
|
|
||||||
@ -14,19 +16,32 @@ Once you've created something amazing with Open MCT, showcase your work in our G
|
|||||||
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
||||||
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
||||||
|
|
||||||
1. Clone the source code
|
1. Clone the source code:
|
||||||
|
|
||||||
`git clone https://github.com/nasa/openmct.git`
|
```
|
||||||
|
git clone https://github.com/nasa/openmct.git
|
||||||
|
```
|
||||||
|
|
||||||
2. Install development dependencies. Note: Check the package.json engine for our tested and supported node versions.
|
2. (Optional) Install the correct node version using [nvm](https://github.com/nvm-sh/nvm):
|
||||||
|
|
||||||
`npm install`
|
```
|
||||||
|
nvm install
|
||||||
|
```
|
||||||
|
|
||||||
3. Run a local development server
|
3. Install development dependencies (Note: Check the `package.json` engine for our tested and supported node versions):
|
||||||
|
|
||||||
`npm start`
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
4. Run a local development server:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
||||||
|
|
||||||
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
||||||
|
|
||||||
@ -40,8 +55,12 @@ The clearest examples for developing Open MCT plugins are in the
|
|||||||
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
||||||
our documentation.
|
our documentation.
|
||||||
|
|
||||||
We want Open MCT to be as easy to use, install, run, and develop for as
|
> [!NOTE]
|
||||||
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
> We want Open MCT to be as easy to use, install, run, and develop for as
|
||||||
|
> possible, and your feedback will help us get there!
|
||||||
|
> Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose),
|
||||||
|
> [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions),
|
||||||
|
> or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
||||||
|
|
||||||
## Developing Applications With Open MCT
|
## Developing Applications With Open MCT
|
||||||
|
|
||||||
@ -51,6 +70,8 @@ For more on developing with Open MCT, see our documentation for a guide on [Deve
|
|||||||
|
|
||||||
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
||||||
|
|
||||||
|
The project uses `nvm` to ensure the node and npm version used, is coherent in all projects. Install nvm (non-windows), [here](https://github.com/nvm-sh/nvm) or the windows equivalent [here](https://github.com/coreybutler/nvm-windows)
|
||||||
|
|
||||||
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
@ -95,10 +116,10 @@ To run the performance tests:
|
|||||||
|
|
||||||
`npm run test:perf`
|
`npm run test:perf`
|
||||||
|
|
||||||
The test suite is configured to all tests localed in `e2e/tests/` ending in `*.e2e.spec.js`. For more about the e2e test suite, please see the [README](./e2e/README.md)
|
The test suite is configured to all tests located in `e2e/tests/` ending in `*.e2e.spec.js`. For more about the e2e test suite, please see the [README](./e2e/README.md)
|
||||||
|
|
||||||
### Security Tests
|
### Security Tests
|
||||||
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/). The list of CWE coverage items is avaiable in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml).
|
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/). The list of CWE coverage items is available in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml).
|
||||||
|
|
||||||
### Test Reporting and Code Coverage
|
### Test Reporting and Code Coverage
|
||||||
|
|
||||||
@ -106,6 +127,8 @@ Each test suite generates a report in CircleCI. For a complete overview of testi
|
|||||||
|
|
||||||
Our code coverage is generated during the runtime of our unit, e2e, and visual tests. The combination of those reports is published to [codecov.io](https://app.codecov.io/gh/nasa/openmct/)
|
Our code coverage is generated during the runtime of our unit, e2e, and visual tests. The combination of those reports is published to [codecov.io](https://app.codecov.io/gh/nasa/openmct/)
|
||||||
|
|
||||||
|
For more on the specifics of our code coverage setup, [see](TESTING.md#code-coverage)
|
||||||
|
|
||||||
# Glossary
|
# Glossary
|
||||||
|
|
||||||
Certain terms are used throughout Open MCT with consistent meanings
|
Certain terms are used throughout Open MCT with consistent meanings
|
||||||
@ -161,3 +184,17 @@ You might still be using legacy API if your source code
|
|||||||
|
|
||||||
### What should I do if I am using legacy API?
|
### What should I do if I am using legacy API?
|
||||||
Please refer to [the modern Open MCT API](https://nasa.github.io/openmct/documentation/). Post any questions to the [Discussions section](https://github.com/nasa/openmct/discussions) of the Open MCT GitHub repository.
|
Please refer to [the modern Open MCT API](https://nasa.github.io/openmct/documentation/). Post any questions to the [Discussions section](https://github.com/nasa/openmct/discussions) of the Open MCT GitHub repository.
|
||||||
|
|
||||||
|
## Related Repos
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Although Open MCT functions as a standalone project, it is primarily an extensible framework intended to be used as a dependency with users' own plugins and packaging. Furthermore, Open MCT is intended to be used with an HTTP server such as Apache or Nginx. A great example of hosting Open MCT with Apache is `openmct-quickstart` and can be found in the table below.
|
||||||
|
|
||||||
|
| Repository | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| [openmct-tutorial](https://github.com/nasa/openmct-tutorial) | A great place for beginners to learn how to use and extend Open MCT. |
|
||||||
|
| [openmct-quickstart](https://github.com/scottbell/openmct-quickstart) | A working example of Open MCT integrated with Apache HTTP server, YAMCS telemetry, and Couch DB for persistence.
|
||||||
|
| [Open MCT YAMCS Plugin](https://github.com/akhenry/openmct-yamcs) | Plugin for integrating YAMCS telemetry and command server with Open MCT. |
|
||||||
|
| [openmct-performance](https://github.com/unlikelyzero/openmct-performance) | Resources for performance testing Open MCT. |
|
||||||
|
| [openmct-as-a-dependency](https://github.com/unlikelyzero/openmct-as-a-dependency) | An advanced guide for users on how to build, develop, and test Open MCT when it's used as a dependency. |
|
||||||
|
|
||||||
|
121
TESTING.md
Normal file
121
TESTING.md
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
# Testing
|
||||||
|
Open MCT Testing is iterating and improving at a rapid pace. This document serves to capture and index existing testing documentation and house documentation which no other obvious location as our testing evolves.
|
||||||
|
|
||||||
|
## General Testing Process
|
||||||
|
Documentation located [here](./docs/src/process/testing/plan.md)
|
||||||
|
|
||||||
|
## Unit Testing
|
||||||
|
Unit testing is essential part of our test strategy and complements our e2e testing strategy.
|
||||||
|
|
||||||
|
#### Unit Test Guidelines
|
||||||
|
* Unit Test specs should reside alongside the source code they test, not in a separate directory.
|
||||||
|
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
||||||
|
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
||||||
|
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
||||||
|
* Where builtin functions have been mocked, be sure to clear them between tests.
|
||||||
|
* Test at an appropriate level of isolation. Eg.
|
||||||
|
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
||||||
|
* You do not need to test that the view switcher works, there should be separate tests for that.
|
||||||
|
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
||||||
|
* Use your best judgement when deciding on appropriate scope.
|
||||||
|
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
||||||
|
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
||||||
|
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
||||||
|
|
||||||
|
#### Unit Test Examples
|
||||||
|
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
||||||
|
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
||||||
|
|
||||||
|
#### Unit Testing Execution
|
||||||
|
|
||||||
|
The unit tests can be executed in one of two ways:
|
||||||
|
`npm run test` which runs the entire suite against headless chrome
|
||||||
|
`npm run test:debug` for debugging the tests in realtime in an active chrome session.
|
||||||
|
|
||||||
|
## e2e, performance, and visual testing
|
||||||
|
Documentation located [here](./e2e/README.md)
|
||||||
|
|
||||||
|
## Code Coverage
|
||||||
|
|
||||||
|
It's up to the individual developer as to whether they want to add line coverage in the form of a unit test or e2e test.
|
||||||
|
|
||||||
|
Line Code Coverage is generated by our unit tests and e2e tests, then combined by ([Codecov.io Flags](https://docs.codecov.com/docs/flags)), and finally reported in GitHub PRs by Codecov.io's PR Bot. This workflow gives a comprehensive (if flawed) view of line coverage.
|
||||||
|
|
||||||
|
### Karma-istanbul
|
||||||
|
|
||||||
|
Line coverage is generated by our `karma-coverage-istanbul-reporter` package as defined in our `karma.conf.js` file:
|
||||||
|
|
||||||
|
```js
|
||||||
|
coverageIstanbulReporter: {
|
||||||
|
fixWebpackSourcePaths: true,
|
||||||
|
skipFilesWithNoCoverage: true,
|
||||||
|
dir: 'coverage/unit', //Sets coverage file to be consumed by codecov.io
|
||||||
|
reports: ['lcovonly']
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the file is generated, it can be published to codecov with
|
||||||
|
|
||||||
|
```json
|
||||||
|
"cov:unit:publish": "codecov --disable=gcov -f ./coverage/unit/lcov.info -F unit",
|
||||||
|
```
|
||||||
|
|
||||||
|
### e2e
|
||||||
|
The e2e line coverage is a bit more complex than the karma implementation. This is the general sequence of events:
|
||||||
|
|
||||||
|
1. Each e2e suite will start webpack with the ```npm run start:coverage``` command with config `webpack.coverage.js` and the `babel-plugin-istanbul` plugin to generate code coverage during e2e test execution using our custom [baseFixture](./baseFixtures.js).
|
||||||
|
1. During testcase execution, each e2e shard will generate its piece of the larger coverage suite. **This coverage file is not merged**. The raw coverage file is stored in a `.nyc_report` directory.
|
||||||
|
1. [nyc](https://github.com/istanbuljs/nyc) converts this directory into a `lcov` file with the following command `npm run cov:e2e:report`
|
||||||
|
1. Most of the tests are run in the '@stable' configuration and focus on chrome/ubuntu at a single resolution. This coverage is published to codecov with `npm run cov:e2e:stable:publish`.
|
||||||
|
1. The rest of our coverage only appears when run against `@unstable` tests, persistent datastore (couchdb), non-ubuntu machines, and non-chrome browsers with the `npm run cov:e2e:full:publish` flag. Since this happens about once a day, we have leveraged codecov.io's carryforward flag to report on lines covered outside of each commit on an individual PR.
|
||||||
|
|
||||||
|
|
||||||
|
### Limitations in our code coverage reporting
|
||||||
|
Our code coverage implementation has some known limitations:
|
||||||
|
- [Variability](https://github.com/nasa/openmct/issues/5811)
|
||||||
|
- [Accuracy](https://github.com/nasa/openmct/issues/7015)
|
||||||
|
- [Vue instrumentation gaps](https://github.com/nasa/openmct/issues/4973)
|
||||||
|
|
||||||
|
## Troubleshooting CI
|
||||||
|
The following is an evolving guide to troubleshoot CI and PR issues.
|
||||||
|
|
||||||
|
### Github Checks failing
|
||||||
|
There are a few reasons that your GitHub PR could be failing beyond simple failed tests.
|
||||||
|
* Required Checks. We're leveraging required checks in GitHub so that we can quickly and precisely control what becomes and informational failure vs a hard requirement. The only way to determine the difference between a required vs information check is check for the `(Required)` emblem next to the step details in GitHub Checks.
|
||||||
|
* Not all required checks are run per commit. You may need to manually trigger addition GitHub checks with a `pr:<label>` label added to your PR.
|
||||||
|
|
||||||
|
### Flaky tests
|
||||||
|
There are two ways to know if a test on your branch is historically flaky:
|
||||||
|
1. `deploysentinel`'s PR comment bot to give an accurate and historical view of e2e flakiness. Check your PR for a view of the test failures and flakes (with link to the failing test). Note: only a 7 day window of flake is available.
|
||||||
|
2. (CircleCI's test insights feature)[https://circleci.com/blog/introducing-test-insights-with-flaky-test-detection/] collects historical data about the individual test results for both unit and e2e tests. Note: only a 14 day window of flake is available.
|
||||||
|
|
||||||
|
### 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'
|
||||||
|
|
||||||
|
#### Run tests in the same container as CI
|
||||||
|
|
||||||
|
In extreme cases, tests can fail due to the constraints of running within a container. To execute tests in exactly the same way as run in CircleCI.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
// Replace {X.X.X} with the current Playwright version
|
||||||
|
// from our package.json or circleCI configuration file
|
||||||
|
docker run --rm --network host --cpus="2" -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
At this point, you're running inside the same container and with 2 cpu cores. You can specify the unit tests:
|
||||||
|
```sh
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
or e2e tests:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep <the testcase name>
|
||||||
|
```
|
14
codecov.yml
14
codecov.yml
@ -11,18 +11,18 @@ coverage:
|
|||||||
informational: true
|
informational: true
|
||||||
precision: 2
|
precision: 2
|
||||||
round: down
|
round: down
|
||||||
range: "66...100"
|
range: '66...100'
|
||||||
|
|
||||||
flags:
|
flags:
|
||||||
unit:
|
unit:
|
||||||
carryforward: true
|
carryforward: false
|
||||||
e2e-ci:
|
e2e-stable:
|
||||||
carryforward: true
|
carryforward: false
|
||||||
e2e-full:
|
e2e-full:
|
||||||
carryforward: true
|
carryforward: true
|
||||||
|
|
||||||
comment:
|
comment:
|
||||||
layout: "reach,diff,flags,files,footer"
|
layout: 'diff,flags,files,footer'
|
||||||
behavior: default
|
behavior: default
|
||||||
require_changes: false
|
require_changes: false
|
||||||
show_carryforward_flags: true
|
show_carryforward_flags: true
|
||||||
|
@ -53,7 +53,7 @@ requirements.
|
|||||||
|
|
||||||
Additionally, the following project-specific standards will be used:
|
Additionally, the following project-specific standards will be used:
|
||||||
|
|
||||||
* During development, a "-SNAPSHOT" suffix shall be appended to the
|
* During development, a "-next" suffix shall be appended to the
|
||||||
version number. The version number before the suffix shall reflect
|
version number. The version number before the suffix shall reflect
|
||||||
the next expected version number for release.
|
the next expected version number for release.
|
||||||
* Prior to a 1.0.0 release, the _minor_ version will be incremented
|
* Prior to a 1.0.0 release, the _minor_ version will be incremented
|
||||||
@ -93,7 +93,7 @@ numbers by the following process:
|
|||||||
|
|
||||||
1. Update version number in `package.json`
|
1. Update version number in `package.json`
|
||||||
1. Checkout branch created for the last sprint that has been successfully tested.
|
1. Checkout branch created for the last sprint that has been successfully tested.
|
||||||
2. Remove a `-SNAPSHOT` suffix from the version in `package.json`.
|
2. Remove a `-next` suffix from the version in `package.json`.
|
||||||
3. Verify that resulting version number meets semantic versioning
|
3. Verify that resulting version number meets semantic versioning
|
||||||
requirements relative to previous stable version. Increment the
|
requirements relative to previous stable version. Increment the
|
||||||
version number if necessary.
|
version number if necessary.
|
||||||
@ -138,7 +138,7 @@ numbers by the following process:
|
|||||||
1. Create a new branch off the `master` branch.
|
1. Create a new branch off the `master` branch.
|
||||||
2. Remove any suffix from the version number,
|
2. Remove any suffix from the version number,
|
||||||
or increment the _patch_ version if there is no suffix.
|
or increment the _patch_ version if there is no suffix.
|
||||||
3. Append a `-SNAPSHOT` suffix.
|
3. Append a `-next` suffix.
|
||||||
4. Commit changes to `package.json` on the `master` branch.
|
4. Commit changes to `package.json` on the `master` branch.
|
||||||
The commit message should reference the sprint being opened,
|
The commit message should reference the sprint being opened,
|
||||||
preferably by a URL reference to the associated Milestone in
|
preferably by a URL reference to the associated Milestone in
|
||||||
@ -150,6 +150,6 @@ numbers by the following process:
|
|||||||
Projects dependent on Open MCT being co-developed by the Open MCT
|
Projects dependent on Open MCT being co-developed by the Open MCT
|
||||||
team should follow a similar process, except that they should
|
team should follow a similar process, except that they should
|
||||||
additionally update their dependency on Open MCT to point to the
|
additionally update their dependency on Open MCT to point to the
|
||||||
latest archive when removing their `-SNAPSHOT` status, and
|
latest archive when removing their `-next` status, and
|
||||||
that they should be pointed back to the `master` branch after
|
that they should be pointed back to the `master` branch after
|
||||||
this has completed.
|
this has completed.
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"extends": ["plugin:playwright/playwright-test"],
|
extends: ['plugin:playwright/playwright-test'],
|
||||||
"rules": {
|
rules: {
|
||||||
"playwright/max-nested-describe": ["error", { "max": 1 }]
|
'playwright/max-nested-describe': ['error', { max: 1 }]
|
||||||
},
|
},
|
||||||
"overrides": [
|
overrides: [
|
||||||
{
|
{
|
||||||
"files": ["tests/visual/*.spec.js"],
|
files: ['tests/visual/*.spec.js'],
|
||||||
"rules": {
|
rules: {
|
||||||
"playwright/no-wait-for-timeout": "off"
|
'playwright/no-wait-for-timeout': 'off'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
28
e2e/.percy.ci.yml
Normal file
28
e2e/.percy.ci.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
version: 2
|
||||||
|
snapshot:
|
||||||
|
widths: [1024]
|
||||||
|
min-height: 1440 # px
|
||||||
|
percyCSS: |
|
||||||
|
/* Clock indicator... your days are numbered */
|
||||||
|
.t-indicator-clock > .label {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
.c-input--datetime {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Timer object text */
|
||||||
|
.c-ne__time-and-creator {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor ticks */
|
||||||
|
div.c-conductor-axis.c-conductor__ticks > svg {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Embedded timestamp in notebooks */
|
||||||
|
.c-ne__embed__time{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor Start Time */
|
||||||
|
.c-compact-tc__setting-value{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
28
e2e/.percy.nightly.yml
Normal file
28
e2e/.percy.nightly.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
version: 2
|
||||||
|
snapshot:
|
||||||
|
widths: [1024, 2000]
|
||||||
|
min-height: 1440 # px
|
||||||
|
percyCSS: |
|
||||||
|
/* Clock indicator... your days are numbered */
|
||||||
|
.t-indicator-clock > .label {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
.c-input--datetime {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Timer object text */
|
||||||
|
.c-ne__time-and-creator {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor ticks */
|
||||||
|
div.c-conductor-axis.c-conductor__ticks > svg {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Embedded timestamp in notebooks */
|
||||||
|
.c-ne__embed__time{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor Start Time */
|
||||||
|
.c-compact-tc__setting-value{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
snapshot:
|
|
||||||
widths: [1024, 2000]
|
|
||||||
min-height: 1440 # px
|
|
||||||
discovery:
|
|
||||||
concurrency: 2 # https://github.com/percy/cli/discussions/1067
|
|
289
e2e/README.md
289
e2e/README.md
@ -51,11 +51,13 @@ Next, you should walk through our implementation of Playwright in Open MCT:
|
|||||||
|
|
||||||
## Types of e2e Testing
|
## Types of e2e Testing
|
||||||
|
|
||||||
e2e testing describes the layer at which a test is performed without prescribing the assertions which are made. Generally, when writing an e2e test, we have three choices to make on an assertion strategy:
|
e2e testing describes the layer at which a test is performed without prescribing the assertions which are made. Generally, when writing an e2e test, we have five choices to make on an assertion strategy:
|
||||||
|
|
||||||
1. Functional - Verifies the functional correctness of the application. Sometimes interchanged with e2e or regression testing.
|
1. Functional - Verifies the functional correctness of the application. Sometimes interchanged with e2e or regression testing.
|
||||||
2. Visual - Verifies the "look and feel" of the application and can only detect _undesirable changes when compared to a previous baseline_.
|
2. Visual - Verifies the "look and feel" of the application and can only detect _undesirable changes when compared to a previous baseline_.
|
||||||
3. Snapshot - Similar to Visual in that it captures the "look" of the application and can only detect _undesirable changes when compared to a previous baseline_. **Generally not preferred due to advanced setup necessary.**
|
3. Snapshot - Similar to Visual in that it captures the "look" of the application and can only detect _undesirable changes when compared to a previous baseline_. **Generally not preferred due to advanced setup necessary.**
|
||||||
|
4. Accessibility - Verifies that the application meets the accessibility standards defined by the [WCAG organization](https://www.w3.org/WAI/standards-guidelines/wcag/).
|
||||||
|
5. Performance - Verifies that application provides a performant experience. Like Snapshot testing, these tests are generally not recommended due to their difficulty in providing a consistent result.
|
||||||
|
|
||||||
When choosing between the different testing strategies, think only about the assertion that is made at the end of the series of test steps. "I want to verify that the Timer plugin functions correctly" vs "I want to verify that the Timer plugin does not look different than originally designed".
|
When choosing between the different testing strategies, think only about the assertion that is made at the end of the series of test steps. "I want to verify that the Timer plugin functions correctly" vs "I want to verify that the Timer plugin does not look different than originally designed".
|
||||||
|
|
||||||
@ -72,19 +74,30 @@ Visual Testing is an essential part of our e2e strategy as it ensures that the a
|
|||||||
For a better understanding of the visual issues which affect Open MCT, please see our bug tracker with the `label:visual` filter applied [here](https://github.com/nasa/openmct/issues?q=label%3Abug%3Avisual+)
|
For a better understanding of the visual issues which affect Open MCT, please see our bug tracker with the `label:visual` filter applied [here](https://github.com/nasa/openmct/issues?q=label%3Abug%3Avisual+)
|
||||||
To read about how to write a good visual test, please see [How to write a great Visual Test](#how-to-write-a-great-visual-test).
|
To read about how to write a good visual test, please see [How to write a great Visual Test](#how-to-write-a-great-visual-test).
|
||||||
|
|
||||||
`npm run test:e2e:visual` 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` 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.
|
||||||
#### Percy.io
|
#### 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)
|
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).
|
||||||
|
|
||||||
### (Advanced) Snapshot Testing
|
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.
|
||||||
|
|
||||||
Snapshot testing is very similar to visual testing but allows us to be more precise in detecting change without relying on a 3rd party service. Unfortuantely, this precision requires advanced test setup and teardown and so we're using this pattern as a last resort.
|
### Advanced: Snapshot Testing (Not Recommended)
|
||||||
|
|
||||||
To give an example, if a _single_ visual test assertion for an Overlay plot is run through multiple DOM rendering engines at various viewports to see how the Plot looks. If that same test were run as a snapshot test, it could only be executed against a single browser, on a single platform (ubuntu docker container).
|
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.
|
||||||
|
|
||||||
Read more about [Playwright Snapshots](https://playwright.dev/docs/test-snapshots)
|
|
||||||
|
|
||||||
#### Open MCT's implementation
|
#### Open MCT's implementation
|
||||||
|
|
||||||
@ -121,34 +134,70 @@ npm install
|
|||||||
npm run test:e2e:updatesnapshots
|
npm run test:e2e:updatesnapshots
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Automated Accessibility (a11y) Testing
|
||||||
|
|
||||||
|
Open MCT incorporates accessibility testing through two primary methods to ensure its compliance with accessibility standards:
|
||||||
|
|
||||||
|
1. **Usage of Playwright's Locator Strategy**: Open MCT utilizes Playwright's locator strategy, specifically the [page.getByRole('') function](https://playwright.dev/docs/api/class-framelocator#frame-locator-get-by-role), to ensure that web elements are accessible via assistive technologies. This approach focuses on the accessibility of elements rather than full adherence to a11y guidelines, which is covered in the second method.
|
||||||
|
|
||||||
|
2. **Enforcing a11y Guidelines with Playwright Axe Plugin**: To rigorously enforce a11y guideline compliance, Open MCT employs the [playwright axe plugin](https://playwright.dev/docs/accessibility-testing). This is achieved through the `scanForA11yViolations` function within the visual testing suite. This method not only benefits from the existing coverage of the visual tests but also targets specific a11y issues, such as `color-contrast` violations, which are particularly pertinent in the context of visual testing.
|
||||||
|
|
||||||
|
### a11y Standards (WCAG and Section 508)
|
||||||
|
|
||||||
|
Playwright axe supports a wide range of [WCAG Standards](https://playwright.dev/docs/accessibility-testing#scanning-for-wcag-violations) to test against. Open MCT is testing against the [Section 508](https://www.section508.gov/test/testing-overview/) accessibility guidelines with the intent to support higher standards over time. As of 2024, Section508 requirements now map completely to WCAG 2.0 AA. In the future, Section 508 requirements may map to WCAG 2.1 AA.
|
||||||
|
|
||||||
|
### Reading an a11y test failure
|
||||||
|
|
||||||
|
When an a11y test fails, the result must be interpreted in the html test report or the a11y report json artifact stored in the `/test-results/` folder. The json structure should be parsed for `"violations"` by `"id"` and identified `"target"`. Example provided for the 'color-contrast-enhanced' violation.
|
||||||
|
|
||||||
|
```json
|
||||||
|
"violations":
|
||||||
|
{
|
||||||
|
"id": "color-contrast-enhanced",
|
||||||
|
"impact": "serious",
|
||||||
|
"html": "<span class=\"label c-indicator__label\">0 Snapshots <button aria-label=\"Show Snapshots\">Show</button></span>",
|
||||||
|
"target": [
|
||||||
|
".s-status-off > .label.c-indicator__label"
|
||||||
|
],
|
||||||
|
"failureSummary": "Fix any of the following:\n Element has insufficient color contrast of 6.51 (foreground color: #aaaaaa, background color: #262626, font size: 8.1pt (10.8px), font weight: normal). Expected contrast ratio of 7:1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Performance Testing
|
## Performance Testing
|
||||||
|
|
||||||
The open source performance tests function mostly as a contract for the locator logic, functionality, and assumptions will work in our downstream, closed source test suites.
|
The open source performance tests function in three ways which match their naming and folder structure:
|
||||||
|
|
||||||
They're found under `./e2e/tests/performance` and are to be executed with the following npm script:
|
`./e2e/tests/performance` - The tests at the root of this folder path detect functional changes which are mostly apparent with large performance regressions like [this](https://github.com/nasa/openmct/issues/6879). These tests run against openmct webpack in `production-mode` with the `npm run test:perf:localhost` script.
|
||||||
|
`./e2e/tests/performance/contract/` - These tests serve as [contracts](https://martinfowler.com/bliki/ContractTest.html) for the locator logic, functionality, and assumptions will work in our downstream, closed source test suites. These tests run against openmct webpack in `dev-mode` with the `npm run test:perf:contract` script.
|
||||||
`npm run test:perf`
|
`./e2e/tests/performance/memory/` - These tests execute memory leak detection checks in various ways. This is expected to evolve as we move to the `memlab` project. These tests run against openmct webpack in `production-mode` with the `npm run test:perf:memory` script.
|
||||||
|
|
||||||
These tests are expected to become blocking and gating with assertions as we extend the capabilities of Playwright.
|
These tests are expected to become blocking and gating with assertions as we extend the capabilities of Playwright.
|
||||||
|
|
||||||
|
In addition to the explicit definition of performance tests, we also ensure that our test timeout timing is "tight" to catch performance regressions detectable by action timeouts. i.e. [Notebooks load much slower than they used to #6459](https://github.com/nasa/openmct/issues/6459)
|
||||||
|
|
||||||
## Test Architecture and CI
|
## Test Architecture and CI
|
||||||
|
|
||||||
### Architecture (TODO)
|
### Architecture
|
||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
|
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
|
||||||
|
|
||||||
- `./helper` - contains helper functions or scripts which are leveraged directly within the testsuites. i.e. non-default plugin scripts injected into DOM
|
|File Path|Description|
|
||||||
- `./test-data` - contains test data which is leveraged or generated in the functional, performance, or visual test suites. i.e. localStorage data
|
|:-:|-|
|
||||||
- `./tests/functional` - the bulk of the tests are contained within this folder to verify the functionality of open mct
|
|`./helper` | Contains helper functions or scripts which are leveraged directly within the test suites (e.g.: non-default plugin scripts injected into the DOM)|
|
||||||
- `./tests/functional/example/` - tests which specifically verify the example plugins
|
|`./test-data` | Contains test data which is leveraged or generated in the functional, performance, or visual test suites (e.g.: localStorage data).|
|
||||||
- `./tests/functional/plugins/` - tests which loosely test each plugin. This folder is the most likely to change. Note: some @snapshot tests are still contained within this structure
|
|`./tests/functional` | The bulk of the tests are contained within this folder to verify the functionality of Open MCT.|
|
||||||
- `./tests/framework/` - tests which verify that our testframework functionality and assumptions will continue to work based on further refactoring or playwright version changes
|
|`./tests/functional/example/` | Tests which specifically verify the example plugins (e.g.: Sine Wave Generator).|
|
||||||
- `./tests/performance/` - performance tests
|
|`./tests/functional/plugins/` | Tests which loosely test each plugin. This folder is the most likely to change. Note: some `@snapshot` tests are still contained within this structure.|
|
||||||
- `./tests/visual/` - Visual tests
|
|`./tests/framework/` | Tests which verify that our testing framework's functionality and assumptions will continue to work based on further refactoring or Playwright version changes (e.g.: verifying custom fixtures and appActions).|
|
||||||
- `./appActions.js` - Contains common fixtures which can be leveraged by testcase authors to quickly move through the application when writing new tests.
|
|`./tests/performance/` | Performance tests which should be run on every commit.|
|
||||||
- `./baseFixture.js` - Contains base fixtures which only extend default `@playwright/test` functionality. The goal is to remove these fixtures as native Playwright APIs improve.
|
|`./tests/performance/contract/` | A subset of performance tests which are designed to provide a contract between the open source tests which are run on every commit and the downstream tests which are run post merge and with other frameworks.|
|
||||||
|
|`./tests/performance/memory` | A subset of performance tests which are designed to test for memory leaks.|
|
||||||
|
|`./tests/visual-a11y/` | Visual tests and accessibility tests.|
|
||||||
|
|`./tests/visual-a11y/component/` | Visual and accessibility tests which are only run against a single component.|
|
||||||
|
|`./appActions.js` | Contains common methods which can be leveraged by test case authors to quickly move through the application when writing new tests.|
|
||||||
|
|`./baseFixture.js` | Contains base fixtures which only extend default `@playwright/test` functionality. The expectation is that these fixtures will be removed as the native Playwright API improves|
|
||||||
|
|
||||||
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
|
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
|
||||||
|
|
||||||
@ -158,10 +207,13 @@ Where possible, we try to run Open MCT without modification or configuration cha
|
|||||||
|
|
||||||
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
|
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
|
||||||
|
|
||||||
- `./playwright-ci.config.js` - Used when running in CI or to debug CI issues locally
|
|Config File|Description|
|
||||||
- `./playwright-local.config.js` - Used when running locally
|
|:-:|-|
|
||||||
- `./playwright-performance.config.js` - Used when running performance tests in CI or locally
|
|`./playwright-ci.config.js` | Used when running in CI or to debug CI issues locally|
|
||||||
- `./playwright-visual.config.js` - Used to run the visual tests in CI or locally
|
|`./playwright-local.config.js` | Used when running locally|
|
||||||
|
|`./playwright-performance.config.js` | Used when running performance tests in CI or locally|
|
||||||
|
|`./playwright-performance-devmode.config.js` | Used when running performance tests in CI or locally|
|
||||||
|
|`./playwright-visual-a11y.config.js` | Used to run the visual and a11y tests in CI or locally|
|
||||||
|
|
||||||
#### Test Tags
|
#### Test Tags
|
||||||
|
|
||||||
@ -169,13 +221,17 @@ Test tags are a great way of organizing tests outside of a file structure. To le
|
|||||||
|
|
||||||
Current list of test tags:
|
Current list of test tags:
|
||||||
|
|
||||||
- `@ipad` - Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no Create button).
|
|Test Tag|Description|
|
||||||
- `@gds` - Denotes a GDS Test Case used in the VIPER Mission.
|
|:-:|-|
|
||||||
- `@addInit` - Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of `npm start`.
|
|`@ipad` | Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no create button).|
|
||||||
- `@localStorage` - Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).
|
|`@a11y` | Test case or test suite to execute playwright-axe accessibility checks and generate a11y reports.|
|
||||||
- `@snapshot` - Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.
|
|`@gds` | Denotes a GDS Test Case used in the VIPER Mission.|
|
||||||
- `@unstable` - A new test or test which is known to be flaky.
|
|`@addInit` | Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of `npm start`.|
|
||||||
- `@2p` - Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.
|
|`@localStorage` | Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB). See [note](#utilizing-localstorage)|
|
||||||
|
|`@snapshot` | Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.|
|
||||||
|
|`@unstable` | A new test or test which is known to be flaky.|
|
||||||
|
|`@2p` | Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.|
|
||||||
|
|`@generatedata` | Indicates that a test is used to generate testdata or test the generated test data. Usually to be associated with localstorage, but this may grow over time.|
|
||||||
|
|
||||||
### Continuous Integration
|
### Continuous Integration
|
||||||
|
|
||||||
@ -194,24 +250,27 @@ CircleCI
|
|||||||
- Stable e2e tests against ubuntu and chrome
|
- Stable e2e tests against ubuntu and chrome
|
||||||
- Performance tests against ubuntu and chrome
|
- Performance tests against ubuntu and chrome
|
||||||
- e2e tests are linted
|
- e2e tests are linted
|
||||||
|
- Visual and a11y tests are run in a single resolution on the default `espresso` theme
|
||||||
|
|
||||||
#### 2. Per-Merge Testing
|
#### 2. Per-Merge Testing
|
||||||
|
|
||||||
Github Actions / Workflow
|
Github Actions / Workflow
|
||||||
|
|
||||||
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
|
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
|
||||||
- Visual Tests. Triggered with Github Label Event 'pr:visual'
|
- CouchDB Tests. Triggered on PR Create and again with Github Label Event 'pr:e2e:couchdb'
|
||||||
|
|
||||||
#### 3. Scheduled / Batch Testing
|
#### 3. Scheduled / Batch Testing
|
||||||
|
|
||||||
Nightly Testing in Circle CI
|
Nightly Testing in Circle CI
|
||||||
|
|
||||||
- Full e2e suite against ubuntu and chrome
|
- Full e2e suite against ubuntu and chrome, firefox, and an MMOC resolution profile
|
||||||
- Performance tests against ubuntu and chrome
|
- Performance tests against ubuntu and chrome
|
||||||
|
- CouchDB suite
|
||||||
|
- Visual and a11y Tests are run in the full profile
|
||||||
|
|
||||||
Github Actions / Workflow
|
Github Actions / Workflow
|
||||||
|
|
||||||
- Visual Test baseline generation.
|
- None at the moment
|
||||||
|
|
||||||
#### Parallelism and Fast Feedback
|
#### Parallelism and Fast Feedback
|
||||||
|
|
||||||
@ -231,7 +290,8 @@ At the same time, we don't want to waste CI resources on parallel runs, so we've
|
|||||||
|
|
||||||
In order to maintain fast and reliable feedback, tests go through a promotion process. All new test cases or test suites must be labeled with the `@unstable` annotation. The Open MCT dev team runs these unstable tests in our private repos to ensure they work downstream and are reliable.
|
In order to maintain fast and reliable feedback, tests go through a promotion process. All new test cases or test suites must be labeled with the `@unstable` annotation. The Open MCT dev team runs these unstable tests in our private repos to ensure they work downstream and are reliable.
|
||||||
|
|
||||||
To run the stable tests, use the ```npm run test:e2e:stable``` command. To run the new and flaky tests, use the ```npm run test:e2e:unstable``` command.
|
- To run the stable tests, use the `npm run test:e2e:stable` command.
|
||||||
|
- To run the new and flaky tests, use the `npm run test:e2e:unstable` command.
|
||||||
|
|
||||||
A testcase and testsuite are to be unmarked as @unstable when:
|
A testcase and testsuite are to be unmarked as @unstable when:
|
||||||
|
|
||||||
@ -242,7 +302,7 @@ A testcase and testsuite are to be unmarked as @unstable when:
|
|||||||
|
|
||||||
#### **What's supported:**
|
#### **What's supported:**
|
||||||
|
|
||||||
We are leveraging the `browserslist` project to declare our supported list of browsers.
|
We are leveraging the `browserslist` project to declare our supported list of browsers. We support macOS, Windows, and ubuntu 20+.
|
||||||
|
|
||||||
#### **Where it's tested:**
|
#### **Where it's tested:**
|
||||||
|
|
||||||
@ -256,11 +316,17 @@ We also have the need to execute our e2e tests across this published list of bro
|
|||||||
- A stable version of Chromium from the official chromium channels. This is always at least 1 version ahead of desktop chrome.
|
- A stable version of Chromium from the official chromium channels. This is always at least 1 version ahead of desktop chrome.
|
||||||
- `playwright-chrome`
|
- `playwright-chrome`
|
||||||
- The stable channel of Chrome from the official chrome channels. This is always 2 versions behind chromium.
|
- The stable channel of Chrome from the official chrome channels. This is always 2 versions behind chromium.
|
||||||
|
- `playwright-firefox`
|
||||||
|
- Firefox Latest Stable. Modified slightly by the playwright team to support a CDP Shim.
|
||||||
|
|
||||||
|
In terms of operating system testing, we're only limited by what the CI providers are able to support. The bulk of our testing is performed on the official playwright container which is based on ubuntu. Github Actions allows us to use `windows-latest` and `mac-latest` and is run as needed.
|
||||||
|
|
||||||
#### **Mobile**
|
#### **Mobile**
|
||||||
|
|
||||||
We have the Mission-need to support iPad. To run our iPad suite, please see our `playwright-*.config.js` with the 'iPad' project.
|
We have the Mission-need to support iPad. To run our iPad suite, please see our `playwright-*.config.js` with the 'iPad' project.
|
||||||
|
|
||||||
|
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) and so this will likely turn into a separate suite.
|
||||||
|
|
||||||
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
||||||
|
|
||||||
Conditionally skipping tests based on browser (**RECOMMENDED**):
|
Conditionally skipping tests based on browser (**RECOMMENDED**):
|
||||||
@ -287,18 +353,66 @@ Skipping based on browser version (Rarely used): <https://github.com/microsoft/p
|
|||||||
|
|
||||||
## Test Design, Best Practices, and Tips & Tricks
|
## Test Design, Best Practices, and Tips & Tricks
|
||||||
|
|
||||||
### Test Design (TODO)
|
### Test Design
|
||||||
|
|
||||||
- How to make tests robust to function in other contexts (VISTA, VIPER, etc.)
|
#### Test as the User
|
||||||
- Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`
|
|
||||||
- How to make tests faster and more resilient
|
|
||||||
- When possible, navigate directly by URL
|
|
||||||
- Leverage `await page.goto('./', { waitUntil: 'networkidle' });`
|
|
||||||
- Avoid repeated setup to test to test a single assertion. Write longer tests with multiple soft assertions.
|
|
||||||
|
|
||||||
### How to write a great test (WIP)
|
In general, strive to test only through the UI as a user would. As stated in the [Playwright Best Practices](https://playwright.dev/docs/best-practices#test-user-visible-behavior):
|
||||||
|
|
||||||
|
> "Automated tests should verify that the application code works for the end users, and avoid relying on implementation details such as things which users will not typically use, see, or even know about such as the name of a function, whether something is an array, or the CSS class of some element. The end user will see or interact with what is rendered on the page, so your test should typically only see/interact with the same rendered output."
|
||||||
|
|
||||||
|
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.
|
||||||
|
1. Avoid creating locator aliases. This likely means that you're compensating for a bad locator. Improve the application instead.
|
||||||
|
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
|
||||||
|
// You can capture the CreatedObjectInfo returned from this appAction:
|
||||||
|
const clock = await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
||||||
|
|
||||||
|
// ...and use its `url` property to navigate directly to it later in the test:
|
||||||
|
await page.goto(clock.url);
|
||||||
|
```
|
||||||
|
|
||||||
|
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.
|
||||||
|
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:
|
||||||
|
```js
|
||||||
|
// Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/display_layout_with_child_layouts.json')
|
||||||
|
});
|
||||||
|
```
|
||||||
|
- Load the state from file at the beginning of the desired test suite (within the `test.describe()`). (NOTE: the storage state will be used for each test in the suite, so you may need to create a new suite):
|
||||||
|
```js
|
||||||
|
const LOCALSTORAGE_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'../../../../test-data/display_layout_with_child_layouts.json'
|
||||||
|
);
|
||||||
|
test.use({
|
||||||
|
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH)
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### How to write a great test
|
||||||
|
|
||||||
|
- Avoid using css locators to find elements to the page. Use modern web accessible locators like `getByRole`
|
||||||
- Use our [App Actions](./appActions.js) for performing common actions whenever applicable.
|
- Use our [App Actions](./appActions.js) for performing common actions whenever applicable.
|
||||||
|
- Use `waitForPlotsToRender()` before asserting against anything that is dependent upon plot series data being loaded and drawn.
|
||||||
- If you create an object outside of using the `createDomainObjectWithDefaults` App Action, make sure to fill in the 'Notes' section of your object with `page.testNotes`:
|
- If you create an object outside of using the `createDomainObjectWithDefaults` App Action, make sure to fill in the 'Notes' section of your object with `page.testNotes`:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -309,7 +423,39 @@ Skipping based on browser version (Rarely used): <https://github.com/microsoft/p
|
|||||||
await notesInput.fill(testNotes);
|
await notesInput.fill(testNotes);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### How to write a great visual test (TODO)
|
#### 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.
|
||||||
|
|
||||||
|
2. **Get the App into Interesting States**: Prioritize getting Open MCT into unusual layouts or behaviors before capturing a visual snapshot. For instance, you could open a dropdown menu.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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})`);
|
||||||
|
//<Click on object>
|
||||||
|
await percySnapshot(page, `object expanded (theme: ${theme})`);
|
||||||
|
//Select from object
|
||||||
|
await percySnapshot(page, `object selected (theme: ${theme})`)
|
||||||
|
```
|
||||||
|
|
||||||
#### How to write a great network test
|
#### How to write a great network test
|
||||||
|
|
||||||
@ -326,12 +472,35 @@ For now, our best practices exist as self-tested, living documentation in our [e
|
|||||||
|
|
||||||
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
|
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
|
||||||
|
|
||||||
### Tips & Tricks (TODO)
|
### Tips & Tricks
|
||||||
|
|
||||||
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
|
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
|
||||||
|
|
||||||
|
- (Advanced) Overriding the Browser's Clock
|
||||||
|
It is possible to override the browser's clock in order to control time-based elements. Since this can cause unwanted behavior (i.e. Tree not rendering), only use this sparingly. To do this, use the `overrideClock` fixture as such:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
|
||||||
|
test.describe('foo test suite', () => {
|
||||||
|
|
||||||
|
// All subsequent tests in this suite will override the clock
|
||||||
|
test.use({
|
||||||
|
clockOptions: {
|
||||||
|
now: 1732413600000, // A timestamp given as milliseconds since the epoch
|
||||||
|
shouldAdvanceTime: true // Should the clock tick?
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('bar test', async ({ page }) => {
|
||||||
|
// ...
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
More info and options for `overrideClock` can be found in [baseFixtures.js](baseFixtures.js)
|
||||||
|
|
||||||
- Working with multiple pages
|
- Working with multiple pages
|
||||||
There are instances where multiple browser pages will need to be opened to verify multi-page or multi-tab application behavior.
|
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.
|
||||||
|
|
||||||
### Reporting
|
### Reporting
|
||||||
|
|
||||||
@ -345,25 +514,17 @@ We leverage the following official Playwright reporters:
|
|||||||
- Tracefile
|
- Tracefile
|
||||||
- Screenshots
|
- Screenshots
|
||||||
|
|
||||||
When running the tests locally with the `npm run test:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
|
When running the tests locally with the `npm run test:e2e:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
|
||||||
|
|
||||||
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
|
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
|
||||||
|
|
||||||
### e2e Code Coverage
|
### e2e Code Coverage
|
||||||
|
|
||||||
Code coverage is collected during test execution using our custom [baseFixture](./baseFixtures.js). The raw coverage files are stored in a `.nyc_report` directory to be converted into a lcov file with the following [nyc](https://github.com/istanbuljs/nyc) command:
|
Our e2e code coverage is captured and combined with our unit test coverage. For more information, please see our [code coverage documentation](../TESTING.md)
|
||||||
|
|
||||||
```npm run cov:e2e:report```
|
#### Generating e2e code coverage
|
||||||
|
|
||||||
At this point, the nyc linecov report can be published to [codecov.io](https://about.codecov.io/) with the following command:
|
Please read more about our code coverage [here](../TESTING.md#code-coverage)
|
||||||
|
|
||||||
```npm run cov:e2e:stable:publish``` for the stable suite running in ubuntu.
|
|
||||||
or
|
|
||||||
```npm run cov:e2e:full:publish``` for the full suite running against all available platforms.
|
|
||||||
|
|
||||||
Codecov.io will combine each of the above commands with [Codecov.io Flags](https://docs.codecov.com/docs/flags). Effectively, this allows us to combine multiple reports which are run at various stages of our CI Pipeline or run as part of a parallel process.
|
|
||||||
|
|
||||||
This e2e coverage is combined with our unit test report to give a comprehensive (if flawed) view of line coverage.
|
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
@ -413,10 +574,10 @@ A single e2e test in Open MCT is extended to run:
|
|||||||
- How is Open MCT extending default Playwright functionality?
|
- How is Open MCT extending default Playwright functionality?
|
||||||
- What about Component Testing?
|
- What about Component Testing?
|
||||||
|
|
||||||
### Troubleshooting
|
### e2e Troubleshooting
|
||||||
|
|
||||||
|
Please follow the general guide troubleshooting in [the general troubleshooting doc](../TESTING.md#troubleshooting-ci)
|
||||||
|
|
||||||
- Why is my test failing on CI and not locally?
|
|
||||||
- How can I view the failing tests on CI?
|
|
||||||
- Tests won't start because 'Error: <http://localhost:8080/># is already used...'
|
- Tests won't start because 'Error: <http://localhost:8080/># is already used...'
|
||||||
This error will appear when running the tests locally. Sometimes, the webserver is left in an orphaned state and needs to be cleaned up. To clear up the orphaned webserver, execute the following from your Terminal:
|
This error will appear when running the tests locally. Sometimes, the webserver is left in an orphaned state and needs to be cleaned up. To clear up the orphaned webserver, execute the following from your Terminal:
|
||||||
```lsof -n -i4TCP:8080 | awk '{print$2}' | tail -1 | xargs kill -9```
|
```lsof -n -i4TCP:8080 | awk '{print$2}' | tail -1 | xargs kill -9```
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
* @property {string} type the type of domain object to create (e.g.: "Sine Wave Generator").
|
* @property {string} type the type of domain object to create (e.g.: "Sine Wave Generator").
|
||||||
* @property {string} [name] the desired name of the created domain object.
|
* @property {string} [name] the desired name of the created domain object.
|
||||||
* @property {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the Identifier or uuid of the parent object.
|
* @property {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the Identifier or uuid of the parent object.
|
||||||
|
* @property {Object<string, string>} [customParameters] any additional parameters to be passed to the domain object's form. E.g. '[aria-label="Data Rate (hz)"]': {'0.1'}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +56,7 @@
|
|||||||
|
|
||||||
const Buffer = require('buffer').Buffer;
|
const Buffer = require('buffer').Buffer;
|
||||||
const genUuid = require('uuid').v4;
|
const genUuid = require('uuid').v4;
|
||||||
|
const { expect } = require('@playwright/test');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
||||||
@ -64,60 +66,69 @@ const genUuid = require('uuid').v4;
|
|||||||
* @param {CreateObjectOptions} options
|
* @param {CreateObjectOptions} options
|
||||||
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||||
*/
|
*/
|
||||||
async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine' }) {
|
async function createDomainObjectWithDefaults(
|
||||||
if (!name) {
|
page,
|
||||||
name = `${type}:${genUuid()}`;
|
{ type, name, parent = 'mine', customParameters = {} }
|
||||||
}
|
) {
|
||||||
|
if (!name) {
|
||||||
|
name = `${type}:${genUuid()}`;
|
||||||
|
}
|
||||||
|
|
||||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
// Navigate to the parent object. This is necessary to create the object
|
// Navigate to the parent object. This is necessary to create the object
|
||||||
// in the correct location, such as a folder, layout, or plot.
|
// in the correct location, such as a folder, layout, or plot.
|
||||||
await page.goto(`${parentUrl}?hideTree=true`);
|
await page.goto(`${parentUrl}`);
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
//Click the Create button
|
//Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
// Click the object specified by 'type'
|
||||||
await page.click(`li[role='menuitem']:text("${type}")`);
|
await page.click(`li[role='menuitem']:text("${type}")`);
|
||||||
|
|
||||||
// Modify the name input field of the domain object to accept 'name'
|
// Modify the name input field of the domain object to accept 'name'
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
await nameInput.fill("");
|
await nameInput.fill('');
|
||||||
await nameInput.fill(name);
|
await nameInput.fill(name);
|
||||||
|
|
||||||
if (page.testNotes) {
|
if (page.testNotes) {
|
||||||
// Fill the "Notes" section with information about the
|
// Fill the "Notes" section with information about the
|
||||||
// currently running test and its project.
|
// currently running test and its project.
|
||||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
await notesInput.fill(page.testNotes);
|
await notesInput.fill(page.testNotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
// If there are any further parameters, fill them in
|
||||||
await Promise.all([
|
for (const [key, value] of Object.entries(customParameters)) {
|
||||||
page.waitForLoadState(),
|
const input = page.locator(`form[name="mctForm"] ${key}`);
|
||||||
page.click('[aria-label="Save"]'),
|
await input.fill('');
|
||||||
// Wait for Save Banner to appear
|
await input.fill(value);
|
||||||
page.waitForSelector('.c-message-banner__message')
|
}
|
||||||
]);
|
|
||||||
|
|
||||||
// Wait until the URL is updated
|
// Click OK button and wait for Navigate event
|
||||||
await page.waitForURL(`**/${parent}/*`);
|
await Promise.all([
|
||||||
const uuid = await getFocusedObjectUuid(page);
|
page.waitForLoadState(),
|
||||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
await page.getByRole('button', { name: 'Save' }).click(),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
if (await _isInEditMode(page, uuid)) {
|
// Wait until the URL is updated
|
||||||
// Save (exit edit mode)
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
await page.locator('button[title="Save"]').click();
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
await page.locator('li[title="Save and Finish Editing"]').click();
|
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
if (await _isInEditMode(page, uuid)) {
|
||||||
name,
|
// Save (exit edit mode)
|
||||||
uuid,
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
url: objectUrl
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
uuid,
|
||||||
|
url: objectUrl
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,30 +137,31 @@ async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine
|
|||||||
* @param {CreateNotificationOptions} createNotificationOptions
|
* @param {CreateNotificationOptions} createNotificationOptions
|
||||||
*/
|
*/
|
||||||
async function createNotification(page, createNotificationOptions) {
|
async function createNotification(page, createNotificationOptions) {
|
||||||
await page.evaluate((_createNotificationOptions) => {
|
await page.evaluate((_createNotificationOptions) => {
|
||||||
const { message, severity, options } = _createNotificationOptions;
|
const { message, severity, options } = _createNotificationOptions;
|
||||||
const notificationApi = window.openmct.notifications;
|
const notificationApi = window.openmct.notifications;
|
||||||
if (severity === 'info') {
|
if (severity === 'info') {
|
||||||
notificationApi.info(message, options);
|
notificationApi.info(message, options);
|
||||||
} else if (severity === 'alert') {
|
} else if (severity === 'alert') {
|
||||||
notificationApi.alert(message, options);
|
notificationApi.alert(message, options);
|
||||||
} else {
|
} else {
|
||||||
notificationApi.error(message, options);
|
notificationApi.error(message, options);
|
||||||
}
|
}
|
||||||
}, createNotificationOptions);
|
}, createNotificationOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Expand an item in the tree by a given object name.
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
async function expandTreePaneItemByName(page, name) {
|
async function expandTreePaneItemByName(page, name) {
|
||||||
const treePane = page.getByRole('tree', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: 'Main Tree'
|
name: 'Main Tree'
|
||||||
});
|
});
|
||||||
const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
|
const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
|
||||||
const expandTriangle = treeItem.locator('.c-disclosure-triangle');
|
const expandTriangle = treeItem.locator('.c-disclosure-triangle');
|
||||||
await expandTriangle.click();
|
await expandTriangle.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,67 +171,123 @@ async function expandTreePaneItemByName(page, name) {
|
|||||||
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||||
*/
|
*/
|
||||||
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
name = `Plan:${genUuid()}`;
|
name = `Plan:${genUuid()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
// Navigate to the parent object. This is necessary to create the object
|
// Navigate to the parent object. This is necessary to create the object
|
||||||
// in the correct location, such as a folder, layout, or plot.
|
// in the correct location, such as a folder, layout, or plot.
|
||||||
await page.goto(`${parentUrl}?hideTree=true`);
|
await page.goto(`${parentUrl}`);
|
||||||
|
|
||||||
// Click the Create button
|
// Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
// Click 'Plan' menu option
|
// Click 'Plan' menu option
|
||||||
await page.click(`li:text("Plan")`);
|
await page.click(`li:text("Plan")`);
|
||||||
|
|
||||||
// Modify the name input field of the domain object to accept 'name'
|
// Modify the name input field of the domain object to accept 'name'
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
const nameInput = page.getByLabel('Title', { exact: true });
|
||||||
await nameInput.fill("");
|
await nameInput.fill('');
|
||||||
await nameInput.fill(name);
|
await nameInput.fill(name);
|
||||||
|
|
||||||
// Upload buffer from memory
|
// Upload buffer from memory
|
||||||
await page.locator('input#fileElem').setInputFiles({
|
await page.locator('input#fileElem').setInputFiles({
|
||||||
name: 'plan.txt',
|
name: 'plan.txt',
|
||||||
mimeType: 'text/plain',
|
mimeType: 'text/plain',
|
||||||
buffer: Buffer.from(JSON.stringify(json))
|
buffer: Buffer.from(JSON.stringify(json))
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
// Click OK button and wait for Navigate event
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.waitForLoadState(),
|
page.waitForLoadState(),
|
||||||
page.click('[aria-label="Save"]'),
|
page.click('[aria-label="Save"]'),
|
||||||
// Wait for Save Banner to appear
|
// Wait for Save Banner to appear
|
||||||
page.waitForSelector('.c-message-banner__message')
|
page.waitForSelector('.c-message-banner__message')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Wait until the URL is updated
|
// Wait until the URL is updated
|
||||||
await page.waitForURL(`**/${parent}/*`);
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
const uuid = await getFocusedObjectUuid(page);
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uuid,
|
uuid,
|
||||||
name,
|
name,
|
||||||
url: objectUrl
|
url: objectUrl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the given `domainObject`'s context menu from the object tree.
|
* Create a standardized Telemetry Object (Sine Wave Generator) for use in visual tests
|
||||||
* Expands the path to the object and scrolls to it if necessary.
|
* and tests against plotting telemetry (e.g. logPlot tests).
|
||||||
*
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the uuid or identifier of the parent object. Defaults to 'mine'
|
||||||
* @param {string} url the url to the object
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the telemetry object.
|
||||||
*/
|
*/
|
||||||
|
async function createExampleTelemetryObject(page, parent = 'mine') {
|
||||||
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
|
await page.goto(`${parentUrl}`);
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
|
await page.locator('li:has-text("Sine Wave Generator")').click();
|
||||||
|
|
||||||
|
const name = 'VIPER Rover Heading';
|
||||||
|
await page.getByRole('dialog').locator('input[type="text"]').fill(name);
|
||||||
|
|
||||||
|
// Fill out the fields with default values
|
||||||
|
await page.getByRole('spinbutton', { name: 'Period' }).fill('10');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Amplitude' }).fill('1');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Offset' }).fill('0');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Data Rate (hz)' }).fill('1');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Phase (radians)' }).fill('0');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Randomness' }).fill('0');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('0');
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
|
// Wait until the URL is updated
|
||||||
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
|
|
||||||
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
|
const url = await getHashUrlToDomainObject(page, uuid);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
uuid,
|
||||||
|
url
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigates directly to a given object url, in fixed time mode, with the given start and end bounds.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} url The url to the domainObject
|
||||||
|
* @param {string | number} start The starting time bound in milliseconds since epoch
|
||||||
|
* @param {string | number} end The ending time bound in milliseconds since epoch
|
||||||
|
*/
|
||||||
|
async function navigateToObjectWithFixedTimeBounds(page, url, start, end) {
|
||||||
|
await page.goto(
|
||||||
|
`${url}?tc.mode=fixed&tc.timeSystem=utc&tc.startBound=${start}&tc.endBound=${end}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the given `domainObject`'s context menu from the object tree.
|
||||||
|
* Expands the path to the object and scrolls to it if necessary.
|
||||||
|
*
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} url the url to the object
|
||||||
|
*/
|
||||||
async function openObjectTreeContextMenu(page, url) {
|
async function openObjectTreeContextMenu(page, url) {
|
||||||
await page.goto(url);
|
await page.goto(url);
|
||||||
await page.click('button[title="Show selected item in tree"]');
|
await page.click('button[title="Show selected item in tree"]');
|
||||||
await page.locator('.is-navigated-object').click({
|
await page.locator('.is-navigated-object').click({
|
||||||
button: 'right'
|
button: 'right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,23 +295,25 @@ async function openObjectTreeContextMenu(page, url) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
|
* @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
|
||||||
*/
|
*/
|
||||||
async function expandEntireTree(page, treeName = "Main Tree") {
|
async function expandEntireTree(page, treeName = 'Main Tree') {
|
||||||
const treeLocator = page.getByRole('tree', {
|
const treeLocator = page.getByRole('tree', {
|
||||||
name: treeName
|
name: treeName
|
||||||
});
|
});
|
||||||
const collapsedTreeItems = treeLocator.getByRole('treeitem', {
|
const collapsedTreeItems = treeLocator
|
||||||
expanded: false
|
.getByRole('treeitem', {
|
||||||
}).locator('span.c-disclosure-triangle.is-enabled');
|
expanded: false
|
||||||
|
})
|
||||||
|
.locator('span.c-disclosure-triangle.is-enabled');
|
||||||
|
|
||||||
while (await collapsedTreeItems.count() > 0) {
|
while ((await collapsedTreeItems.count()) > 0) {
|
||||||
await collapsedTreeItems.nth(0).click();
|
await collapsedTreeItems.nth(0).click();
|
||||||
|
|
||||||
// FIXME: Replace hard wait with something event-driven.
|
// FIXME: Replace hard wait with something event-driven.
|
||||||
// Without the wait, this fails periodically due to a race condition
|
// Without the wait, this fails periodically due to a race condition
|
||||||
// with Vue rendering (loop exits prematurely).
|
// with Vue rendering (loop exits prematurely).
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
||||||
await page.waitForTimeout(200);
|
await page.waitForTimeout(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,12 +323,12 @@ async function expandEntireTree(page, treeName = "Main Tree") {
|
|||||||
* @returns {Promise<string>} the uuid of the focused object
|
* @returns {Promise<string>} the uuid of the focused object
|
||||||
*/
|
*/
|
||||||
async function getFocusedObjectUuid(page) {
|
async function getFocusedObjectUuid(page) {
|
||||||
const UUIDv4Regexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi;
|
const UUIDv4Regexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi;
|
||||||
const focusedObjectUuid = await page.evaluate((regexp) => {
|
const focusedObjectUuid = await page.evaluate((regexp) => {
|
||||||
return window.location.href.split('?')[0].match(regexp).at(-1);
|
return window.location.href.split('?')[0].match(regexp).at(-1);
|
||||||
}, UUIDv4Regexp);
|
}, UUIDv4Regexp);
|
||||||
|
|
||||||
return focusedObjectUuid;
|
return focusedObjectUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,36 +338,41 @@ async function getFocusedObjectUuid(page) {
|
|||||||
* URLs returned will be of the form `'./browse/#/mine/<uuid0>/<uuid1>/...'`
|
* URLs returned will be of the form `'./browse/#/mine/<uuid0>/<uuid1>/...'`
|
||||||
*
|
*
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {string} uuid the uuid of the object to get the url for
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} identifier the uuid or identifier of the object to get the url for
|
||||||
* @returns {Promise<string>} the url of the object
|
* @returns {Promise<string>} the url of the object
|
||||||
*/
|
*/
|
||||||
async function getHashUrlToDomainObject(page, uuid) {
|
async function getHashUrlToDomainObject(page, identifier) {
|
||||||
const hashUrl = await page.evaluate(async (objectUuid) => {
|
await page.waitForLoadState('load');
|
||||||
const path = await window.openmct.objects.getOriginalPath(objectUuid);
|
const hashUrl = await page.evaluate(async (objectIdentifier) => {
|
||||||
let url = './#/browse/' + [...path].reverse()
|
const path = await window.openmct.objects.getOriginalPath(objectIdentifier);
|
||||||
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
let url =
|
||||||
.join('/');
|
'./#/browse/' +
|
||||||
|
[...path]
|
||||||
|
.reverse()
|
||||||
|
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
||||||
|
.join('/');
|
||||||
|
|
||||||
// Drop the vestigial '/ROOT' if it exists
|
// Drop the vestigial '/ROOT' if it exists
|
||||||
if (url.includes('/ROOT')) {
|
if (url.includes('/ROOT')) {
|
||||||
url = url.split('/ROOT').join('');
|
url = url.split('/ROOT').join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}, uuid);
|
}, identifier);
|
||||||
|
|
||||||
return hashUrl;
|
return hashUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilizes the OpenMCT API to detect if the UI is in Edit mode.
|
* Utilizes the OpenMCT API to detect if the UI is in Edit mode.
|
||||||
* @private
|
* @private
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} identifier
|
||||||
* @return {Promise<boolean>} true if the Open MCT is in Edit Mode
|
* @return {Promise<boolean>} true if the Open MCT is in Edit Mode
|
||||||
*/
|
*/
|
||||||
async function _isInEditMode(page, identifier) {
|
async function _isInEditMode(page, identifier) {
|
||||||
// eslint-disable-next-line no-return-await
|
// eslint-disable-next-line no-return-await
|
||||||
return await page.evaluate(() => window.openmct.editor.isEditing());
|
return await page.evaluate(() => window.openmct.editor.isEditing());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,15 +381,17 @@ async function _isInEditMode(page, identifier) {
|
|||||||
* @param {boolean} [isFixedTimespan=true] true for fixed timespan mode, false for realtime mode; default is true
|
* @param {boolean} [isFixedTimespan=true] true for fixed timespan mode, false for realtime mode; default is true
|
||||||
*/
|
*/
|
||||||
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
||||||
// Click 'mode' button
|
// Click 'mode' button
|
||||||
await page.locator('.c-mode-button').click();
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await page.getByRole('button', { name: 'Time Conductor Mode Menu' }).click();
|
||||||
// Switch time conductor mode
|
// Switch time conductor mode. Note, need to wait here for URL to update as the router is debounced.
|
||||||
if (isFixedTimespan) {
|
if (isFixedTimespan) {
|
||||||
await page.locator('data-testid=conductor-modeOption-fixed').click();
|
await page.getByRole('menuitem', { name: /Fixed Timespan/ }).click();
|
||||||
} else {
|
await page.waitForURL(/tc\.mode=fixed/);
|
||||||
await page.locator('data-testid=conductor-modeOption-realtime').click();
|
} else {
|
||||||
}
|
await page.getByRole('menuitem', { name: /Real-Time/ }).click();
|
||||||
|
await page.waitForURL(/tc\.mode=local/);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -322,7 +399,7 @@ async function setTimeConductorMode(page, isFixedTimespan = true) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function setFixedTimeMode(page) {
|
async function setFixedTimeMode(page) {
|
||||||
await setTimeConductorMode(page, true);
|
await setTimeConductorMode(page, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,14 +407,17 @@ async function setFixedTimeMode(page) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function setRealTimeMode(page) {
|
async function setRealTimeMode(page) {
|
||||||
await setTimeConductorMode(page, false);
|
await setTimeConductorMode(page, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} OffsetValues
|
* @typedef {Object} OffsetValues
|
||||||
* @property {string | undefined} hours
|
* @property {string | undefined} startHours
|
||||||
* @property {string | undefined} mins
|
* @property {string | undefined} startMins
|
||||||
* @property {string | undefined} secs
|
* @property {string | undefined} startSecs
|
||||||
|
* @property {string | undefined} endHours
|
||||||
|
* @property {string | undefined} endMins
|
||||||
|
* @property {string | undefined} endSecs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -346,23 +426,36 @@ async function setRealTimeMode(page) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
* @param {import('@playwright/test').Locator} offsetButton
|
* @param {import('@playwright/test').Locator} offsetButton
|
||||||
*/
|
*/
|
||||||
async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
async function setTimeConductorOffset(
|
||||||
await offsetButton.click();
|
page,
|
||||||
|
{ startHours, startMins, startSecs, endHours, endMins, endSecs }
|
||||||
|
) {
|
||||||
|
if (startHours) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'Start offset hours' }).fill(startHours);
|
||||||
|
}
|
||||||
|
|
||||||
if (hours) {
|
if (startMins) {
|
||||||
await page.fill('.pr-time-controls__hrs', hours);
|
await page.getByRole('spinbutton', { name: 'Start offset minutes' }).fill(startMins);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mins) {
|
if (startSecs) {
|
||||||
await page.fill('.pr-time-controls__mins', mins);
|
await page.getByRole('spinbutton', { name: 'Start offset seconds' }).fill(startSecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secs) {
|
if (endHours) {
|
||||||
await page.fill('.pr-time-controls__secs', secs);
|
await page.getByRole('spinbutton', { name: 'End offset hours' }).fill(endHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click the check button
|
if (endMins) {
|
||||||
await page.locator('.pr-time__buttons .icon-check').click();
|
await page.getByRole('spinbutton', { name: 'End offset minutes' }).fill(endMins);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endSecs) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'End offset seconds' }).fill(endSecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Click the check button
|
||||||
|
await page.locator('.pr-time-input--buttons .icon-check').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,8 +464,9 @@ async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
*/
|
*/
|
||||||
async function setStartOffset(page, offset) {
|
async function setStartOffset(page, offset) {
|
||||||
const startOffsetButton = page.locator('data-testid=conductor-start-offset-button');
|
// Click 'mode' button
|
||||||
await setTimeConductorOffset(page, offset, startOffsetButton);
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -381,42 +475,194 @@ async function setStartOffset(page, offset) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
*/
|
*/
|
||||||
async function setEndOffset(page, offset) {
|
async function setEndOffset(page, offset) {
|
||||||
const endOffsetButton = page.locator('data-testid=conductor-end-offset-button');
|
// Click 'mode' button
|
||||||
await setTimeConductorOffset(page, offset, endOffsetButton);
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects an inspector tab based on the provided tab name
|
* Set the time conductor bounds in fixed time mode
|
||||||
*
|
*
|
||||||
|
* NOTE: Unless explicitly testing the Time Conductor itself, it is advised to instead
|
||||||
|
* navigate directly to the object with the desired time bounds using `navigateToObjectWithFixedTimeBounds()`.
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {String} name the name of the tab
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
*/
|
*/
|
||||||
async function selectInspectorTab(page, name) {
|
async function setTimeConductorBounds(page, startDate, endDate) {
|
||||||
const inspectorTabs = page.getByRole('tablist');
|
// Bring up the time conductor popup
|
||||||
const inspectorTab = inspectorTabs.getByTitle(name);
|
expect(await page.locator('.l-shell__time-conductor.c-compact-tc').count()).toBe(1);
|
||||||
const inspectorTabClass = await inspectorTab.getAttribute('class');
|
await page.click('.l-shell__time-conductor.c-compact-tc');
|
||||||
const isSelectedInspectorTab = inspectorTabClass.includes('is-current');
|
|
||||||
|
|
||||||
// do not click a tab that is already selected or it will timeout your test
|
await setTimeBounds(page, startDate, endDate);
|
||||||
// do to a { pointer-events: none; } on selected tabs
|
|
||||||
if (!isSelectedInspectorTab) {
|
await page.keyboard.press('Enter');
|
||||||
await inspectorTab.click();
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Set the independent time conductor bounds in fixed time mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @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();
|
||||||
|
|
||||||
|
// Bring up the time conductor popup
|
||||||
|
await page.click('.c-conductor-holder--compact .c-compact-tc');
|
||||||
|
await expect(page.locator('.itc-popout')).toBeInViewport();
|
||||||
|
|
||||||
|
await setTimeBounds(page, startDate, endDate);
|
||||||
|
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the bounds of the visible conductor in fixed time mode
|
||||||
|
* @private
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
|
async function setTimeBounds(page, startDate, endDate) {
|
||||||
|
if (startDate) {
|
||||||
|
// Fill start time
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Start date' })
|
||||||
|
.fill(startDate.toString().substring(0, 10));
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Start time' })
|
||||||
|
.fill(startDate.toString().substring(11, 19));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endDate) {
|
||||||
|
// Fill end time
|
||||||
|
await page.getByRole('textbox', { name: 'End date' }).fill(endDate.toString().substring(0, 10));
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'End time' })
|
||||||
|
.fill(endDate.toString().substring(11, 19));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits and asserts that all plot series data on the page
|
||||||
|
* is loaded and drawn.
|
||||||
|
*
|
||||||
|
* In lieu of a better way to detect when a plot is done rendering,
|
||||||
|
* we [attach a class to the '.gl-plot' element](https://github.com/nasa/openmct/blob/5924d7ea95a0c2d4141c602a3c7d0665cb91095f/src/plugins/plot/MctPlot.vue#L27)
|
||||||
|
* once all pending series data has been loaded. The following appAction retrieves
|
||||||
|
* all plots on the page and waits up to the default timeout for the class to be
|
||||||
|
* attached to each plot.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function waitForPlotsToRender(page) {
|
||||||
|
const plotLocator = page.locator('.gl-plot');
|
||||||
|
for (const plot of await plotLocator.all()) {
|
||||||
|
await expect(plot).toHaveClass(/js-series-data-loaded/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PlotPixel
|
||||||
|
* @property {number} r The value of the red channel (0-255)
|
||||||
|
* @property {number} g The value of the green channel (0-255)
|
||||||
|
* @property {number} b The value of the blue channel (0-255)
|
||||||
|
* @property {number} a The value of the alpha channel (0-255)
|
||||||
|
* @property {string} strValue The rgba string value of the pixel
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for all plots to render and then retrieve and return an array
|
||||||
|
* of canvas plot pixel data (RGBA values).
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} canvasSelector The selector for the canvas element
|
||||||
|
* @return {Promise<PlotPixel[]>}
|
||||||
|
*/
|
||||||
|
async function getCanvasPixels(page, canvasSelector) {
|
||||||
|
const getTelemValuePromise = new Promise((resolve) =>
|
||||||
|
page.exposeFunction('getCanvasValue', resolve)
|
||||||
|
);
|
||||||
|
const canvasHandle = await page.evaluateHandle(
|
||||||
|
(canvas) => document.querySelector(canvas),
|
||||||
|
canvasSelector
|
||||||
|
);
|
||||||
|
const canvasContextHandle = await page.evaluateHandle(
|
||||||
|
(canvas) => canvas.getContext('2d'),
|
||||||
|
canvasHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
await page.evaluate(
|
||||||
|
([canvas, ctx]) => {
|
||||||
|
// The document canvas is where the plot points and lines are drawn.
|
||||||
|
// The only way to access the canvas is using document (using page.evaluate)
|
||||||
|
/** @type {ImageData} */
|
||||||
|
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
|
||||||
|
/** @type {number[]} */
|
||||||
|
const imageDataValues = Object.values(data);
|
||||||
|
/** @type {PlotPixel[]} */
|
||||||
|
const plotPixels = [];
|
||||||
|
// Each pixel consists of four values within the ImageData.data array. The for loop iterates by multiples of four.
|
||||||
|
// The values associated with each pixel are R (red), G (green), B (blue), and A (alpha), in that order.
|
||||||
|
for (let i = 0; i < imageDataValues.length; ) {
|
||||||
|
if (imageDataValues[i] > 0) {
|
||||||
|
plotPixels.push({
|
||||||
|
r: imageDataValues[i],
|
||||||
|
g: imageDataValues[i + 1],
|
||||||
|
b: imageDataValues[i + 2],
|
||||||
|
a: imageDataValues[i + 3],
|
||||||
|
strValue: `rgb(${imageDataValues[i]}, ${imageDataValues[i + 1]}, ${
|
||||||
|
imageDataValues[i + 2]
|
||||||
|
}, ${imageDataValues[i + 3]})`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i = i + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.getCanvasValue(plotPixels);
|
||||||
|
},
|
||||||
|
[canvasHandle, canvasContextHandle]
|
||||||
|
);
|
||||||
|
|
||||||
|
return getTelemValuePromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} myItemsFolderName
|
||||||
|
* @param {string} url
|
||||||
|
* @param {string} newName
|
||||||
|
*/
|
||||||
|
async function renameObjectFromContextMenu(page, url, newName) {
|
||||||
|
await openObjectTreeContextMenu(page, url);
|
||||||
|
await page.click('li:text("Edit Properties")');
|
||||||
|
const nameInput = page.getByLabel('Title', { exact: true });
|
||||||
|
await nameInput.fill('');
|
||||||
|
await nameInput.fill(newName);
|
||||||
|
await page.click('[aria-label="Save"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createDomainObjectWithDefaults,
|
createDomainObjectWithDefaults,
|
||||||
createNotification,
|
createExampleTelemetryObject,
|
||||||
expandTreePaneItemByName,
|
createNotification,
|
||||||
expandEntireTree,
|
createPlanFromJSON,
|
||||||
createPlanFromJSON,
|
expandEntireTree,
|
||||||
openObjectTreeContextMenu,
|
expandTreePaneItemByName,
|
||||||
getHashUrlToDomainObject,
|
getCanvasPixels,
|
||||||
getFocusedObjectUuid,
|
getHashUrlToDomainObject,
|
||||||
setFixedTimeMode,
|
getFocusedObjectUuid,
|
||||||
setRealTimeMode,
|
navigateToObjectWithFixedTimeBounds,
|
||||||
setStartOffset,
|
openObjectTreeContextMenu,
|
||||||
setEndOffset,
|
setFixedTimeMode,
|
||||||
selectInspectorTab
|
setRealTimeMode,
|
||||||
|
setStartOffset,
|
||||||
|
setEndOffset,
|
||||||
|
setTimeConductorBounds,
|
||||||
|
setIndependentTimeConductorBounds,
|
||||||
|
waitForPlotsToRender,
|
||||||
|
renameObjectFromContextMenu
|
||||||
};
|
};
|
||||||
|
97
e2e/avpFixtures.js
Normal file
97
e2e/avpFixtures.js
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* avpFixtures.js
|
||||||
|
*
|
||||||
|
* @file This module provides custom fixtures specifically tailored for Accessibility, Visual, and Performance (AVP) tests.
|
||||||
|
* These fixtures extend the base functionality of the Playwright fixtures and appActions, and are designed to be
|
||||||
|
* generalized across all plugins. They offer functionalities like scanning for accessibility violations, integrating
|
||||||
|
* with axe-core, and more.
|
||||||
|
*
|
||||||
|
* IMPORTANT NOTE: This fixture file is not intended to be extended further by other fixtures. If you find yourself
|
||||||
|
* needing to do so, please consult the documentation and consider creating a specialized fixture or modifying the
|
||||||
|
* existing ones.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const { test, expect } = require('./pluginFixtures');
|
||||||
|
const AxeBuilder = require('@axe-core/playwright').default;
|
||||||
|
|
||||||
|
// Constants for repeated values
|
||||||
|
const TEST_RESULTS_DIR = './test-results';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
/* eslint-disable no-undef */
|
||||||
|
exports.scanForA11yViolations = async function (page, testCaseName, options = {}) {
|
||||||
|
const builder = new AxeBuilder({ page });
|
||||||
|
builder.withTags(['wcag2aa']);
|
||||||
|
// https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md
|
||||||
|
builder.disableRules(['color-contrast']);
|
||||||
|
const accessibilityScanResults = await builder.analyze();
|
||||||
|
|
||||||
|
// Assert that no violations should be present
|
||||||
|
expect(
|
||||||
|
accessibilityScanResults.violations,
|
||||||
|
`Accessibility violations found in test case: ${testCaseName}`
|
||||||
|
).toEqual([]);
|
||||||
|
|
||||||
|
// Check if there are any violations
|
||||||
|
if (accessibilityScanResults.violations.length > 0) {
|
||||||
|
let reportName = options.reportName || testCaseName;
|
||||||
|
let sanitizedReportName = reportName.replace(/\//g, '_');
|
||||||
|
const reportPath = path.join(TEST_RESULTS_DIR, `${sanitizedReportName}.json`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(TEST_RESULTS_DIR)) {
|
||||||
|
fs.mkdirSync(TEST_RESULTS_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(reportPath, JSON.stringify(accessibilityScanResults, null, 2));
|
||||||
|
console.log(`Accessibility report with violations saved successfully as ${reportPath}`);
|
||||||
|
return accessibilityScanResults;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error writing the accessibility report to file ${reportPath}:`, err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('No accessibility violations found, no report generated.');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.expect = expect;
|
||||||
|
exports.test = test;
|
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const base = require('@playwright/test');
|
const base = require('@playwright/test');
|
||||||
const { expect } = base;
|
const { expect, request } = base;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { v4: uuid } = require('uuid');
|
const { v4: uuid } = require('uuid');
|
||||||
@ -43,9 +43,9 @@ const sinon = require('sinon');
|
|||||||
* @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) {
|
function _consoleMessageToString(msg) {
|
||||||
const { url, lineNumber, columnNumber } = msg.location();
|
const { url, lineNumber, columnNumber } = msg.location();
|
||||||
|
|
||||||
return `[${msg.type()}] ${msg.text()} at (${url} ${lineNumber}:${columnNumber})`;
|
return `[${msg.type()}] ${msg.text()} at (${url} ${lineNumber}:${columnNumber})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,12 +56,9 @@ function _consoleMessageToString(msg) {
|
|||||||
* @return {Promise<Animation[]>}
|
* @return {Promise<Animation[]>}
|
||||||
*/
|
*/
|
||||||
function waitForAnimations(locator) {
|
function waitForAnimations(locator) {
|
||||||
return locator
|
return locator.evaluate((element) =>
|
||||||
.evaluate((element) =>
|
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
|
||||||
Promise.all(
|
);
|
||||||
element
|
|
||||||
.getAnimations({ subtree: true })
|
|
||||||
.map((animation) => animation.finished)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,103 +69,138 @@ function waitForAnimations(locator) {
|
|||||||
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
||||||
|
|
||||||
exports.test = base.test.extend({
|
exports.test = base.test.extend({
|
||||||
/**
|
/**
|
||||||
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
|
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
|
||||||
* the Time Indicator Clock to be in a specific state.
|
* the Time Indicator Clock to be in a specific state.
|
||||||
* Usage:
|
*
|
||||||
* ```
|
* Warning: Has many limitations and secondary side effects in Open MCT.
|
||||||
* test.use({
|
* 1. The tree component does not render.
|
||||||
* clockOptions: {
|
* 2. page.WaitForNavigation does not trigger.
|
||||||
* now: 0,
|
*
|
||||||
* shouldAdvanceTime: true
|
* Usage:
|
||||||
* ```
|
* ```js
|
||||||
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
* test.use({
|
||||||
*
|
* clockOptions: {
|
||||||
* Default: `undefined`
|
* now: MISSION_TIME,
|
||||||
*
|
* shouldAdvanceTime: true
|
||||||
* @see {@link https://github.com/microsoft/playwright/issues/6347 Github RFE}
|
* ```
|
||||||
* @see {@link https://github.com/sinonjs/fake-timers/#var-clock--faketimersinstallconfig SinonJS FakeTimers Config}
|
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
||||||
*/
|
*
|
||||||
clockOptions: [undefined, { option: true }],
|
* Default: `undefined`
|
||||||
overrideClock: [async ({ context, clockOptions }, use) => {
|
*
|
||||||
if (clockOptions !== undefined) {
|
* @see {@link https://github.com/microsoft/playwright/issues/6347 Github RFE}
|
||||||
await context.addInitScript({
|
* @see {@link https://github.com/sinonjs/fake-timers/#var-clock--faketimersinstallconfig SinonJS FakeTimers Config}
|
||||||
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js')
|
* @type {import('@types/sinonjs__fake-timers').FakeTimerInstallOpts}
|
||||||
});
|
*/
|
||||||
await context.addInitScript((options) => {
|
clockOptions: [undefined, { option: true }],
|
||||||
window.__clock = sinon.useFakeTimers(options);
|
overrideClock: [
|
||||||
}, clockOptions);
|
async ({ context, clockOptions }, use) => {
|
||||||
}
|
if (clockOptions !== undefined) {
|
||||||
|
await context.addInitScript({
|
||||||
await use(context);
|
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js')
|
||||||
}, {
|
|
||||||
auto: true,
|
|
||||||
scope: 'test'
|
|
||||||
}],
|
|
||||||
/**
|
|
||||||
* Extends the base context class to add codecoverage shim.
|
|
||||||
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
|
||||||
*/
|
|
||||||
context: async ({ context }, use) => {
|
|
||||||
await context.addInitScript(() =>
|
|
||||||
window.addEventListener('beforeunload', () =>
|
|
||||||
(window).collectIstanbulCoverage(JSON.stringify((window).__coverage__))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
|
|
||||||
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
|
|
||||||
if (coverageJSON) {
|
|
||||||
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${uuid()}.json`), coverageJSON);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
await context.addInitScript((options) => {
|
||||||
|
window.__clock = sinon.useFakeTimers(options);
|
||||||
|
}, clockOptions);
|
||||||
|
}
|
||||||
|
|
||||||
await use(context);
|
await use(context);
|
||||||
for (const page of context.pages()) {
|
|
||||||
await page.evaluate(() => (window).collectIstanbulCoverage(JSON.stringify((window).__coverage__)));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/**
|
{
|
||||||
* If true, will assert against any console.error calls that occur during the test. Assertions occur
|
auto: true,
|
||||||
* during test teardown (after the test has completed).
|
scope: 'test'
|
||||||
*
|
|
||||||
* Default: `true`
|
|
||||||
*/
|
|
||||||
failOnConsoleError: [true, { option: true }],
|
|
||||||
/**
|
|
||||||
* Extends the base page class to enable console log error detection.
|
|
||||||
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
|
||||||
*/
|
|
||||||
page: async ({ page, failOnConsoleError }, use) => {
|
|
||||||
// Capture any console errors during test execution
|
|
||||||
const messages = [];
|
|
||||||
page.on('console', (msg) => messages.push(msg));
|
|
||||||
|
|
||||||
await use(page);
|
|
||||||
|
|
||||||
// Assert against console errors during teardown
|
|
||||||
if (failOnConsoleError) {
|
|
||||||
messages.forEach(
|
|
||||||
msg => expect.soft(msg.type(), `Console error detected: ${_consoleMessageToString(msg)}`).not.toEqual('error')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Extends the base browser class to enable CDP connection definition in playwright.config.js. Once
|
|
||||||
* that RFE is implemented, this function can be removed.
|
|
||||||
* @see {@link https://github.com/microsoft/playwright/issues/8379 Github RFE}
|
|
||||||
*/
|
|
||||||
browser: async ({ playwright, browser }, use, workerInfo) => {
|
|
||||||
// Use browserless if configured
|
|
||||||
if (workerInfo.project.name.match(/browserless/)) {
|
|
||||||
const vBrowser = await playwright.chromium.connectOverCDP({
|
|
||||||
endpointURL: 'ws://localhost:3003'
|
|
||||||
});
|
|
||||||
await use(vBrowser);
|
|
||||||
} else {
|
|
||||||
// Use Local Browser for testing.
|
|
||||||
await use(browser);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
* Extends the base context class to add codecoverage shim.
|
||||||
|
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
||||||
|
*/
|
||||||
|
context: async ({ context }, use) => {
|
||||||
|
await context.addInitScript(() =>
|
||||||
|
window.addEventListener('beforeunload', () =>
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
|
||||||
|
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
|
||||||
|
if (coverageJSON) {
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(istanbulCLIOutput, `playwright_coverage_${uuid()}.json`),
|
||||||
|
coverageJSON
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await use(context);
|
||||||
|
for (const page of context.pages()) {
|
||||||
|
await page.evaluate(() =>
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* If true, will assert against any console.error calls that occur during the test. Assertions occur
|
||||||
|
* during test teardown (after the test has completed).
|
||||||
|
*
|
||||||
|
* Default: `true`
|
||||||
|
*/
|
||||||
|
failOnConsoleError: [true, { option: true }],
|
||||||
|
/**
|
||||||
|
* Extends the base page class to enable console log error detection.
|
||||||
|
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
||||||
|
*/
|
||||||
|
page: async ({ page, failOnConsoleError, clockOptions }, use) => {
|
||||||
|
// If overriding the clock, we must also override the Date.now()
|
||||||
|
// 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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Capture any console errors during test execution
|
||||||
|
const messages = [];
|
||||||
|
page.on('console', (msg) => messages.push(msg));
|
||||||
|
|
||||||
|
await use(page);
|
||||||
|
|
||||||
|
// Assert against console errors during teardown
|
||||||
|
if (failOnConsoleError) {
|
||||||
|
messages.forEach((msg) =>
|
||||||
|
expect
|
||||||
|
.soft(msg.type(), `Console error detected: ${_consoleMessageToString(msg)}`)
|
||||||
|
.not.toEqual('error')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Extends the base browser class to enable CDP connection definition in playwright.config.js. Once
|
||||||
|
* that RFE is implemented, this function can be removed.
|
||||||
|
* @see {@link https://github.com/microsoft/playwright/issues/8379 Github RFE}
|
||||||
|
*/
|
||||||
|
browser: async ({ playwright, browser }, use, workerInfo) => {
|
||||||
|
// Use browserless if configured
|
||||||
|
if (workerInfo.project.name.match(/browserless/)) {
|
||||||
|
const vBrowser = await playwright.chromium.connectOverCDP({
|
||||||
|
endpointURL: 'ws://localhost:3003'
|
||||||
|
});
|
||||||
|
await use(vBrowser);
|
||||||
|
} else {
|
||||||
|
// Use Local Browser for testing.
|
||||||
|
await use(browser);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.expect = expect;
|
exports.expect = expect;
|
||||||
|
exports.request = request;
|
||||||
exports.waitForAnimations = waitForAnimations;
|
exports.waitForAnimations = waitForAnimations;
|
||||||
|
18
e2e/constants.js
Normal file
18
e2e/constants.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* eslint-disable prettier/prettier */
|
||||||
|
/**
|
||||||
|
* Constants which may be used across all e2e tests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time Constants
|
||||||
|
* - 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)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
export const VISUAL_URL = './#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
|
@ -20,17 +20,11 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
// This should be used to install the Example User
|
||||||
* This test suite template is to be used when verifying Test Data files found in /e2e/test-data/
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
*/
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.example.ExampleDataVisualizationSourcePlugin());
|
||||||
const { test } = require('../../baseFixtures');
|
openmct.install(
|
||||||
|
openmct.plugins.InspectorDataVisualization({ type: 'exampleDataVisualizationSource' })
|
||||||
test.describe('recycled_local_storage @localStorage', () => {
|
);
|
||||||
//We may want to do some additional level of verification of this file. For now, we just verify that it exists and can be used in a test suite.
|
|
||||||
test.use({ storageState: './e2e/test-data/recycled_local_storage.json' });
|
|
||||||
test('Can use recycled_local_storage file', async ({ page }) => {
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
@ -23,6 +23,6 @@
|
|||||||
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
||||||
});
|
});
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
const staticFaults = true;
|
const staticFaults = true;
|
||||||
|
|
||||||
openmct.install(openmct.plugins.example.ExampleFaultSource(staticFaults));
|
openmct.install(openmct.plugins.example.ExampleFaultSource(staticFaults));
|
||||||
});
|
});
|
||||||
|
@ -22,6 +22,6 @@
|
|||||||
|
|
||||||
// This should be used to install the Example User
|
// This should be used to install the Example User
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.example.ExampleUser());
|
openmct.install(openmct.plugins.example.ExampleUser());
|
||||||
});
|
});
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.FaultManagement());
|
openmct.install(openmct.plugins.FaultManagement());
|
||||||
});
|
});
|
||||||
|
@ -1,76 +1,71 @@
|
|||||||
class DomainObjectViewProvider {
|
class DomainObjectViewProvider {
|
||||||
constructor(openmct) {
|
constructor(openmct) {
|
||||||
this.key = 'doViewProvider';
|
this.key = 'doViewProvider';
|
||||||
this.name = 'Domain Object View Provider';
|
this.name = 'Domain Object View Provider';
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
}
|
}
|
||||||
|
|
||||||
canView(domainObject) {
|
canView(domainObject) {
|
||||||
return domainObject.type === 'imageFileInput'
|
return domainObject.type === 'imageFileInput' || domainObject.type === 'jsonFileInput';
|
||||||
|| domainObject.type === 'jsonFileInput';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
view(domainObject, objectPath) {
|
view(domainObject, objectPath) {
|
||||||
let content;
|
let content;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: function (element) {
|
show: function (element) {
|
||||||
const body = domainObject.selectFile.body;
|
const body = domainObject.selectFile.body;
|
||||||
const type = typeof body;
|
const type = typeof body;
|
||||||
|
|
||||||
content = document.createElement('div');
|
content = document.createElement('div');
|
||||||
content.id = 'file-input-type';
|
content.id = 'file-input-type';
|
||||||
content.textContent = JSON.stringify(type);
|
content.textContent = JSON.stringify(type);
|
||||||
element.appendChild(content);
|
element.appendChild(content);
|
||||||
},
|
},
|
||||||
destroy: function (element) {
|
destroy: function (element) {
|
||||||
element.removeChild(content);
|
element.removeChild(content);
|
||||||
content = undefined;
|
content = undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
|
|
||||||
openmct.types.addType('jsonFileInput', {
|
openmct.types.addType('jsonFileInput', {
|
||||||
key: 'jsonFileInput',
|
key: 'jsonFileInput',
|
||||||
name: "JSON File Input Object",
|
name: 'JSON File Input Object',
|
||||||
creatable: true,
|
creatable: true,
|
||||||
form: [
|
form: [
|
||||||
{
|
{
|
||||||
name: 'Upload File',
|
name: 'Upload File',
|
||||||
key: 'selectFile',
|
key: 'selectFile',
|
||||||
control: 'file-input',
|
control: 'file-input',
|
||||||
required: true,
|
required: true,
|
||||||
text: 'Select File...',
|
text: 'Select File...',
|
||||||
type: 'application/json',
|
type: 'application/json',
|
||||||
property: [
|
property: ['selectFile']
|
||||||
"selectFile"
|
}
|
||||||
]
|
]
|
||||||
}
|
});
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
openmct.types.addType('imageFileInput', {
|
openmct.types.addType('imageFileInput', {
|
||||||
key: 'imageFileInput',
|
key: 'imageFileInput',
|
||||||
name: "Image File Input Object",
|
name: 'Image File Input Object',
|
||||||
creatable: true,
|
creatable: true,
|
||||||
form: [
|
form: [
|
||||||
{
|
{
|
||||||
name: 'Upload File',
|
name: 'Upload File',
|
||||||
key: 'selectFile',
|
key: 'selectFile',
|
||||||
control: 'file-input',
|
control: 'file-input',
|
||||||
required: true,
|
required: true,
|
||||||
text: 'Select File...',
|
text: 'Select File...',
|
||||||
type: 'image/*',
|
type: 'image/*',
|
||||||
property: [
|
property: ['selectFile']
|
||||||
"selectFile"
|
}
|
||||||
]
|
]
|
||||||
}
|
});
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
|
openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
|
||||||
});
|
});
|
||||||
|
@ -27,6 +27,6 @@ const NOTEBOOK_NAME = 'Notebook';
|
|||||||
const URL_WHITELIST = ['google.com'];
|
const URL_WHITELIST = ['google.com'];
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
|
openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
|
||||||
});
|
});
|
||||||
|
@ -22,6 +22,6 @@
|
|||||||
|
|
||||||
// This should be used to install the Operator Status
|
// This should be used to install the Operator Status
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.OperatorStatus());
|
openmct.install(openmct.plugins.OperatorStatus());
|
||||||
});
|
});
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.RestrictedNotebook('CUSTOM_NAME'));
|
openmct.install(openmct.plugins.RestrictedNotebook('CUSTOM_NAME'));
|
||||||
});
|
});
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
(function () {
|
(function () {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const PERSISTENCE_KEY = 'persistence-tests';
|
const PERSISTENCE_KEY = 'persistence-tests';
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
|
|
||||||
openmct.objects.addRoot({
|
openmct.objects.addRoot({
|
||||||
namespace: PERSISTENCE_KEY,
|
namespace: PERSISTENCE_KEY,
|
||||||
key: PERSISTENCE_KEY
|
key: PERSISTENCE_KEY
|
||||||
});
|
|
||||||
|
|
||||||
openmct.objects.addProvider(PERSISTENCE_KEY, {
|
|
||||||
get(identifier) {
|
|
||||||
if (identifier.key !== PERSISTENCE_KEY) {
|
|
||||||
return undefined;
|
|
||||||
} else {
|
|
||||||
return Promise.resolve({
|
|
||||||
identifier,
|
|
||||||
type: 'folder',
|
|
||||||
name: 'Persistence Testing',
|
|
||||||
location: 'ROOT',
|
|
||||||
composition: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}());
|
|
||||||
|
openmct.objects.addProvider(PERSISTENCE_KEY, {
|
||||||
|
get(identifier) {
|
||||||
|
if (identifier.key !== PERSISTENCE_KEY) {
|
||||||
|
return undefined;
|
||||||
|
} else {
|
||||||
|
return Promise.resolve({
|
||||||
|
identifier,
|
||||||
|
type: 'folder',
|
||||||
|
name: 'Persistence Testing',
|
||||||
|
location: 'ROOT',
|
||||||
|
composition: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
@ -19,259 +19,275 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultManagementWithExample(page) {
|
async function navigateToFaultManagementWithExample(page) {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultManagementWithStaticExample(page) {
|
async function navigateToFaultManagementWithStaticExample(page) {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js') });
|
path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js')
|
||||||
|
});
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultManagementWithoutExample(page) {
|
async function navigateToFaultManagementWithoutExample(page) {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultItemInTree(page) {
|
async function navigateToFaultItemInTree(page) {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
// Click text=Fault Management
|
const faultManagementTreeItem = page
|
||||||
await page.click('text=Fault Management'); // this verifies the plugin has been added
|
.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
})
|
||||||
|
.getByRole('treeitem', {
|
||||||
|
name: 'Fault Management'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Navigate to "Fault Management" from the tree
|
||||||
|
await faultManagementTreeItem.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function acknowledgeFault(page, rowNumber) {
|
async function acknowledgeFault(page, rowNumber) {
|
||||||
await openFaultRowMenu(page, rowNumber);
|
await openFaultRowMenu(page, rowNumber);
|
||||||
await page.locator('.c-menu >> text="Acknowledge"').click();
|
await page.locator('.c-menu >> text="Acknowledge"').click();
|
||||||
// Click [aria-label="Save"]
|
// Click [aria-label="Save"]
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function shelveMultipleFaults(page, ...nums) {
|
async function shelveMultipleFaults(page, ...nums) {
|
||||||
const selectRows = nums.map((num) => {
|
const selectRows = nums.map((num) => {
|
||||||
return selectFaultItem(page, num);
|
return selectFaultItem(page, num);
|
||||||
});
|
});
|
||||||
await Promise.all(selectRows);
|
await Promise.all(selectRows);
|
||||||
|
|
||||||
await page.locator('button:has-text("Shelve")').click();
|
await page.locator('button:has-text("Shelve")').click();
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function acknowledgeMultipleFaults(page, ...nums) {
|
async function acknowledgeMultipleFaults(page, ...nums) {
|
||||||
const selectRows = nums.map((num) => {
|
const selectRows = nums.map((num) => {
|
||||||
return selectFaultItem(page, num);
|
return selectFaultItem(page, num);
|
||||||
});
|
});
|
||||||
await Promise.all(selectRows);
|
await Promise.all(selectRows);
|
||||||
|
|
||||||
await page.locator('button:has-text("Acknowledge")').click();
|
await page.locator('button:has-text("Acknowledge")').click();
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function shelveFault(page, rowNumber) {
|
async function shelveFault(page, rowNumber) {
|
||||||
await openFaultRowMenu(page, rowNumber);
|
await openFaultRowMenu(page, rowNumber);
|
||||||
await page.locator('.c-menu >> text="Shelve"').click();
|
await page.locator('.c-menu >> text="Shelve"').click();
|
||||||
// Click [aria-label="Save"]
|
// Click [aria-label="Save"]
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function changeViewTo(page, view) {
|
async function changeViewTo(page, view) {
|
||||||
await page.locator('.c-fault-mgmt__search-row select').first().selectOption(view);
|
await page.locator('.c-fault-mgmt__search-row select').first().selectOption(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function sortFaultsBy(page, sort) {
|
async function sortFaultsBy(page, sort) {
|
||||||
await page.locator('.c-fault-mgmt__list-header-sortButton select').selectOption(sort);
|
await page.locator('.c-fault-mgmt__list-header-sortButton select').selectOption(sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function enterSearchTerm(page, term) {
|
async function enterSearchTerm(page, term) {
|
||||||
await page.locator('.c-fault-mgmt-search [aria-label="Search Input"]').fill(term);
|
await page.locator('.c-fault-mgmt-search [aria-label="Search Input"]').fill(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function clearSearch(page) {
|
async function clearSearch(page) {
|
||||||
await enterSearchTerm(page, '');
|
await enterSearchTerm(page, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function selectFaultItem(page, rowNumber) {
|
async function selectFaultItem(page, rowNumber) {
|
||||||
// eslint-disable-next-line playwright/no-force-option
|
await page.locator(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`).check();
|
||||||
await page.check(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`, { force: true }); // this will not work without force true, saw this may be a pw bug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getHighestSeverity(page) {
|
async function getHighestSeverity(page) {
|
||||||
const criticalCount = await page.locator('[title=CRITICAL]').count();
|
const criticalCount = await page.locator('[title=CRITICAL]').count();
|
||||||
const warningCount = await page.locator('[title=WARNING]').count();
|
const warningCount = await page.locator('[title=WARNING]').count();
|
||||||
|
|
||||||
if (criticalCount > 0) {
|
if (criticalCount > 0) {
|
||||||
return 'CRITICAL';
|
return 'CRITICAL';
|
||||||
} else if (warningCount > 0) {
|
} else if (warningCount > 0) {
|
||||||
return 'WARNING';
|
return 'WARNING';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'WATCH';
|
return 'WATCH';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getLowestSeverity(page) {
|
async function getLowestSeverity(page) {
|
||||||
const warningCount = await page.locator('[title=WARNING]').count();
|
const warningCount = await page.locator('[title=WARNING]').count();
|
||||||
const watchCount = await page.locator('[title=WATCH]').count();
|
const watchCount = await page.locator('[title=WATCH]').count();
|
||||||
|
|
||||||
if (watchCount > 0) {
|
if (watchCount > 0) {
|
||||||
return 'WATCH';
|
return 'WATCH';
|
||||||
} else if (warningCount > 0) {
|
} else if (warningCount > 0) {
|
||||||
return 'WARNING';
|
return 'WARNING';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'CRITICAL';
|
return 'CRITICAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultResultCount(page) {
|
async function getFaultResultCount(page) {
|
||||||
const count = await page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').count();
|
const count = await page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').count();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
function getFault(page, rowNumber) {
|
function getFault(page, rowNumber) {
|
||||||
const fault = page.locator(`.c-faults-list-view-item-body > .c-fault-mgmt__list >> nth=${rowNumber - 1}`);
|
const fault = page.locator(
|
||||||
|
`.c-faults-list-view-item-body > .c-fault-mgmt__list >> nth=${rowNumber - 1}`
|
||||||
|
);
|
||||||
|
|
||||||
return fault;
|
return fault;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
function getFaultByName(page, name) {
|
function getFaultByName(page, name) {
|
||||||
const fault = page.locator(`.c-fault-mgmt__list-faultname:has-text("${name}")`);
|
const fault = page.locator(`.c-fault-mgmt__list-faultname:has-text("${name}")`);
|
||||||
|
|
||||||
return fault;
|
return fault;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultName(page, rowNumber) {
|
async function getFaultName(page, rowNumber) {
|
||||||
const faultName = await page.locator(`.c-fault-mgmt__list-faultname >> nth=${rowNumber - 1}`).textContent();
|
const faultName = await page
|
||||||
|
.locator(`.c-fault-mgmt__list-faultname >> nth=${rowNumber - 1}`)
|
||||||
|
.textContent();
|
||||||
|
|
||||||
return faultName;
|
return faultName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultSeverity(page, rowNumber) {
|
async function getFaultSeverity(page, rowNumber) {
|
||||||
const faultSeverity = await page.locator(`.c-faults-list-view-item-body .c-fault-mgmt__list-severity >> nth=${rowNumber - 1}`).getAttribute('title');
|
const faultSeverity = await page
|
||||||
|
.locator(`.c-faults-list-view-item-body .c-fault-mgmt__list-severity >> nth=${rowNumber - 1}`)
|
||||||
|
.getAttribute('title');
|
||||||
|
|
||||||
return faultSeverity;
|
return faultSeverity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultNamespace(page, rowNumber) {
|
async function getFaultNamespace(page, rowNumber) {
|
||||||
const faultNamespace = await page.locator(`.c-fault-mgmt__list-path >> nth=${rowNumber - 1}`).textContent();
|
const faultNamespace = await page
|
||||||
|
.locator(`.c-fault-mgmt__list-path >> nth=${rowNumber - 1}`)
|
||||||
|
.textContent();
|
||||||
|
|
||||||
return faultNamespace;
|
return faultNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultTriggerTime(page, rowNumber) {
|
async function getFaultTriggerTime(page, rowNumber) {
|
||||||
const faultTriggerTime = await page.locator(`.c-fault-mgmt__list-trigTime >> nth=${rowNumber - 1} >> .c-fault-mgmt-item__value`).textContent();
|
const faultTriggerTime = await page
|
||||||
|
.locator(`.c-fault-mgmt__list-trigTime >> nth=${rowNumber - 1} >> .c-fault-mgmt-item__value`)
|
||||||
|
.textContent();
|
||||||
|
|
||||||
return faultTriggerTime.toString().trim();
|
return faultTriggerTime.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function openFaultRowMenu(page, rowNumber) {
|
async function openFaultRowMenu(page, rowNumber) {
|
||||||
// select
|
// select
|
||||||
await page.locator(`.c-fault-mgmt-item > .c-fault-mgmt__list-action-button >> nth=${rowNumber - 1}`).click();
|
await page
|
||||||
|
.locator(`.c-fault-mgmt-item > .c-fault-mgmt__list-action-button >> nth=${rowNumber - 1}`)
|
||||||
|
.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
module.exports = {
|
||||||
navigateToFaultManagementWithExample,
|
navigateToFaultManagementWithExample,
|
||||||
navigateToFaultManagementWithStaticExample,
|
navigateToFaultManagementWithStaticExample,
|
||||||
navigateToFaultManagementWithoutExample,
|
navigateToFaultManagementWithoutExample,
|
||||||
navigateToFaultItemInTree,
|
navigateToFaultItemInTree,
|
||||||
acknowledgeFault,
|
acknowledgeFault,
|
||||||
shelveMultipleFaults,
|
shelveMultipleFaults,
|
||||||
acknowledgeMultipleFaults,
|
acknowledgeMultipleFaults,
|
||||||
shelveFault,
|
shelveFault,
|
||||||
changeViewTo,
|
changeViewTo,
|
||||||
sortFaultsBy,
|
sortFaultsBy,
|
||||||
enterSearchTerm,
|
enterSearchTerm,
|
||||||
clearSearch,
|
clearSearch,
|
||||||
selectFaultItem,
|
selectFaultItem,
|
||||||
getHighestSeverity,
|
getHighestSeverity,
|
||||||
getLowestSeverity,
|
getLowestSeverity,
|
||||||
getFaultResultCount,
|
getFaultResultCount,
|
||||||
getFault,
|
getFault,
|
||||||
getFaultByName,
|
getFaultByName,
|
||||||
getFaultName,
|
getFaultName,
|
||||||
getFaultSeverity,
|
getFaultSeverity,
|
||||||
getFaultNamespace,
|
getFaultNamespace,
|
||||||
getFaultTriggerTime,
|
getFaultTriggerTime,
|
||||||
openFaultRowMenu
|
openFaultRowMenu
|
||||||
};
|
};
|
||||||
|
@ -23,34 +23,36 @@
|
|||||||
const { createDomainObjectWithDefaults } = require('../appActions');
|
const { createDomainObjectWithDefaults } = require('../appActions');
|
||||||
|
|
||||||
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
||||||
|
const CUSTOM_NAME = 'CUSTOM_NAME';
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function enterTextEntry(page, text) {
|
async function enterTextEntry(page, text) {
|
||||||
// Click .c-notebook__drag-area
|
// Click the 'Add Notebook Entry' area
|
||||||
await page.locator(NOTEBOOK_DROP_AREA).click();
|
await page.locator(NOTEBOOK_DROP_AREA).click();
|
||||||
|
|
||||||
// enter text
|
// enter text
|
||||||
await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').fill(text);
|
await page.getByLabel('Notebook Entry Input').last().fill(text);
|
||||||
await commitEntry(page);
|
await commitEntry(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function dragAndDropEmbed(page, notebookObject) {
|
async function dragAndDropEmbed(page, notebookObject) {
|
||||||
// Create example telemetry object
|
// Create example telemetry object
|
||||||
const swg = await createDomainObjectWithDefaults(page, {
|
const swg = await createDomainObjectWithDefaults(page, {
|
||||||
type: "Sine Wave Generator"
|
type: 'Sine Wave Generator'
|
||||||
});
|
});
|
||||||
// Navigate to notebook
|
// Navigate to notebook
|
||||||
await page.goto(notebookObject.url);
|
await page.goto(notebookObject.url);
|
||||||
// Expand the tree to reveal the notebook
|
// Expand the tree to reveal the notebook
|
||||||
await page.click('button[title="Show selected item in tree"]');
|
await page.click('button[title="Show selected item in tree"]');
|
||||||
// Drag and drop the SWG into the notebook
|
// Drag and drop the SWG into the notebook
|
||||||
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
||||||
await commitEntry(page);
|
await commitEntry(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,11 +60,90 @@ async function dragAndDropEmbed(page, notebookObject) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function commitEntry(page) {
|
async function commitEntry(page) {
|
||||||
await page.locator('.c-ne__save-button > button').click();
|
//Click the Commit Entry button
|
||||||
|
await page.locator('.c-ne__save-button > button').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function startAndAddRestrictedNotebookObject(page) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
return createDomainObjectWithDefaults(page, {
|
||||||
|
type: CUSTOM_NAME,
|
||||||
|
name: 'Restricted Test Notebook'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function lockPage(page) {
|
||||||
|
const commitButton = page.locator('button:has-text("Commit Entries")');
|
||||||
|
await commitButton.click();
|
||||||
|
|
||||||
|
//Wait until Lock Banner is visible
|
||||||
|
await page.locator('text=Lock Page').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object and adds an entry.
|
||||||
|
* @param {import('@playwright/test').Page} - page to load
|
||||||
|
* @param {number} [iterations = 1] - the number of entries to create
|
||||||
|
*/
|
||||||
|
async function createNotebookAndEntry(page, iterations = 1) {
|
||||||
|
const notebook = createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
await enterTextEntry(page, `Entry ${iteration}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object, adds an entry, and adds a tag.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {number} [iterations = 1] - the number of entries (and tags) to create
|
||||||
|
*/
|
||||||
|
async function createNotebookEntryAndTags(page, iterations = 1) {
|
||||||
|
const notebook = await createNotebookAndEntry(page, iterations);
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.locator(`[aria-label="Notebook Entry"] >> nth = ${iteration}`).click();
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Driving" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
||||||
|
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Science" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
module.exports = {
|
||||||
enterTextEntry,
|
enterTextEntry,
|
||||||
dragAndDropEmbed
|
dragAndDropEmbed,
|
||||||
|
startAndAddRestrictedNotebookObject,
|
||||||
|
lockPage,
|
||||||
|
createNotebookEntryAndTags,
|
||||||
|
createNotebookAndEntry
|
||||||
};
|
};
|
||||||
|
@ -32,46 +32,77 @@ import { expect } from '../pluginFixtures';
|
|||||||
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||||
*/
|
*/
|
||||||
export async function assertPlanActivities(page, plan, objectUrl) {
|
export async function assertPlanActivities(page, plan, objectUrl) {
|
||||||
const groups = Object.keys(plan);
|
const groups = Object.keys(plan);
|
||||||
for (const group of groups) {
|
for (const group of groups) {
|
||||||
for (let i = 0; i < plan[group].length; i++) {
|
for (let i = 0; i < plan[group].length; i++) {
|
||||||
// Set the startBound to the start time of the first activity in the group
|
// Set the startBound to the start time of the first activity in the group
|
||||||
const startBound = plan[group][0].start;
|
const startBound = plan[group][0].start;
|
||||||
// Set the endBound to the end time of the current activity
|
// Set the endBound to the end time of the current activity
|
||||||
let endBound = plan[group][i].end;
|
let endBound = plan[group][i].end;
|
||||||
if (endBound === startBound) {
|
if (endBound === startBound) {
|
||||||
// Prevent oddities with setting start and end bound equal
|
// Prevent oddities with setting start and end bound equal
|
||||||
// via URL params
|
// via URL params
|
||||||
endBound += 1;
|
endBound += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to fixed time mode with all plan events within the bounds
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
await page.goto(`${objectUrl}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`);
|
await page.goto(
|
||||||
|
`${objectUrl}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
|
||||||
// Assert that the number of activities in the plan view matches the number of
|
// Assert that the number of activities in the plan view matches the number of
|
||||||
// activities in the plan data within the specified time bounds
|
// activities in the plan data within the specified time bounds
|
||||||
const eventCount = await page.locator('.activity-bounds').count();
|
const eventCount = await page.locator('.activity-bounds').count();
|
||||||
expect(eventCount).toEqual(Object.values(plan)
|
expect(eventCount).toEqual(
|
||||||
.flat()
|
Object.values(plan)
|
||||||
.filter(event =>
|
.flat()
|
||||||
activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)).length);
|
.filter((event) =>
|
||||||
}
|
activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)
|
||||||
|
).length
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the activities time bounds overlap, false otherwise.
|
* Returns true if the activities time bounds overlap, false otherwise.
|
||||||
* @param {number} start1 the start time of the first activity
|
* @param {number} start1 the start time of the first activity
|
||||||
* @param {number} end1 the end time of the first activity
|
* @param {number} end1 the end time of the first activity
|
||||||
* @param {number} start2 the start time of the second activity
|
* @param {number} start2 the start time of the second activity
|
||||||
* @param {number} end2 the end time of the second activity
|
* @param {number} end2 the end time of the second activity
|
||||||
* @returns {boolean} true if the activities overlap, false otherwise
|
* @returns {boolean} true if the activities overlap, false otherwise
|
||||||
*/
|
*/
|
||||||
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
||||||
return (start1 >= start2 && start1 <= end2)
|
return (
|
||||||
|| (end1 >= start2 && end1 <= end2)
|
(start1 >= start2 && start1 <= end2) ||
|
||||||
|| (start2 >= start1 && start2 <= end1)
|
(end1 >= start2 && end1 <= end2) ||
|
||||||
|| (end2 >= start1 && end2 <= end1);
|
(start2 >= start1 && start2 <= end1) ||
|
||||||
|
(end2 >= start1 && end2 <= end1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||||
|
*/
|
||||||
|
export async function assertPlanOrderedSwimLanes(page, plan, objectUrl) {
|
||||||
|
// Switch to the plan view
|
||||||
|
await page.goto(`${objectUrl}?view=plan.view`);
|
||||||
|
const planGroups = await page
|
||||||
|
.locator('.c-plan__contents > div > .c-swimlane__lane-label .c-object-label__name')
|
||||||
|
.all();
|
||||||
|
|
||||||
|
const groups = plan.Groups;
|
||||||
|
|
||||||
|
for (let i = 0; i < groups.length; i++) {
|
||||||
|
// Assert that the order of groups in the plan view matches the order of
|
||||||
|
// groups in the plan data
|
||||||
|
const groupName = await planGroups[i].innerText();
|
||||||
|
expect(groupName).toEqual(groups[i].name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,11 +113,44 @@ function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
|||||||
* @param {string} planObjectUrl
|
* @param {string} planObjectUrl
|
||||||
*/
|
*/
|
||||||
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
||||||
const activities = Object.values(planJson).flat();
|
const activities = Object.values(planJson).flat();
|
||||||
// Get the earliest start value
|
// Get the earliest start value
|
||||||
const start = Math.min(...activities.map(activity => activity.start));
|
const start = Math.min(...activities.map((activity) => activity.start));
|
||||||
// Get the latest end value
|
// Get the latest end value
|
||||||
const end = Math.max(...activities.map(activity => activity.end));
|
const end = Math.max(...activities.map((activity) => activity.end));
|
||||||
// Set the start and end bounds to the earliest start and latest end
|
// Set the start and end bounds to the earliest start and latest end
|
||||||
await page.goto(`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`);
|
await page.goto(
|
||||||
|
`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the Open MCT API to set the status of a plan to 'draft'.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {import('../../appActions').CreatedObjectInfo} plan
|
||||||
|
*/
|
||||||
|
export async function setDraftStatusForPlan(page, plan) {
|
||||||
|
await page.evaluate(async (planObject) => {
|
||||||
|
await window.openmct.status.set(planObject.uuid, 'draft');
|
||||||
|
}, plan);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addPlanGetInterceptor(page) {
|
||||||
|
await page.waitForLoadState('load');
|
||||||
|
await page.evaluate(async () => {
|
||||||
|
await window.openmct.objects.addGetInterceptor({
|
||||||
|
appliesTo: (identifier, domainObject) => {
|
||||||
|
return domainObject && domainObject.type === 'plan';
|
||||||
|
},
|
||||||
|
invoke: (identifier, object) => {
|
||||||
|
if (object) {
|
||||||
|
object.sourceMap = {
|
||||||
|
orderedGroups: 'Groups'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
189
e2e/helper/plotTagsUtils.js
Normal file
189
e2e/helper/plotTagsUtils.js
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, 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 { expect } from '../pluginFixtures';
|
||||||
|
const { waitForPlotsToRender } = require('../appActions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export async function createTags({ page, canvas, xEnd = 700, yEnd = 520 }) {
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
//Alt+Shift Drag Start to select some points to tag
|
||||||
|
await page.keyboard.down('Alt');
|
||||||
|
await page.keyboard.down('Shift');
|
||||||
|
|
||||||
|
await canvas.dragTo(canvas, {
|
||||||
|
sourcePosition: {
|
||||||
|
x: 1,
|
||||||
|
y: 1
|
||||||
|
},
|
||||||
|
targetPosition: {
|
||||||
|
x: xEnd,
|
||||||
|
y: yEnd
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Alt Drag End
|
||||||
|
await page.keyboard.up('Alt');
|
||||||
|
await page.keyboard.up('Shift');
|
||||||
|
|
||||||
|
//Wait for canvas to stabilize.
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
// add some tags
|
||||||
|
await page.getByText('Annotations').click();
|
||||||
|
await page.getByRole('button', { name: /Add Tag/ }).click();
|
||||||
|
await page.getByPlaceholder('Type to select tag').click();
|
||||||
|
await page.getByText('Driving').click();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /Add Tag/ }).click();
|
||||||
|
await page.getByPlaceholder('Type to select tag').click();
|
||||||
|
await page.getByText('Science').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a telemetry item (e.g., a Sine Wave Generator) with a plot, tests that the plot can be tagged.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {import('../../../../appActions').CreatedObjectInfo} telemetryItem a telemetry item with a plot
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export async function testTelemetryItem(page, telemetryItem) {
|
||||||
|
// Check that telemetry item also received the tag
|
||||||
|
await page.goto(telemetryItem.url);
|
||||||
|
|
||||||
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
|
||||||
|
const canvas = page.locator('canvas').nth(1);
|
||||||
|
//Wait for canvas to stabilize.
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
|
||||||
|
await expect(canvas).toBeInViewport();
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
// click on the tagged plot point
|
||||||
|
await canvas.click({
|
||||||
|
position: {
|
||||||
|
x: 100,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeHidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a page, tests that tags are searchable, deletable, and persist across reloads.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export async function basicTagsTests(page) {
|
||||||
|
// Search for Driving
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
|
||||||
|
// Clicking elsewhere should cause annotation selection to be cleared
|
||||||
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
//
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).fill('driv');
|
||||||
|
|
||||||
|
// Always click on the first Sine Wave result
|
||||||
|
await page
|
||||||
|
.getByLabel('Search Result')
|
||||||
|
.getByText(/Sine Wave/)
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Delete Driving Tag
|
||||||
|
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
||||||
|
await page.locator('[aria-label="Remove tag Driving"]').click();
|
||||||
|
|
||||||
|
// Search for Science Tag
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).fill('sc');
|
||||||
|
|
||||||
|
//Expect Science Tag to be present and and Driving Tags to be deleted
|
||||||
|
await expect(page.getByLabel('Search Result').first()).toContainText('Science');
|
||||||
|
await expect(page.getByLabel('Search Result').first()).not.toContainText('Driving');
|
||||||
|
|
||||||
|
// Search for Driving Tag and expect nothing found
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).fill('driv');
|
||||||
|
await expect(page.getByText('No results found')).toBeVisible();
|
||||||
|
|
||||||
|
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
|
||||||
|
//Navigate to the Inspector and check that all tags have been removed
|
||||||
|
await expect(page.getByRole('tab', { name: 'Annotations' })).not.toHaveClass(/is-current/);
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
await expect(page.getByRole('tab', { name: 'Annotations' })).toHaveClass(/is-current/);
|
||||||
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
|
||||||
|
const canvas = page.locator('canvas').nth(1);
|
||||||
|
// click on the tagged plot point
|
||||||
|
await canvas.click({
|
||||||
|
position: {
|
||||||
|
x: 100,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Expect Science to be visible but Driving to be hidden
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeHidden();
|
||||||
|
|
||||||
|
//Click elsewhere
|
||||||
|
await page.locator('body').click();
|
||||||
|
//Click on tagged plot point again
|
||||||
|
await canvas.click({
|
||||||
|
position: {
|
||||||
|
x: 100,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add Driving Tag again
|
||||||
|
await page.getByText('Annotations').click();
|
||||||
|
await page.getByRole('button', { name: /Add Tag/ }).click();
|
||||||
|
await page.getByPlaceholder('Type to select tag').click();
|
||||||
|
await page.getByText('Driving').click();
|
||||||
|
|
||||||
|
//Science and Driving Tags should be visible
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeVisible();
|
||||||
|
|
||||||
|
// Delete Driving Tag again
|
||||||
|
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
||||||
|
await page.locator('[aria-label="Remove tag Driving"]').click();
|
||||||
|
|
||||||
|
//Science Tag should be visible and Driving Tag should be hidden
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeHidden();
|
||||||
|
}
|
@ -25,6 +25,6 @@
|
|||||||
// await page.addInitScript({ path: path.join(__dirname, 'useSnowTheme.js') });
|
// await page.addInitScript({ path: path.join(__dirname, 'useSnowTheme.js') });
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.Snow());
|
openmct.install(openmct.plugins.Snow());
|
||||||
});
|
});
|
||||||
|
@ -9,73 +9,76 @@ const NUM_WORKERS = 2;
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with maxFailures = 5, this should ensure that flake is managed without failing the full suite
|
retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
|
||||||
testDir: 'tests',
|
testDir: 'tests',
|
||||||
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
||||||
timeout: 60 * 1000,
|
timeout: 60 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start:coverage',
|
command: 'npm run start:coverage',
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: false
|
reuseExistingServer: true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
|
||||||
|
},
|
||||||
|
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
||||||
|
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
{
|
||||||
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
name: 'MMOC',
|
||||||
use: {
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
baseURL: 'http://localhost:8080/',
|
grepInvert: /@snapshot/,
|
||||||
headless: true,
|
use: {
|
||||||
ignoreHTTPSErrors: true,
|
browserName: 'chromium',
|
||||||
screenshot: 'only-on-failure',
|
viewport: {
|
||||||
trace: 'on-first-retry',
|
width: 2560,
|
||||||
video: 'off'
|
height: 1440
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'MMOC',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
viewport: {
|
|
||||||
width: 2560,
|
|
||||||
height: 1440
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'firefox',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'firefox'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chrome-beta', //Only Chrome Beta is available on ubuntu -- not chrome canary
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
channel: 'chrome-beta'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'firefox'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome-beta', //Only Chrome Beta is available on ubuntu -- not chrome canary
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
channel: 'chrome-beta'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'never',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
],
|
],
|
||||||
reporter: [
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
['list'],
|
['@deploysentinel/playwright']
|
||||||
['html', {
|
]
|
||||||
open: 'never',
|
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
|
||||||
}],
|
|
||||||
['junit', { outputFile: '../test-results/results.xml' }],
|
|
||||||
['github']
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -7,98 +7,101 @@ const { devices } = require('@playwright/test');
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 0,
|
retries: 0,
|
||||||
testDir: 'tests',
|
testDir: 'tests',
|
||||||
testIgnore: '**/*.perf.spec.js',
|
testIgnore: '**/*.perf.spec.js',
|
||||||
timeout: 30 * 1000,
|
timeout: 30 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start:coverage',
|
command: 'npm run start:coverage',
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: true
|
reuseExistingServer: true
|
||||||
|
},
|
||||||
|
workers: 1,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: false,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'retain-on-failure',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
workers: 1,
|
{
|
||||||
use: {
|
name: 'MMOC',
|
||||||
browserName: "chromium",
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
baseURL: 'http://localhost:8080/',
|
grepInvert: /@snapshot/,
|
||||||
headless: false,
|
use: {
|
||||||
ignoreHTTPSErrors: true,
|
browserName: 'chromium',
|
||||||
screenshot: 'only-on-failure',
|
viewport: {
|
||||||
trace: 'retain-on-failure',
|
width: 2560,
|
||||||
video: 'off'
|
height: 1440
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'MMOC',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
viewport: {
|
|
||||||
width: 2560,
|
|
||||||
height: 1440
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'safari',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grep: /@ipad/, // only run ipad tests due to this bug https://github.com/microsoft/playwright/issues/8340
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'webkit'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'firefox',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'firefox'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'canary',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
channel: 'chrome-canary' //Note this is not available in ubuntu/CircleCI
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chrome-beta',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
channel: 'chrome-beta'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ipad',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grep: /@ipad/,
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'webkit',
|
|
||||||
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
reporter: [
|
},
|
||||||
['list'],
|
{
|
||||||
['html', {
|
name: 'safari',
|
||||||
open: 'on-failure',
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
grep: /@ipad/, // only run ipad tests due to this bug https://github.com/microsoft/playwright/issues/8340
|
||||||
}]
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'webkit'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'firefox'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'canary',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
channel: 'chrome-canary' //Note this is not available in ubuntu/CircleCI
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome-beta',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
channel: 'chrome-beta'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ipad',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grep: /@ipad/,
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'webkit',
|
||||||
|
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'on-failure',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
43
e2e/playwright-performance-dev.config.js
Normal file
43
e2e/playwright-performance-dev.config.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
|
testDir: 'tests/performance/',
|
||||||
|
testMatch: '*.contract.perf.spec.js', //Run everything except contract tests which require marks in dev mode
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Only run in serial with 1 worker
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start', //need development mode for performance.marks and others
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: false
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: false, //HTTP performance varies!
|
||||||
|
screenshot: 'off',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testIgnore: '*.memory.perf.spec.js', //Do not run memory tests without proper flags. Shouldn't get here
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
60
e2e/playwright-performance-prod.config.js
Normal file
60
e2e/playwright-performance-prod.config.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
|
testDir: 'tests/performance/',
|
||||||
|
testIgnore: '*.contract.perf.spec.js', //Run everything except contract tests which require marks in dev mode
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Only run in serial with 1 worker
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start:prod', //Production mode
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: false //Must be run with this option to prevent dev mode
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: false, //HTTP performance varies!
|
||||||
|
screenshot: 'off',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome-memory',
|
||||||
|
testMatch: '*.memory.perf.spec.js', //Only run memory tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-notifications',
|
||||||
|
'--use-fake-ui-for-media-stream',
|
||||||
|
'--use-fake-device-for-media-stream',
|
||||||
|
'--js-flags=--no-move-object-start --expose-gc',
|
||||||
|
'--enable-precise-memory-info',
|
||||||
|
'--display=:100'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testIgnore: '*.memory.perf.spec.js', //Do not run memory tests without proper flags
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
@ -1,43 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
const CI = process.env.CI === 'true';
|
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
||||||
const config = {
|
|
||||||
retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
|
|
||||||
testDir: 'tests/performance/',
|
|
||||||
timeout: 60 * 1000,
|
|
||||||
workers: 1, //Only run in serial with 1 worker
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run start', //coverage not generated
|
|
||||||
url: 'http://localhost:8080/#',
|
|
||||||
timeout: 200 * 1000,
|
|
||||||
reuseExistingServer: !CI
|
|
||||||
},
|
|
||||||
use: {
|
|
||||||
browserName: "chromium",
|
|
||||||
baseURL: 'http://localhost:8080/',
|
|
||||||
headless: CI, //Only if running locally
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
screenshot: 'off',
|
|
||||||
trace: 'on-first-retry',
|
|
||||||
video: 'off'
|
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
reporter: [
|
|
||||||
['list'],
|
|
||||||
['junit', { outputFile: '../test-results/results.xml' }],
|
|
||||||
['json', { outputFile: '../test-results/results.json' }]
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
54
e2e/playwright-visual-a11y.config.js
Normal file
54
e2e/playwright-visual-a11y.config.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
||||||
|
testDir: 'tests/visual-a11y',
|
||||||
|
testMatch: '**/*.visual.spec.js', // only run visual tests
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start:coverage',
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: !process.env.CI
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome-snow-theme', //Runs the same visual tests but with snow-theme enabled
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
theme: 'snow'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'on-failure',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
@ -1,51 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
|
||||||
const config = {
|
|
||||||
retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
|
||||||
testDir: 'tests/visual',
|
|
||||||
testMatch: '**/*.visual.spec.js', // only run visual tests
|
|
||||||
timeout: 60 * 1000,
|
|
||||||
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run start:coverage',
|
|
||||||
url: 'http://localhost:8080/#',
|
|
||||||
timeout: 200 * 1000,
|
|
||||||
reuseExistingServer: !process.env.CI
|
|
||||||
},
|
|
||||||
use: {
|
|
||||||
baseURL: 'http://localhost:8080/',
|
|
||||||
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
screenshot: 'only-on-failure',
|
|
||||||
trace: 'on-first-retry',
|
|
||||||
video: 'off'
|
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chrome-snow-theme', //Runs the same visual tests but with snow-theme enabled
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
theme: 'snow'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
reporter: [
|
|
||||||
['list'],
|
|
||||||
['junit', { outputFile: '../test-results/results.xml' }],
|
|
||||||
['html', {
|
|
||||||
open: 'on-failure',
|
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
|
||||||
}]
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
@ -26,7 +26,7 @@
|
|||||||
* and appActions. These fixtures should be generalized across all plugins.
|
* and appActions. These fixtures should be generalized across all plugins.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('./baseFixtures');
|
const { test, expect, request } = require('./baseFixtures');
|
||||||
// const { createDomainObjectWithDefaults } = require('./appActions');
|
// const { createDomainObjectWithDefaults } = require('./appActions');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
@ -45,8 +45,6 @@ const path = require('path');
|
|||||||
// const createdObjects = new Map();
|
// const createdObjects = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE: This feature is a work-in-progress and should not currently be used.**
|
|
||||||
*
|
|
||||||
* This action will create a domain object for the test to reference and return the uuid. If an object
|
* This action will create a domain object for the test to reference and return the uuid. If an object
|
||||||
* of a given name already exists, it will return the uuid of that object to the test instead of creating
|
* of a given name already exists, it will return the uuid of that object to the test instead of creating
|
||||||
* a new file. The intent is to move object creation out of test suites which are not explicitly worried
|
* a new file. The intent is to move object creation out of test suites which are not explicitly worried
|
||||||
@ -65,10 +63,7 @@ const path = require('path');
|
|||||||
|
|
||||||
// await createDomainObjectWithDefaults(page, type, name);
|
// await createDomainObjectWithDefaults(page, type, name);
|
||||||
|
|
||||||
// // Once object is created, get the uuid from the url
|
// const uuid = getHashUrlToDomainObject(page);
|
||||||
// const uuid = await page.evaluate(() => {
|
|
||||||
// return window.location.href.match(/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/)[0];
|
|
||||||
// });
|
|
||||||
|
|
||||||
// createdObjects.set(objectName, uuid);
|
// createdObjects.set(objectName, uuid);
|
||||||
|
|
||||||
@ -120,33 +115,46 @@ const theme = 'espresso';
|
|||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
const myItemsFolderName = "My Items";
|
const myItemsFolderName = 'My Items';
|
||||||
|
|
||||||
exports.test = test.extend({
|
exports.test = test.extend({
|
||||||
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
|
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
|
||||||
theme: [theme, { option: true }],
|
theme: [theme, { option: true }],
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
page: async ({ page, theme }, use, testInfo) => {
|
page: async ({ page, theme }, use, testInfo) => {
|
||||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
// eslint-disable-next-line playwright/no-conditional-in-test
|
||||||
if (theme === 'snow') {
|
if (theme === 'snow') {
|
||||||
//inject snow theme
|
//inject snow theme
|
||||||
await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') });
|
await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') });
|
||||||
}
|
|
||||||
|
|
||||||
// Attach info about the currently running test and its project.
|
|
||||||
// This will be used by appActions to fill in the created
|
|
||||||
// domain object's notes.
|
|
||||||
page.testNotes = [
|
|
||||||
`${testInfo.titlePath.join('\n')}`,
|
|
||||||
`${testInfo.project.name}`
|
|
||||||
].join('\n');
|
|
||||||
|
|
||||||
await use(page);
|
|
||||||
},
|
|
||||||
myItemsFolderName: [myItemsFolderName, { option: true }],
|
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
openmctConfig: async ({ myItemsFolderName }, use) => {
|
|
||||||
await use({ myItemsFolderName });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach info about the currently running test and its project.
|
||||||
|
// This will be used by appActions to fill in the created
|
||||||
|
// domain object's notes.
|
||||||
|
page.testNotes = [`${testInfo.titlePath.join('\n')}`, `${testInfo.project.name}`].join('\n');
|
||||||
|
|
||||||
|
await use(page);
|
||||||
|
},
|
||||||
|
myItemsFolderName: [myItemsFolderName, { option: true }],
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
|
openmctConfig: async ({ myItemsFolderName }, use) => {
|
||||||
|
await use({ myItemsFolderName });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.expect = expect;
|
exports.expect = expect;
|
||||||
|
exports.request = request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a readable stream and returns a string.
|
||||||
|
* @param {ReadableStream} readable - the readable stream
|
||||||
|
* @return {Promise<String>} the stringified stream
|
||||||
|
*/
|
||||||
|
exports.streamToString = async function (readable) {
|
||||||
|
let result = '';
|
||||||
|
for await (const chunk of readable) {
|
||||||
|
result += chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
@ -274,10 +274,7 @@
|
|||||||
"id": "ac0d7eb1-b485-458f-bd2a-a63aa87a3a8a"
|
"id": "ac0d7eb1-b485-458f-bd2a-a63aa87a3a8a"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"layoutGrid": [
|
"layoutGrid": [10, 10],
|
||||||
10,
|
|
||||||
10
|
|
||||||
],
|
|
||||||
"objectStyles": {
|
"objectStyles": {
|
||||||
"ed63cc29-80e2-4e2b-a472-3d6d4adbf310": {
|
"ed63cc29-80e2-4e2b-a472-3d6d4adbf310": {
|
||||||
"staticStyle": {
|
"staticStyle": {
|
||||||
@ -1455,9 +1452,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["120"],
|
||||||
"120"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1475,10 +1470,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["120", "-20"],
|
||||||
"120",
|
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1496,9 +1488,7 @@
|
|||||||
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "lessThan",
|
"operation": "lessThan",
|
||||||
"input": [
|
"input": ["-20"],
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1550,9 +1540,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["120"],
|
||||||
"120"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1570,10 +1558,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["120", "-20"],
|
||||||
"120",
|
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1591,9 +1576,7 @@
|
|||||||
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "lessThan",
|
"operation": "lessThan",
|
||||||
"input": [
|
"input": ["-20"],
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1645,9 +1628,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["150"],
|
||||||
"150"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1665,10 +1646,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["50", "-50"],
|
||||||
"50",
|
|
||||||
"-50"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1720,9 +1698,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["150"],
|
||||||
"150"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1740,10 +1716,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["50", "-50"],
|
||||||
"50",
|
|
||||||
"-50"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -2204,4 +2177,4 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rootId": "45b24009-dfed-4023-a30b-d31f5e3a2d87"
|
"rootId": "45b24009-dfed-4023-a30b-d31f5e3a2d87"
|
||||||
}
|
}
|
||||||
|
@ -1 +1,90 @@
|
|||||||
{"openmct":{"b3cee102-86dd-4c0a-8eec-4d5d276f8691":{"identifier":{"key":"b3cee102-86dd-4c0a-8eec-4d5d276f8691","namespace":""},"name":"Performance Display Layout","type":"layout","composition":[{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""}],"configuration":{"items":[{"width":32,"height":18,"x":12,"y":9,"identifier":{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""},"hasFrame":true,"fontSize":"default","font":"default","type":"subobject-view","id":"23ca351d-a67d-46aa-a762-290eb742d2f1"}],"layoutGrid":[10,10]},"modified":1654299875432,"location":"mine","persisted":1654299878751},"9666e7b4-be0c-47a5-94b8-99accad7155e":{"identifier":{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""},"name":"Performance Example Imagery","type":"example.imagery","configuration":{"imageLocation":"","imageLoadDelayInMilliSeconds":20000,"imageSamples":[],"layers":[{"source":"dist/imagery/example-imagery-layer-16x9.png","name":"16:9","visible":false},{"source":"dist/imagery/example-imagery-layer-safe.png","name":"Safe","visible":false},{"source":"dist/imagery/example-imagery-layer-scale.png","name":"Scale","visible":false}]},"telemetry":{"values":[{"name":"Name","key":"name"},{"name":"Time","key":"utc","format":"utc","hints":{"domain":2}},{"name":"Local Time","key":"local","format":"local-format","hints":{"domain":1}},{"name":"Image","key":"url","format":"image","hints":{"image":1},"layers":[{"source":"dist/imagery/example-imagery-layer-16x9.png","name":"16:9"},{"source":"dist/imagery/example-imagery-layer-safe.png","name":"Safe"},{"source":"dist/imagery/example-imagery-layer-scale.png","name":"Scale"}]},{"name":"Image Download Name","key":"imageDownloadName","format":"imageDownloadName","hints":{"imageDownloadName":1}}]},"modified":1654299840077,"location":"b3cee102-86dd-4c0a-8eec-4d5d276f8691","persisted":1654299840078}},"rootId":"b3cee102-86dd-4c0a-8eec-4d5d276f8691"}
|
{
|
||||||
|
"openmct": {
|
||||||
|
"b3cee102-86dd-4c0a-8eec-4d5d276f8691": {
|
||||||
|
"identifier": { "key": "b3cee102-86dd-4c0a-8eec-4d5d276f8691", "namespace": "" },
|
||||||
|
"name": "Performance Display Layout",
|
||||||
|
"type": "layout",
|
||||||
|
"composition": [{ "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" }],
|
||||||
|
"configuration": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"width": 32,
|
||||||
|
"height": 18,
|
||||||
|
"x": 12,
|
||||||
|
"y": 9,
|
||||||
|
"identifier": { "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" },
|
||||||
|
"hasFrame": true,
|
||||||
|
"fontSize": "default",
|
||||||
|
"font": "default",
|
||||||
|
"type": "subobject-view",
|
||||||
|
"id": "23ca351d-a67d-46aa-a762-290eb742d2f1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"layoutGrid": [10, 10]
|
||||||
|
},
|
||||||
|
"modified": 1654299875432,
|
||||||
|
"location": "mine",
|
||||||
|
"persisted": 1654299878751
|
||||||
|
},
|
||||||
|
"9666e7b4-be0c-47a5-94b8-99accad7155e": {
|
||||||
|
"identifier": { "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" },
|
||||||
|
"name": "Performance Example Imagery",
|
||||||
|
"type": "example.imagery",
|
||||||
|
"configuration": {
|
||||||
|
"imageLocation": "",
|
||||||
|
"imageLoadDelayInMilliSeconds": 20000,
|
||||||
|
"imageSamples": [],
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-16x9.png",
|
||||||
|
"name": "16:9",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-safe.png",
|
||||||
|
"name": "Safe",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-scale.png",
|
||||||
|
"name": "Scale",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"telemetry": {
|
||||||
|
"values": [
|
||||||
|
{ "name": "Name", "key": "name" },
|
||||||
|
{ "name": "Time", "key": "utc", "format": "utc", "hints": { "domain": 2 } },
|
||||||
|
{
|
||||||
|
"name": "Local Time",
|
||||||
|
"key": "local",
|
||||||
|
"format": "local-format",
|
||||||
|
"hints": { "domain": 1 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Image",
|
||||||
|
"key": "url",
|
||||||
|
"format": "image",
|
||||||
|
"hints": { "image": 1 },
|
||||||
|
"layers": [
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-16x9.png", "name": "16:9" },
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-safe.png", "name": "Safe" },
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-scale.png", "name": "Scale" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Image Download Name",
|
||||||
|
"key": "imageDownloadName",
|
||||||
|
"format": "imageDownloadName",
|
||||||
|
"hints": { "imageDownloadName": 1 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"modified": 1654299840077,
|
||||||
|
"location": "b3cee102-86dd-4c0a-8eec-4d5d276f8691",
|
||||||
|
"persisted": 1654299840078
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rootId": "b3cee102-86dd-4c0a-8eec-4d5d276f8691"
|
||||||
|
}
|
||||||
|
@ -1 +1,96 @@
|
|||||||
{"openmct":{"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d":{"identifier":{"key":"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d","namespace":""},"name":"Performance Notebook","type":"notebook","configuration":{"defaultSort":"oldest","entries":{"3e31c412-33ba-4757-8ade-e9821f6ba321":{"8c8f6035-631c-45af-8c24-786c60295335":[{"id":"entry-1652815305457","createdOn":1652815305457,"createdBy":"","text":"Existing Entry 1","embeds":[]},{"id":"entry-1652815313465","createdOn":1652815313465,"createdBy":"","text":"Existing Entry 2","embeds":[]},{"id":"entry-1652815399955","createdOn":1652815399955,"createdBy":"","text":"Existing Entry 3","embeds":[]}]}},"imageMigrationVer":"v1","pageTitle":"Page","sections":[{"id":"3e31c412-33ba-4757-8ade-e9821f6ba321","isDefault":false,"isSelected":false,"name":"Section1","pages":[{"id":"8c8f6035-631c-45af-8c24-786c60295335","isDefault":false,"isSelected":false,"name":"Page1","pageTitle":"Page"},{"id":"36555942-c9aa-439c-bbdb-0aaf50db50f5","isDefault":false,"isSelected":false,"name":"Page2","pageTitle":"Page"}],"sectionTitle":"Section"},{"id":"dab0bd1d-2c5a-405c-987f-107123d6189a","isDefault":false,"isSelected":true,"name":"Section2","pages":[{"id":"f625a86a-cb99-4898-8082-80543c8de534","isDefault":false,"isSelected":false,"name":"Page1","pageTitle":"Page"},{"id":"e77ef810-f785-42a7-942e-07e999b79c59","isDefault":false,"isSelected":true,"name":"Page2","pageTitle":"Page"}],"sectionTitle":"Section"}],"sectionTitle":"Section","type":"General","showTime":"0"},"modified":1652815915219,"location":"mine","persisted":1652815915222}},"rootId":"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d"}
|
{
|
||||||
|
"openmct": {
|
||||||
|
"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d": {
|
||||||
|
"identifier": { "key": "6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d", "namespace": "" },
|
||||||
|
"name": "Performance Notebook",
|
||||||
|
"type": "notebook",
|
||||||
|
"configuration": {
|
||||||
|
"defaultSort": "oldest",
|
||||||
|
"entries": {
|
||||||
|
"3e31c412-33ba-4757-8ade-e9821f6ba321": {
|
||||||
|
"8c8f6035-631c-45af-8c24-786c60295335": [
|
||||||
|
{
|
||||||
|
"id": "entry-1652815305457",
|
||||||
|
"createdOn": 1652815305457,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 1",
|
||||||
|
"embeds": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "entry-1652815313465",
|
||||||
|
"createdOn": 1652815313465,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 2",
|
||||||
|
"embeds": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "entry-1652815399955",
|
||||||
|
"createdOn": 1652815399955,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 3",
|
||||||
|
"embeds": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imageMigrationVer": "v1",
|
||||||
|
"pageTitle": "Page",
|
||||||
|
"sections": [
|
||||||
|
{
|
||||||
|
"id": "3e31c412-33ba-4757-8ade-e9821f6ba321",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Section1",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"id": "8c8f6035-631c-45af-8c24-786c60295335",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page1",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "36555942-c9aa-439c-bbdb-0aaf50db50f5",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page2",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dab0bd1d-2c5a-405c-987f-107123d6189a",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": true,
|
||||||
|
"name": "Section2",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"id": "f625a86a-cb99-4898-8082-80543c8de534",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page1",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e77ef810-f785-42a7-942e-07e999b79c59",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": true,
|
||||||
|
"name": "Page2",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section",
|
||||||
|
"type": "General",
|
||||||
|
"showTime": "0"
|
||||||
|
},
|
||||||
|
"modified": 1652815915219,
|
||||||
|
"location": "mine",
|
||||||
|
"persisted": 1652815915222
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rootId": "6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d"
|
||||||
|
}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"cookies": [],
|
|
||||||
"origins": [
|
|
||||||
{
|
|
||||||
"origin": "http://localhost:8080",
|
|
||||||
"localStorage": [
|
|
||||||
{
|
|
||||||
"name": "tcHistory",
|
|
||||||
"value": "{\"utc\":[{\"start\":1658617611983,\"end\":1658619411983}]}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mct",
|
|
||||||
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"persisted\":1658619412848,\"modified\":1658619412848},\"7fa5749b-8969-494c-9d85-c272516d333c\":{\"identifier\":{\"key\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"namespace\":\"\"},\"name\":\"Unnamed Overlay Plot\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"}}]},\"modified\":1658619413566,\"location\":\"mine\",\"persisted\":1658619413567},\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\":{\"name\":\"Unnamed Sine Wave Generator\",\"type\":\"generator\",\"identifier\":{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":\"5000\"},\"modified\":1658619413552,\"location\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"persisted\":1658619413552}}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mct-tree-expanded",
|
|
||||||
"value": "[\"/browse/mine\"]"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
22
e2e/test-data/display_layout_with_child_layouts.json
Normal file
22
e2e/test-data/display_layout_with_child_layouts.json
Normal file
File diff suppressed because one or more lines are too long
54
e2e/test-data/examplePlans/ExamplePlanWithOrderedLanes.json
Normal file
54
e2e/test-data/examplePlans/ExamplePlanWithOrderedLanes.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"Groups": [
|
||||||
|
{
|
||||||
|
"name": "Group 1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Group 2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Group 2": [
|
||||||
|
{
|
||||||
|
"name": "Past event 3",
|
||||||
|
"start": 1660493208000,
|
||||||
|
"end": 1660503981000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 4",
|
||||||
|
"start": 1660579608000,
|
||||||
|
"end": 1660624108000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 5",
|
||||||
|
"start": 1660666008000,
|
||||||
|
"end": 1660681529000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Group 1": [
|
||||||
|
{
|
||||||
|
"name": "Past event 1",
|
||||||
|
"start": 1660320408000,
|
||||||
|
"end": 1660343797000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 2",
|
||||||
|
"start": 1660406808000,
|
||||||
|
"end": 1660429160000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1077,4 +1077,4 @@
|
|||||||
"textColor": "#ffffff"
|
"textColor": "#ffffff"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
{
|
{
|
||||||
"Group 1": [
|
"Group 1": [
|
||||||
{
|
{
|
||||||
"name": "Past event 1",
|
"name": "Past event 1",
|
||||||
"start": 1660320408000,
|
"start": 1660320408000,
|
||||||
"end": 1660343797000,
|
"end": 1660343797000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 2",
|
"name": "Past event 2",
|
||||||
"start": 1660406808000,
|
"start": 1660406808000,
|
||||||
"end": 1660429160000,
|
"end": 1660429160000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 3",
|
"name": "Past event 3",
|
||||||
"start": 1660493208000,
|
"start": 1660493208000,
|
||||||
"end": 1660503981000,
|
"end": 1660503981000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 4",
|
"name": "Past event 4",
|
||||||
"start": 1660579608000,
|
"start": 1660579608000,
|
||||||
"end": 1660624108000,
|
"end": 1660624108000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 5",
|
"name": "Past event 5",
|
||||||
"start": 1660666008000,
|
"start": 1660666008000,
|
||||||
"end": 1660681529000,
|
"end": 1660681529000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
{
|
{
|
||||||
"Group 1": [
|
"Group 1": [
|
||||||
{
|
{
|
||||||
"name": "Group 1 event 1",
|
"name": "Group 1 event 1",
|
||||||
"start": 1650320408000,
|
"start": 1650320408000,
|
||||||
"end": 1660343797000,
|
"end": 1660343797000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Group 1 event 2",
|
"name": "Group 1 event 2",
|
||||||
"start": 1660005808000,
|
"start": 1660005808000,
|
||||||
"end": 1660429160000,
|
"end": 1660429160000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "yellow",
|
"color": "yellow",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Group 2": [
|
"Group 2": [
|
||||||
{
|
{
|
||||||
"name": "Group 2 event 1",
|
"name": "Group 2 event 1",
|
||||||
"start": 1660320408000,
|
"start": 1660320408000,
|
||||||
"end": 1660420408000,
|
"end": 1660420408000,
|
||||||
"type": "Group 2",
|
"type": "Group 2",
|
||||||
"color": "green",
|
"color": "green",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Group 2 event 2",
|
"name": "Group 2 event 2",
|
||||||
"start": 1660406808000,
|
"start": 1660406808000,
|
||||||
"end": 1690429160000,
|
"end": 1690429160000,
|
||||||
"type": "Group 2",
|
"type": "Group 2",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
22
e2e/test-data/flexible_layout_with_child_layouts.json
Normal file
22
e2e/test-data/flexible_layout_with_child_layouts.json
Normal file
File diff suppressed because one or more lines are too long
1
e2e/test-data/memory-leak-detection.json
Normal file
1
e2e/test-data/memory-leak-detection.json
Normal file
File diff suppressed because one or more lines are too long
22
e2e/test-data/overlay_plot_storage.json
Normal file
22
e2e/test-data/overlay_plot_storage.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},\"20e7d5fe-9cf8-4099-8957-9453a8954c67\":{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960},\"2db521a9-996d-4d04-a171-93f4c5c220af\":{\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-recent-objects",
|
||||||
|
"value": "[{\"objectPath\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/2db521a9-996d-4d04-a171-93f4c5c220af\",\"domainObject\":{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540}},{\"objectPath\":[{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"domainObject\":{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960}},{\"objectPath\":[{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine\",\"domainObject\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540}}]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413601340,\"created\":1732413600580,\"persisted\":1732413601340},\"98161570-a735-4a50-9c75-11b346ad3789\":{\"identifier\":{\"key\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"namespace\":\"\"},\"name\":\"Overlay Plot with 5s Delay\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with 5s Delay\\nchrome\",\"modified\":1732413602660,\"location\":\"mine\",\"created\":1732413601340,\"persisted\":1732413602660},\"477e60bb-4cba-4603-b4c9-2281ccf7e054\":{\"identifier\":{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":5000,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602520,\"location\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"created\":1732413602040,\"persisted\":1732413602520}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
@ -21,145 +21,149 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../pluginFixtures.js');
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
const { createDomainObjectWithDefaults, createNotification, expandEntireTree } = require('../../appActions.js');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createNotification,
|
||||||
|
expandEntireTree
|
||||||
|
} = require('../../appActions.js');
|
||||||
|
|
||||||
test.describe('AppActions', () => {
|
test.describe('AppActions', () => {
|
||||||
test('createDomainObjectsWithDefaults', async ({ page }) => {
|
test('createDomainObjectsWithDefaults', async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
const e2eFolder = await createDomainObjectWithDefaults(page, {
|
const e2eFolder = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Folder',
|
type: 'Folder',
|
||||||
name: 'e2e folder'
|
name: 'e2e folder'
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('Create multiple flat objects in a row', async () => {
|
|
||||||
const timer1 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Timer',
|
|
||||||
name: 'Timer Foo',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
const timer2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Timer',
|
|
||||||
name: 'Timer Bar',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
const timer3 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Timer',
|
|
||||||
name: 'Timer Baz',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto(timer1.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
|
|
||||||
await page.goto(timer2.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
|
|
||||||
await page.goto(timer3.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer3.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('Create multiple nested objects in a row', async () => {
|
|
||||||
const folder1 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
name: 'Folder Foo',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
const folder2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
name: 'Folder Bar',
|
|
||||||
parent: folder1.uuid
|
|
||||||
});
|
|
||||||
const folder3 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
name: 'Folder Baz',
|
|
||||||
parent: folder2.uuid
|
|
||||||
});
|
|
||||||
await page.goto(folder1.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
|
|
||||||
await page.goto(folder2.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
|
|
||||||
await page.goto(folder3.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder3.name);
|
|
||||||
|
|
||||||
expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
|
|
||||||
expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
|
|
||||||
expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test("createNotification", async ({ page }) => {
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await test.step('Create multiple flat objects in a row', async () => {
|
||||||
await createNotification(page, {
|
const timer1 = await createDomainObjectWithDefaults(page, {
|
||||||
message: 'Test info notification',
|
type: 'Timer',
|
||||||
severity: 'info'
|
name: 'Timer Foo',
|
||||||
});
|
parent: e2eFolder.uuid
|
||||||
await expect(page.locator('.c-message-banner__message')).toHaveText('Test info notification');
|
});
|
||||||
await expect(page.locator('.c-message-banner')).toHaveClass(/info/);
|
const timer2 = await createDomainObjectWithDefaults(page, {
|
||||||
await page.locator('[aria-label="Dismiss"]').click();
|
type: 'Timer',
|
||||||
await createNotification(page, {
|
name: 'Timer Bar',
|
||||||
message: 'Test alert notification',
|
parent: e2eFolder.uuid
|
||||||
severity: 'alert'
|
});
|
||||||
});
|
const timer3 = await createDomainObjectWithDefaults(page, {
|
||||||
await expect(page.locator('.c-message-banner__message')).toHaveText('Test alert notification');
|
type: 'Timer',
|
||||||
await expect(page.locator('.c-message-banner')).toHaveClass(/alert/);
|
name: 'Timer Baz',
|
||||||
await page.locator('[aria-label="Dismiss"]').click();
|
parent: e2eFolder.uuid
|
||||||
await createNotification(page, {
|
});
|
||||||
message: 'Test error notification',
|
|
||||||
severity: 'error'
|
await page.goto(timer1.url);
|
||||||
});
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
|
||||||
await expect(page.locator('.c-message-banner__message')).toHaveText('Test error notification');
|
await page.goto(timer2.url);
|
||||||
await expect(page.locator('.c-message-banner')).toHaveClass(/error/);
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
|
||||||
await page.locator('[aria-label="Dismiss"]').click();
|
await page.goto(timer3.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer3.name);
|
||||||
});
|
});
|
||||||
test('expandEntireTree', async ({ page }) => {
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
const rootFolder = await createDomainObjectWithDefaults(page, {
|
await test.step('Create multiple nested objects in a row', async () => {
|
||||||
type: 'Folder'
|
const folder1 = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Folder',
|
||||||
const folder1 = await createDomainObjectWithDefaults(page, {
|
name: 'Folder Foo',
|
||||||
type: 'Folder',
|
parent: e2eFolder.uuid
|
||||||
parent: rootFolder.uuid
|
});
|
||||||
});
|
const folder2 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
name: 'Folder Bar',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
const folder3 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
name: 'Folder Baz',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
await page.goto(folder1.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
|
||||||
|
await page.goto(folder2.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
|
||||||
|
await page.goto(folder3.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder3.name);
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
|
||||||
type: 'Clock',
|
expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
|
||||||
parent: folder1.uuid
|
expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
|
||||||
});
|
|
||||||
const folder2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
parent: folder1.uuid
|
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
parent: folder1.uuid
|
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
parent: folder2.uuid
|
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
parent: folder2.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto('./#/browse/mine');
|
|
||||||
await expandEntireTree(page);
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: "Main Tree"
|
|
||||||
});
|
|
||||||
const treePaneCollapsedItems = treePane.getByRole('treeitem', { expanded: false });
|
|
||||||
expect(await treePaneCollapsedItems.count()).toBe(0);
|
|
||||||
|
|
||||||
await page.goto('./#/browse/mine');
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
|
||||||
await page.click(`li[role='menuitem']:text("Clock")`);
|
|
||||||
await expandEntireTree(page, "Create Modal Tree");
|
|
||||||
const locatorTree = page.getByRole("tree", {
|
|
||||||
name: "Create Modal Tree"
|
|
||||||
});
|
|
||||||
const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
|
|
||||||
expect(await locatorTreeCollapsedItems.count()).toBe(0);
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
test('createNotification', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test info notification',
|
||||||
|
severity: 'info'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test info notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/info/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test alert notification',
|
||||||
|
severity: 'alert'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test alert notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/alert/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test error notification',
|
||||||
|
severity: 'error'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test error notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/error/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
});
|
||||||
|
test('expandEntireTree', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const rootFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
const folder1 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: rootFolder.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Clock',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
const folder2 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
await expandEntireTree(page);
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const treePaneCollapsedItems = treePane.getByRole('treeitem', { expanded: false });
|
||||||
|
expect(await treePaneCollapsedItems.count()).toBe(0);
|
||||||
|
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click the object specified by 'type'
|
||||||
|
await page.click(`li[role='menuitem']:text("Clock")`);
|
||||||
|
await expandEntireTree(page, 'Create Modal Tree');
|
||||||
|
const locatorTree = page.getByRole('tree', {
|
||||||
|
name: 'Create Modal Tree'
|
||||||
|
});
|
||||||
|
const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
|
||||||
|
expect(await locatorTreeCollapsedItems.count()).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,27 +29,26 @@ relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions ma
|
|||||||
const { test } = require('../../baseFixtures.js');
|
const { test } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
test.describe('baseFixtures tests', () => {
|
test.describe('baseFixtures tests', () => {
|
||||||
test('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
//Skip this test for now https://github.com/nasa/openmct/issues/6785
|
||||||
test.fail();
|
test.fixme('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||||
//Go to baseURL
|
test.fail();
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
//Verify that ../fixtures.js detects console log errors
|
//Verify that ../fixtures.js detects console log errors
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.evaluate(() => console.error('This should result in a failure')),
|
page.evaluate(() => console.error('This should result in a failure')),
|
||||||
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
|
test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
});
|
//Verify that ../fixtures.js detects console log errors
|
||||||
test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
|
await Promise.all([
|
||||||
//Go to baseURL
|
page.evaluate(() => console.warn('This should result in a pass')),
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
||||||
|
]);
|
||||||
//Verify that ../fixtures.js detects console log errors
|
});
|
||||||
await Promise.all([
|
|
||||||
page.evaluate(() => console.warn('This should result in a pass')),
|
|
||||||
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
|
||||||
]);
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -21,28 +21,28 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test suite template is to be used when creating new test suites. It will be kept up to date with the latest improvements
|
* This test suite template is to be used when creating new test suites. It will be kept up to date with the latest improvements
|
||||||
* made by the Open MCT team. It will also follow our best pratices as those evolve. Please use this structure as a _reference_ and clear
|
* made by the Open MCT team. It will also follow our best pratices as those evolve. Please use this structure as a _reference_ and clear
|
||||||
* or update any references when creating a new test suite!
|
* or update any references when creating a new test suite!
|
||||||
*
|
*
|
||||||
* To illustrate current best practices, we've included a mocked up test suite for Renaming a Timer domain object.
|
* To illustrate current best practices, we've included a mocked up test suite for Renaming a Timer domain object.
|
||||||
*
|
*
|
||||||
* Demonstrated:
|
* Demonstrated:
|
||||||
* - Using appActions to leverage existing functions
|
* - Using appActions to leverage existing functions
|
||||||
* - Structure
|
* - Structure
|
||||||
* - @unstable annotation
|
* - @unstable annotation
|
||||||
* - await, expect, test, describe syntax
|
* - await, expect, test, describe syntax
|
||||||
* - Writing a custom function for a test suite
|
* - Writing a custom function for a test suite
|
||||||
* - Test stub for unfinished test coverage (test.fixme)
|
* - Test stub for unfinished test coverage (test.fixme)
|
||||||
*
|
*
|
||||||
* The structure should follow
|
* The structure should follow
|
||||||
* 1. imports
|
* 1. imports
|
||||||
* 2. test.describe()
|
* 2. test.describe()
|
||||||
* 3. -> test1
|
* 3. -> test1
|
||||||
* -> test2
|
* -> test2
|
||||||
* -> test3(stub)
|
* -> test3(stub)
|
||||||
* 4. Any custom functions
|
* 4. Any custom functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Structure: Some standard Imports. Please update the required pathing.
|
// Structure: Some standard Imports. Please update the required pathing.
|
||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
@ -58,63 +58,92 @@ const { createDomainObjectWithDefaults } = require('../../appActions');
|
|||||||
* as a part of our test promotion pipeline.
|
* as a part of our test promotion pipeline.
|
||||||
*/
|
*/
|
||||||
test.describe('Renaming Timer Object', () => {
|
test.describe('Renaming Timer Object', () => {
|
||||||
// Top-level declaration of the Timer object created in beforeEach().
|
// Top-level declaration of the Timer object created in beforeEach().
|
||||||
// We can then use this throughout the entire test suite.
|
// We can then use this throughout the entire test suite.
|
||||||
let timer;
|
let timer;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
|
// We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
|
||||||
// This example will create a Timer object with default properties, under the root folder:
|
// This example will create a Timer object with default properties, under the root folder:
|
||||||
timer = await createDomainObjectWithDefaults(page, { type: 'Timer' });
|
timer = await createDomainObjectWithDefaults(page, { type: 'Timer' });
|
||||||
|
|
||||||
// Assert the object to be created and check its name in the title
|
// Assert the object to be created and check its name in the title
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(timer.name);
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(timer.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure to use testcase names which are descriptive and easy to understand.
|
||||||
|
* A good testcase name concisely describes the test's goal(s) and should give
|
||||||
|
* some hint as to what went wrong if the test fails.
|
||||||
|
*/
|
||||||
|
test('An existing Timer object can be renamed via the 3dot actions menu', async ({ page }) => {
|
||||||
|
const newObjectName = 'Renamed Timer';
|
||||||
|
|
||||||
|
// We've created an example of a shared function which pases the page and newObjectName values
|
||||||
|
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
||||||
|
|
||||||
|
// Assert that the name has changed in the browser bar to the value we assigned above
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('An existing Timer object can be renamed twice', async ({ page }) => {
|
||||||
|
const newObjectName = 'Renamed Timer';
|
||||||
|
const newObjectName2 = 'Re-Renamed Timer';
|
||||||
|
|
||||||
|
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
||||||
|
|
||||||
|
// Assert that the name has changed in the browser bar to the value we assigned above
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
||||||
|
|
||||||
|
// Rename the Timer object again
|
||||||
|
await renameTimerFrom3DotMenu(page, timer.url, newObjectName2);
|
||||||
|
|
||||||
|
// Assert that the name has changed in the browser bar to the second value
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName2);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you run out of time to write new tests, please stub in the missing tests
|
||||||
|
* in-place with a test.fixme and BDD-style test steps.
|
||||||
|
* Someone will carry the baton!
|
||||||
|
*/
|
||||||
|
test.fixme('Can Rename Timer Object from Tree', async ({ page }) => {
|
||||||
|
//Create a new object
|
||||||
|
//Copy this object
|
||||||
|
//Delete first object
|
||||||
|
//Expect copied object to persist
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The next most important concept in our testing is working with telemetry objects. Telemetry is at the core of Open MCT
|
||||||
|
* and we have developed a great pattern for working with it.
|
||||||
|
*/
|
||||||
|
test.describe('Advanced: Working with telemetry objects', () => {
|
||||||
|
let displayLayout;
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create a Display Layout with a meaningful name
|
||||||
|
displayLayout = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Display Layout with Embedded SWG'
|
||||||
});
|
});
|
||||||
|
// Create Telemetry object within the parent object created above
|
||||||
/**
|
await createDomainObjectWithDefaults(page, {
|
||||||
* Make sure to use testcase names which are descriptive and easy to understand.
|
type: 'Sine Wave Generator',
|
||||||
* A good testcase name concisely describes the test's goal(s) and should give
|
name: 'Telemetry',
|
||||||
* some hint as to what went wrong if the test fails.
|
parent: displayLayout.uuid //reference the display layout in the creation process
|
||||||
*/
|
|
||||||
test('An existing Timer object can be renamed via the 3dot actions menu', async ({ page }) => {
|
|
||||||
const newObjectName = "Renamed Timer";
|
|
||||||
|
|
||||||
// We've created an example of a shared function which pases the page and newObjectName values
|
|
||||||
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
|
||||||
|
|
||||||
// Assert that the name has changed in the browser bar to the value we assigned above
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('An existing Timer object can be renamed twice', async ({ page }) => {
|
|
||||||
const newObjectName = "Renamed Timer";
|
|
||||||
const newObjectName2 = "Re-Renamed Timer";
|
|
||||||
|
|
||||||
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
|
||||||
|
|
||||||
// Assert that the name has changed in the browser bar to the value we assigned above
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
|
||||||
|
|
||||||
// Rename the Timer object again
|
|
||||||
await renameTimerFrom3DotMenu(page, timer.url, newObjectName2);
|
|
||||||
|
|
||||||
// Assert that the name has changed in the browser bar to the second value
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName2);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If you run out of time to write new tests, please stub in the missing tests
|
|
||||||
* in-place with a test.fixme and BDD-style test steps.
|
|
||||||
* Someone will carry the baton!
|
|
||||||
*/
|
|
||||||
test.fixme('Can Rename Timer Object from Tree', async ({ page }) => {
|
|
||||||
//Create a new object
|
|
||||||
//Copy this object
|
|
||||||
//Delete first object
|
|
||||||
//Expect copied object to persist
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
test('Can directly navigate to a Display Layout with embedded telemetry', async ({ page }) => {
|
||||||
|
//Now you can directly navigate to the displayLayout created in the beforeEach with the embedded telemetry
|
||||||
|
await page.goto(displayLayout.url);
|
||||||
|
//Expect the created Telemetry Object to be visible when directly navigating to the displayLayout
|
||||||
|
await expect(page.getByTitle('Sine')).toBeVisible();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,18 +160,18 @@ test.describe('Renaming Timer Object', () => {
|
|||||||
* @param {string} newNameForTimer New name for object
|
* @param {string} newNameForTimer New name for object
|
||||||
*/
|
*/
|
||||||
async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
|
async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
|
||||||
// Navigate to the timer object
|
// Navigate to the timer object
|
||||||
await page.goto(timerUrl);
|
await page.goto(timerUrl);
|
||||||
|
|
||||||
// Click on 3 Dot Menu
|
// Click on 3 Dot Menu
|
||||||
await page.locator('button[title="More options"]').click();
|
await page.locator('button[title="More options"]').click();
|
||||||
|
|
||||||
// Click text=Edit Properties...
|
// Click text=Edit Properties...
|
||||||
await page.locator('text=Edit Properties...').click();
|
await page.locator('text=Edit Properties...').click();
|
||||||
|
|
||||||
// Rename the timer object
|
// Rename the timer object
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
|
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
|
||||||
|
|
||||||
// Click Ok button to Save
|
// Click Ok button to Save
|
||||||
await page.locator('button:has-text("OK")').click();
|
await page.locator('button:has-text("OK")').click();
|
||||||
}
|
}
|
||||||
|
320
e2e/tests/framework/generateLocalStorageData.e2e.spec.js
Normal file
320
e2e/tests/framework/generateLocalStorageData.e2e.spec.js
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2022, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
/**
|
||||||
|
* This test suite is dedicated to generating LocalStorage via Session Storage to be used
|
||||||
|
* in some visual test suites like controlledClock.visual.spec.js. This suite should run to completion
|
||||||
|
* and generate an artifact in ./e2e/test-data/<name>_storage.json . This will run
|
||||||
|
* on every commit to ensure that this object still loads into tests correctly and will retain the
|
||||||
|
* *.e2e.spec.js suffix.
|
||||||
|
*
|
||||||
|
* TODO: Provide additional validation of object properties as it grows.
|
||||||
|
* Verification of object properties happens in this file before the test-data is generated,
|
||||||
|
* and is additionally verified in the validation test suites below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createExampleTelemetryObject
|
||||||
|
} = require('../../appActions.js');
|
||||||
|
const { MISSION_TIME } = require('../../constants.js');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const overlayPlotName = 'Overlay Plot with Telemetry Object';
|
||||||
|
|
||||||
|
test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
|
||||||
|
test.use({
|
||||||
|
clockOptions: {
|
||||||
|
now: MISSION_TIME,
|
||||||
|
shouldAdvanceTime: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Generate display layout with 2 child display layouts', async ({ page, context }) => {
|
||||||
|
// Create Display Layout
|
||||||
|
const parent = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Parent Display Layout'
|
||||||
|
});
|
||||||
|
const child1 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Child Layout 1',
|
||||||
|
parent: parent.uuid
|
||||||
|
});
|
||||||
|
const child2 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Child Layout 2',
|
||||||
|
parent: parent.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(parent.url);
|
||||||
|
await page.getByLabel('Edit').click();
|
||||||
|
await page.getByLabel(`${child2.name} Layout Grid`).hover();
|
||||||
|
await page.getByLabel('Move Sub-object Frame').nth(1).click();
|
||||||
|
await page.getByLabel('X:').fill('30');
|
||||||
|
|
||||||
|
await page.getByLabel(`${child1.name} Layout Grid`).hover();
|
||||||
|
await page.getByLabel('Move Sub-object Frame').first().click();
|
||||||
|
await page.getByLabel('Y:').fill('30');
|
||||||
|
|
||||||
|
await page.getByLabel('Save').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
//Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/display_layout_with_child_layouts.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Generate flexible layout with 2 child display layouts', async ({ page, context }) => {
|
||||||
|
// Create Display Layout
|
||||||
|
const parent = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Flexible Layout',
|
||||||
|
name: 'Parent Flexible Layout'
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Child Layout 1',
|
||||||
|
parent: parent.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Child Layout 2',
|
||||||
|
parent: parent.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(parent.url);
|
||||||
|
|
||||||
|
//Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/flexible_layout_with_child_layouts.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Visual test for the generated object here
|
||||||
|
// - Move to using appActions to create the overlay plot
|
||||||
|
// and embedded standard telemetry object
|
||||||
|
test('Generate Overlay Plot with Telemetry Object', async ({ page, context }) => {
|
||||||
|
// Create Overlay Plot
|
||||||
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Overlay Plot',
|
||||||
|
name: overlayPlotName
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create Telemetry Object
|
||||||
|
const exampleTelemetry = await createExampleTelemetryObject(page);
|
||||||
|
|
||||||
|
// Make Link from Telemetry Object to Overlay Plot
|
||||||
|
await page.locator('button[title="More options"]').click();
|
||||||
|
|
||||||
|
// Select 'Create Link' from dropdown
|
||||||
|
await page.getByRole('menuitem', { name: ' Create Link' }).click();
|
||||||
|
|
||||||
|
// Search and Select for overlay Plot within Create Modal
|
||||||
|
await page.getByRole('dialog').getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('dialog')
|
||||||
|
.getByRole('searchbox', { name: 'Search Input' })
|
||||||
|
.fill(overlayPlot.name);
|
||||||
|
await page
|
||||||
|
.getByRole('treeitem', { name: new RegExp(overlayPlot.name) })
|
||||||
|
.locator('a')
|
||||||
|
.click();
|
||||||
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
|
await page.goto(overlayPlot.url);
|
||||||
|
|
||||||
|
// TODO: Flesh Out Assertions against created Objects
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlotName);
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('list', { name: 'Plot Series Properties' })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// TODO: Modify the Overlay Plot to use fixed Scaling
|
||||||
|
// TODO: Verify Autoscaling.
|
||||||
|
|
||||||
|
// TODO: Fix accessibility of Plot Series Properties tables
|
||||||
|
// Assert that the Plot Series properties have the correct values
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Value")~[role=cell]:has-text("sin")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[role=cell]:has-text("Line Method")~[role=cell]:has-text("Linear interpolation")'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Markers")~[role=cell]:has-text("Point: 2px")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Alarm Markers")~[role=cell]:has-text("Enabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Limit Lines")~[role=cell]:has-text("Disabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page.goto(exampleTelemetry.url);
|
||||||
|
await page.getByRole('tab', { name: 'Properties' }).click();
|
||||||
|
|
||||||
|
// TODO: assert Example Telemetry property values
|
||||||
|
// await page.goto(exampleTelemetry.url);
|
||||||
|
|
||||||
|
// Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/overlay_plot_storage.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// TODO: Merge this with previous test. Edit object created in previous test.
|
||||||
|
test('Generate Overlay Plot with 5s Delay', async ({ page, context }) => {
|
||||||
|
// add overlay plot with defaults
|
||||||
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Overlay Plot',
|
||||||
|
name: 'Overlay Plot with 5s Delay'
|
||||||
|
});
|
||||||
|
|
||||||
|
const swgWith5sDelay = await createExampleTelemetryObject(page, overlayPlot.uuid);
|
||||||
|
|
||||||
|
await page.goto(swgWith5sDelay.url);
|
||||||
|
await page.getByTitle('More options').click();
|
||||||
|
await page.getByRole('menuitem', { name: ' Edit Properties...' }).click();
|
||||||
|
|
||||||
|
//Edit Example Telemetry Object to include 5s loading Delay
|
||||||
|
await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000');
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
page.waitForNavigation(),
|
||||||
|
page.locator('text=OK').click(),
|
||||||
|
//Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// focus the overlay plot
|
||||||
|
await page.goto(overlayPlot.url);
|
||||||
|
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlot.name);
|
||||||
|
|
||||||
|
// Clear Recently Viewed
|
||||||
|
await page.getByRole('button', { name: 'Clear Recently Viewed' }).click();
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
//Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/overlay_plot_with_delay_storage.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Validate Overlay Plot with Telemetry Object @localStorage @generatedata', () => {
|
||||||
|
test.use({
|
||||||
|
storageState: path.join(__dirname, '../../../e2e/test-data/overlay_plot_storage.json')
|
||||||
|
});
|
||||||
|
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('a').filter({ hasText: overlayPlotName }).click();
|
||||||
|
// TODO: Flesh Out Assertions against created Objects
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlotName);
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('list', { name: 'Plot Series Properties' })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// TODO: Modify the Overlay Plot to use fixed Scaling
|
||||||
|
// TODO: Verify Autoscaling.
|
||||||
|
|
||||||
|
// TODO: Fix accessibility of Plot Series Properties tables
|
||||||
|
// Assert that the Plot Series properties have the correct values
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Value")~[role=cell]:has-text("sin")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[role=cell]:has-text("Line Method")~[role=cell]:has-text("Linear interpolation")'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Markers")~[role=cell]:has-text("Point: 2px")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Alarm Markers")~[role=cell]:has-text("Enabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Limit Lines")~[role=cell]:has-text("Disabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Validate Overlay Plot with 5s Delay Telemetry Object @localStorage @generatedata', () => {
|
||||||
|
test.use({
|
||||||
|
storageState: path.join(
|
||||||
|
__dirname,
|
||||||
|
'../../../e2e/test-data/overlay_plot_with_delay_storage.json'
|
||||||
|
)
|
||||||
|
});
|
||||||
|
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {
|
||||||
|
const plotName = 'Overlay Plot with 5s Delay';
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('a').filter({ hasText: plotName }).click();
|
||||||
|
// TODO: Flesh Out Assertions against created Objects
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(plotName);
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('list', { name: 'Plot Series Properties' })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// TODO: Modify the Overlay Plot to use fixed Scaling
|
||||||
|
// TODO: Verify Autoscaling.
|
||||||
|
|
||||||
|
// TODO: Fix accessibility of Plot Series Properties tables
|
||||||
|
// Assert that the Plot Series properties have the correct values
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Value")~[role=cell]:has-text("sin")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[role=cell]:has-text("Line Method")~[role=cell]:has-text("Linear interpolation")'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Markers")~[role=cell]:has-text("Point: 2px")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Alarm Markers")~[role=cell]:has-text("Enabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Limit Lines")~[role=cell]:has-text("Disabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
@ -1,64 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* Open MCT, Copyright (c) 2014-2023, 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.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
This test suite is dedicated to generating LocalStorage via Session Storage to be used
|
|
||||||
in some visual test suites like controlledClock.visual.spec.js. This suite should run to completion
|
|
||||||
and generate an artifact named ./e2e/test-data/VisualTestData_storage.json . This will run
|
|
||||||
on every Commit to ensure that this object still loads into tests correctly and will retain the
|
|
||||||
.e2e.spec.js suffix.
|
|
||||||
|
|
||||||
TODO: Provide additional validation of object properties as it grows.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { createDomainObjectWithDefaults } = require('../../appActions.js');
|
|
||||||
const { test, expect } = require('../../pluginFixtures.js');
|
|
||||||
|
|
||||||
test('Generate Visual Test Data @localStorage', async ({ page, context }) => {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
const overlayPlot = await createDomainObjectWithDefaults(page, { type: 'Overlay Plot' });
|
|
||||||
|
|
||||||
// click create button
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
|
||||||
|
|
||||||
// add sine wave generator with defaults
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
|
|
||||||
|
|
||||||
//Add a 5000 ms Delay
|
|
||||||
await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000');
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('button:has-text("OK")').click(),
|
|
||||||
//Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// focus the overlay plot
|
|
||||||
await page.goto(overlayPlot.url);
|
|
||||||
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlot.name);
|
|
||||||
//Save localStorage for future test execution
|
|
||||||
await context.storageState({ path: './e2e/test-data/VisualTestData_storage.json' });
|
|
||||||
});
|
|
@ -29,18 +29,16 @@ const { test } = require('../../pluginFixtures.js');
|
|||||||
|
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
test.describe.skip('pluginFixtures tests', () => {
|
test.describe.skip('pluginFixtures tests', () => {
|
||||||
// test.use({ domainObjectName: 'Timer' });
|
// test.use({ domainObjectName: 'Timer' });
|
||||||
// let timerUUID;
|
// let timerUUID;
|
||||||
|
// test('Creates a timer object @framework @unstable', ({ domainObject }) => {
|
||||||
// test('Creates a timer object @framework @unstable', ({ domainObject }) => {
|
// const { uuid } = domainObject;
|
||||||
// const { uuid } = domainObject;
|
// const uuidRegexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/;
|
||||||
// const uuidRegexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/;
|
// expect(uuid).toMatch(uuidRegexp);
|
||||||
// expect(uuid).toMatch(uuidRegexp);
|
// timerUUID = uuid;
|
||||||
// timerUUID = uuid;
|
// });
|
||||||
// });
|
// test('Provides same uuid for subsequent uses of the same object @framework', ({ domainObject }) => {
|
||||||
|
// const { uuid } = domainObject;
|
||||||
// test('Provides same uuid for subsequent uses of the same object @framework', ({ domainObject }) => {
|
// expect(uuid).toEqual(timerUUID);
|
||||||
// const { uuid } = domainObject;
|
// });
|
||||||
// expect(uuid).toEqual(timerUUID);
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
@ -27,37 +27,39 @@ This test suite is dedicated to tests which verify branding related components.
|
|||||||
const { test, expect } = require('../../baseFixtures.js');
|
const { test, expect } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
test.describe('Branding tests', () => {
|
test.describe('Branding tests', () => {
|
||||||
test('About Modal launches with basic branding properties', async ({ page }) => {
|
test('About Modal launches with basic branding properties', async ({ page }) => {
|
||||||
// Go to baseURL
|
// Go to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Click About button
|
// Click About button
|
||||||
await page.click('.l-shell__app-logo');
|
await page.click('.l-shell__app-logo');
|
||||||
|
|
||||||
// Verify that the NASA Logo Appears
|
// Verify that the NASA Logo Appears
|
||||||
await expect(page.locator('.c-about__image')).toBeVisible();
|
await expect(page.locator('.c-about__image')).toBeVisible();
|
||||||
|
|
||||||
// Modify the Build information in 'about' Modal
|
// Modify the Build information in 'about' Modal
|
||||||
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info').first();
|
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info').first();
|
||||||
await expect(versionInformationLocator).toBeEnabled();
|
await expect(versionInformationLocator).toBeEnabled();
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Version: \d/);
|
await expect.soft(versionInformationLocator).toContainText(/Version: \d/);
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Build Date: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun))/);
|
await expect
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Revision: \b[0-9a-f]{5,40}\b/);
|
.soft(versionInformationLocator)
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Branch: ./);
|
.toContainText(/Build Date: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun))/);
|
||||||
});
|
await expect.soft(versionInformationLocator).toContainText(/Revision: \b[0-9a-f]{5,40}\b/);
|
||||||
test('Verify Links in About Modal @2p', async ({ page }) => {
|
await expect.soft(versionInformationLocator).toContainText(/Branch: ./);
|
||||||
// Go to baseURL
|
});
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
test('Verify Links in About Modal @2p', async ({ page }) => {
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Click About button
|
// Click About button
|
||||||
await page.click('.l-shell__app-logo');
|
await page.click('.l-shell__app-logo');
|
||||||
|
|
||||||
// Verify that clicking on the third party licenses information opens up another tab on licenses url
|
// Verify that clicking on the third party licenses information opens up another tab on licenses url
|
||||||
const [page2] = await Promise.all([
|
const [page2] = await Promise.all([
|
||||||
page.waitForEvent('popup'),
|
page.waitForEvent('popup'),
|
||||||
page.locator('text=click here for third party licensing information').click()
|
page.locator('text=click here for third party licensing information').click()
|
||||||
]);
|
]);
|
||||||
await page2.waitForLoadState('networkidle'); //Avoids timing issues with juggler/firefox
|
await page2.waitForLoadState('networkidle'); //Avoids timing issues with juggler/firefox
|
||||||
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
59
e2e/tests/functional/clearDataAction.e2e.spec.js
Normal file
59
e2e/tests/functional/clearDataAction.e2e.spec.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Verify that the "Clear Data" menu action performs as expected for various object types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
const { createDomainObjectWithDefaults } = require('../../appActions.js');
|
||||||
|
|
||||||
|
const backgroundImageSelector = '.c-imagery__main-image__background-image';
|
||||||
|
|
||||||
|
test.describe('Clear Data Action', () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create a default 'Example Imagery' object
|
||||||
|
const exampleImagery = await createDomainObjectWithDefaults(page, { type: 'Example Imagery' });
|
||||||
|
|
||||||
|
// Verify that the created object is focused
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(exampleImagery.name);
|
||||||
|
await page.locator('.c-imagery__main-image__bg').hover({ trial: true });
|
||||||
|
await expect(page.locator(backgroundImageSelector)).toBeVisible();
|
||||||
|
});
|
||||||
|
test('works as expected with Example Imagery', async ({ page }) => {
|
||||||
|
await expect(await page.locator('.c-thumb__image').count()).toBeGreaterThan(0);
|
||||||
|
// Click the "Clear Data" menu action
|
||||||
|
await page.getByTitle('More options').click();
|
||||||
|
const clearDataMenuItem = page.getByRole('menuitem', {
|
||||||
|
name: 'Clear Data'
|
||||||
|
});
|
||||||
|
await expect(clearDataMenuItem).toBeEnabled();
|
||||||
|
await clearDataMenuItem.click();
|
||||||
|
|
||||||
|
// Verify that the background image is no longer visible
|
||||||
|
await expect(page.locator(backgroundImageSelector)).toBeHidden();
|
||||||
|
await expect(await page.locator('.c-thumb__image').count()).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
@ -21,91 +21,98 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test suite is meant to be executed against a couchdb container. More doc to come
|
* This test suite is meant to be executed against a couchdb container. More doc to come
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
|
|
||||||
test.describe("CouchDB Status Indicator with mocked responses @couchdb", () => {
|
test.describe('CouchDB Status Indicator with mocked responses @couchdb', () => {
|
||||||
test.use({ failOnConsoleError: false });
|
test.use({ failOnConsoleError: false });
|
||||||
//TODO BeforeAll Verify CouchDB Connectivity with APIContext
|
//TODO BeforeAll Verify CouchDB Connectivity with APIContext
|
||||||
test('Shows green if connected', async ({ page }) => {
|
test('Shows green if connected', async ({ page }) => {
|
||||||
await page.route('**/openmct/mine', route => {
|
await page.route('**/openmct/mine', (route) => {
|
||||||
route.fulfill({
|
route.fulfill({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
body: JSON.stringify({})
|
body: JSON.stringify({})
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
|
||||||
await expect(page.locator('div:has-text("CouchDB is connected")').nth(3)).toBeVisible();
|
|
||||||
});
|
});
|
||||||
test('Shows red if not connected', async ({ page }) => {
|
|
||||||
await page.route('**/openmct/**', route => {
|
|
||||||
route.fulfill({
|
|
||||||
status: 503,
|
|
||||||
contentType: 'application/json',
|
|
||||||
body: JSON.stringify({})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
await expect(page.locator('div:has-text("CouchDB is offline")').nth(3)).toBeVisible();
|
waitUntil: 'networkidle'
|
||||||
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB is connected")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Shows red if not connected', async ({ page }) => {
|
||||||
|
await page.route('**/openmct/**', (route) => {
|
||||||
|
route.fulfill({
|
||||||
|
status: 503,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify({})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test('Shows unknown if it receives an unexpected response code', async ({ page }) => {
|
|
||||||
await page.route('**/openmct/mine', route => {
|
|
||||||
route.fulfill({
|
|
||||||
status: 418,
|
|
||||||
contentType: 'application/json',
|
|
||||||
body: JSON.stringify({})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
await expect(page.locator('div:has-text("CouchDB connectivity unknown")').nth(3)).toBeVisible();
|
waitUntil: 'networkidle'
|
||||||
});
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB is offline")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Shows unknown if it receives an unexpected response code', async ({ page }) => {
|
||||||
|
await page.route('**/openmct/mine', (route) => {
|
||||||
|
route.fulfill({
|
||||||
|
status: 418,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify({})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
|
waitUntil: 'networkidle'
|
||||||
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB connectivity unknown")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe("CouchDB initialization with mocked responses @couchdb", () => {
|
test.describe('CouchDB initialization with mocked responses @couchdb', () => {
|
||||||
test.use({ failOnConsoleError: false });
|
test.use({ failOnConsoleError: false });
|
||||||
test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
|
test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
|
||||||
const mockedMissingObjectResponsefromCouchDB = {
|
const mockedMissingObjectResponseFromCouchDB = {
|
||||||
status: 404,
|
status: 404,
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
body: JSON.stringify({})
|
body: JSON.stringify({})
|
||||||
};
|
};
|
||||||
|
|
||||||
// Override the first request to GET openmct/mine to return a 404.
|
// Override the first request to GET openmct/mine to return a 404.
|
||||||
// This simulates the case of starting Open MCT with a fresh database
|
// This simulates the case of starting Open MCT with a fresh database
|
||||||
// and no "My Items" folder created yet.
|
// and no "My Items" folder created yet.
|
||||||
await page.route('**/mine', route => {
|
await page.route(
|
||||||
route.fulfill(mockedMissingObjectResponsefromCouchDB);
|
'**/mine',
|
||||||
}, { times: 1 });
|
(route) => {
|
||||||
|
route.fulfill(mockedMissingObjectResponseFromCouchDB);
|
||||||
|
},
|
||||||
|
{ times: 1 }
|
||||||
|
);
|
||||||
|
|
||||||
// Set up promise to verify that a PUT request to create "My Items"
|
// Set up promise to verify that a PUT request to create "My Items"
|
||||||
// folder was made.
|
// folder was made.
|
||||||
const putMineFolderRequest = page.waitForRequest(req =>
|
const putMineFolderRequest = page.waitForRequest(
|
||||||
req.url().endsWith('/mine')
|
(req) => req.url().endsWith('/mine') && req.method() === 'PUT'
|
||||||
&& req.method() === 'PUT');
|
);
|
||||||
|
|
||||||
// Set up promise to verify that a GET request to retrieve "My Items"
|
// Set up promise to verify that a GET request to retrieve "My Items"
|
||||||
// folder was made.
|
// folder was made.
|
||||||
const getMineFolderRequest = page.waitForRequest(req =>
|
const getMineFolderRequest = page.waitForRequest(
|
||||||
req.url().endsWith('/mine')
|
(req) => req.url().endsWith('/mine') && req.method() === 'GET'
|
||||||
&& req.method() === 'GET');
|
);
|
||||||
|
|
||||||
// Go to baseURL.
|
// Go to baseURL.
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Wait for both requests to resolve.
|
// Wait for both requests to resolve.
|
||||||
await Promise.all([
|
await Promise.all([putMineFolderRequest, getMineFolderRequest]);
|
||||||
putMineFolderRequest,
|
});
|
||||||
getMineFolderRequest
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -28,32 +28,31 @@ const { test, expect } = require('../../../pluginFixtures');
|
|||||||
const { createDomainObjectWithDefaults } = require('../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../appActions');
|
||||||
|
|
||||||
test.describe('Example Event Generator CRUD Operations', () => {
|
test.describe('Example Event Generator CRUD Operations', () => {
|
||||||
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
|
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
//Create a name for the object
|
//Create a name for the object
|
||||||
const newObjectName = 'Test Event Generator';
|
const newObjectName = 'Test Event Generator';
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Event Message Generator',
|
type: 'Event Message Generator',
|
||||||
name: newObjectName
|
name: newObjectName
|
||||||
});
|
|
||||||
|
|
||||||
//Assertions against newly created object which define standard behavior
|
|
||||||
await expect(page.waitForURL(/.*&view=table/)).toBeTruthy();
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Assertions against newly created object which define standard behavior
|
||||||
|
await expect(page.waitForURL(/.*&view=table/)).toBeTruthy();
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Example Event Generator Telemetry Event Verficiation', () => {
|
test.describe('Example Event Generator Telemetry Event Verification', () => {
|
||||||
|
test.fixme('telemetry is coming in for test event', async ({ page }) => {
|
||||||
test.fixme('telemetry is coming in for test event', async ({ page }) => {
|
|
||||||
// Go to object created in step one
|
// Go to object created in step one
|
||||||
// Verify the telemetry table is filled with > 1 row
|
// Verify the telemetry table is filled with > 1 row
|
||||||
});
|
});
|
||||||
test.fixme('telemetry is sorted by time ascending', async ({ page }) => {
|
test.fixme('telemetry is sorted by time ascending', async ({ page }) => {
|
||||||
// Go to object created in step one
|
// Go to object created in step one
|
||||||
// Verify the telemetry table has a class with "is-sorting asc"
|
// Verify the telemetry table has a class with "is-sorting asc"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -27,93 +27,113 @@ This test suite is dedicated to tests which verify the basic operations surround
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('Sine Wave Generator', () => {
|
test.describe('Sine Wave Generator', () => {
|
||||||
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({ page, browserName }) => {
|
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
page,
|
||||||
test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
|
browserName
|
||||||
|
}) => {
|
||||||
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
|
test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
|
||||||
|
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
//Click the Create button
|
//Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
// Click Sine Wave Generator
|
// Click Sine Wave Generator
|
||||||
await page.click('text=Sine Wave Generator');
|
await page.click('text=Sine Wave Generator');
|
||||||
|
|
||||||
// Verify that the each required field has required indicator
|
// Verify that the each required field has required indicator
|
||||||
// Title
|
// Title
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
||||||
|
|
||||||
// Verify that the Notes row does not have a required indicator
|
// Verify that the Notes row does not have a required indicator
|
||||||
await expect(page.locator('.c-form__section div:nth-child(3) .form-row .c-form-row__state-indicator')).not.toContain('.req');
|
await expect(
|
||||||
await page.locator('textarea[type="text"]').fill('Optional Note Text');
|
page.locator('.c-form__section div:nth-child(3) .form-row .c-form-row__state-indicator')
|
||||||
|
).not.toContain('.req');
|
||||||
|
await page.locator('textarea[type="text"]').fill('Optional Note Text');
|
||||||
|
|
||||||
// Period
|
// Period
|
||||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Amplitude
|
// Amplitude
|
||||||
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Offset
|
// Offset
|
||||||
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Data Rate
|
// Data Rate
|
||||||
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Phase
|
// Phase
|
||||||
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Randomness
|
// Randomness
|
||||||
await expect(page.locator('div:nth-child(9) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(9) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Verify that by removing value from required text field shows invalid indicator
|
// Verify that by removing value from required text field shows invalid indicator
|
||||||
await page.locator('text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]').fill('');
|
await page
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
.locator(
|
||||||
|
'text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]'
|
||||||
|
)
|
||||||
|
.fill('');
|
||||||
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
||||||
|
|
||||||
// Verify that by adding value to empty required text field changes invalid to valid indicator
|
// Verify that by adding value to empty required text field changes invalid to valid indicator
|
||||||
await page.locator('text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]').fill('New Sine Wave Generator');
|
await page
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
.locator(
|
||||||
|
'text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]'
|
||||||
|
)
|
||||||
|
.fill('New Sine Wave Generator');
|
||||||
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
||||||
|
|
||||||
// Verify that by removing value from required number field shows invalid indicator
|
// Verify that by removing value from required number field shows invalid indicator
|
||||||
await page.locator('.field.control.l-input-sm input').first().fill('');
|
await page.locator('.field.control.l-input-sm input').first().fill('');
|
||||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/invalid/);
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(
|
||||||
|
/invalid/
|
||||||
|
);
|
||||||
|
|
||||||
// Verify that by adding value to empty required number field changes invalid to valid indicator
|
// Verify that by adding value to empty required number field changes invalid to valid indicator
|
||||||
await page.locator('.field.control.l-input-sm input').first().fill('3');
|
await page.locator('.field.control.l-input-sm input').first().fill('3');
|
||||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/valid/);
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(
|
||||||
|
/valid/
|
||||||
|
);
|
||||||
|
|
||||||
// Verify that can change value of number field by up/down arrows keys
|
// Verify that can change value of number field by up/down arrows keys
|
||||||
// Click .field.control.l-input-sm input >> nth=0
|
// Click .field.control.l-input-sm input >> nth=0
|
||||||
await page.locator('.field.control.l-input-sm input').first().click();
|
await page.locator('.field.control.l-input-sm input').first().click();
|
||||||
// Press ArrowUp 3 times to change value from 3 to 6
|
// Press ArrowUp 3 times to change value from 3 to 6
|
||||||
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
||||||
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
||||||
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
||||||
|
|
||||||
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
||||||
await expect(value).toBe('6');
|
await expect(value).toBe('6');
|
||||||
|
|
||||||
//Click text=OK
|
//Click text=OK
|
||||||
await Promise.all([
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('button:has-text("OK")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Verify that the Sine Wave Generator is displayed and correct
|
// Verify that the Sine Wave Generator is displayed and correct
|
||||||
// Verify object properties
|
// Verify object properties
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText('New Sine Wave Generator');
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(
|
||||||
|
'New Sine Wave Generator'
|
||||||
|
);
|
||||||
|
|
||||||
// Verify canvas rendered and can be interacted with
|
// Verify canvas rendered and can be interacted with
|
||||||
await page.locator('canvas').nth(1).click({
|
await page
|
||||||
position: {
|
.locator('canvas')
|
||||||
x: 341,
|
.nth(1)
|
||||||
y: 28
|
.click({
|
||||||
}
|
position: {
|
||||||
});
|
x: 341,
|
||||||
|
y: 28
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Verify that where we click on canvas shows the number we clicked on
|
// Verify that where we click on canvas shows the number we clicked on
|
||||||
// Note that any number will do, we just care that a number exists
|
// Note that any number will do, we just care that a number exists
|
||||||
await expect(page.locator('.value-to-display-nearestValue')).toContainText(/[+-]?([0-9]*[.])?[0-9]+/);
|
await expect(page.locator('.value-to-display-nearestValue')).toContainText(
|
||||||
|
/[+-]?([0-9]*[.])?[0-9]+/
|
||||||
});
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify form functionality in isolation
|
This test suite is dedicated to tests which verify form functionality in isolation
|
||||||
*/
|
*/
|
||||||
@ -34,246 +34,269 @@ const jsonFilePath = 'e2e/test-data/ExampleLayouts.json';
|
|||||||
const imageFilePath = 'e2e/test-data/rick.jpg';
|
const imageFilePath = 'e2e/test-data/rick.jpg';
|
||||||
|
|
||||||
test.describe('Form Validation Behavior', () => {
|
test.describe('Form Validation Behavior', () => {
|
||||||
test('Required Field indicators appear if title is empty and can be corrected', async ({ page }) => {
|
test('Required Field indicators appear if title is empty and can be corrected', async ({
|
||||||
//Go to baseURL
|
page
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
}) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
await page.click(':nth-match(:text("Folder"), 2)');
|
await page.getByRole('menuitem', { name: ' Folder' }).click();
|
||||||
|
|
||||||
// Fill in empty string into title and trigger validation with 'Tab'
|
// Fill in empty string into title and trigger validation with 'Tab'
|
||||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
await page.click('text=Properties Title Notes >> input[type="text"]');
|
||||||
await page.fill('text=Properties Title Notes >> input[type="text"]', '');
|
await page.fill('text=Properties Title Notes >> input[type="text"]', '');
|
||||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
||||||
|
|
||||||
//Required Field Form Validation
|
//Required Field Form Validation
|
||||||
await expect(page.locator('button:has-text("OK")')).toBeDisabled();
|
await expect(page.locator('button:has-text("OK")')).toBeDisabled();
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
||||||
|
|
||||||
//Correct Form Validation for missing title and trigger validation with 'Tab'
|
//Correct Form Validation for missing title and trigger validation with 'Tab'
|
||||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
await page.click('text=Properties Title Notes >> input[type="text"]');
|
||||||
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
||||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
||||||
|
|
||||||
//Required Field Form Validation is corrected
|
//Required Field Form Validation is corrected
|
||||||
await expect(page.locator('button:has-text("OK")')).toBeEnabled();
|
await expect(page.locator('button:has-text("OK")')).toBeEnabled();
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
||||||
|
|
||||||
//Finish Creating Domain Object
|
//Finish Creating Domain Object
|
||||||
await Promise.all([
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('button:has-text("OK")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Verify that the Domain Object has been created with the corrected title property
|
//Verify that the Domain Object has been created with the corrected title property
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(TEST_FOLDER);
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(TEST_FOLDER);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Form File Input Behavior', () => {
|
test.describe('Form File Input Behavior', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addInitFileInputObject.js') });
|
path: path.join(__dirname, '../../helper', 'addInitFileInputObject.js')
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('Can select a JSON file type', async ({ page }) => {
|
test('Can select a JSON file type', async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.getByRole('button', { name: ' Create ' }).click();
|
await page.getByRole('button', { name: ' Create ' }).click();
|
||||||
await page.getByRole('menuitem', { name: 'JSON File Input Object' }).click();
|
await page.getByRole('menuitem', { name: 'JSON File Input Object' }).click();
|
||||||
|
|
||||||
await page.setInputFiles('#fileElem', jsonFilePath);
|
await page.setInputFiles('#fileElem', jsonFilePath);
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Save' }).click();
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
const type = await page.locator('#file-input-type').textContent();
|
const type = await page.locator('#file-input-type').textContent();
|
||||||
await expect(type).toBe(`"string"`);
|
await expect(type).toBe(`"string"`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can select an image file type', async ({ page }) => {
|
test('Can select an image file type', async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.getByRole('button', { name: ' Create ' }).click();
|
await page.getByRole('button', { name: ' Create ' }).click();
|
||||||
await page.getByRole('menuitem', { name: 'Image File Input Object' }).click();
|
await page.getByRole('menuitem', { name: 'Image File Input Object' }).click();
|
||||||
|
|
||||||
await page.setInputFiles('#fileElem', imageFilePath);
|
await page.setInputFiles('#fileElem', imageFilePath);
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Save' }).click();
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
const type = await page.locator('#file-input-type').textContent();
|
const type = await page.locator('#file-input-type').textContent();
|
||||||
await expect(type).toBe(`"object"`);
|
await expect(type).toBe(`"object"`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Persistence operations @addInit', () => {
|
test.describe('Persistence operations @addInit', () => {
|
||||||
// add non persistable root item
|
// add non persistable root item
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') });
|
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js')
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('Persistability should be respected in the create form location field', async ({ page }) => {
|
test('Persistability should be respected in the create form location field', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/4323'
|
description: 'https://github.com/nasa/openmct/issues/4323'
|
||||||
});
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
await page.click('text=Condition Set');
|
|
||||||
|
|
||||||
await page.locator('form[name="mctForm"] >> text=Persistence Testing').click();
|
|
||||||
|
|
||||||
const okButton = page.locator('button:has-text("OK")');
|
|
||||||
await expect(okButton).toBeDisabled();
|
|
||||||
});
|
});
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
await page.click('text=Condition Set');
|
||||||
|
|
||||||
|
await page.locator('form[name="mctForm"] >> text=Persistence Testing').click();
|
||||||
|
|
||||||
|
const okButton = page.locator('button:has-text("OK")');
|
||||||
|
await expect(okButton).toBeDisabled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Persistence operations @couchdb', () => {
|
test.describe('Persistence operations @couchdb', () => {
|
||||||
test.use({ failOnConsoleError: false });
|
test.use({ failOnConsoleError: false });
|
||||||
test('Editing object properties should generate a single persistence operation', async ({ page }) => {
|
test('Editing object properties should generate a single persistence operation', async ({
|
||||||
test.info().annotations.push({
|
page
|
||||||
type: 'issue',
|
}) => {
|
||||||
description: 'https://github.com/nasa/openmct/issues/5616'
|
test.info().annotations.push({
|
||||||
});
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5616'
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create a new 'Clock' object with default settings
|
|
||||||
const clock = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Clock'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Count all persistence operations (PUT requests) for this specific object
|
|
||||||
let putRequestCount = 0;
|
|
||||||
page.on('request', req => {
|
|
||||||
if (req.method() === 'PUT' && req.url().endsWith(clock.uuid)) {
|
|
||||||
putRequestCount += 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Open the edit form for the clock object
|
|
||||||
await page.click('button[title="More options"]');
|
|
||||||
await page.click('li[title="Edit properties of this object."]');
|
|
||||||
|
|
||||||
// Modify the display format from default 12hr -> 24hr and click 'Save'
|
|
||||||
await page.locator('select[aria-label="12 or 24 hour clock"]').selectOption({ value: 'clock24' });
|
|
||||||
await page.click('button[aria-label="Save"]');
|
|
||||||
|
|
||||||
await expect.poll(() => putRequestCount, {
|
|
||||||
message: 'Verify a single PUT request was made to persist the object',
|
|
||||||
timeout: 1000
|
|
||||||
}).toEqual(1);
|
|
||||||
});
|
});
|
||||||
test('Can create an object after a conflict error @couchdb @2p', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5982'
|
|
||||||
});
|
|
||||||
|
|
||||||
const page2 = await page.context().newPage();
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Both pages: Go to baseURL
|
// Create a new 'Clock' object with default settings
|
||||||
await Promise.all([
|
const clock = await createDomainObjectWithDefaults(page, {
|
||||||
page.goto('./', { waitUntil: 'networkidle' }),
|
type: 'Clock'
|
||||||
page2.goto('./', { waitUntil: 'networkidle' })
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Both pages: Click the Create button
|
|
||||||
await Promise.all([
|
|
||||||
page.click('button:has-text("Create")'),
|
|
||||||
page2.click('button:has-text("Create")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Both pages: Click "Clock" in the Create menu
|
|
||||||
await Promise.all([
|
|
||||||
page.click(`li[role='menuitem']:text("Clock")`),
|
|
||||||
page2.click(`li[role='menuitem']:text("Clock")`)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Generate unique names for both objects
|
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
|
||||||
const nameInput2 = page2.locator('form[name="mctForm"] .first input[type="text"]');
|
|
||||||
|
|
||||||
// Both pages: Fill in the 'Name' form field.
|
|
||||||
await Promise.all([
|
|
||||||
nameInput.fill(""),
|
|
||||||
nameInput.fill(`Clock:${genUuid()}`),
|
|
||||||
nameInput2.fill(""),
|
|
||||||
nameInput2.fill(`Clock:${genUuid()}`)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Both pages: Fill the "Notes" section with information about the
|
|
||||||
// currently running test and its project.
|
|
||||||
const testNotes = page.testNotes;
|
|
||||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
|
||||||
const notesInput2 = page2.locator('form[name="mctForm"] #notes-textarea');
|
|
||||||
await Promise.all([
|
|
||||||
notesInput.fill(testNotes),
|
|
||||||
notesInput2.fill(testNotes)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Page 2: Click "OK" to create the domain object and wait for navigation.
|
|
||||||
// This will update the composition of the parent folder, setting the
|
|
||||||
// conditions for a conflict error from the first page.
|
|
||||||
await Promise.all([
|
|
||||||
page2.waitForLoadState(),
|
|
||||||
page2.click('[aria-label="Save"]'),
|
|
||||||
// Wait for Save Banner to appear
|
|
||||||
page2.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Close Page 2, we're done with it.
|
|
||||||
await page2.close();
|
|
||||||
|
|
||||||
// Page 1: Click "OK" to create the domain object and wait for navigation.
|
|
||||||
// This will trigger a conflict error upon attempting to update
|
|
||||||
// the composition of the parent folder.
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForLoadState(),
|
|
||||||
page.click('[aria-label="Save"]'),
|
|
||||||
// Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Page 1: Verify that the conflict has occurred and an error notification is displayed.
|
|
||||||
await expect(page.locator('.c-message-banner__message', {
|
|
||||||
hasText: "Conflict detected while saving mine"
|
|
||||||
})).toBeVisible();
|
|
||||||
|
|
||||||
// Page 1: Start logging console errors from this point on
|
|
||||||
let errors = [];
|
|
||||||
page.on('console', (msg) => {
|
|
||||||
if (msg.type() === 'error') {
|
|
||||||
errors.push(msg.text());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Page 1: Try to create a clock with the page that received the conflict.
|
|
||||||
const clockAfterConflict = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Clock'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Page 1: Wait for save progress dialog to appear/disappear
|
|
||||||
await page.locator('.c-message-banner__message', {
|
|
||||||
hasText: 'Do not navigate away from this page or close this browser tab while this message is displayed.',
|
|
||||||
state: 'visible'
|
|
||||||
}).waitFor({ state: 'hidden' });
|
|
||||||
|
|
||||||
// Page 1: Navigate to 'My Items' and verify that the second clock was created
|
|
||||||
await page.goto('./#/browse/mine');
|
|
||||||
await expect(page.locator(`.c-grid-item__name[title="${clockAfterConflict.name}"]`)).toBeVisible();
|
|
||||||
|
|
||||||
// Verify no console errors occurred
|
|
||||||
expect(errors).toHaveLength(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Count all persistence operations (PUT requests) for this specific object
|
||||||
|
let putRequestCount = 0;
|
||||||
|
page.on('request', (req) => {
|
||||||
|
if (req.method() === 'PUT' && req.url().endsWith(clock.uuid)) {
|
||||||
|
putRequestCount += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Open the edit form for the clock object
|
||||||
|
await page.click('button[title="More options"]');
|
||||||
|
await page.click('li[title="Edit properties of this object."]');
|
||||||
|
|
||||||
|
// Modify the display format from default 12hr -> 24hr and click 'Save'
|
||||||
|
await page
|
||||||
|
.locator('select[aria-label="12 or 24 hour clock"]')
|
||||||
|
.selectOption({ value: 'clock24' });
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
await expect
|
||||||
|
.poll(() => putRequestCount, {
|
||||||
|
message: 'Verify a single PUT request was made to persist the object',
|
||||||
|
timeout: 1000
|
||||||
|
})
|
||||||
|
.toEqual(1);
|
||||||
|
});
|
||||||
|
test('Can create an object after a conflict error @couchdb @2p', async ({
|
||||||
|
page,
|
||||||
|
openmctConfig
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5982'
|
||||||
|
});
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
// Instantiate a second page/tab
|
||||||
|
const page2 = await page.context().newPage();
|
||||||
|
|
||||||
|
// Both pages: Go to baseURL
|
||||||
|
await Promise.all([
|
||||||
|
page.goto('./', { waitUntil: 'networkidle' }),
|
||||||
|
page2.goto('./', { waitUntil: 'networkidle' })
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Slow down the test a bit
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `Expand ${myItemsFolderName} folder` })
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page2.getByRole('button', { name: `Expand ${myItemsFolderName} folder` })
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Both pages: Click the Create button
|
||||||
|
await Promise.all([
|
||||||
|
page.click('button:has-text("Create")'),
|
||||||
|
page2.click('button:has-text("Create")')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Both pages: Click "Clock" in the Create menu
|
||||||
|
await Promise.all([
|
||||||
|
page.click(`li[role='menuitem']:text("Clock")`),
|
||||||
|
page2.click(`li[role='menuitem']:text("Clock")`)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Generate unique names for both objects
|
||||||
|
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
|
const nameInput2 = page2.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
|
|
||||||
|
// Both pages: Fill in the 'Name' form field.
|
||||||
|
await Promise.all([
|
||||||
|
nameInput.fill(''),
|
||||||
|
nameInput.fill(`Clock:${genUuid()}`),
|
||||||
|
nameInput2.fill(''),
|
||||||
|
nameInput2.fill(`Clock:${genUuid()}`)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Both pages: Fill the "Notes" section with information about the
|
||||||
|
// currently running test and its project.
|
||||||
|
const testNotes = page.testNotes;
|
||||||
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
const notesInput2 = page2.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
await Promise.all([notesInput.fill(testNotes), notesInput2.fill(testNotes)]);
|
||||||
|
|
||||||
|
// Page 2: Click "OK" to create the domain object and wait for navigation.
|
||||||
|
// This will update the composition of the parent folder, setting the
|
||||||
|
// conditions for a conflict error from the first page.
|
||||||
|
await Promise.all([
|
||||||
|
page2.waitForLoadState(),
|
||||||
|
page2.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page2.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Close Page 2, we're done with it.
|
||||||
|
await page2.close();
|
||||||
|
|
||||||
|
// Page 1: Click "OK" to create the domain object and wait for navigation.
|
||||||
|
// This will trigger a conflict error upon attempting to update
|
||||||
|
// the composition of the parent folder.
|
||||||
|
await Promise.all([
|
||||||
|
page.waitForLoadState(),
|
||||||
|
page.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Page 1: Verify that the conflict has occurred and an error notification is displayed.
|
||||||
|
await expect(
|
||||||
|
page.locator('.c-message-banner__message', {
|
||||||
|
hasText: 'Conflict detected while saving mine'
|
||||||
|
})
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Page 1: Start logging console errors from this point on
|
||||||
|
let errors = [];
|
||||||
|
page.on('console', (msg) => {
|
||||||
|
if (msg.type() === 'error') {
|
||||||
|
errors.push(msg.text());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Page 1: Try to create a clock with the page that received the conflict.
|
||||||
|
const clockAfterConflict = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Clock'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Page 1: Wait for save progress dialog to appear/disappear
|
||||||
|
await page
|
||||||
|
.locator('.c-message-banner__message', {
|
||||||
|
hasText:
|
||||||
|
'Do not navigate away from this page or close this browser tab while this message is displayed.',
|
||||||
|
state: 'visible'
|
||||||
|
})
|
||||||
|
.waitFor({ state: 'hidden' });
|
||||||
|
|
||||||
|
// Page 1: Navigate to 'My Items' and verify that the second clock was created
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
await expect(
|
||||||
|
page.locator(`.c-grid-item__name[title="${clockAfterConflict.name}"]`)
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Verify no console errors occurred
|
||||||
|
expect(errors).toHaveLength(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Form Correctness by Object Type', () => {
|
test.describe('Form Correctness by Object Type', () => {
|
||||||
test.fixme('Verify correct behavior of number object (SWG)', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object (SWG)', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Timer', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Timer', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Plan View', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Plan View', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Clock', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Clock', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Hyperlink', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Hyperlink', async ({ page }) => {});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify persistability checks
|
This test suite is dedicated to tests which verify persistability checks
|
||||||
*/
|
*/
|
||||||
@ -29,22 +29,31 @@ const { test, expect } = require('../../baseFixtures.js');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
test.describe('Persistence operations @addInit', () => {
|
test.describe('Persistence operations @addInit', () => {
|
||||||
// add non persistable root item
|
// add non persistable root item
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') });
|
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Non-persistable objects should not show persistence related actions', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('text=Persistence Testing').first().click({
|
||||||
|
button: 'right'
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Non-persistable objects should not show persistence related actions', async ({ page }) => {
|
const menuOptions = page.locator('.c-menu li');
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
await page.locator('text=Persistence Testing').first().click({
|
await expect.soft(menuOptions).toContainText(['Open In New Tab', 'View', 'Create Link']);
|
||||||
button: 'right'
|
await expect(menuOptions).not.toContainText([
|
||||||
});
|
'Move',
|
||||||
|
'Duplicate',
|
||||||
const menuOptions = page.locator('.c-menu li');
|
'Remove',
|
||||||
|
'Add New Folder',
|
||||||
await expect.soft(menuOptions).toContainText(['Open In New Tab', 'View', 'Create Link']);
|
'Edit Properties...',
|
||||||
await expect(menuOptions).not.toContainText(['Move', 'Duplicate', 'Remove', 'Add New Folder', 'Edit Properties...', 'Export as JSON', 'Import from JSON']);
|
'Export as JSON',
|
||||||
});
|
'Import from JSON'
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,276 +1,303 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
* 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.
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
* Open MCT includes source code licensed under additional open source
|
* Open MCT includes source code licensed under additional open source
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
|
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||||
|
|
||||||
test.describe('Move & link item tests', () => {
|
test.describe('Move & link item tests', () => {
|
||||||
test('Create a basic object and verify that it can be moved to another folder', async ({ page, openmctConfig }) => {
|
test('Create a basic object and verify that it can be moved to another folder', async ({
|
||||||
const { myItemsFolderName } = openmctConfig;
|
page,
|
||||||
|
openmctConfig
|
||||||
// Go to Open MCT
|
}) => {
|
||||||
await page.goto('./');
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
|
||||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
// Go to Open MCT
|
||||||
type: 'Folder',
|
await page.goto('./');
|
||||||
name: 'Parent Folder'
|
|
||||||
});
|
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
type: 'Folder',
|
||||||
type: 'Folder',
|
name: 'Parent Folder'
|
||||||
name: 'Child Folder',
|
});
|
||||||
parent: parentFolder.uuid
|
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Folder',
|
||||||
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
name: 'Child Folder',
|
||||||
type: 'Folder',
|
parent: parentFolder.uuid
|
||||||
name: 'Grandchild Folder',
|
});
|
||||||
parent: childFolder.uuid
|
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Folder',
|
||||||
|
name: 'Grandchild Folder',
|
||||||
// Attempt to move parent to its own grandparent
|
parent: childFolder.uuid
|
||||||
await page.locator('button[title="Show selected item in tree"]').click();
|
});
|
||||||
|
|
||||||
const treePane = page.getByRole('tree', {
|
// Attempt to move parent to its own grandparent
|
||||||
name: 'Main Tree'
|
await page.locator('button[title="Show selected item in tree"]').click();
|
||||||
});
|
|
||||||
await treePane.getByRole('treeitem', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: 'Parent Folder'
|
name: 'Main Tree'
|
||||||
}).click({
|
});
|
||||||
button: 'right'
|
await treePane
|
||||||
});
|
.getByRole('treeitem', {
|
||||||
|
name: 'Parent Folder'
|
||||||
await page.getByRole('menuitem', {
|
})
|
||||||
name: /Move/
|
.click({
|
||||||
}).click();
|
button: 'right'
|
||||||
|
});
|
||||||
const createModalTree = page.getByRole('tree', {
|
|
||||||
name: "Create Modal Tree"
|
await page
|
||||||
});
|
.getByRole('menuitem', {
|
||||||
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
name: /Move/
|
||||||
name: myItemsFolderName
|
})
|
||||||
});
|
.click();
|
||||||
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
|
||||||
await myItemsLocatorTreeItem.click();
|
const createModalTree = page.getByRole('tree', {
|
||||||
|
name: 'Create Modal Tree'
|
||||||
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
});
|
||||||
name: parentFolder.name
|
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
});
|
name: myItemsFolderName
|
||||||
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
});
|
||||||
await parentFolderLocatorTreeItem.click();
|
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await myItemsLocatorTreeItem.click();
|
||||||
|
|
||||||
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
name: new RegExp(childFolder.name)
|
name: parentFolder.name
|
||||||
});
|
});
|
||||||
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await childFolderLocatorTreeItem.click();
|
await parentFolderLocatorTreeItem.click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
|
||||||
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
name: grandchildFolder.name
|
name: new RegExp(childFolder.name)
|
||||||
});
|
});
|
||||||
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await grandchildFolderLocatorTreeItem.click();
|
await childFolderLocatorTreeItem.click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
|
||||||
await parentFolderLocatorTreeItem.click();
|
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
name: grandchildFolder.name
|
||||||
await page.locator('[aria-label="Cancel"]').click();
|
});
|
||||||
|
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
// Move Child Folder from Parent Folder to My Items
|
await grandchildFolderLocatorTreeItem.click();
|
||||||
await treePane.getByRole('treeitem', {
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
name: new RegExp(childFolder.name)
|
|
||||||
}).click({
|
await parentFolderLocatorTreeItem.click();
|
||||||
button: 'right'
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
});
|
await page.locator('[aria-label="Cancel"]').click();
|
||||||
await page.getByRole('menuitem', {
|
|
||||||
name: /Move/
|
// Move Child Folder from Parent Folder to My Items
|
||||||
}).click();
|
await treePane
|
||||||
await myItemsLocatorTreeItem.click();
|
.getByRole('treeitem', {
|
||||||
|
name: new RegExp(childFolder.name)
|
||||||
await page.locator('[aria-label="Save"]').click();
|
})
|
||||||
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
.click({
|
||||||
name: myItemsFolderName
|
button: 'right'
|
||||||
});
|
});
|
||||||
|
await page
|
||||||
// Expect that Child Folder is in My Items, the root folder
|
.getByRole('menuitem', {
|
||||||
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
name: /Move/
|
||||||
});
|
})
|
||||||
test('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({ page, openmctConfig }) => {
|
.click();
|
||||||
const { myItemsFolderName } = openmctConfig;
|
await myItemsLocatorTreeItem.click();
|
||||||
|
|
||||||
// Go to Open MCT
|
await page.locator('[aria-label="Save"]').click();
|
||||||
await page.goto('./');
|
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: myItemsFolderName
|
||||||
// Create Telemetry Table
|
});
|
||||||
let telemetryTable = 'Test Telemetry Table';
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
// Expect that Child Folder is in My Items, the root folder
|
||||||
await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
|
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
});
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
|
test('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({
|
||||||
|
page,
|
||||||
await page.locator('button:has-text("OK")').click();
|
openmctConfig
|
||||||
|
}) => {
|
||||||
// Finish editing and save Telemetry Table
|
const { myItemsFolderName } = openmctConfig;
|
||||||
await page.locator('.c-button--menu.c-button--major.icon-save').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
// Go to Open MCT
|
||||||
|
await page.goto('./');
|
||||||
// Create New Folder Basic Domain Object
|
|
||||||
let folder = 'Test Folder';
|
// Create Telemetry Table
|
||||||
await page.locator('button:has-text("Create")').click();
|
let telemetryTable = 'Test Telemetry Table';
|
||||||
await page.locator('li[role="menuitem"]:has-text("Folder")').click();
|
await page.locator('button:has-text("Create")').click();
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
|
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||||
|
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
|
||||||
// See if it's possible to put the folder in the Telemetry object during creation (Soft Assert)
|
|
||||||
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
await page.locator('button:has-text("OK")').click();
|
||||||
let okButton = page.locator('button.c-button.c-button--major:has-text("OK")');
|
|
||||||
let okButtonStateDisabled = await okButton.isDisabled();
|
// Finish editing and save Telemetry Table
|
||||||
expect.soft(okButtonStateDisabled).toBeTruthy();
|
await page.locator('.c-button--menu.c-button--major.icon-save').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
// Continue test regardless of assertion and create it in My Items
|
|
||||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
// Create New Folder Basic Domain Object
|
||||||
await page.locator('button:has-text("OK")').click();
|
let folder = 'Test Folder';
|
||||||
|
await page.locator('button:has-text("Create")').click();
|
||||||
// Open My Items
|
await page.locator('li[role="menuitem"]:has-text("Folder")').click();
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||||
|
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
|
||||||
// Select Folder Object and select Move from context menu
|
|
||||||
await Promise.all([
|
// See if it's possible to put the folder in the Telemetry object during creation (Soft Assert)
|
||||||
page.waitForNavigation(),
|
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
||||||
page.locator(`a:has-text("${folder}")`).click()
|
let okButton = page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||||
]);
|
let okButtonStateDisabled = await okButton.isDisabled();
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-tree__item__label .c-tree__item__type-icon').click({
|
expect.soft(okButtonStateDisabled).toBeTruthy();
|
||||||
button: 'right'
|
|
||||||
});
|
// Continue test regardless of assertion and create it in My Items
|
||||||
await page.locator('li.icon-move').click();
|
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
// See if it's possible to put the folder in the Telemetry object after creation
|
|
||||||
await page.locator(`text=Location Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
// Open My Items
|
||||||
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||||
let okButton2 = page.locator('button.c-button.c-button--major:has-text("OK")');
|
|
||||||
let okButtonStateDisabled2 = await okButton2.isDisabled();
|
// Select Folder Object and select Move from context menu
|
||||||
expect(okButtonStateDisabled2).toBeTruthy();
|
await Promise.all([page.waitForNavigation(), page.locator(`a:has-text("${folder}")`).click()]);
|
||||||
});
|
await page
|
||||||
|
.locator('.c-tree__item.is-navigated-object .c-tree__item__label .c-tree__item__type-icon')
|
||||||
test('Create a basic object and verify that it can be linked to another folder', async ({ page, openmctConfig }) => {
|
.click({
|
||||||
const { myItemsFolderName } = openmctConfig;
|
button: 'right'
|
||||||
|
});
|
||||||
// Go to Open MCT
|
await page.locator('li.icon-move').click();
|
||||||
await page.goto('./');
|
|
||||||
|
// See if it's possible to put the folder in the Telemetry object after creation
|
||||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
await page.locator(`text=Location Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||||
type: 'Folder',
|
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
||||||
name: 'Parent Folder'
|
let okButton2 = page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||||
});
|
let okButtonStateDisabled2 = await okButton2.isDisabled();
|
||||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
expect(okButtonStateDisabled2).toBeTruthy();
|
||||||
type: 'Folder',
|
});
|
||||||
name: 'Child Folder',
|
|
||||||
parent: parentFolder.uuid
|
test('Create a basic object and verify that it can be linked to another folder', async ({
|
||||||
});
|
page,
|
||||||
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
openmctConfig
|
||||||
type: 'Folder',
|
}) => {
|
||||||
name: 'Grandchild Folder',
|
const { myItemsFolderName } = openmctConfig;
|
||||||
parent: childFolder.uuid
|
|
||||||
});
|
// Go to Open MCT
|
||||||
|
await page.goto('./');
|
||||||
// Attempt to move parent to its own grandparent
|
|
||||||
await page.locator('button[title="Show selected item in tree"]').click();
|
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
const treePane = page.getByRole('tree', {
|
name: 'Parent Folder'
|
||||||
name: 'Main Tree'
|
});
|
||||||
});
|
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||||
await treePane.getByRole('treeitem', {
|
type: 'Folder',
|
||||||
name: 'Parent Folder'
|
name: 'Child Folder',
|
||||||
}).click({
|
parent: parentFolder.uuid
|
||||||
button: 'right'
|
});
|
||||||
});
|
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
await page.getByRole('menuitem', {
|
name: 'Grandchild Folder',
|
||||||
name: /Move/
|
parent: childFolder.uuid
|
||||||
}).click();
|
});
|
||||||
|
|
||||||
const createModalTree = page.getByRole('tree', {
|
// Attempt to move parent to its own grandparent
|
||||||
name: "Create Modal Tree"
|
await page.locator('button[title="Show selected item in tree"]').click();
|
||||||
});
|
|
||||||
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: myItemsFolderName
|
name: 'Main Tree'
|
||||||
});
|
});
|
||||||
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await treePane
|
||||||
await myItemsLocatorTreeItem.click();
|
.getByRole('treeitem', {
|
||||||
|
name: 'Parent Folder'
|
||||||
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
})
|
||||||
name: parentFolder.name
|
.click({
|
||||||
});
|
button: 'right'
|
||||||
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
});
|
||||||
await parentFolderLocatorTreeItem.click();
|
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await page
|
||||||
|
.getByRole('menuitem', {
|
||||||
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
name: /Move/
|
||||||
name: new RegExp(childFolder.name)
|
})
|
||||||
});
|
.click();
|
||||||
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
|
||||||
await childFolderLocatorTreeItem.click();
|
const createModalTree = page.getByRole('tree', {
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
name: 'Create Modal Tree'
|
||||||
|
});
|
||||||
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
name: grandchildFolder.name
|
name: myItemsFolderName
|
||||||
});
|
});
|
||||||
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await grandchildFolderLocatorTreeItem.click();
|
await myItemsLocatorTreeItem.click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
|
||||||
|
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
await parentFolderLocatorTreeItem.click();
|
name: parentFolder.name
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
});
|
||||||
await page.locator('[aria-label="Cancel"]').click();
|
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
|
await parentFolderLocatorTreeItem.click();
|
||||||
// Move Child Folder from Parent Folder to My Items
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
await treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(childFolder.name)
|
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
}).click({
|
name: new RegExp(childFolder.name)
|
||||||
button: 'right'
|
});
|
||||||
});
|
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await page.getByRole('menuitem', {
|
await childFolderLocatorTreeItem.click();
|
||||||
name: /Link/
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
}).click();
|
|
||||||
await myItemsLocatorTreeItem.click();
|
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
|
name: grandchildFolder.name
|
||||||
await page.locator('[aria-label="Save"]').click();
|
});
|
||||||
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
name: myItemsFolderName
|
await grandchildFolderLocatorTreeItem.click();
|
||||||
});
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
|
||||||
// Expect that Child Folder is in My Items, the root folder
|
await parentFolderLocatorTreeItem.click();
|
||||||
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
});
|
await page.locator('[aria-label="Cancel"]').click();
|
||||||
});
|
|
||||||
|
// Move Child Folder from Parent Folder to My Items
|
||||||
test.fixme('Cannot move a previously created domain object to non-peristable object in Move Modal', async ({ page }) => {
|
await treePane
|
||||||
//Create a domain object
|
.getByRole('treeitem', {
|
||||||
//Save Domain object
|
name: new RegExp(childFolder.name)
|
||||||
//Move Object and verify that cannot select non-persistable object
|
})
|
||||||
//Move Object to My Items
|
.click({
|
||||||
//Verify successful move
|
button: 'right'
|
||||||
});
|
});
|
||||||
|
await page
|
||||||
|
.getByRole('menuitem', {
|
||||||
|
name: /Link/
|
||||||
|
})
|
||||||
|
.click();
|
||||||
|
await myItemsLocatorTreeItem.click();
|
||||||
|
|
||||||
|
await page.locator('[aria-label="Save"]').click();
|
||||||
|
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: myItemsFolderName
|
||||||
|
});
|
||||||
|
|
||||||
|
// Expect that Child Folder is in My Items, the root folder
|
||||||
|
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.fixme(
|
||||||
|
'Cannot move a previously created domain object to non-persistable object in Move Modal',
|
||||||
|
async ({ page }) => {
|
||||||
|
//Create a domain object
|
||||||
|
//Save Domain object
|
||||||
|
//Move Object and verify that cannot select non-persistable object
|
||||||
|
//Move Object to My Items
|
||||||
|
//Verify successful move
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -28,85 +28,90 @@ const { createDomainObjectWithDefaults, createNotification } = require('../../ap
|
|||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
|
|
||||||
test.describe('Notifications List', () => {
|
test.describe('Notifications List', () => {
|
||||||
test('Notifications can be dismissed individually', async ({ page }) => {
|
test.fixme('Notifications can be dismissed individually', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/6122'
|
description: 'https://github.com/nasa/openmct/issues/6820'
|
||||||
});
|
|
||||||
|
|
||||||
// Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create an error notification with the message "Error message"
|
|
||||||
await createNotification(page, {
|
|
||||||
severity: 'error',
|
|
||||||
message: 'Error message'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create an alert notification with the message "Alert message"
|
|
||||||
await createNotification(page, {
|
|
||||||
severity: 'alert',
|
|
||||||
message: 'Alert message'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify that there is a button with aria-label "Review 2 Notifications"
|
|
||||||
expect(await page.locator('button[aria-label="Review 2 Notifications"]').count()).toBe(1);
|
|
||||||
|
|
||||||
// Click on button with aria-label "Review 2 Notifications"
|
|
||||||
await page.click('button[aria-label="Review 2 Notifications"]');
|
|
||||||
|
|
||||||
// Click on button with aria-label="Dismiss notification of Error message"
|
|
||||||
await page.click('button[aria-label="Dismiss notification of Error message"]');
|
|
||||||
|
|
||||||
// Verify there is no a notification (listitem) with the text "Error message" since it was dismissed
|
|
||||||
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).not.toContain('Error message');
|
|
||||||
|
|
||||||
// Verify there is still a notification (listitem) with the text "Alert message"
|
|
||||||
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).toContain('Alert message');
|
|
||||||
|
|
||||||
// Click on button with aria-label="Dismiss notification of Alert message"
|
|
||||||
await page.click('button[aria-label="Dismiss notification of Alert message"]');
|
|
||||||
|
|
||||||
// Verify that there is no dialog since the notification overlay was closed automatically after all notifications were dismissed
|
|
||||||
expect(await page.locator('div[role="dialog"]').count()).toBe(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create an error notification with the message "Error message"
|
||||||
|
await createNotification(page, {
|
||||||
|
severity: 'error',
|
||||||
|
message: 'Error message'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create an alert notification with the message "Alert message"
|
||||||
|
await createNotification(page, {
|
||||||
|
severity: 'alert',
|
||||||
|
message: 'Alert message'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Verify that there is a button with aria-label "Review 2 Notifications"
|
||||||
|
expect(await page.locator('button[aria-label="Review 2 Notifications"]').count()).toBe(1);
|
||||||
|
|
||||||
|
// Click on button with aria-label "Review 2 Notifications"
|
||||||
|
await page.click('button[aria-label="Review 2 Notifications"]');
|
||||||
|
|
||||||
|
// Click on button with aria-label="Dismiss notification of Error message"
|
||||||
|
await page.click('button[aria-label="Dismiss notification of Error message"]');
|
||||||
|
|
||||||
|
// Verify there is no a notification (listitem) with the text "Error message" since it was dismissed
|
||||||
|
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).not.toContain(
|
||||||
|
'Error message'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Verify there is still a notification (listitem) with the text "Alert message"
|
||||||
|
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).toContain(
|
||||||
|
'Alert message'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Click on button with aria-label="Dismiss notification of Alert message"
|
||||||
|
await page.click('button[aria-label="Dismiss notification of Alert message"]');
|
||||||
|
|
||||||
|
// Verify that there is no dialog since the notification overlay was closed automatically after all notifications were dismissed
|
||||||
|
expect(await page.locator('div[role="dialog"]').count()).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Notification Overlay', () => {
|
test.describe('Notification Overlay', () => {
|
||||||
test('Closing notification list after notification banner disappeared does not cause it to open automatically', async ({ page }) => {
|
test('Closing notification list after notification banner disappeared does not cause it to open automatically', async ({
|
||||||
test.info().annotations.push({
|
page
|
||||||
type: 'issue',
|
}) => {
|
||||||
description: 'https://github.com/nasa/openmct/issues/6130'
|
test.info().annotations.push({
|
||||||
});
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6130'
|
||||||
// Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create a new Display Layout object
|
|
||||||
await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
|
|
||||||
|
|
||||||
// Click on the button "Review 1 Notification"
|
|
||||||
await page.click('button[aria-label="Review 1 Notification"]');
|
|
||||||
|
|
||||||
// Verify that Notification List is open
|
|
||||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
|
||||||
|
|
||||||
// Wait until there is no Notification Banner
|
|
||||||
await page.waitForSelector('div[role="alert"]', { state: 'detached'});
|
|
||||||
|
|
||||||
// Click on the "Close" button of the Notification List
|
|
||||||
await page.click('button[aria-label="Close"]');
|
|
||||||
|
|
||||||
// On the Display Layout object, click on the "Edit" button
|
|
||||||
await page.click('button[title="Edit"]');
|
|
||||||
|
|
||||||
// Click on the "Save" button
|
|
||||||
await page.click('button[title="Save"]');
|
|
||||||
|
|
||||||
// Click on the "Save and Finish Editing" option
|
|
||||||
await page.click('li[title="Save and Finish Editing"]');
|
|
||||||
|
|
||||||
// Verify that Notification List is NOT open
|
|
||||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create a new Display Layout object
|
||||||
|
await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
|
||||||
|
|
||||||
|
// Click on the button "Review 1 Notification"
|
||||||
|
await page.click('button[aria-label="Review 1 Notification"]');
|
||||||
|
|
||||||
|
// Verify that Notification List is open
|
||||||
|
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
||||||
|
|
||||||
|
// Wait until there is no Notification Banner
|
||||||
|
await page.waitForSelector('div[role="alert"]', { state: 'detached' });
|
||||||
|
|
||||||
|
// Click on the "Close" button of the Notification List
|
||||||
|
await page.click('button[aria-label="Close"]');
|
||||||
|
|
||||||
|
// On the Display Layout object, click on the "Edit" button
|
||||||
|
await page.click('button[title="Edit"]');
|
||||||
|
|
||||||
|
// Click on the "Save" button
|
||||||
|
await page.click('button[title="Save"]');
|
||||||
|
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Verify that Notification List is NOT open
|
||||||
|
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -20,66 +20,104 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
const { test, expect } = require('../../../pluginFixtures');
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
const { createPlanFromJSON, createDomainObjectWithDefaults, selectInspectorTab } = require('../../../appActions');
|
const { createPlanFromJSON, createDomainObjectWithDefaults } = require('../../../appActions');
|
||||||
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
||||||
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json');
|
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json');
|
||||||
const { assertPlanActivities, setBoundsToSpanAllActivities } = require('../../../helper/planningUtils');
|
const {
|
||||||
|
assertPlanActivities,
|
||||||
|
setBoundsToSpanAllActivities
|
||||||
|
} = require('../../../helper/planningUtils');
|
||||||
const { getPreciseDuration } = require('../../../../src/utils/duration');
|
const { getPreciseDuration } = require('../../../../src/utils/duration');
|
||||||
|
|
||||||
test.describe("Gantt Chart", () => {
|
test.describe('Gantt Chart', () => {
|
||||||
let ganttChart;
|
let ganttChart;
|
||||||
test.beforeEach(async ({ page }) => {
|
let plan;
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
test.beforeEach(async ({ page }) => {
|
||||||
ganttChart = await createDomainObjectWithDefaults(page, {
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
type: 'Gantt Chart'
|
ganttChart = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Gantt Chart'
|
||||||
await createPlanFromJSON(page, {
|
});
|
||||||
json: testPlan1,
|
plan = await createPlanFromJSON(page, {
|
||||||
parent: ganttChart.uuid
|
json: testPlan1,
|
||||||
});
|
parent: ganttChart.uuid
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Displays all plan events', async ({ page }) => {
|
||||||
|
await page.goto(ganttChart.url);
|
||||||
|
|
||||||
|
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
||||||
|
});
|
||||||
|
test('Replaces a plan with a new plan', async ({ page }) => {
|
||||||
|
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
||||||
|
await createPlanFromJSON(page, {
|
||||||
|
json: testPlan2,
|
||||||
|
parent: ganttChart.uuid
|
||||||
|
});
|
||||||
|
const replaceModal = page
|
||||||
|
.getByRole('dialog')
|
||||||
|
.filter({ hasText: 'This action will replace the current Plan. Do you want to continue?' });
|
||||||
|
await expect(replaceModal).toBeVisible();
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
|
||||||
|
await assertPlanActivities(page, testPlan2, ganttChart.url);
|
||||||
|
});
|
||||||
|
test('Can select a single activity and display its details in the inspector', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.slow();
|
||||||
|
await page.goto(ganttChart.url);
|
||||||
|
|
||||||
|
await setBoundsToSpanAllActivities(page, testPlan1, ganttChart.url);
|
||||||
|
|
||||||
|
const activities = Object.values(testPlan1).flat();
|
||||||
|
const activity = activities[0];
|
||||||
|
await page
|
||||||
|
.locator('g')
|
||||||
|
.filter({ hasText: new RegExp(activity.name) })
|
||||||
|
.click();
|
||||||
|
await page.getByRole('tab', { name: 'Activity' }).click();
|
||||||
|
|
||||||
|
const startDateTime = await page
|
||||||
|
.locator(
|
||||||
|
'.c-inspect-properties__label:has-text("Start DateTime")+.c-inspect-properties__value'
|
||||||
|
)
|
||||||
|
.innerText();
|
||||||
|
const endDateTime = await page
|
||||||
|
.locator('.c-inspect-properties__label:has-text("End DateTime")+.c-inspect-properties__value')
|
||||||
|
.innerText();
|
||||||
|
const duration = await page
|
||||||
|
.locator('.c-inspect-properties__label:has-text("duration")+.c-inspect-properties__value')
|
||||||
|
.innerText();
|
||||||
|
|
||||||
|
const expectedStartDate = new Date(activity.start).toISOString();
|
||||||
|
const actualStartDate = new Date(startDateTime).toISOString();
|
||||||
|
const expectedEndDate = new Date(activity.end).toISOString();
|
||||||
|
const actualEndDate = new Date(endDateTime).toISOString();
|
||||||
|
const expectedDuration = getPreciseDuration(activity.end - activity.start);
|
||||||
|
const actualDuration = duration;
|
||||||
|
|
||||||
|
expect(expectedStartDate).toEqual(actualStartDate);
|
||||||
|
expect(expectedEndDate).toEqual(actualEndDate);
|
||||||
|
expect(expectedDuration).toEqual(actualDuration);
|
||||||
|
});
|
||||||
|
test("Displays a Plan's draft status", async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6641'
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Displays all plan events", async ({ page }) => {
|
// Mark the Plan's status as draft in the OpenMCT API
|
||||||
await page.goto(ganttChart.url);
|
await page.evaluate(async (planObject) => {
|
||||||
|
await window.openmct.status.set(planObject.uuid, 'draft');
|
||||||
|
}, plan);
|
||||||
|
|
||||||
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
// Navigate to the Gantt Chart
|
||||||
});
|
await page.goto(ganttChart.url);
|
||||||
test("Replaces a plan with a new plan", async ({ page }) => {
|
|
||||||
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
|
||||||
await createPlanFromJSON(page, {
|
|
||||||
json: testPlan2,
|
|
||||||
parent: ganttChart.uuid
|
|
||||||
});
|
|
||||||
const replaceModal = page.getByRole('dialog').filter({ hasText: "This action will replace the current Plan. Do you want to continue?" });
|
|
||||||
await expect(replaceModal).toBeVisible();
|
|
||||||
await page.getByRole('button', { name: 'OK' }).click();
|
|
||||||
|
|
||||||
await assertPlanActivities(page, testPlan2, ganttChart.url);
|
// Assert that the Plan's status is displayed as draft
|
||||||
});
|
expect(await page.locator('.u-contents.c-swimlane.is-status--draft').count()).toBe(
|
||||||
test("Can select a single activity and display its details in the inspector", async ({ page }) => {
|
Object.keys(testPlan1).length
|
||||||
test.slow();
|
);
|
||||||
await page.goto(ganttChart.url);
|
});
|
||||||
|
|
||||||
await setBoundsToSpanAllActivities(page, testPlan1, ganttChart.url);
|
|
||||||
|
|
||||||
const activities = Object.values(testPlan1).flat();
|
|
||||||
const activity = activities[0];
|
|
||||||
await page.locator('g').filter({ hasText: new RegExp(activity.name) }).click();
|
|
||||||
await selectInspectorTab(page, 'Activity');
|
|
||||||
|
|
||||||
const startDateTime = await page.locator('.c-inspect-properties__label:has-text("Start DateTime")+.c-inspect-properties__value').innerText();
|
|
||||||
const endDateTime = await page.locator('.c-inspect-properties__label:has-text("End DateTime")+.c-inspect-properties__value').innerText();
|
|
||||||
const duration = await page.locator('.c-inspect-properties__label:has-text("duration")+.c-inspect-properties__value').innerText();
|
|
||||||
|
|
||||||
const expectedStartDate = new Date(activity.start).toISOString();
|
|
||||||
const actualStartDate = new Date(startDateTime).toISOString();
|
|
||||||
const expectedEndDate = new Date(activity.end).toISOString();
|
|
||||||
const actualEndDate = new Date(endDateTime).toISOString();
|
|
||||||
const expectedDuration = getPreciseDuration(activity.end - activity.start);
|
|
||||||
const actualDuration = duration;
|
|
||||||
|
|
||||||
expect(expectedStartDate).toEqual(actualStartDate);
|
|
||||||
expect(expectedEndDate).toEqual(actualEndDate);
|
|
||||||
expect(expectedDuration).toEqual(actualDuration);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -21,19 +21,34 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
const { test } = require('../../../pluginFixtures');
|
const { test } = require('../../../pluginFixtures');
|
||||||
const { createPlanFromJSON } = require('../../../appActions');
|
const { createPlanFromJSON } = require('../../../appActions');
|
||||||
|
const { addPlanGetInterceptor } = require('../../../helper/planningUtils.js');
|
||||||
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
||||||
const { assertPlanActivities } = require('../../../helper/planningUtils');
|
const testPlanWithOrderedLanes = require('../../../test-data/examplePlans/ExamplePlanWithOrderedLanes.json');
|
||||||
|
const {
|
||||||
|
assertPlanActivities,
|
||||||
|
assertPlanOrderedSwimLanes
|
||||||
|
} = require('../../../helper/planningUtils');
|
||||||
|
|
||||||
test.describe("Plan", () => {
|
test.describe('Plan', () => {
|
||||||
let plan;
|
let plan;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
plan = await createPlanFromJSON(page, {
|
plan = await createPlanFromJSON(page, {
|
||||||
json: testPlan1
|
json: testPlan1
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("Displays all plan events", async ({ page }) => {
|
test('Displays all plan events', async ({ page }) => {
|
||||||
await assertPlanActivities(page, testPlan1, plan.url);
|
await assertPlanActivities(page, testPlan1, plan.url);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Displays plans with ordered swim lanes configuration', async ({ page }) => {
|
||||||
|
// Add configuration for swim lanes
|
||||||
|
await addPlanGetInterceptor(page);
|
||||||
|
// Create the plan
|
||||||
|
const planWithSwimLanes = await createPlanFromJSON(page, {
|
||||||
|
json: testPlanWithOrderedLanes
|
||||||
});
|
});
|
||||||
|
await assertPlanOrderedSwimLanes(page, testPlanWithOrderedLanes, planWithSwimLanes.url);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
124
e2e/tests/functional/planning/timelist.e2e.spec.js
Normal file
124
e2e/tests/functional/planning/timelist.e2e.spec.js
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
|
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../../appActions');
|
||||||
|
|
||||||
|
const testPlan = {
|
||||||
|
TEST_GROUP: [
|
||||||
|
{
|
||||||
|
name: 'Past event 1',
|
||||||
|
start: 1660320408000,
|
||||||
|
end: 1660343797000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 2',
|
||||||
|
start: 1660406808000,
|
||||||
|
end: 1660429160000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 3',
|
||||||
|
start: 1660493208000,
|
||||||
|
end: 1660503981000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 4',
|
||||||
|
start: 1660579608000,
|
||||||
|
end: 1660624108000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 5',
|
||||||
|
start: 1660666008000,
|
||||||
|
end: 1660681529000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
test.describe('Time List', () => {
|
||||||
|
test('Create a Time List, add a single Plan to it and verify all the activities are displayed with no milliseconds', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
// Goto baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const timelist = await test.step('Create a Time List', async () => {
|
||||||
|
const createdTimeList = await createDomainObjectWithDefaults(page, { type: 'Time List' });
|
||||||
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
|
expect(objectName).toBe(createdTimeList.name);
|
||||||
|
|
||||||
|
return createdTimeList;
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Create a Plan and add it to the timelist', async () => {
|
||||||
|
const createdPlan = await createPlanFromJSON(page, {
|
||||||
|
name: 'Test Plan',
|
||||||
|
json: testPlan
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(timelist.url);
|
||||||
|
// Expand the tree to show the plan
|
||||||
|
await page.click("button[title='Show selected item in tree']");
|
||||||
|
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
|
||||||
|
await page.click("button[title='Save']");
|
||||||
|
await page.click("li[title='Save and Finish Editing']");
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
||||||
|
|
||||||
|
await page.goto(timelist.url);
|
||||||
|
|
||||||
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
|
await page.goto(
|
||||||
|
`${timelist.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=timelist.view`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Verify all events are displayed
|
||||||
|
const eventCount = await page.locator('.js-list-item').count();
|
||||||
|
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Does not show milliseconds in times', async () => {
|
||||||
|
// Get the first activity
|
||||||
|
const row = page.locator('.js-list-item').first();
|
||||||
|
// Verify that none fo the times have milliseconds displayed.
|
||||||
|
// Example: 2024-11-17T16:00:00Z is correct and 2024-11-17T16:00:00.000Z is wrong
|
||||||
|
|
||||||
|
await expect(row.locator('.--start')).not.toContainText('.');
|
||||||
|
await expect(row.locator('.--end')).not.toContainText('.');
|
||||||
|
await expect(row.locator('.--duration')).not.toContainText('.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -21,161 +21,153 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../../pluginFixtures');
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createPlanFromJSON,
|
||||||
|
setIndependentTimeConductorBounds
|
||||||
|
} = require('../../../appActions');
|
||||||
|
|
||||||
const testPlan = {
|
const testPlan = {
|
||||||
"TEST_GROUP": [
|
TEST_GROUP: [
|
||||||
{
|
{
|
||||||
"name": "Past event 1",
|
name: 'Past event 1',
|
||||||
"start": 1660320408000,
|
start: 1660320408000,
|
||||||
"end": 1660343797000,
|
end: 1660343797000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 2",
|
name: 'Past event 2',
|
||||||
"start": 1660406808000,
|
start: 1660406808000,
|
||||||
"end": 1660429160000,
|
end: 1660429160000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 3",
|
name: 'Past event 3',
|
||||||
"start": 1660493208000,
|
start: 1660493208000,
|
||||||
"end": 1660503981000,
|
end: 1660503981000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 4",
|
name: 'Past event 4',
|
||||||
"start": 1660579608000,
|
start: 1660579608000,
|
||||||
"end": 1660624108000,
|
end: 1660624108000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 5",
|
name: 'Past event 5',
|
||||||
"start": 1660666008000,
|
start: 1660666008000,
|
||||||
"end": 1660681529000,
|
end: 1660681529000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
test.describe("Time Strip", () => {
|
test.describe('Time Strip', () => {
|
||||||
test("Create two Time Strips, add a single Plan to both, and verify they can have separate Indepdenent Time Contexts @unstable", async ({ page }) => {
|
test('Create two Time Strips, add a single Plan to both, and verify they can have separate Independent Time Contexts @unstable', async ({
|
||||||
test.info().annotations.push({
|
page
|
||||||
type: 'issue',
|
}) => {
|
||||||
description: 'https://github.com/nasa/openmct/issues/5627'
|
test.info().annotations.push({
|
||||||
});
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5627'
|
||||||
// Constant locators
|
|
||||||
const independentTimeConductorInputs = page.locator('.l-shell__main-independent-time-conductor .c-input--datetime');
|
|
||||||
const activityBounds = page.locator('.activity-bounds');
|
|
||||||
|
|
||||||
// Goto baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
const timestrip = await test.step("Create a Time Strip", async () => {
|
|
||||||
const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
|
|
||||||
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
|
||||||
expect(objectName).toBe(createdTimeStrip.name);
|
|
||||||
|
|
||||||
return createdTimeStrip;
|
|
||||||
});
|
|
||||||
|
|
||||||
const plan = await test.step("Create a Plan and add it to the timestrip", async () => {
|
|
||||||
const createdPlan = await createPlanFromJSON(page, {
|
|
||||||
name: 'Test Plan',
|
|
||||||
json: testPlan
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto(timestrip.url);
|
|
||||||
// Expand the tree to show the plan
|
|
||||||
await page.click("button[title='Show selected item in tree']");
|
|
||||||
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
|
|
||||||
await page.click("button[title='Save']");
|
|
||||||
await page.click("li[title='Save and Finish Editing']");
|
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
|
||||||
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
|
||||||
|
|
||||||
// Switch to fixed time mode with all plan events within the bounds
|
|
||||||
await page.goto(`${timestrip.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=time-strip.view`);
|
|
||||||
|
|
||||||
// Verify all events are displayed
|
|
||||||
const eventCount = await page.locator('.activity-bounds').count();
|
|
||||||
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
|
||||||
|
|
||||||
return createdPlan;
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step("TimeStrip can use the Independent Time Conductor", async () => {
|
|
||||||
// Activate Independent Time Conductor in Fixed Time Mode
|
|
||||||
await page.click('.c-toggle-switch__slider');
|
|
||||||
expect(await activityBounds.count()).toEqual(0);
|
|
||||||
|
|
||||||
// Set the independent time bounds so that only one event is shown
|
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
|
||||||
const endBound = testPlan.TEST_GROUP[0].end;
|
|
||||||
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
|
||||||
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
|
||||||
|
|
||||||
await independentTimeConductorInputs.nth(0).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(0).fill(startBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill(endBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
expect(await activityBounds.count()).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step("Can have multiple TimeStrips with the same plan linked and different Independent Time Contexts", async () => {
|
|
||||||
// Create another Time Strip and verify that it has been created
|
|
||||||
const createdTimeStrip = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Time Strip',
|
|
||||||
name: "Another Time Strip"
|
|
||||||
});
|
|
||||||
|
|
||||||
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
|
||||||
expect(objectName).toBe(createdTimeStrip.name);
|
|
||||||
|
|
||||||
// Drag the existing Plan onto the newly created Time Strip, and save.
|
|
||||||
await page.dragAndDrop(`role=treeitem[name=/${plan.name}/]`, '.c-object-view');
|
|
||||||
await page.click("button[title='Save']");
|
|
||||||
await page.click("li[title='Save and Finish Editing']");
|
|
||||||
|
|
||||||
// Activate Independent Time Conductor in Fixed Time Mode
|
|
||||||
await page.click('.c-toggle-switch__slider');
|
|
||||||
|
|
||||||
// All events should be displayed at this point because the
|
|
||||||
// initial independent context bounds will match the global bounds
|
|
||||||
expect(await activityBounds.count()).toEqual(5);
|
|
||||||
|
|
||||||
// Set the independent time bounds so that two events are shown
|
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
|
||||||
const endBound = testPlan.TEST_GROUP[1].end;
|
|
||||||
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
|
||||||
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
|
||||||
|
|
||||||
await independentTimeConductorInputs.nth(0).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(0).fill(startBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill(endBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
|
|
||||||
// Verify that two events are displayed
|
|
||||||
expect(await activityBounds.count()).toEqual(2);
|
|
||||||
|
|
||||||
// Switch to the previous Time Strip and verify that only one event is displayed
|
|
||||||
await page.goto(timestrip.url);
|
|
||||||
expect(await activityBounds.count()).toEqual(1);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Constant locators
|
||||||
|
const activityBounds = page.locator('.activity-bounds');
|
||||||
|
|
||||||
|
// Goto baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const timestrip = await test.step('Create a Time Strip', async () => {
|
||||||
|
const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
|
||||||
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
|
expect(objectName).toBe(createdTimeStrip.name);
|
||||||
|
|
||||||
|
return createdTimeStrip;
|
||||||
|
});
|
||||||
|
|
||||||
|
const plan = await test.step('Create a Plan and add it to the timestrip', async () => {
|
||||||
|
const createdPlan = await createPlanFromJSON(page, {
|
||||||
|
name: 'Test Plan',
|
||||||
|
json: testPlan
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(timestrip.url);
|
||||||
|
// Expand the tree to show the plan
|
||||||
|
await page.click("button[title='Show selected item in tree']");
|
||||||
|
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
|
||||||
|
await page.click("button[title='Save']");
|
||||||
|
await page.click("li[title='Save and Finish Editing']");
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
||||||
|
|
||||||
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
|
await page.goto(
|
||||||
|
`${timestrip.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=time-strip.view`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Verify all events are displayed
|
||||||
|
const eventCount = await page.locator('.activity-bounds').count();
|
||||||
|
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
||||||
|
|
||||||
|
return createdPlan;
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('TimeStrip can use the Independent Time Conductor', async () => {
|
||||||
|
expect(await activityBounds.count()).toEqual(5);
|
||||||
|
|
||||||
|
// Set the independent time bounds so that only one event is shown
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[0].end;
|
||||||
|
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
||||||
|
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
||||||
|
|
||||||
|
await setIndependentTimeConductorBounds(page, startBoundString, endBoundString);
|
||||||
|
expect(await activityBounds.count()).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Can have multiple TimeStrips with the same plan linked and different Independent Time Contexts', async () => {
|
||||||
|
// Create another Time Strip and verify that it has been created
|
||||||
|
const createdTimeStrip = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Time Strip',
|
||||||
|
name: 'Another Time Strip'
|
||||||
|
});
|
||||||
|
|
||||||
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
|
expect(objectName).toBe(createdTimeStrip.name);
|
||||||
|
|
||||||
|
// Drag the existing Plan onto the newly created Time Strip, and save.
|
||||||
|
await page.dragAndDrop(`role=treeitem[name=/${plan.name}/]`, '.c-object-view');
|
||||||
|
await page.click("button[title='Save']");
|
||||||
|
await page.click("li[title='Save and Finish Editing']");
|
||||||
|
|
||||||
|
// All events should be displayed at this point because the
|
||||||
|
// initial independent context bounds will match the global bounds
|
||||||
|
expect(await activityBounds.count()).toEqual(5);
|
||||||
|
|
||||||
|
// Set the independent time bounds so that two events are shown
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[1].end;
|
||||||
|
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
||||||
|
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
||||||
|
|
||||||
|
await setIndependentTimeConductorBounds(page, startBoundString, endBoundString);
|
||||||
|
|
||||||
|
// Verify that two events are displayed
|
||||||
|
expect(await activityBounds.count()).toEqual(2);
|
||||||
|
|
||||||
|
// Switch to the previous Time Strip and verify that only one event is displayed
|
||||||
|
await page.goto(timestrip.url);
|
||||||
|
expect(await activityBounds.count()).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -27,40 +27,40 @@ This test suite is dedicated to tests which verify the basic operations surround
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('Clock Generator CRUD Operations', () => {
|
test.describe('Clock Generator CRUD Operations', () => {
|
||||||
|
test('Timezone dropdown will collapse when clicked outside or on dropdown icon again', async ({
|
||||||
test('Timezone dropdown will collapse when clicked outside or on dropdown icon again', async ({ page }) => {
|
page
|
||||||
test.info().annotations.push({
|
}) => {
|
||||||
type: 'issue',
|
test.info().annotations.push({
|
||||||
description: 'https://github.com/nasa/openmct/issues/4878'
|
type: 'issue',
|
||||||
});
|
description: 'https://github.com/nasa/openmct/issues/4878'
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click Clock
|
|
||||||
await page.click('text=Clock');
|
|
||||||
|
|
||||||
// Click .icon-arrow-down
|
|
||||||
await page.locator('.icon-arrow-down').click();
|
|
||||||
//verify if the autocomplete dropdown is visible
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeVisible();
|
|
||||||
// Click .icon-arrow-down
|
|
||||||
await page.locator('.icon-arrow-down').click();
|
|
||||||
|
|
||||||
// Verify clicking on the autocomplete arrow collapses the dropdown
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeHidden();
|
|
||||||
|
|
||||||
// Click timezone input to open dropdown
|
|
||||||
await page.locator('.c-input--autocomplete__input').click();
|
|
||||||
//verify if the autocomplete dropdown is visible
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeVisible();
|
|
||||||
|
|
||||||
// Verify clicking outside the autocomplete dropdown collapses it
|
|
||||||
await page.locator('text=Timezone').click();
|
|
||||||
// Verify clicking on the autocomplete arrow collapses the dropdown
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeHidden();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click Clock
|
||||||
|
await page.getByRole('menuitem').first().click();
|
||||||
|
|
||||||
|
// Click .icon-arrow-down
|
||||||
|
await page.locator('.icon-arrow-down').click();
|
||||||
|
//verify if the autocomplete dropdown is visible
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeVisible();
|
||||||
|
// Click .icon-arrow-down
|
||||||
|
await page.locator('.icon-arrow-down').click();
|
||||||
|
|
||||||
|
// Verify clicking on the autocomplete arrow collapses the dropdown
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeHidden();
|
||||||
|
|
||||||
|
// Click timezone input to open dropdown
|
||||||
|
await page.locator('.c-input--autocomplete__input').click();
|
||||||
|
//verify if the autocomplete dropdown is visible
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeVisible();
|
||||||
|
|
||||||
|
// Verify clicking outside the autocomplete dropdown collapses it
|
||||||
|
await page.locator('text=Timezone').click();
|
||||||
|
// Verify clicking on the autocomplete arrow collapses the dropdown
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeHidden();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -25,17 +25,17 @@
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('Remote Clock', () => {
|
test.describe('Remote Clock', () => {
|
||||||
// eslint-disable-next-line require-await
|
// eslint-disable-next-line require-await
|
||||||
test.fixme('blocks historical requests until first tick is received', async ({ page }) => {
|
test.fixme('blocks historical requests until first tick is received', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/5221'
|
description: 'https://github.com/nasa/openmct/issues/5221'
|
||||||
});
|
|
||||||
// addInitScript to with remote clock
|
|
||||||
// Switch time conductor mode to 'remote clock'
|
|
||||||
// Navigate to telemetry
|
|
||||||
// Verify that the plot renders historical data within the correct bounds
|
|
||||||
// Refresh the page
|
|
||||||
// Verify again that the plot renders historical data within the correct bounds
|
|
||||||
});
|
});
|
||||||
|
// addInitScript to with remote clock
|
||||||
|
// Switch time conductor mode to 'remote clock'
|
||||||
|
// Navigate to telemetry
|
||||||
|
// Verify that the plot renders historical data within the correct bounds
|
||||||
|
// Refresh the page
|
||||||
|
// Verify again that the plot renders historical data within the correct bounds
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,307 +19,357 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
|
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
|
||||||
suite is sharing state between tests which is considered an anti-pattern. Implimenting in this way to
|
suite is sharing state between tests which is considered an anti-pattern. Implementing in this way to
|
||||||
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
|
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures.js');
|
const { test, expect } = require('../../../../pluginFixtures.js');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createExampleTelemetryObject
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
let conditionSetUrl;
|
let conditionSetUrl;
|
||||||
let getConditionSetIdentifierFromUrl;
|
let getConditionSetIdentifierFromUrl;
|
||||||
|
|
||||||
test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
|
test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
|
||||||
test.beforeAll(async ({ browser}) => {
|
test.beforeAll(async ({ browser }) => {
|
||||||
//TODO: This needs to be refactored
|
//TODO: This needs to be refactored
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Condition Set")').click();
|
await page.locator('li[role="menuitem"]:has-text("Condition Set")').click();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('button:has-text("OK")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Save localStorage for future test execution
|
//Save localStorage for future test execution
|
||||||
await context.storageState({ path: './e2e/test-data/recycled_local_storage.json' });
|
await context.storageState({
|
||||||
|
path: path.resolve(__dirname, '../../../../test-data/recycled_local_storage.json')
|
||||||
//Set object identifier from url
|
|
||||||
conditionSetUrl = page.url();
|
|
||||||
|
|
||||||
getConditionSetIdentifierFromUrl = conditionSetUrl.split('/').pop().split('?')[0];
|
|
||||||
console.debug(`getConditionSetIdentifierFromUrl: ${getConditionSetIdentifierFromUrl}`);
|
|
||||||
await page.close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Load localStorage for subsequent tests
|
//Set object identifier from url
|
||||||
test.use({ storageState: './e2e/test-data/recycled_local_storage.json' });
|
conditionSetUrl = page.url();
|
||||||
|
|
||||||
//Begin suite of tests again localStorage
|
getConditionSetIdentifierFromUrl = conditionSetUrl.split('/').pop().split('?')[0];
|
||||||
test('Condition set object properties persist in main view and inspector @localStorage', async ({ page }) => {
|
console.debug(`getConditionSetIdentifierFromUrl: ${getConditionSetIdentifierFromUrl}`);
|
||||||
//Navigate to baseURL with injected localStorage
|
await page.close();
|
||||||
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
});
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
//Load localStorage for subsequent tests
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
test.use({
|
||||||
|
storageState: path.resolve(__dirname, '../../../../test-data/recycled_local_storage.json')
|
||||||
|
});
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in Inspector
|
//Begin suite of tests again localStorage
|
||||||
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
test('Condition set object properties persist in main view and inspector @localStorage', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
//Navigate to baseURL with injected localStorage
|
||||||
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
//Reload Page
|
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
||||||
await Promise.all([
|
await expect
|
||||||
page.reload(),
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
page.waitForLoadState('networkidle')
|
.toContainText('Unnamed Condition Set');
|
||||||
]);
|
|
||||||
|
|
||||||
//Re-verify after reload
|
//Assertions on loaded Condition Set in Inspector
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
||||||
//Assertions on loaded Condition Set in Inspector
|
|
||||||
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
|
||||||
|
|
||||||
});
|
//Reload Page
|
||||||
test('condition set object can be modified on @localStorage', async ({ page, openmctConfig }) => {
|
await Promise.all([page.reload(), page.waitForLoadState('networkidle')]);
|
||||||
const { myItemsFolderName } = openmctConfig;
|
|
||||||
|
|
||||||
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
//Re-verify after reload
|
||||||
|
await expect
|
||||||
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
|
.toContainText('Unnamed Condition Set');
|
||||||
|
//Assertions on loaded Condition Set in Inspector
|
||||||
|
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('condition set object can be modified on @localStorage', async ({ page, openmctConfig }) => {
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
||||||
|
|
||||||
//Update the Condition Set properties
|
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
||||||
// Click Edit Button
|
await expect
|
||||||
await page.locator('text=Conditions View Snapshot >> button').nth(3).click();
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
|
.toContainText('Unnamed Condition Set');
|
||||||
|
|
||||||
//Edit Condition Set Name from main view
|
//Update the Condition Set properties
|
||||||
await page.locator('.l-browse-bar__object-name').filter({ hasText: 'Unnamed Condition Set' }).first().fill('Renamed Condition Set');
|
// Click Edit Button
|
||||||
await page.locator('.l-browse-bar__object-name').filter({ hasText: 'Renamed Condition Set' }).first().press('Enter');
|
await page.locator('text=Conditions View Snapshot >> button').nth(3).click();
|
||||||
// Click Save Button
|
|
||||||
await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1).click();
|
|
||||||
// Click Save and Finish Editing Option
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
//Verify Main section reflects updated Name Property
|
//Edit Condition Set Name from main view
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Renamed Condition Set');
|
await page
|
||||||
|
.locator('.l-browse-bar__object-name')
|
||||||
|
.filter({ hasText: 'Unnamed Condition Set' })
|
||||||
|
.first()
|
||||||
|
.fill('Renamed Condition Set');
|
||||||
|
await page
|
||||||
|
.locator('.l-browse-bar__object-name')
|
||||||
|
.filter({ hasText: 'Renamed Condition Set' })
|
||||||
|
.first()
|
||||||
|
.press('Enter');
|
||||||
|
// Click Save Button
|
||||||
|
await page
|
||||||
|
.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button')
|
||||||
|
.nth(1)
|
||||||
|
.click();
|
||||||
|
// Click Save and Finish Editing Option
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
// Verify Inspector properties
|
//Verify Main section reflects updated Name Property
|
||||||
// Verify Inspector has updated Name property
|
await expect
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
// Verify Inspector Details has updated Name property
|
.toContainText('Renamed Condition Set');
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
|
||||||
|
|
||||||
// Verify Tree reflects updated Name proprety
|
// Verify Inspector properties
|
||||||
// Expand Tree
|
// Verify Inspector has updated Name property
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
||||||
// Verify Condition Set Object is renamed in Tree
|
// Verify Inspector Details has updated Name property
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
||||||
// Verify Search Tree reflects renamed Name property
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
||||||
|
|
||||||
//Reload Page
|
// Verify Tree reflects updated Name property
|
||||||
await Promise.all([
|
// Expand Tree
|
||||||
page.reload(),
|
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
||||||
page.waitForLoadState('networkidle')
|
// Verify Condition Set Object is renamed in Tree
|
||||||
]);
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
// Verify Search Tree reflects renamed Name property
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
||||||
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
|
||||||
//Verify Main section reflects updated Name Property
|
//Reload Page
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Renamed Condition Set');
|
await Promise.all([page.reload(), page.waitForLoadState('networkidle')]);
|
||||||
|
|
||||||
// Verify Inspector properties
|
//Verify Main section reflects updated Name Property
|
||||||
// Verify Inspector has updated Name property
|
await expect
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
// Verify Inspector Details has updated Name property
|
.toContainText('Renamed Condition Set');
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
|
||||||
|
|
||||||
// Verify Tree reflects updated Name proprety
|
// Verify Inspector properties
|
||||||
// Expand Tree
|
// Verify Inspector has updated Name property
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
||||||
// Verify Condition Set Object is renamed in Tree
|
// Verify Inspector Details has updated Name property
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
||||||
// Verify Search Tree reflects renamed Name property
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
||||||
});
|
|
||||||
test('condition set object can be deleted by Search Tree Actions menu on @localStorage', async ({ page }) => {
|
|
||||||
//Navigate to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
// Verify Tree reflects updated Name property
|
||||||
await expect(page.locator('a:has-text("Unnamed Condition Set Condition Set") >> nth=0')).toBeVisible();
|
// Expand Tree
|
||||||
|
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
||||||
|
// Verify Condition Set Object is renamed in Tree
|
||||||
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
// Verify Search Tree reflects renamed Name property
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
||||||
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('condition set object can be deleted by Search Tree Actions menu on @localStorage', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
//Navigate to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
const numberOfConditionSetsToStart = await page.locator('a:has-text("Unnamed Condition Set Condition Set")').count();
|
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
||||||
|
await expect(
|
||||||
|
page.locator('a:has-text("Unnamed Condition Set Condition Set") >> nth=0')
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
// Search for Unnamed Condition Set
|
const numberOfConditionSetsToStart = await page
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Unnamed Condition Set');
|
.locator('a:has-text("Unnamed Condition Set Condition Set")')
|
||||||
// Click Search Result
|
.count();
|
||||||
await page.locator('[aria-label="OpenMCT Search"] >> text=Unnamed Condition Set').first().click();
|
|
||||||
// Click hamburger button
|
|
||||||
await page.locator('[title="More options"]').click();
|
|
||||||
|
|
||||||
// Click 'Remove' and press OK
|
// Search for Unnamed Condition Set
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
await page
|
||||||
await page.locator('button:has-text("OK")').click();
|
.locator('[aria-label="OpenMCT Search"] input[type="search"]')
|
||||||
|
.fill('Unnamed Condition Set');
|
||||||
|
// Click Search Result
|
||||||
|
await page
|
||||||
|
.locator('[aria-label="OpenMCT Search"] >> text=Unnamed Condition Set')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
// Click hamburger button
|
||||||
|
await page.locator('[title="More options"]').click();
|
||||||
|
|
||||||
//Expect Unnamed Condition Set to be removed in Main View
|
// Click 'Remove' and press OK
|
||||||
const numberOfConditionSetsAtEnd = await page.locator('a:has-text("Unnamed Condition Set Condition Set")').count();
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
expect(numberOfConditionSetsAtEnd).toEqual(numberOfConditionSetsToStart - 1);
|
//Expect Unnamed Condition Set to be removed in Main View
|
||||||
|
const numberOfConditionSetsAtEnd = await page
|
||||||
|
.locator('a:has-text("Unnamed Condition Set Condition Set")')
|
||||||
|
.count();
|
||||||
|
|
||||||
//Feature?
|
expect(numberOfConditionSetsAtEnd).toEqual(numberOfConditionSetsToStart - 1);
|
||||||
//Domain Object is still available by direct URL after delete
|
|
||||||
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
||||||
|
|
||||||
});
|
//Feature?
|
||||||
|
//Domain Object is still available by direct URL after delete
|
||||||
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Basic Condition Set Use', () => {
|
test.describe('Basic Condition Set Use', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
let conditionSet;
|
||||||
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
// Create a new condition set
|
||||||
|
conditionSet = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Condition Set',
|
||||||
|
name: 'Test Condition Set'
|
||||||
});
|
});
|
||||||
test('Can add a condition', async ({ page }) => {
|
});
|
||||||
// Create a new condition set
|
test('Creating a condition defaults the condition name to "Unnamed Condition"', async ({
|
||||||
await createDomainObjectWithDefaults(page, {
|
page
|
||||||
type: 'Condition Set',
|
}) => {
|
||||||
name: "Test Condition Set"
|
await page.goto(conditionSet.url);
|
||||||
});
|
|
||||||
// Change the object to edit mode
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Click Add Condition button
|
// Change the object to edit mode
|
||||||
await page.locator('#addCondition').click();
|
await page.locator('[title="Edit"]').click();
|
||||||
// Check that the new Unnamed Condition section appears
|
|
||||||
const numOfUnnamedConditions = await page.locator('text=Unnamed Condition').count();
|
// Click Add Condition button
|
||||||
expect(numOfUnnamedConditions).toEqual(1);
|
await page.locator('#addCondition').click();
|
||||||
|
// Check that the new Unnamed Condition section appears
|
||||||
|
const numOfUnnamedConditions = await page
|
||||||
|
.locator('.c-condition__name', { hasText: 'Unnamed Condition' })
|
||||||
|
.count();
|
||||||
|
expect(numOfUnnamedConditions).toEqual(1);
|
||||||
|
});
|
||||||
|
test('ConditionSet should display appropriate view options', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5924'
|
||||||
});
|
});
|
||||||
test('ConditionSet should display appropriate view options', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5924'
|
|
||||||
});
|
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator',
|
type: 'Sine Wave Generator',
|
||||||
name: "Alpha Sine Wave Generator"
|
name: 'Alpha Sine Wave Generator'
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Sine Wave Generator',
|
|
||||||
name: "Beta Sine Wave Generator"
|
|
||||||
});
|
|
||||||
const conditionSet1 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Condition Set',
|
|
||||||
name: "Test Condition Set"
|
|
||||||
});
|
|
||||||
|
|
||||||
// Change the object to edit mode
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.goto(conditionSet1.url);
|
|
||||||
page.click('button[title="Show selected item in tree"]');
|
|
||||||
// Add the Alpha & Beta Sine Wave Generator to the Condition Set and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const alphaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Alpha Sine Wave Generator"});
|
|
||||||
const betaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Beta Sine Wave Generator"});
|
|
||||||
const conditionCollection = page.locator('#conditionCollection');
|
|
||||||
|
|
||||||
await alphaGeneratorTreeItem.dragTo(conditionCollection);
|
|
||||||
await betaGeneratorTreeItem.dragTo(conditionCollection);
|
|
||||||
|
|
||||||
const saveButtonLocator = page.locator('button[title="Save"]');
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
|
||||||
await page.click('button[title="Change the current view"]');
|
|
||||||
|
|
||||||
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();
|
|
||||||
});
|
});
|
||||||
test('ConditionSet should output blank instead of the default value', async ({ page }) => {
|
await createDomainObjectWithDefaults(page, {
|
||||||
//Navigate to baseURL
|
type: 'Sine Wave Generator',
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
name: 'Beta Sine Wave Generator'
|
||||||
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
|
||||||
await page.click(`li[role='menuitem']:text("Sine Wave Generator")`);
|
|
||||||
await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000');
|
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
|
||||||
await nameInput.fill("Delayed Sine Wave Generator");
|
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForLoadState(),
|
|
||||||
page.click('[aria-label="Save"]'),
|
|
||||||
// Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Create a new condition set
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Condition Set',
|
|
||||||
name: "Test Blank Output of Condition Set"
|
|
||||||
});
|
|
||||||
// Change the object to edit mode
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Click Add Condition button twice
|
|
||||||
await page.locator('#addCondition').click();
|
|
||||||
await page.locator('#addCondition').click();
|
|
||||||
await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition');
|
|
||||||
await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition');
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
|
||||||
// Add the Sine Wave Generator to the Condition Set and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Delayed Sine Wave Generator"});
|
|
||||||
const conditionCollection = await page.locator('#conditionCollection');
|
|
||||||
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(conditionCollection);
|
|
||||||
|
|
||||||
const firstCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=0');
|
|
||||||
firstCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' });
|
|
||||||
|
|
||||||
const secondCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=1');
|
|
||||||
secondCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' });
|
|
||||||
|
|
||||||
const firstCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=0');
|
|
||||||
firstCriterionMetadata.selectOption({ label: 'Sine' });
|
|
||||||
|
|
||||||
const secondCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=1');
|
|
||||||
secondCriterionMetadata.selectOption({ label: 'Sine' });
|
|
||||||
|
|
||||||
const firstCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=0');
|
|
||||||
firstCriterionComparison.selectOption({ label: 'is greater than or equal to' });
|
|
||||||
|
|
||||||
const secondCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=1');
|
|
||||||
secondCriterionComparison.selectOption({ label: 'is less than' });
|
|
||||||
|
|
||||||
const firstCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=0');
|
|
||||||
await firstCriterionInput.fill("0");
|
|
||||||
|
|
||||||
const secondCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=1');
|
|
||||||
await secondCriterionInput.fill("0");
|
|
||||||
|
|
||||||
const saveButtonLocator = page.locator('button[title="Save"]');
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
|
||||||
|
|
||||||
const outputValue = await page.locator('[aria-label="Current Output Value"]');
|
|
||||||
await expect(outputValue).toHaveText('---');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await page.goto(conditionSet.url);
|
||||||
|
|
||||||
|
// Change the object to edit mode
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
page.click('button[title="Show selected item in tree"]');
|
||||||
|
// Add the Alpha & Beta Sine Wave Generator to the Condition Set and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const alphaGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: 'Alpha Sine Wave Generator'
|
||||||
|
});
|
||||||
|
const betaGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: 'Beta Sine Wave Generator'
|
||||||
|
});
|
||||||
|
const conditionCollection = page.locator('#conditionCollection');
|
||||||
|
|
||||||
|
await alphaGeneratorTreeItem.dragTo(conditionCollection);
|
||||||
|
await betaGeneratorTreeItem.dragTo(conditionCollection);
|
||||||
|
|
||||||
|
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 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();
|
||||||
|
});
|
||||||
|
test('ConditionSet has correct outputs when telemetry is and is not available', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const exampleTelemetry = await createExampleTelemetryObject(page);
|
||||||
|
|
||||||
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
await page.goto(conditionSet.url);
|
||||||
|
// Change the object to edit mode
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Create two conditions
|
||||||
|
await page.locator('#addCondition').click();
|
||||||
|
await page.locator('#addCondition').click();
|
||||||
|
await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition');
|
||||||
|
await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition');
|
||||||
|
|
||||||
|
// Add Telemetry to ConditionSet
|
||||||
|
const sineWaveGeneratorTreeItem = page
|
||||||
|
.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
})
|
||||||
|
.getByRole('treeitem', {
|
||||||
|
name: exampleTelemetry.name
|
||||||
|
});
|
||||||
|
const conditionCollection = page.locator('#conditionCollection');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(conditionCollection);
|
||||||
|
|
||||||
|
// Modify First Criterion
|
||||||
|
const firstCriterionTelemetry = page.locator(
|
||||||
|
'[aria-label="Criterion Telemetry Selection"] >> nth=0'
|
||||||
|
);
|
||||||
|
firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name });
|
||||||
|
const firstCriterionMetadata = page.locator(
|
||||||
|
'[aria-label="Criterion Metadata Selection"] >> nth=0'
|
||||||
|
);
|
||||||
|
firstCriterionMetadata.selectOption({ label: 'Sine' });
|
||||||
|
const firstCriterionComparison = page.locator(
|
||||||
|
'[aria-label="Criterion Comparison Selection"] >> nth=0'
|
||||||
|
);
|
||||||
|
firstCriterionComparison.selectOption({ label: 'is greater than or equal to' });
|
||||||
|
const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0');
|
||||||
|
await firstCriterionInput.fill('0');
|
||||||
|
|
||||||
|
// Modify First Criterion
|
||||||
|
const secondCriterionTelemetry = page.locator(
|
||||||
|
'[aria-label="Criterion Telemetry Selection"] >> nth=1'
|
||||||
|
);
|
||||||
|
secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name });
|
||||||
|
|
||||||
|
const secondCriterionMetadata = page.locator(
|
||||||
|
'[aria-label="Criterion Metadata Selection"] >> nth=1'
|
||||||
|
);
|
||||||
|
secondCriterionMetadata.selectOption({ label: 'Sine' });
|
||||||
|
|
||||||
|
const secondCriterionComparison = page.locator(
|
||||||
|
'[aria-label="Criterion Comparison Selection"] >> nth=1'
|
||||||
|
);
|
||||||
|
secondCriterionComparison.selectOption({ label: 'is less than' });
|
||||||
|
|
||||||
|
const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1');
|
||||||
|
await secondCriterionInput.fill('0');
|
||||||
|
|
||||||
|
// Save ConditionSet
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Validate that the condition set is evaluating and outputting
|
||||||
|
// the correct value when the underlying telemetry subscription is active.
|
||||||
|
let outputValue = page.locator('[aria-label="Current Output Value"]');
|
||||||
|
await expect(outputValue).toHaveText('false');
|
||||||
|
|
||||||
|
await page.goto(exampleTelemetry.url);
|
||||||
|
|
||||||
|
// Edit SWG to add 8 second loading delay to simulate the case
|
||||||
|
// where telemetry is not available.
|
||||||
|
await page.getByTitle('More options').click();
|
||||||
|
await page.getByRole('menuitem', { name: 'Edit Properties...' }).click();
|
||||||
|
await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000');
|
||||||
|
await page.getByLabel('Save').click();
|
||||||
|
|
||||||
|
// Expect that the output value is blank or '---' if the
|
||||||
|
// underlying telemetry subscription is not active.
|
||||||
|
await page.goto(conditionSet.url);
|
||||||
|
await expect(outputValue).toHaveText('---');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,177 +19,463 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults, setStartOffset, setFixedTimeMode, setRealTimeMode } = require('../../../../appActions');
|
const path = require('path');
|
||||||
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
setStartOffset,
|
||||||
|
setFixedTimeMode,
|
||||||
|
setRealTimeMode,
|
||||||
|
setIndependentTimeConductorBounds
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
|
||||||
|
const LOCALSTORAGE_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'../../../../test-data/display_layout_with_child_layouts.json'
|
||||||
|
);
|
||||||
|
const TINY_IMAGE_BASE64 =
|
||||||
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
|
||||||
|
|
||||||
|
test.describe('Display Layout Toolbar Actions @localStorage', () => {
|
||||||
|
const PARENT_DISPLAY_LAYOUT_NAME = 'Parent Display Layout';
|
||||||
|
const CHILD_DISPLAY_LAYOUT_NAME1 = 'Child Layout 1';
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await setRealTimeMode(page);
|
||||||
|
await page
|
||||||
|
.locator('a')
|
||||||
|
.filter({ hasText: 'Parent Display Layout Display Layout' })
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await page.getByLabel('Edit').click();
|
||||||
|
});
|
||||||
|
test.use({
|
||||||
|
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH)
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can add/remove Text element to a single layout', async ({ page }) => {
|
||||||
|
const layoutObject = 'Text';
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the parent's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, PARENT_DISPLAY_LAYOUT_NAME);
|
||||||
|
});
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the child's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, CHILD_DISPLAY_LAYOUT_NAME1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('can add/remove Image to a single layout', async ({ page }) => {
|
||||||
|
const layoutObject = 'Image';
|
||||||
|
await test.step("Add and remove image element from the parent's layout", async () => {
|
||||||
|
expect(await page.getByLabel(`Move ${layoutObject} Frame`).count()).toBe(0);
|
||||||
|
await addLayoutObject(page, PARENT_DISPLAY_LAYOUT_NAME, layoutObject);
|
||||||
|
expect(await page.getByLabel(`Move ${layoutObject} Frame`).count()).toBe(1);
|
||||||
|
await removeLayoutObject(page, layoutObject);
|
||||||
|
expect(await page.getByLabel(`Move ${layoutObject} Frame`).count()).toBe(0);
|
||||||
|
});
|
||||||
|
await test.step("Add and remove image from the child's layout", async () => {
|
||||||
|
await addLayoutObject(page, CHILD_DISPLAY_LAYOUT_NAME1, layoutObject);
|
||||||
|
expect(await page.getByLabel(`Move ${layoutObject} Frame`).count()).toBe(1);
|
||||||
|
await removeLayoutObject(page, layoutObject);
|
||||||
|
expect(await page.getByLabel(`Move ${layoutObject} Frame`).count()).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test(`can add/remove Box to a single layout`, async ({ page }) => {
|
||||||
|
const layoutObject = 'Box';
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the parent's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, PARENT_DISPLAY_LAYOUT_NAME);
|
||||||
|
});
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the child's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, CHILD_DISPLAY_LAYOUT_NAME1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test(`can add/remove Line to a single layout`, async ({ page }) => {
|
||||||
|
const layoutObject = 'Line';
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the parent's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, PARENT_DISPLAY_LAYOUT_NAME);
|
||||||
|
});
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the child's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, CHILD_DISPLAY_LAYOUT_NAME1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test(`can add/remove Ellipse to a single layout`, async ({ page }) => {
|
||||||
|
const layoutObject = 'Ellipse';
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the parent's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, PARENT_DISPLAY_LAYOUT_NAME);
|
||||||
|
});
|
||||||
|
await test.step(`Add and remove ${layoutObject} from the child's layout`, async () => {
|
||||||
|
await addAndRemoveDrawingObjectAndAssert(page, layoutObject, CHILD_DISPLAY_LAYOUT_NAME1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test.fixme('Can switch view types of a single SWG in a layout', async ({ page }) => {});
|
||||||
|
test.fixme('Can merge multiple plots in a layout', async ({ page }) => {});
|
||||||
|
test.fixme('Can adjust stack order of a single object in a layout', async ({ page }) => {});
|
||||||
|
test.fixme('Can duplicate a single object in a layout', async ({ page }) => {});
|
||||||
|
});
|
||||||
|
|
||||||
test.describe('Display Layout', () => {
|
test.describe('Display Layout', () => {
|
||||||
/** @type {import('../../../../appActions').CreatedObjectInfo} */
|
/** @type {import('../../../../appActions').CreatedObjectInfo} */
|
||||||
let sineWaveObject;
|
let sineWaveObject;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
await setRealTimeMode(page);
|
await setRealTimeMode(page);
|
||||||
|
|
||||||
// Create Sine Wave Generator
|
// Create Sine Wave Generator
|
||||||
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator'
|
type: 'Sine Wave Generator'
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in real time', async ({ page }) => {
|
});
|
||||||
// Create a Display Layout
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
name: "Test Display Layout"
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in real time', async ({
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
page
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
}) => {
|
||||||
const treePane = page.getByRole('tree', {
|
// Create a Display Layout
|
||||||
name: 'Main Tree'
|
await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Display Layout',
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
name: 'Test Display Layout'
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
// Subscribe to the Sine Wave Generator data
|
|
||||||
// On getting data, check if the value found in the Display Layout is the most recent value
|
|
||||||
// from the Sine Wave Generator
|
|
||||||
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
|
||||||
const formattedTelemetryValue = getTelemValuePromise;
|
|
||||||
const displayLayoutValuePromise = await page.waitForSelector(`text="${formattedTelemetryValue}"`);
|
|
||||||
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
|
||||||
const trimmedDisplayValue = displayLayoutValue.trim();
|
|
||||||
|
|
||||||
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
|
||||||
});
|
});
|
||||||
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in fixed time', async ({ page }) => {
|
// Edit Display Layout
|
||||||
// Create a Display Layout
|
await page.locator('[title="Edit"]').click();
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
name: "Test Display Layout"
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Expand the 'My Items' folder in the left tree
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
const treePane = page.getByRole('tree', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: 'Main Tree'
|
name: 'Main Tree'
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
// Subscribe to the Sine Wave Generator data
|
|
||||||
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
|
||||||
// Set an offset of 1 minute and then change the time mode to fixed to set a 1 minute historical window
|
|
||||||
await setStartOffset(page, { mins: '1' });
|
|
||||||
await setFixedTimeMode(page);
|
|
||||||
|
|
||||||
// On getting data, check if the value found in the Display Layout is the most recent value
|
|
||||||
// from the Sine Wave Generator
|
|
||||||
const formattedTelemetryValue = getTelemValuePromise;
|
|
||||||
const displayLayoutValuePromise = await page.waitForSelector(`text="${formattedTelemetryValue}"`);
|
|
||||||
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
|
||||||
const trimmedDisplayValue = displayLayoutValue.trim();
|
|
||||||
|
|
||||||
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
|
||||||
});
|
});
|
||||||
test('items in a display layout can be removed with object tree context menu when viewing the display layout', async ({ page }) => {
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
// Create a Display Layout
|
name: new RegExp(sineWaveObject.name)
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
name: "Test Display Layout"
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
|
||||||
|
|
||||||
// Expand the Display Layout so we can remove the sine wave generator
|
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
|
||||||
|
|
||||||
// Bring up context menu and remove
|
|
||||||
await sineWaveGeneratorTreeItem.nth(1).click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// delete
|
|
||||||
|
|
||||||
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
test('items in a display layout can be removed with object tree context menu when viewing another item', async ({ page }) => {
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
test.info().annotations.push({
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
type: 'issue',
|
await page.locator('button[title="Save"]').click();
|
||||||
description: 'https://github.com/nasa/openmct/issues/3117'
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
});
|
|
||||||
// Create a Display Layout
|
|
||||||
const displayLayout = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout'
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Subscribe to the Sine Wave Generator data
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
// On getting data, check if the value found in the Display Layout is the most recent value
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
// from the Sine Wave Generator
|
||||||
const treePane = page.getByRole('tree', {
|
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
||||||
name: 'Main Tree'
|
const formattedTelemetryValue = getTelemValuePromise;
|
||||||
});
|
const displayLayoutValuePromise = await page.waitForSelector(
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
`text="${formattedTelemetryValue}"`
|
||||||
name: new RegExp(sineWaveObject.name)
|
);
|
||||||
});
|
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
const trimmedDisplayValue = displayLayoutValue.trim();
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
||||||
|
});
|
||||||
// Expand the Display Layout so we can remove the sine wave generator
|
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in fixed time', async ({
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
page
|
||||||
|
}) => {
|
||||||
// Go to the original Sine Wave Generator to navigate away from the Display Layout
|
// Create a Display Layout
|
||||||
await page.goto(sineWaveObject.url);
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
// Bring up context menu and remove
|
name: 'Test Display Layout'
|
||||||
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// navigate back to the display layout to confirm it has been removed
|
|
||||||
await page.goto(displayLayout.url);
|
|
||||||
|
|
||||||
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Subscribe to the Sine Wave Generator data
|
||||||
|
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
||||||
|
// Set an offset of 1 minute and then change the time mode to fixed to set a 1 minute historical window
|
||||||
|
await setStartOffset(page, { mins: '1' });
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
|
||||||
|
// On getting data, check if the value found in the Display Layout is the most recent value
|
||||||
|
// from the Sine Wave Generator
|
||||||
|
const formattedTelemetryValue = getTelemValuePromise;
|
||||||
|
const displayLayoutValuePromise = await page.waitForSelector(
|
||||||
|
`text="${formattedTelemetryValue}"`
|
||||||
|
);
|
||||||
|
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
||||||
|
const trimmedDisplayValue = displayLayoutValue.trim();
|
||||||
|
|
||||||
|
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
||||||
|
});
|
||||||
|
test('items in a display layout can be removed with object tree context menu when viewing the display layout', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
// Create a Display Layout
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Test Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Display Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.nth(1).click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// delete
|
||||||
|
|
||||||
|
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
test('items in a display layout can be removed with object tree context menu when viewing another item', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/3117'
|
||||||
|
});
|
||||||
|
// Create a Display Layout
|
||||||
|
const displayLayout = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Display Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Go to the original Sine Wave Generator to navigate away from the Display Layout
|
||||||
|
await page.goto(sineWaveObject.url);
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// navigate back to the display layout to confirm it has been removed
|
||||||
|
await page.goto(displayLayout.url);
|
||||||
|
|
||||||
|
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('independent time works with display layouts and its children', async ({ page }) => {
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
// Create Example Imagery
|
||||||
|
const exampleImageryObject = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Example Imagery'
|
||||||
|
});
|
||||||
|
// Create a Display Layout
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const exampleImageryTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(exampleImageryObject.name)
|
||||||
|
});
|
||||||
|
let layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await exampleImageryTreeItem.dragTo(layoutGridHolder);
|
||||||
|
|
||||||
|
//adjust so that we can see the independent time conductor toggle
|
||||||
|
// Adjust object height
|
||||||
|
await page.locator('div[title="Resize object height"] > input').click();
|
||||||
|
await page.locator('div[title="Resize object height"] > input').fill('70');
|
||||||
|
|
||||||
|
// Adjust object width
|
||||||
|
await page.locator('div[title="Resize object width"] > input').click();
|
||||||
|
await page.locator('div[title="Resize object width"] > input').fill('70');
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
const startDate = '2021-12-30 01:01:00.000Z';
|
||||||
|
const endDate = '2021-12-30 01:11:00.000Z';
|
||||||
|
await setIndependentTimeConductorBounds(page, startDate, endDate);
|
||||||
|
|
||||||
|
// check image date
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible();
|
||||||
|
|
||||||
|
// flip it off
|
||||||
|
await page.getByRole('switch').click();
|
||||||
|
// timestamp shouldn't be in the past anymore
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('When multiple plots are contained in a layout, we only ask for annotations once @couchdb', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
// Create another Sine Wave Generator
|
||||||
|
const anotherSineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Sine Wave Generator',
|
||||||
|
customParameters: {
|
||||||
|
'[aria-label="Data Rate (hz)"]': '0.01'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Create a Display Layout
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Test Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
|
||||||
|
let layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
// eslint-disable-next-line playwright/no-force-option
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder, { force: true });
|
||||||
|
|
||||||
|
await page.getByText('View type').click();
|
||||||
|
await page.getByText('Overlay Plot').click();
|
||||||
|
|
||||||
|
const anotherSineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(anotherSineWaveObject.name)
|
||||||
|
});
|
||||||
|
layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
// eslint-disable-next-line playwright/no-force-option
|
||||||
|
await anotherSineWaveGeneratorTreeItem.dragTo(layoutGridHolder, { force: true });
|
||||||
|
|
||||||
|
await page.getByText('View type').click();
|
||||||
|
await page.getByText('Overlay Plot').click();
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Time to inspect some network traffic
|
||||||
|
let networkRequests = [];
|
||||||
|
page.on('request', (request) => {
|
||||||
|
const searchRequest =
|
||||||
|
request.url().endsWith('_find') || request.url().includes('by_keystring');
|
||||||
|
const fetchRequest = request.resourceType() === 'fetch';
|
||||||
|
if (searchRequest && fetchRequest) {
|
||||||
|
networkRequests.push(request);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// wait for annotations requests to be batched and requested
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
// Network requests for the composite telemetry with multiple items should be:
|
||||||
|
// 1. a single batched request for annotations
|
||||||
|
expect(networkRequests.length).toBe(1);
|
||||||
|
|
||||||
|
await setRealTimeMode(page);
|
||||||
|
|
||||||
|
networkRequests = [];
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// wait for annotations to not load (if we have any, we've got a problem)
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// In real time mode, we don't fetch annotations at all
|
||||||
|
expect(networkRequests.length).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function addAndRemoveDrawingObjectAndAssert(page, layoutObject, DISPLAY_LAYOUT_NAME) {
|
||||||
|
expect(await page.getByLabel(layoutObject, { exact: true }).count()).toBe(0);
|
||||||
|
await addLayoutObject(page, DISPLAY_LAYOUT_NAME, layoutObject);
|
||||||
|
expect(
|
||||||
|
await page
|
||||||
|
.getByLabel(layoutObject, {
|
||||||
|
exact: true
|
||||||
|
})
|
||||||
|
.count()
|
||||||
|
).toBe(1);
|
||||||
|
await removeLayoutObject(page, layoutObject);
|
||||||
|
expect(await page.getByLabel(layoutObject, { exact: true }).count()).toBe(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the first matching layout object from the layout
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {'Box' | 'Ellipse' | 'Line' | 'Text' | 'Image'} layoutObject
|
||||||
|
*/
|
||||||
|
async function removeLayoutObject(page, layoutObject) {
|
||||||
|
await page
|
||||||
|
.getByLabel(`Move ${layoutObject} Frame`, { exact: true })
|
||||||
|
.or(page.getByLabel(layoutObject, { exact: true }))
|
||||||
|
.first()
|
||||||
|
// eslint-disable-next-line playwright/no-force-option
|
||||||
|
.click({ force: true });
|
||||||
|
await page.getByTitle('Delete the selected object').click();
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a layout object to the specified layout
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} layoutName
|
||||||
|
* @param {'Box' | 'Ellipse' | 'Line' | 'Text' | 'Image'} layoutObject
|
||||||
|
*/
|
||||||
|
async function addLayoutObject(page, layoutName, layoutObject) {
|
||||||
|
await page.getByLabel(`${layoutName} Layout`, { exact: true }).click();
|
||||||
|
await page.getByText('Add Drawing Object').click();
|
||||||
|
await page
|
||||||
|
.getByRole('menuitem', {
|
||||||
|
name: layoutObject
|
||||||
|
})
|
||||||
|
.click();
|
||||||
|
if (layoutObject === 'Text') {
|
||||||
|
await page.getByRole('textbox', { name: 'Text' }).fill('Hello, Universe!');
|
||||||
|
await page.getByText('OK').click();
|
||||||
|
} else if (layoutObject === 'Image') {
|
||||||
|
await page.getByLabel('Image URL').fill(TINY_IMAGE_BASE64);
|
||||||
|
await page.getByText('OK').click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Util for subscribing to a telemetry object by object identifier
|
* Util for subscribing to a telemetry object by object identifier
|
||||||
* Limitations: Currently only works to return telemetry once to the node scope
|
* Limitations: Currently only works to return telemetry once to the node scope
|
||||||
@ -200,18 +486,20 @@ test.describe('Display Layout', () => {
|
|||||||
* @returns {Promise<string>} the formatted sin telemetry value
|
* @returns {Promise<string>} the formatted sin telemetry value
|
||||||
*/
|
*/
|
||||||
async function subscribeToTelemetry(page, objectIdentifier) {
|
async function subscribeToTelemetry(page, objectIdentifier) {
|
||||||
const getTelemValuePromise = new Promise(resolve => page.exposeFunction('getTelemValue', resolve));
|
const getTelemValuePromise = new Promise((resolve) =>
|
||||||
|
page.exposeFunction('getTelemValue', resolve)
|
||||||
|
);
|
||||||
|
|
||||||
await page.evaluate(async (telemetryIdentifier) => {
|
await page.evaluate(async (telemetryIdentifier) => {
|
||||||
const telemetryObject = await window.openmct.objects.get(telemetryIdentifier);
|
const telemetryObject = await window.openmct.objects.get(telemetryIdentifier);
|
||||||
const metadata = window.openmct.telemetry.getMetadata(telemetryObject);
|
const metadata = window.openmct.telemetry.getMetadata(telemetryObject);
|
||||||
const formats = await window.openmct.telemetry.getFormatMap(metadata);
|
const formats = await window.openmct.telemetry.getFormatMap(metadata);
|
||||||
window.openmct.telemetry.subscribe(telemetryObject, (obj) => {
|
window.openmct.telemetry.subscribe(telemetryObject, (obj) => {
|
||||||
const sinVal = obj.sin;
|
const sinVal = obj.sin;
|
||||||
const formattedSinVal = formats.sin.format(sinVal);
|
const formattedSinVal = formats.sin.format(sinVal);
|
||||||
window.getTelemValue(formattedSinVal);
|
window.getTelemValue(formattedSinVal);
|
||||||
});
|
});
|
||||||
}, objectIdentifier);
|
}, objectIdentifier);
|
||||||
|
|
||||||
return getTelemValuePromise;
|
return getTelemValuePromise;
|
||||||
}
|
}
|
||||||
|
@ -24,214 +24,231 @@ const { test, expect } = require('../../../../pluginFixtures');
|
|||||||
const utils = require('../../../../helper/faultUtils');
|
const utils = require('../../../../helper/faultUtils');
|
||||||
|
|
||||||
test.describe('The Fault Management Plugin using example faults', () => {
|
test.describe('The Fault Management Plugin using example faults', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await utils.navigateToFaultManagementWithExample(page);
|
await utils.navigateToFaultManagementWithExample(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Shows a criticality icon for every fault @unstable', async ({ page }) => {
|
test('Shows a criticality icon for every fault @unstable', async ({ page }) => {
|
||||||
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
const criticalityIconCount = await page.locator('c-fault-mgmt__list-severity').count();
|
const criticalityIconCount = await page.locator('c-fault-mgmt__list-severity').count();
|
||||||
|
|
||||||
expect.soft(faultCount).toEqual(criticalityIconCount);
|
expect.soft(faultCount).toEqual(criticalityIconCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('When selecting a fault, it has an "is-selected" class and it\'s information shows in the inspector @unstable', async ({ page }) => {
|
test('When selecting a fault, it has an "is-selected" class and it\'s information shows in the inspector @unstable', async ({
|
||||||
await utils.selectFaultItem(page, 1);
|
page
|
||||||
|
}) => {
|
||||||
|
await utils.selectFaultItem(page, 1);
|
||||||
|
|
||||||
const selectedFaultName = await page.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname').textContent();
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
const inspectorFaultNameCount = await page.locator(`.c-inspector__properties >> :text("${selectedFaultName}")`).count();
|
const selectedFaultName = await page
|
||||||
|
.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname')
|
||||||
|
.textContent();
|
||||||
|
const inspectorFaultNameCount = await page
|
||||||
|
.locator(`.c-inspector__properties >> :text("${selectedFaultName}")`)
|
||||||
|
.count();
|
||||||
|
|
||||||
await expect.soft(page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').first()).toHaveClass(/is-selected/);
|
await expect
|
||||||
expect.soft(inspectorFaultNameCount).toEqual(1);
|
.soft(page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').first())
|
||||||
});
|
.toHaveClass(/is-selected/);
|
||||||
|
expect.soft(inspectorFaultNameCount).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
test('When selecting multiple faults, no specific fault information is shown in the inspector @unstable', async ({ page }) => {
|
test('When selecting multiple faults, no specific fault information is shown in the inspector @unstable', async ({
|
||||||
await utils.selectFaultItem(page, 1);
|
page
|
||||||
await utils.selectFaultItem(page, 2);
|
}) => {
|
||||||
|
await utils.selectFaultItem(page, 1);
|
||||||
|
await utils.selectFaultItem(page, 2);
|
||||||
|
|
||||||
const selectedRows = page.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname');
|
const selectedRows = page.locator(
|
||||||
expect.soft(await selectedRows.count()).toEqual(2);
|
'.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname'
|
||||||
|
);
|
||||||
|
expect.soft(await selectedRows.count()).toEqual(2);
|
||||||
|
|
||||||
const firstSelectedFaultName = await selectedRows.nth(0).textContent();
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
const secondSelectedFaultName = await selectedRows.nth(1).textContent();
|
const firstSelectedFaultName = await selectedRows.nth(0).textContent();
|
||||||
const firstNameInInspectorCount = await page.locator(`.c-inspector__properties >> :text("${firstSelectedFaultName}")`).count();
|
const secondSelectedFaultName = await selectedRows.nth(1).textContent();
|
||||||
const secondNameInInspectorCount = await page.locator(`.c-inspector__properties >> :text("${secondSelectedFaultName}")`).count();
|
const firstNameInInspectorCount = await page
|
||||||
|
.locator(`.c-inspector__properties >> :text("${firstSelectedFaultName}")`)
|
||||||
|
.count();
|
||||||
|
const secondNameInInspectorCount = await page
|
||||||
|
.locator(`.c-inspector__properties >> :text("${secondSelectedFaultName}")`)
|
||||||
|
.count();
|
||||||
|
|
||||||
expect.soft(firstNameInInspectorCount).toEqual(0);
|
expect.soft(firstNameInInspectorCount).toEqual(0);
|
||||||
expect.soft(secondNameInInspectorCount).toEqual(0);
|
expect.soft(secondNameInInspectorCount).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to shelve a fault @unstable', async ({ page }) => {
|
test('Allows you to shelve a fault @unstable', async ({ page }) => {
|
||||||
const shelvedFaultName = await utils.getFaultName(page, 2);
|
const shelvedFaultName = await utils.getFaultName(page, 2);
|
||||||
const beforeShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
const beforeShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
||||||
|
|
||||||
expect.soft(await beforeShelvedFault.count()).toBe(1);
|
expect.soft(await beforeShelvedFault.count()).toBe(1);
|
||||||
|
|
||||||
await utils.shelveFault(page, 2);
|
await utils.shelveFault(page, 2);
|
||||||
|
|
||||||
// check it is removed from standard view
|
// check it is removed from standard view
|
||||||
const afterShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
const afterShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
||||||
expect.soft(await afterShelvedFault.count()).toBe(0);
|
expect.soft(await afterShelvedFault.count()).toBe(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'shelved');
|
await utils.changeViewTo(page, 'shelved');
|
||||||
|
|
||||||
const shelvedViewFault = utils.getFaultByName(page, shelvedFaultName);
|
const shelvedViewFault = utils.getFaultByName(page, shelvedFaultName);
|
||||||
|
|
||||||
expect.soft(await shelvedViewFault.count()).toBe(1);
|
expect.soft(await shelvedViewFault.count()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to acknowledge a fault @unstable', async ({ page }) => {
|
test('Allows you to acknowledge a fault @unstable', async ({ page }) => {
|
||||||
const acknowledgedFaultName = await utils.getFaultName(page, 3);
|
const acknowledgedFaultName = await utils.getFaultName(page, 3);
|
||||||
|
|
||||||
await utils.acknowledgeFault(page, 3);
|
await utils.acknowledgeFault(page, 3);
|
||||||
|
|
||||||
const fault = utils.getFault(page, 3);
|
const fault = utils.getFault(page, 3);
|
||||||
await expect.soft(fault).toHaveClass(/is-acknowledged/);
|
await expect.soft(fault).toHaveClass(/is-acknowledged/);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'acknowledged');
|
await utils.changeViewTo(page, 'acknowledged');
|
||||||
|
|
||||||
const acknowledgedViewFaultName = await utils.getFaultName(page, 1);
|
const acknowledgedViewFaultName = await utils.getFaultName(page, 1);
|
||||||
expect.soft(acknowledgedFaultName).toEqual(acknowledgedViewFaultName);
|
expect.soft(acknowledgedFaultName).toEqual(acknowledgedViewFaultName);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to shelve multiple faults @unstable', async ({ page }) => {
|
test('Allows you to shelve multiple faults @unstable', async ({ page }) => {
|
||||||
const shelvedFaultNameOne = await utils.getFaultName(page, 1);
|
const shelvedFaultNameOne = await utils.getFaultName(page, 1);
|
||||||
const shelvedFaultNameFour = await utils.getFaultName(page, 4);
|
const shelvedFaultNameFour = await utils.getFaultName(page, 4);
|
||||||
|
|
||||||
const beforeShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
const beforeShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
||||||
const beforeShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
const beforeShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
||||||
|
|
||||||
expect.soft(await beforeShelvedFaultOne.count()).toBe(1);
|
expect.soft(await beforeShelvedFaultOne.count()).toBe(1);
|
||||||
expect.soft(await beforeShelvedFaultFour.count()).toBe(1);
|
expect.soft(await beforeShelvedFaultFour.count()).toBe(1);
|
||||||
|
|
||||||
await utils.shelveMultipleFaults(page, 1, 4);
|
await utils.shelveMultipleFaults(page, 1, 4);
|
||||||
|
|
||||||
// check it is removed from standard view
|
// check it is removed from standard view
|
||||||
const afterShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
const afterShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
||||||
const afterShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
const afterShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
||||||
expect.soft(await afterShelvedFaultOne.count()).toBe(0);
|
expect.soft(await afterShelvedFaultOne.count()).toBe(0);
|
||||||
expect.soft(await afterShelvedFaultFour.count()).toBe(0);
|
expect.soft(await afterShelvedFaultFour.count()).toBe(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'shelved');
|
await utils.changeViewTo(page, 'shelved');
|
||||||
|
|
||||||
const shelvedViewFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
const shelvedViewFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
||||||
const shelvedViewFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
const shelvedViewFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
||||||
|
|
||||||
expect.soft(await shelvedViewFaultOne.count()).toBe(1);
|
expect.soft(await shelvedViewFaultOne.count()).toBe(1);
|
||||||
expect.soft(await shelvedViewFaultFour.count()).toBe(1);
|
expect.soft(await shelvedViewFaultFour.count()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to acknowledge multiple faults @unstable', async ({ page }) => {
|
test('Allows you to acknowledge multiple faults @unstable', async ({ page }) => {
|
||||||
const acknowledgedFaultNameTwo = await utils.getFaultName(page, 2);
|
const acknowledgedFaultNameTwo = await utils.getFaultName(page, 2);
|
||||||
const acknowledgedFaultNameFive = await utils.getFaultName(page, 5);
|
const acknowledgedFaultNameFive = await utils.getFaultName(page, 5);
|
||||||
|
|
||||||
await utils.acknowledgeMultipleFaults(page, 2, 5);
|
await utils.acknowledgeMultipleFaults(page, 2, 5);
|
||||||
|
|
||||||
const faultTwo = utils.getFault(page, 2);
|
const faultTwo = utils.getFault(page, 2);
|
||||||
const faultFive = utils.getFault(page, 5);
|
const faultFive = utils.getFault(page, 5);
|
||||||
|
|
||||||
// check they have been acknowledged
|
// check they have been acknowledged
|
||||||
await expect.soft(faultTwo).toHaveClass(/is-acknowledged/);
|
await expect.soft(faultTwo).toHaveClass(/is-acknowledged/);
|
||||||
await expect.soft(faultFive).toHaveClass(/is-acknowledged/);
|
await expect.soft(faultFive).toHaveClass(/is-acknowledged/);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'acknowledged');
|
await utils.changeViewTo(page, 'acknowledged');
|
||||||
|
|
||||||
const acknowledgedViewFaultTwo = utils.getFaultByName(page, acknowledgedFaultNameTwo);
|
const acknowledgedViewFaultTwo = utils.getFaultByName(page, acknowledgedFaultNameTwo);
|
||||||
const acknowledgedViewFaultFive = utils.getFaultByName(page, acknowledgedFaultNameFive);
|
const acknowledgedViewFaultFive = utils.getFaultByName(page, acknowledgedFaultNameFive);
|
||||||
|
|
||||||
expect.soft(await acknowledgedViewFaultTwo.count()).toBe(1);
|
expect.soft(await acknowledgedViewFaultTwo.count()).toBe(1);
|
||||||
expect.soft(await acknowledgedViewFaultFive.count()).toBe(1);
|
expect.soft(await acknowledgedViewFaultFive.count()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to search faults @unstable', async ({ page }) => {
|
test('Allows you to search faults @unstable', async ({ page }) => {
|
||||||
const faultThreeNamespace = await utils.getFaultNamespace(page, 3);
|
const faultThreeNamespace = await utils.getFaultNamespace(page, 3);
|
||||||
const faultTwoName = await utils.getFaultName(page, 2);
|
const faultTwoName = await utils.getFaultName(page, 2);
|
||||||
const faultFiveTriggerTime = await utils.getFaultTriggerTime(page, 5);
|
const faultFiveTriggerTime = await utils.getFaultTriggerTime(page, 5);
|
||||||
|
|
||||||
// should be all faults (5)
|
// should be all faults (5)
|
||||||
let faultResultCount = await utils.getFaultResultCount(page);
|
let faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(5);
|
expect.soft(faultResultCount).toEqual(5);
|
||||||
|
|
||||||
// search namespace
|
// search namespace
|
||||||
await utils.enterSearchTerm(page, faultThreeNamespace);
|
await utils.enterSearchTerm(page, faultThreeNamespace);
|
||||||
|
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(1);
|
expect.soft(faultResultCount).toEqual(1);
|
||||||
expect.soft(await utils.getFaultNamespace(page, 1)).toEqual(faultThreeNamespace);
|
expect.soft(await utils.getFaultNamespace(page, 1)).toEqual(faultThreeNamespace);
|
||||||
|
|
||||||
// all faults
|
// all faults
|
||||||
await utils.clearSearch(page);
|
await utils.clearSearch(page);
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(5);
|
expect.soft(faultResultCount).toEqual(5);
|
||||||
|
|
||||||
// search name
|
// search name
|
||||||
await utils.enterSearchTerm(page, faultTwoName);
|
await utils.enterSearchTerm(page, faultTwoName);
|
||||||
|
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(1);
|
expect.soft(faultResultCount).toEqual(1);
|
||||||
expect.soft(await utils.getFaultName(page, 1)).toEqual(faultTwoName);
|
expect.soft(await utils.getFaultName(page, 1)).toEqual(faultTwoName);
|
||||||
|
|
||||||
// all faults
|
// all faults
|
||||||
await utils.clearSearch(page);
|
await utils.clearSearch(page);
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(5);
|
expect.soft(faultResultCount).toEqual(5);
|
||||||
|
|
||||||
// search triggerTime
|
// search triggerTime
|
||||||
await utils.enterSearchTerm(page, faultFiveTriggerTime);
|
await utils.enterSearchTerm(page, faultFiveTriggerTime);
|
||||||
|
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(1);
|
expect.soft(faultResultCount).toEqual(1);
|
||||||
expect.soft(await utils.getFaultTriggerTime(page, 1)).toEqual(faultFiveTriggerTime);
|
expect.soft(await utils.getFaultTriggerTime(page, 1)).toEqual(faultFiveTriggerTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to sort faults @unstable', async ({ page }) => {
|
test('Allows you to sort faults @unstable', async ({ page }) => {
|
||||||
const highestSeverity = await utils.getHighestSeverity(page);
|
const highestSeverity = await utils.getHighestSeverity(page);
|
||||||
const lowestSeverity = await utils.getLowestSeverity(page);
|
const lowestSeverity = await utils.getLowestSeverity(page);
|
||||||
const faultOneName = 'Example Fault 1';
|
const faultOneName = 'Example Fault 1';
|
||||||
const faultFiveName = 'Example Fault 5';
|
const faultFiveName = 'Example Fault 5';
|
||||||
let firstFaultName = await utils.getFaultName(page, 1);
|
let firstFaultName = await utils.getFaultName(page, 1);
|
||||||
|
|
||||||
expect.soft(firstFaultName).toEqual(faultOneName);
|
expect.soft(firstFaultName).toEqual(faultOneName);
|
||||||
|
|
||||||
await utils.sortFaultsBy(page, 'oldest-first');
|
await utils.sortFaultsBy(page, 'oldest-first');
|
||||||
|
|
||||||
firstFaultName = await utils.getFaultName(page, 1);
|
firstFaultName = await utils.getFaultName(page, 1);
|
||||||
expect.soft(firstFaultName).toEqual(faultFiveName);
|
expect.soft(firstFaultName).toEqual(faultFiveName);
|
||||||
|
|
||||||
await utils.sortFaultsBy(page, 'severity');
|
await utils.sortFaultsBy(page, 'severity');
|
||||||
|
|
||||||
const sortedHighestSeverity = await utils.getFaultSeverity(page, 1);
|
|
||||||
const sortedLowestSeverity = await utils.getFaultSeverity(page, 5);
|
|
||||||
expect.soft(sortedHighestSeverity).toEqual(highestSeverity);
|
|
||||||
expect.soft(sortedLowestSeverity).toEqual(lowestSeverity);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const sortedHighestSeverity = await utils.getFaultSeverity(page, 1);
|
||||||
|
const sortedLowestSeverity = await utils.getFaultSeverity(page, 5);
|
||||||
|
expect.soft(sortedHighestSeverity).toEqual(highestSeverity);
|
||||||
|
expect.soft(sortedLowestSeverity).toEqual(lowestSeverity);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('The Fault Management Plugin without using example faults', () => {
|
test.describe('The Fault Management Plugin without using example faults', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await utils.navigateToFaultManagementWithoutExample(page);
|
await utils.navigateToFaultManagementWithoutExample(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Shows no faults when no faults are provided @unstable', async ({ page }) => {
|
test('Shows no faults when no faults are provided @unstable', async ({ page }) => {
|
||||||
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
|
|
||||||
expect.soft(faultCount).toEqual(0);
|
expect.soft(faultCount).toEqual(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'acknowledged');
|
await utils.changeViewTo(page, 'acknowledged');
|
||||||
const acknowledgedCount = await page.locator('c-fault-mgmt__list').count();
|
const acknowledgedCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
expect.soft(acknowledgedCount).toEqual(0);
|
expect.soft(acknowledgedCount).toEqual(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'shelved');
|
await utils.changeViewTo(page, 'shelved');
|
||||||
const shelvedCount = await page.locator('c-fault-mgmt__list').count();
|
const shelvedCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
expect.soft(shelvedCount).toEqual(0);
|
expect.soft(shelvedCount).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Will return no faults when searching @unstable', async ({ page }) => {
|
test('Will return no faults when searching @unstable', async ({ page }) => {
|
||||||
await utils.enterSearchTerm(page, 'fault');
|
await utils.enterSearchTerm(page, 'fault');
|
||||||
|
|
||||||
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
|
|
||||||
expect.soft(faultCount).toEqual(0);
|
expect.soft(faultCount).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,135 +19,298 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
setIndependentTimeConductorBounds
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const LOCALSTORAGE_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'../../../../test-data/flexible_layout_with_child_layouts.json'
|
||||||
|
);
|
||||||
|
|
||||||
test.describe('Flexible Layout', () => {
|
test.describe('Flexible Layout', () => {
|
||||||
let sineWaveObject;
|
let sineWaveObject;
|
||||||
let clockObject;
|
let clockObject;
|
||||||
test.beforeEach(async ({ page }) => {
|
let treePane;
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
let sineWaveGeneratorTreeItem;
|
||||||
|
let clockTreeItem;
|
||||||
|
let flexibleLayout;
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Create Sine Wave Generator
|
// Create Sine Wave Generator
|
||||||
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator'
|
type: 'Sine Wave Generator'
|
||||||
});
|
|
||||||
|
|
||||||
// Create Clock Object
|
|
||||||
clockObject = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Clock'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test('panes have the appropriate draggable attribute while in Edit and Browse modes', async ({ page }) => {
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const clockTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(clockObject.name)
|
|
||||||
});
|
|
||||||
// Create a Flexible Layout
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Flexible Layout'
|
|
||||||
});
|
|
||||||
// Edit Flexible Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Create Clock Object
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
clockObject = await createDomainObjectWithDefaults(page, {
|
||||||
// Add the Sine Wave Generator and Clock to the Flexible Layout
|
type: 'Clock'
|
||||||
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
|
||||||
await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
|
|
||||||
// Check that panes can be dragged while Flexible Layout is in Edit mode
|
|
||||||
let dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
|
|
||||||
await expect(dragWrapper).toHaveAttribute('draggable', 'true');
|
|
||||||
// Save Flexible Layout
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
// Check that panes are not draggable while Flexible Layout is in Browse mode
|
|
||||||
dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
|
|
||||||
await expect(dragWrapper).toHaveAttribute('draggable', 'false');
|
|
||||||
});
|
});
|
||||||
test('items in a flexible layout can be removed with object tree context menu when viewing the flexible layout', async ({ page }) => {
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
// Create a Display Layout
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Flexible Layout'
|
|
||||||
});
|
|
||||||
// Edit Flexible Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Create a Flexible Layout
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
flexibleLayout = await createDomainObjectWithDefaults(page, {
|
||||||
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
type: 'Flexible Layout'
|
||||||
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
|
||||||
|
|
||||||
// Expand the Flexible Layout so we can remove the sine wave generator
|
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
|
||||||
|
|
||||||
// Bring up context menu and remove
|
|
||||||
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// Verify that the item has been removed from the layout
|
|
||||||
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
test('items in a flexible layout can be removed with object tree context menu when viewing another item', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/3117'
|
|
||||||
});
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a Flexible Layout
|
// Define the Sine Wave Generator and Clock tree items
|
||||||
const flexibleLayout = await createDomainObjectWithDefaults(page, {
|
treePane = page.getByRole('tree', {
|
||||||
type: 'Flexible Layout'
|
name: 'Main Tree'
|
||||||
});
|
|
||||||
// Edit Flexible Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
|
||||||
|
|
||||||
// Expand the Flexible Layout so we can remove the sine wave generator
|
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
|
||||||
|
|
||||||
// Go to the original Sine Wave Generator to navigate away from the Flexible Layout
|
|
||||||
await page.goto(sineWaveObject.url);
|
|
||||||
|
|
||||||
// Bring up context menu and remove
|
|
||||||
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// navigate back to the display layout to confirm it has been removed
|
|
||||||
await page.goto(flexibleLayout.url);
|
|
||||||
|
|
||||||
// Verify that the item has been removed from the layout
|
|
||||||
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
|
sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
clockTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(clockObject.name)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('panes have the appropriate draggable attribute while in Edit and Browse modes', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
||||||
|
// Add the Sine Wave Generator and Clock to the Flexible Layout
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
|
||||||
|
// Check that panes can be dragged while Flexible Layout is in Edit mode
|
||||||
|
let dragWrapper = page
|
||||||
|
.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper')
|
||||||
|
.first();
|
||||||
|
await expect(dragWrapper).toHaveAttribute('draggable', 'true');
|
||||||
|
// Save Flexible Layout
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
// Check that panes are not draggable while Flexible Layout is in Browse mode
|
||||||
|
dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
|
||||||
|
await expect(dragWrapper).toHaveAttribute('draggable', 'false');
|
||||||
|
});
|
||||||
|
test('changing toolbar settings in edit mode is immediately reflected and persists upon save', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6942'
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
||||||
|
// Add the Sine Wave Generator and Clock to the Flexible Layout
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
|
||||||
|
|
||||||
|
// Click on the first frame to select it
|
||||||
|
await page.locator('.c-fl-container__frame').first().click();
|
||||||
|
await expect(page.locator('.c-fl-container__frame > .c-frame').first()).toHaveAttribute(
|
||||||
|
's-selected',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert the toolbar is visible
|
||||||
|
await expect(page.locator('.c-toolbar')).toBeInViewport();
|
||||||
|
|
||||||
|
// Assert the layout is in columns orientation
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
|
|
||||||
|
// Change the layout to rows orientation
|
||||||
|
await page.getByTitle('Columns layout').click();
|
||||||
|
|
||||||
|
// Assert the layout is in rows orientation
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
// Assert the frame of the first item is visible
|
||||||
|
await expect(page.locator('.c-so-view').first()).not.toHaveClass(/c-so-view--no-frame/);
|
||||||
|
|
||||||
|
// Hide the frame of the first item
|
||||||
|
await page.getByTitle('Frame visible').click();
|
||||||
|
|
||||||
|
// Assert the frame is hidden
|
||||||
|
await expect(page.locator('.c-so-view').first()).toHaveClass(/c-so-view--no-frame/);
|
||||||
|
|
||||||
|
// Assert there are 2 containers
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(2);
|
||||||
|
|
||||||
|
// Add a container
|
||||||
|
await page.getByTitle('Add Container').click();
|
||||||
|
|
||||||
|
// Assert there are 3 containers
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(3);
|
||||||
|
|
||||||
|
// Save Flexible Layout
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Nav away and back
|
||||||
|
await page.goto(sineWaveObject.url);
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
|
||||||
|
// Wait for the first frame to be visible so we know the layout has loaded
|
||||||
|
await expect(page.locator('.c-fl-container').nth(0)).toBeInViewport();
|
||||||
|
|
||||||
|
// Assert the settings have persisted
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(3);
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toBeGreaterThan(0);
|
||||||
|
await expect(page.locator('.c-so-view').first()).toHaveClass(/c-so-view--no-frame/);
|
||||||
|
});
|
||||||
|
test('items in a flexible layout can be removed with object tree context menu when viewing the flexible layout', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
||||||
|
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Flexible Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// Verify that the item has been removed from the layout
|
||||||
|
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
test('items in a flexible layout can be removed with object tree context menu when viewing another item', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/3117'
|
||||||
|
});
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Flexible Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Go to the original Sine Wave Generator to navigate away from the Flexible Layout
|
||||||
|
await page.goto(sineWaveObject.url);
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// navigate back to the display layout to confirm it has been removed
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
|
||||||
|
// Verify that the item has been removed from the layout
|
||||||
|
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('independent time works with flexible layouts and its children', async ({ page }) => {
|
||||||
|
// Create Example Imagery
|
||||||
|
const exampleImageryObject = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Example Imagery'
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
const exampleImageryTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(exampleImageryObject.name)
|
||||||
|
});
|
||||||
|
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
||||||
|
await exampleImageryTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
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'
|
||||||
|
);
|
||||||
|
|
||||||
|
// check image date
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible();
|
||||||
|
|
||||||
|
// flip it off
|
||||||
|
await page.getByRole('switch').click();
|
||||||
|
// timestamp shouldn't be in the past anymore
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
|
||||||
|
test.use({
|
||||||
|
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH)
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await page
|
||||||
|
.locator('a')
|
||||||
|
.filter({ hasText: 'Parent Flexible Layout Flexible Layout' })
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await page.getByLabel('Edit').click();
|
||||||
|
});
|
||||||
|
test('Add/Remove Container', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/7234'
|
||||||
|
});
|
||||||
|
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(2);
|
||||||
|
await page.getByRole('group', { name: 'Container' }).nth(1).click();
|
||||||
|
await page.getByTitle('Add Container').click();
|
||||||
|
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(3);
|
||||||
|
await page.getByTitle('Remove Container').click();
|
||||||
|
await expect(page.getByRole('dialog')).toHaveText(
|
||||||
|
'This action will permanently delete this container from this Flexible Layout. Do you want to continue?'
|
||||||
|
);
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
expect(await page.getByRole('group', { name: 'Container' }).count()).toEqual(2);
|
||||||
|
});
|
||||||
|
test('Remove Frame', async ({ page }) => {
|
||||||
|
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')).toHaveText(
|
||||||
|
'This action will remove this frame from this Flexible Layout. Do you want to continue?'
|
||||||
|
);
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
expect(await page.getByRole('group', { name: 'Frame' }).count()).toEqual(1);
|
||||||
|
});
|
||||||
|
test('Columns/Rows Layout Toggle', async ({ page }) => {
|
||||||
|
await page.getByRole('group', { name: 'Container' }).nth(1).click();
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
|
await page.getByTitle('Columns layout').click();
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(1);
|
||||||
|
await page.getByTitle('Rows layout').click();
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,104 +21,165 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test suite is dedicated to testing the Gauge component.
|
* This test suite is dedicated to testing the Gauge component.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createExampleTelemetryObject
|
||||||
|
} = require('../../../../appActions');
|
||||||
const uuid = require('uuid').v4;
|
const uuid = require('uuid').v4;
|
||||||
|
|
||||||
test.describe('Gauge', () => {
|
test.describe('Gauge', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// Open a browser, navigate to the main page, and wait until all networkevents to resolve
|
// Open a browser, navigate to the main page, and wait until all networkevents to resolve
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Can add and remove telemetry sources @unstable', async ({ page }) => {
|
||||||
|
// Create the gauge with defaults
|
||||||
|
const gauge = await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
||||||
|
const editButtonLocator = page.locator('button[title="Edit"]');
|
||||||
|
const saveButtonLocator = page.locator('button[title="Save"]');
|
||||||
|
|
||||||
|
// Create a sine wave generator within the gauge
|
||||||
|
const swg1 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Sine Wave Generator',
|
||||||
|
name: `swg-${uuid()}`,
|
||||||
|
parent: gauge.uuid
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can add and remove telemetry sources @unstable', async ({ page }) => {
|
// Navigate to the gauge and verify that
|
||||||
// Create the gauge with defaults
|
// the SWG appears in the elements pool
|
||||||
const gauge = await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
await page.goto(gauge.url);
|
||||||
const editButtonLocator = page.locator('button[title="Edit"]');
|
await editButtonLocator.click();
|
||||||
const saveButtonLocator = page.locator('button[title="Save"]');
|
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeVisible();
|
||||||
|
await saveButtonLocator.click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
// Create a sine wave generator within the gauge
|
// Create another sine wave generator within the gauge
|
||||||
const swg1 = await createDomainObjectWithDefaults(page, {
|
const swg2 = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator',
|
type: 'Sine Wave Generator',
|
||||||
name: `swg-${uuid()}`,
|
name: `swg-${uuid()}`,
|
||||||
parent: gauge.uuid
|
parent: gauge.uuid
|
||||||
});
|
|
||||||
|
|
||||||
// Navigate to the gauge and verify that
|
|
||||||
// the SWG appears in the elements pool
|
|
||||||
await page.goto(gauge.url);
|
|
||||||
await editButtonLocator.click();
|
|
||||||
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeVisible();
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
await page.locator('li[title="Save and Finish Editing"]').click();
|
|
||||||
|
|
||||||
// Create another sine wave generator within the gauge
|
|
||||||
const swg2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Sine Wave Generator',
|
|
||||||
name: `swg-${uuid()}`,
|
|
||||||
parent: gauge.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify that the 'Replace telemetry source' modal appears and accept it
|
|
||||||
await expect.soft(page.locator('text=This action will replace the current telemetry source. Do you want to continue?')).toBeVisible();
|
|
||||||
await page.click('text=Ok');
|
|
||||||
|
|
||||||
// Navigate to the gauge and verify that the new SWG
|
|
||||||
// appears in the elements pool and the old one is gone
|
|
||||||
await page.goto(gauge.url);
|
|
||||||
await editButtonLocator.click();
|
|
||||||
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeHidden();
|
|
||||||
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg2.name}`)).toBeVisible();
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
|
|
||||||
// Right click on the new SWG in the elements pool and delete it
|
|
||||||
await page.locator(`#inspector-elements-tree >> text=${swg2.name}`).click({
|
|
||||||
button: 'right'
|
|
||||||
});
|
|
||||||
await page.locator('li[title="Remove this object from its containing object."]').click();
|
|
||||||
|
|
||||||
// Verify that the 'Remove object' confirmation modal appears and accept it
|
|
||||||
await expect.soft(page.locator('text=Warning! This action will remove this object. Are you sure you want to continue?')).toBeVisible();
|
|
||||||
await page.click('text=Ok');
|
|
||||||
|
|
||||||
// Verify that the elements pool shows no elements
|
|
||||||
await expect(page.locator('text="No contained elements"')).toBeVisible();
|
|
||||||
});
|
});
|
||||||
test('Can create a non-default Gauge', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5356'
|
|
||||||
});
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
// Verify that the 'Replace telemetry source' modal appears and accept it
|
||||||
await page.click(`li[role='menuitem']:text("Gauge")`);
|
await expect
|
||||||
// FIXME: We need better selectors for these custom form controls
|
.soft(
|
||||||
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
page.locator(
|
||||||
await displayCurrentValueSwitch.setChecked(false);
|
'text=This action will replace the current telemetry source. Do you want to continue?'
|
||||||
await page.click('button[aria-label="Save"]');
|
)
|
||||||
|
)
|
||||||
|
.toBeVisible();
|
||||||
|
await page.click('text=Ok');
|
||||||
|
|
||||||
// TODO: Verify changes in the UI
|
// Navigate to the gauge and verify that the new SWG
|
||||||
|
// appears in the elements pool and the old one is gone
|
||||||
|
await page.goto(gauge.url);
|
||||||
|
await editButtonLocator.click();
|
||||||
|
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeHidden();
|
||||||
|
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg2.name}`)).toBeVisible();
|
||||||
|
await saveButtonLocator.click();
|
||||||
|
|
||||||
|
// Right click on the new SWG in the elements pool and delete it
|
||||||
|
await page.locator(`#inspector-elements-tree >> text=${swg2.name}`).click({
|
||||||
|
button: 'right'
|
||||||
});
|
});
|
||||||
test('Can edit a single Gauge-specific property', async ({ page }) => {
|
await page.locator('li[title="Remove this object from its containing object."]').click();
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5985'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create the gauge with defaults
|
// Verify that the 'Remove object' confirmation modal appears and accept it
|
||||||
await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
await expect
|
||||||
await page.click('button[title="More options"]');
|
.soft(
|
||||||
await page.click('li[role="menuitem"]:has-text("Edit Properties")');
|
page.locator(
|
||||||
// FIXME: We need better selectors for these custom form controls
|
'text=Warning! This action will remove this object. Are you sure you want to continue?'
|
||||||
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
)
|
||||||
await displayCurrentValueSwitch.setChecked(false);
|
)
|
||||||
await page.click('button[aria-label="Save"]');
|
.toBeVisible();
|
||||||
|
await page.click('text=Ok');
|
||||||
|
|
||||||
// TODO: Verify changes in the UI
|
// Verify that the elements pool shows no elements
|
||||||
|
await expect(page.locator('text="No contained elements"')).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Can create a non-default Gauge', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5356'
|
||||||
});
|
});
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click the object specified by 'type'
|
||||||
|
await page.click(`li[role='menuitem']:text("Gauge")`);
|
||||||
|
// FIXME: We need better selectors for these custom form controls
|
||||||
|
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
||||||
|
await displayCurrentValueSwitch.setChecked(false);
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
// TODO: Verify changes in the UI
|
||||||
|
});
|
||||||
|
test('Can edit a single Gauge-specific property', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5985'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create the gauge with defaults
|
||||||
|
await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
||||||
|
await page.click('button[title="More options"]');
|
||||||
|
await page.click('li[role="menuitem"]:has-text("Edit Properties")');
|
||||||
|
// FIXME: We need better selectors for these custom form controls
|
||||||
|
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
||||||
|
await displayCurrentValueSwitch.setChecked(false);
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
// TODO: Verify changes in the UI
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Gauge does not display NaN when data not available', async ({ page }) => {
|
||||||
|
// Create a Gauge
|
||||||
|
const gauge = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Gauge'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create a Sine Wave Generator in the Gauge with a loading delay
|
||||||
|
const swgWith5sDelay = await createExampleTelemetryObject(page, gauge.uuid);
|
||||||
|
|
||||||
|
await page.goto(swgWith5sDelay.url);
|
||||||
|
await page.getByTitle('More options').click();
|
||||||
|
await page.getByRole('menuitem', { name: /Edit Properties.../ }).click();
|
||||||
|
|
||||||
|
//Edit Example Telemetry Object to include 5s loading Delay
|
||||||
|
await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000');
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
|
// Wait until the URL is updated
|
||||||
|
await page.waitForURL(`**/${gauge.uuid}/*`);
|
||||||
|
|
||||||
|
// Nav to the Gauge
|
||||||
|
await page.goto(gauge.url);
|
||||||
|
const gaugeNoDataText = await page.locator('.js-dial-current-value tspan').textContent();
|
||||||
|
expect(gaugeNoDataText).toBe('--');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Gauge enforces composition policy', async ({ page }) => {
|
||||||
|
// Create a Gauge
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Gauge',
|
||||||
|
name: 'Unnamed Gauge'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Try to create a Folder into the Gauge. Should be disallowed.
|
||||||
|
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('menuitem', { name: /Display Layout/ }).click();
|
||||||
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user