mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 10:44:21 +00:00
Compare commits
494 Commits
vue-3-migr
...
subscripti
Author | SHA1 | Date | |
---|---|---|---|
4cc0a9e402 | |||
12b921a006 | |||
34b36d544a | |||
e135498401 | |||
114864429a | |||
4cf63062c0 | |||
c4a3ace027 | |||
ad02ba7ffe | |||
0bdd5efcba | |||
2e3dc4da9a | |||
61edd0f810 | |||
4c86b66624 | |||
f079c3a3b9 | |||
43ae3cf655 | |||
947810b5d7 | |||
c28ced5c29 | |||
01434ff2d5 | |||
e530fd8e8b | |||
74c1cdf468 | |||
0061d162e1 | |||
70f5ba9ca8 | |||
11f3ce9470 | |||
2f2af0bac5 | |||
6ce340cebd | |||
6fd7b6f7a3 | |||
a87ffee264 | |||
69b2f05de2 | |||
3ff2f029eb | |||
67a1094a1f | |||
64d4ddd80e | |||
dfba4e23c5 | |||
70de7363d8 | |||
6f3bb5fc6f | |||
b220c2bad5 | |||
74f30789ca | |||
fce98a1c47 | |||
68e60e332e | |||
5af491382e | |||
2e03bc394c | |||
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 | |||
7ec2c4475b | |||
8f59b16465 | |||
36cfb1d515 | |||
2ff7132e90 | |||
d0ca398e01 | |||
59278e8a06 | |||
c8377f392b | |||
29df748f2b | |||
665ba6dae1 | |||
f39f8df4e2 | |||
4aa572d489 | |||
0b24c4f2c5 | |||
e4657f79cd | |||
f2059406e0 | |||
3e3dc7dd83 | |||
50742c4f82 | |||
2f04add2a3 | |||
0ce5060246 | |||
00353cdccf | |||
a1ac209d74 | |||
bdd8477b54 | |||
f690f36bfb | |||
e174f075df | |||
8cf12db104 | |||
453b1f3009 | |||
201c669328 | |||
1b7fb9b952 | |||
a3c5450205 | |||
8831b75c5d | |||
8fe0472af2 | |||
6cb5c47f3a | |||
eff0cc96b9 | |||
6ac7f24c63 | |||
39463c515f | |||
25c0dab346 | |||
3714958627 | |||
270a3d4f49 | |||
1dc137f95e | |||
ff3a20e446 | |||
0b3e0e7efd | |||
22cc28d733 | |||
006fa0bcc7 | |||
817d8da3e4 | |||
8df81f0ea9 | |||
1f30706d27 | |||
600890c4a6 | |||
b5002e166a | |||
39cff51db0 | |||
73734d99ea | |||
1d4cf1ff06 | |||
f388d9a548 | |||
8040b275fc | |||
0dd12bce85 | |||
9c9e0442f1 | |||
d49f057698 | |||
c74ad1279c | |||
470a451956 | |||
fa6cbb6f4d | |||
52c00cfaef | |||
96d723a424 | |||
fb4b80862e | |||
bb2c8cfa63 | |||
ceffee9f22 | |||
a08ccd80dc | |||
3509eacdec | |||
d4496cba41 | |||
64f300d466 | |||
8de24a109a | |||
6d62e0e73c | |||
5da1c9c0d7 | |||
4fa9a9697b | |||
bf48a6e306 | |||
00ad452930 | |||
8df1f6406b | |||
a50960d66c | |||
e3a69c8856 | |||
672cb7e621 | |||
7dcccee1ae | |||
302dbe7359 | |||
b4df01965e | |||
5a8f1d542e | |||
10decda94e | |||
5b1f8d0eac | |||
2f6e1b703a | |||
5384022a59 | |||
b57974b462 | |||
3c36ba9a71 | |||
2ac463de90 | |||
be38c3e654 | |||
0f312a88bb | |||
422b7f3e09 | |||
800062d37e | |||
c1e8c7915c | |||
c1c1d87953 | |||
0382d22f7f | |||
f570424357 | |||
393c801426 | |||
6d63339b23 | |||
66d7c626e1 | |||
2246f33023 | |||
871362d469 | |||
cc1bf47f5a | |||
9c784398b3 | |||
21ce013df2 | |||
d20c2a3e3c | |||
8d1a2e6716 | |||
01f724959d | |||
3ae6290ec3 | |||
ba5ed27e74 | |||
ca737d8afa | |||
33a275e8bc | |||
60e808689c | |||
8847c862fa | |||
1b71a3bf33 | |||
9980aab18f | |||
5e530aa625 | |||
986c596d90 | |||
4d84b16d8b | |||
20c7b23a4f | |||
d1c7d133fc | |||
edbbebe329 | |||
f98a2cdd6b | |||
22621aaaf8 | |||
e0ca6200bb | |||
70074c52c8 | |||
d5adaf6e8c | |||
8125632728 | |||
14c9dd0a32 | |||
9ae58f8441 | |||
4889284335 | |||
c2183d4de2 | |||
902d80c214 | |||
22ce817443 | |||
cdb202d8ba | |||
905373f294 | |||
60c07ab506 | |||
7336abc111 | |||
8fe9da89a3 | |||
e6bdaa957a | |||
93b5519c4b | |||
04ef4b369c | |||
5424a62db5 | |||
9ed9e62202 | |||
327fc826c1 | |||
a9e3eca35c | |||
cbecd79f71 | |||
3deb2e3dc2 | |||
d6e80447ab | |||
1a4bd0fb55 | |||
80f89c7609 | |||
b82649772f | |||
7f2ed27106 | |||
57e02db6b5 | |||
d54335d21c | |||
e0ed0bb6e2 | |||
ed3fd8f965 | |||
e6d59c61d1 |
@ -2,19 +2,23 @@ version: 2.1
|
||||
executors:
|
||||
pw-focal-development:
|
||||
docker:
|
||||
- image: mcr.microsoft.com/playwright:v1.25.2-focal
|
||||
- image: mcr.microsoft.com/playwright:v1.39.0-focal
|
||||
environment:
|
||||
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
||||
PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
|
||||
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||
ubuntu:
|
||||
machine:
|
||||
image: ubuntu-2204:current
|
||||
docker_layer_caching: true
|
||||
parameters:
|
||||
BUST_CACHE:
|
||||
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
||||
description: 'Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!'
|
||||
default: false
|
||||
type: boolean
|
||||
commands:
|
||||
build_and_install:
|
||||
description: "All steps used to build and install. Will use cache if found"
|
||||
description: 'All steps used to build and install. Will use cache if found'
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
@ -23,53 +27,52 @@ commands:
|
||||
- restore_cache_cmd:
|
||||
node-version: << parameters.node-version >>
|
||||
- node/install:
|
||||
install-npm: true
|
||||
node-version: << parameters.node-version >>
|
||||
- run: npm install --prefer-offline --no-audit --progress=false
|
||||
- run: npm install --no-audit --progress=false
|
||||
restore_cache_cmd:
|
||||
description: "Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache"
|
||||
description: 'Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache'
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
steps:
|
||||
- when:
|
||||
condition:
|
||||
equal: [false, << pipeline.parameters.BUST_CACHE >> ]
|
||||
equal: [false, << pipeline.parameters.BUST_CACHE >>]
|
||||
steps:
|
||||
- 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:
|
||||
description: "Custom command for saving cache."
|
||||
description: 'Custom command for saving cache.'
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
steps:
|
||||
- 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:
|
||||
- ~/.npm
|
||||
- node_modules
|
||||
generate_and_store_version_and_filesystem_artifacts:
|
||||
description: "Track important packages and files"
|
||||
description: 'Track important packages and files'
|
||||
steps:
|
||||
- run: |
|
||||
mkdir /tmp/artifacts
|
||||
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt
|
||||
[[ $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 || true
|
||||
npm -v >> /tmp/artifacts/npm-version.txt
|
||||
node -v >> /tmp/artifacts/node-version.txt
|
||||
ls -latR >> /tmp/artifacts/dir.txt
|
||||
- store_artifacts:
|
||||
path: /tmp/artifacts/
|
||||
generate_e2e_code_cov_report:
|
||||
description: "Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test"
|
||||
parameters:
|
||||
description: 'Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test'
|
||||
parameters:
|
||||
suite:
|
||||
type: string
|
||||
steps:
|
||||
- run: npm run cov:e2e:report || true
|
||||
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
||||
steps:
|
||||
- run: npm run cov:e2e:report || true
|
||||
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
||||
orbs:
|
||||
node: circleci/node@4.9.0
|
||||
node: circleci/node@5.1.0
|
||||
browser-tools: circleci/browser-tools@1.3.0
|
||||
jobs:
|
||||
npm-audit:
|
||||
@ -110,26 +113,32 @@ jobs:
|
||||
path: dist/reports/tests/
|
||||
- store_artifacts:
|
||||
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:
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
suite: #stable or full
|
||||
type: string
|
||||
executor: pw-focal-development
|
||||
parallelism: 4
|
||||
parallelism: 6
|
||||
steps:
|
||||
- build_and_install:
|
||||
node-version: <<parameters.node-version>>
|
||||
node-version: lts/hydrogen
|
||||
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
||||
condition:
|
||||
equal: [ "full", <<parameters.suite>> ]
|
||||
equal: ['full', <<parameters.suite>>]
|
||||
steps:
|
||||
- run: npx playwright install chrome-beta
|
||||
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
||||
- generate_e2e_code_cov_report:
|
||||
suite: <<parameters.suite>>
|
||||
- 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: <<parameters.suite>>
|
||||
- store_test_results:
|
||||
path: test-results/results.xml
|
||||
- store_artifacts:
|
||||
@ -138,81 +147,138 @@ jobs:
|
||||
path: coverage
|
||||
- store_artifacts:
|
||||
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:
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
executor: pw-focal-development
|
||||
steps:
|
||||
- build_and_install:
|
||||
node-version: <<parameters.node-version>>
|
||||
- run: npm run test:perf
|
||||
node-version: lts/hydrogen
|
||||
- run: npm run test:perf:localhost
|
||||
- run: npm run test:perf:contract
|
||||
- store_test_results:
|
||||
path: test-results/results.xml
|
||||
- store_artifacts:
|
||||
path: test-results
|
||||
- store_artifacts:
|
||||
path: html-test-results
|
||||
- generate_and_store_version_and_filesystem_artifacts
|
||||
visual-test:
|
||||
- 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
|
||||
visual-a11y-tests:
|
||||
parameters:
|
||||
node-version:
|
||||
type: string
|
||||
suite:
|
||||
type: string # ci or full
|
||||
executor: pw-focal-development
|
||||
steps:
|
||||
- build_and_install:
|
||||
node-version: <<parameters.node-version>>
|
||||
- run: npm run test:e2e:visual
|
||||
node-version: lts/hydrogen
|
||||
- run: npm run test:e2e:visual:<<parameters.suite>>
|
||||
- store_test_results:
|
||||
path: test-results/results.xml
|
||||
- store_artifacts:
|
||||
path: test-results
|
||||
- store_artifacts:
|
||||
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:
|
||||
overall-circleci-commit-status: #These jobs run on every commit
|
||||
jobs:
|
||||
- lint:
|
||||
name: node14-lint
|
||||
node-version: lts/fermium
|
||||
name: node20-lint
|
||||
node-version: lts/iron
|
||||
- unit-test:
|
||||
name: node18-chrome
|
||||
node-version: "18"
|
||||
node-version: lts/hydrogen
|
||||
- e2e-test:
|
||||
name: e2e-stable
|
||||
node-version: lts/gallium
|
||||
suite: stable
|
||||
- perf-test:
|
||||
node-version: lts/gallium
|
||||
- visual-test:
|
||||
node-version: lts/gallium
|
||||
|
||||
- mem-test
|
||||
- perf-test
|
||||
- visual-a11y-tests:
|
||||
name: visual-test-ci
|
||||
suite: ci
|
||||
|
||||
the-nightly: #These jobs do not run on PRs, but against master at night
|
||||
jobs:
|
||||
- unit-test:
|
||||
name: node14-chrome-nightly
|
||||
node-version: lts/fermium
|
||||
- unit-test:
|
||||
name: node16-chrome-nightly
|
||||
node-version: lts/gallium
|
||||
name: node20-chrome-nightly
|
||||
node-version: lts/iron
|
||||
- unit-test:
|
||||
name: node18-chrome
|
||||
node-version: "18"
|
||||
node-version: lts/hydrogen
|
||||
- npm-audit:
|
||||
node-version: lts/gallium
|
||||
node-version: lts/hydrogen
|
||||
- e2e-test:
|
||||
name: e2e-full-nightly
|
||||
node-version: lts/gallium
|
||||
suite: full
|
||||
- perf-test:
|
||||
node-version: lts/gallium
|
||||
- visual-test:
|
||||
node-version: lts/gallium
|
||||
- mem-test
|
||||
- perf-test
|
||||
- visual-a11y-tests:
|
||||
name: visual-test-nightly
|
||||
suite: full
|
||||
- e2e-couchdb
|
||||
triggers:
|
||||
- schedule:
|
||||
cron: "0 0 * * *"
|
||||
cron: '0 0 * * *'
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
|
508
.cspell.json
Normal file
508
.cspell.json
Normal file
@ -0,0 +1,508 @@
|
||||
{
|
||||
"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",
|
||||
"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",
|
||||
"stackedplot",
|
||||
"Andale"
|
||||
],
|
||||
"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"
|
||||
]
|
||||
}
|
181
.eslintrc.cjs
Normal file
181
.eslintrc.cjs
Normal file
@ -0,0 +1,181 @@
|
||||
const LEGACY_FILES = ['example/**'];
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es6: true,
|
||||
jasmine: true,
|
||||
amd: true
|
||||
},
|
||||
globals: {
|
||||
_: 'readonly'
|
||||
},
|
||||
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:compat/recommended',
|
||||
'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'
|
||||
}
|
||||
],
|
||||
'no-console': 'off',
|
||||
'new-cap': [
|
||||
'error',
|
||||
{
|
||||
capIsNew: false,
|
||||
properties: false
|
||||
}
|
||||
],
|
||||
'dot-notation': 'error',
|
||||
|
||||
// https://eslint.org/docs/rules/no-case-declarations
|
||||
'no-case-declarations': 'error',
|
||||
// https://eslint.org/docs/rules/max-classes-per-file
|
||||
'max-classes-per-file': ['error', 1],
|
||||
// https://eslint.org/docs/rules/no-eq-null
|
||||
'no-eq-null': 'error',
|
||||
// https://eslint.org/docs/rules/no-eval
|
||||
'no-eval': 'error',
|
||||
// https://eslint.org/docs/rules/no-implicit-globals
|
||||
'no-implicit-globals': 'error',
|
||||
// https://eslint.org/docs/rules/no-implied-eval
|
||||
'no-implied-eval': 'error',
|
||||
// https://eslint.org/docs/rules/no-lone-blocks
|
||||
'no-lone-blocks': 'error',
|
||||
// https://eslint.org/docs/rules/no-loop-func
|
||||
'no-loop-func': 'error',
|
||||
// https://eslint.org/docs/rules/no-new-func
|
||||
'no-new-func': 'error',
|
||||
// https://eslint.org/docs/rules/no-new-wrappers
|
||||
'no-new-wrappers': 'error',
|
||||
// https://eslint.org/docs/rules/no-octal-escape
|
||||
'no-octal-escape': 'error',
|
||||
// https://eslint.org/docs/rules/no-proto
|
||||
'no-proto': 'error',
|
||||
// https://eslint.org/docs/rules/no-return-await
|
||||
'no-return-await': 'error',
|
||||
// https://eslint.org/docs/rules/no-script-url
|
||||
'no-script-url': 'error',
|
||||
// https://eslint.org/docs/rules/no-self-compare
|
||||
'no-self-compare': 'error',
|
||||
// https://eslint.org/docs/rules/no-sequences
|
||||
'no-sequences': 'error',
|
||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||
'no-unmodified-loop-condition': 'error',
|
||||
// https://eslint.org/docs/rules/no-useless-call
|
||||
'no-useless-call': 'error',
|
||||
// https://eslint.org/docs/rules/no-nested-ternary
|
||||
'no-nested-ternary': 'error',
|
||||
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||
'no-useless-computed-key': 'error',
|
||||
// https://eslint.org/docs/rules/no-var
|
||||
'no-var': 'error',
|
||||
// https://eslint.org/docs/rules/one-var
|
||||
'one-var': ['error', 'never'],
|
||||
// https://eslint.org/docs/rules/default-case-last
|
||||
'default-case-last': 'error',
|
||||
// https://eslint.org/docs/rules/default-param-last
|
||||
'default-param-last': 'error',
|
||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||
'grouped-accessor-pairs': 'error',
|
||||
// https://eslint.org/docs/rules/no-constructor-return
|
||||
'no-constructor-return': 'error',
|
||||
// https://eslint.org/docs/rules/array-callback-return
|
||||
'array-callback-return': 'error',
|
||||
// https://eslint.org/docs/rules/no-invalid-this
|
||||
'no-invalid-this': 'error', // Believe this one actually surfaces some bugs
|
||||
// https://eslint.org/docs/rules/func-style
|
||||
'func-style': ['error', 'declaration'],
|
||||
// https://eslint.org/docs/rules/no-unused-expressions
|
||||
'no-unused-expressions': 'error',
|
||||
// https://eslint.org/docs/rules/no-useless-concat
|
||||
'no-useless-concat': 'error',
|
||||
// https://eslint.org/docs/rules/radix
|
||||
radix: '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
|
||||
'no-implicit-coercion': 'error',
|
||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||
'no-unneeded-ternary': 'error',
|
||||
'unicorn/filename-case': [
|
||||
'error',
|
||||
{
|
||||
cases: {
|
||||
pascalCase: true
|
||||
},
|
||||
ignore: ['^.*\\.js$']
|
||||
}
|
||||
],
|
||||
'vue/first-attribute-linebreak': 'error',
|
||||
'vue/multiline-html-element-content-newline': 'off',
|
||||
'vue/singleline-html-element-content-newline': 'off',
|
||||
'vue/no-mutating-props': 'off' // TODO: Remove this rule and fix resulting errors
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: LEGACY_FILES,
|
||||
rules: {
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
vars: 'all',
|
||||
args: 'none',
|
||||
varsIgnorePattern: 'controller'
|
||||
}
|
||||
],
|
||||
'no-nested-ternary': 'off',
|
||||
'no-var': 'off',
|
||||
'one-var': 'off'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
271
.eslintrc.js
271
.eslintrc.js
@ -1,271 +0,0 @@
|
||||
const LEGACY_FILES = ["example/**"];
|
||||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"jasmine": true,
|
||||
"amd": true
|
||||
},
|
||||
"globals": {
|
||||
"_": "readonly"
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:compat/recommended",
|
||||
"plugin:vue/recommended",
|
||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
||||
],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
"parser": "@babel/eslint-parser",
|
||||
"requireConfigFile": false,
|
||||
"allowImportExportEverywhere": true,
|
||||
"ecmaVersion": 2015,
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true
|
||||
}
|
||||
},
|
||||
"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
|
||||
"no-case-declarations": "error",
|
||||
// https://eslint.org/docs/rules/max-classes-per-file
|
||||
"max-classes-per-file": ["error", 1],
|
||||
// https://eslint.org/docs/rules/no-eq-null
|
||||
"no-eq-null": "error",
|
||||
// https://eslint.org/docs/rules/no-eval
|
||||
"no-eval": "error",
|
||||
// https://eslint.org/docs/rules/no-floating-decimal
|
||||
"no-floating-decimal": "error",
|
||||
// https://eslint.org/docs/rules/no-implicit-globals
|
||||
"no-implicit-globals": "error",
|
||||
// https://eslint.org/docs/rules/no-implied-eval
|
||||
"no-implied-eval": "error",
|
||||
// https://eslint.org/docs/rules/no-lone-blocks
|
||||
"no-lone-blocks": "error",
|
||||
// https://eslint.org/docs/rules/no-loop-func
|
||||
"no-loop-func": "error",
|
||||
// https://eslint.org/docs/rules/no-new-func
|
||||
"no-new-func": "error",
|
||||
// https://eslint.org/docs/rules/no-new-wrappers
|
||||
"no-new-wrappers": "error",
|
||||
// https://eslint.org/docs/rules/no-octal-escape
|
||||
"no-octal-escape": "error",
|
||||
// https://eslint.org/docs/rules/no-proto
|
||||
"no-proto": "error",
|
||||
// https://eslint.org/docs/rules/no-return-await
|
||||
"no-return-await": "error",
|
||||
// https://eslint.org/docs/rules/no-script-url
|
||||
"no-script-url": "error",
|
||||
// https://eslint.org/docs/rules/no-self-compare
|
||||
"no-self-compare": "error",
|
||||
// https://eslint.org/docs/rules/no-sequences
|
||||
"no-sequences": "error",
|
||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||
"no-unmodified-loop-condition": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-call
|
||||
"no-useless-call": "error",
|
||||
// https://eslint.org/docs/rules/wrap-iife
|
||||
"wrap-iife": "error",
|
||||
// https://eslint.org/docs/rules/no-nested-ternary
|
||||
"no-nested-ternary": "error",
|
||||
// https://eslint.org/docs/rules/switch-colon-spacing
|
||||
"switch-colon-spacing": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||
"no-useless-computed-key": "error",
|
||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
||||
"rest-spread-spacing": ["error"],
|
||||
// https://eslint.org/docs/rules/no-var
|
||||
"no-var": "error",
|
||||
// https://eslint.org/docs/rules/one-var
|
||||
"one-var": ["error", "never"],
|
||||
// https://eslint.org/docs/rules/default-case-last
|
||||
"default-case-last": "error",
|
||||
// https://eslint.org/docs/rules/default-param-last
|
||||
"default-param-last": "error",
|
||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||
"grouped-accessor-pairs": "error",
|
||||
// https://eslint.org/docs/rules/no-constructor-return
|
||||
"no-constructor-return": "error",
|
||||
// https://eslint.org/docs/rules/array-callback-return
|
||||
"array-callback-return": "error",
|
||||
// https://eslint.org/docs/rules/no-invalid-this
|
||||
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
|
||||
// https://eslint.org/docs/rules/func-style
|
||||
"func-style": ["error", "declaration"],
|
||||
// https://eslint.org/docs/rules/no-unused-expressions
|
||||
"no-unused-expressions": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-concat
|
||||
"no-useless-concat": "error",
|
||||
// https://eslint.org/docs/rules/radix
|
||||
"radix": "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
|
||||
"no-implicit-coercion": "error",
|
||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||
"no-unneeded-ternary": "error",
|
||||
// https://eslint.org/docs/rules/semi
|
||||
"semi": ["error", "always"],
|
||||
// https://eslint.org/docs/rules/no-multi-spaces
|
||||
"no-multi-spaces": "error",
|
||||
// https://eslint.org/docs/rules/key-spacing
|
||||
"key-spacing": ["error", {
|
||||
"afterColon": true
|
||||
}],
|
||||
// https://eslint.org/docs/rules/keyword-spacing
|
||||
"keyword-spacing": ["error", {
|
||||
"before": true,
|
||||
"after": true
|
||||
}],
|
||||
// https://eslint.org/docs/rules/comma-spacing
|
||||
// Also requires one line code fix
|
||||
"comma-spacing": ["error", {
|
||||
"after": true
|
||||
}],
|
||||
//https://eslint.org/docs/rules/no-whitespace-before-property
|
||||
"no-whitespace-before-property": "error",
|
||||
// https://eslint.org/docs/rules/object-curly-newline
|
||||
"object-curly-newline": ["error", {
|
||||
"consistent": true,
|
||||
"multiline": true
|
||||
}],
|
||||
// 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",
|
||||
{
|
||||
"html": {
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
16
.git-blame-ignore-revs
Normal file
16
.git-blame-ignore-revs
Normal file
@ -0,0 +1,16 @@
|
||||
# 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
|
||||
|
||||
# vue-eslint update 2019
|
||||
14a0f84c1bcd56886d7c9e4e6afa8f7d292734e5
|
||||
# eslint changes 2022
|
||||
d80b6923541704ab925abf0047cbbc58735c27e2
|
||||
# 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?
|
||||
* [ ] Tests included and/or updated with changes?
|
||||
* [ ] Command line build passes?
|
||||
* [ ] Has this been smoke tested?
|
||||
* [ ] Have you associated this PR with a `type:` label? Note: this is not necessarily the same as the original issue.
|
||||
* [ ] Have you associated a milestone with this PR? Note: leave blank if unsure.
|
||||
* [ ] Is this a breaking change to be called out in the release notes?
|
||||
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
||||
|
||||
### Reviewer Checklist
|
||||
@ -25,5 +27,3 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
||||
* [ ] Changes appear not to be breaking changes?
|
||||
* [ ] Appropriate automated tests included?
|
||||
* [ ] 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
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
- package-ecosystem: 'npm'
|
||||
directory: '/'
|
||||
schedule:
|
||||
interval: "daily"
|
||||
interval: 'weekly'
|
||||
open-pull-requests-limit: 10
|
||||
rebase-strategy: 'disabled'
|
||||
labels:
|
||||
- "pr:e2e"
|
||||
- "type:maintenance"
|
||||
- "dependencies"
|
||||
- "pr:daveit"
|
||||
- "pr:platform"
|
||||
- 'pr:daveit'
|
||||
- 'pr:e2e'
|
||||
- 'type:maintenance'
|
||||
- 'dependencies'
|
||||
- 'pr:platform'
|
||||
ignore:
|
||||
#We have to source the playwright container which is not detected by Dependabot
|
||||
- dependency-name: "@playwright/test"
|
||||
- dependency-name: "playwright-core"
|
||||
- dependency-name: '@playwright/test'
|
||||
- dependency-name: 'playwright-core'
|
||||
#Lots of noise in these type patch releases.
|
||||
- dependency-name: "@babel/eslint-parser"
|
||||
update-types: ["version-update:semver-patch"]
|
||||
- dependency-name: "eslint-plugin-vue"
|
||||
update-types: ["version-update:semver-patch"]
|
||||
- dependency-name: "babel-loader"
|
||||
update-types: ["version-update:semver-patch"]
|
||||
- dependency-name: "sinon"
|
||||
update-types: ["version-update:semver-patch"]
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
- dependency-name: '@babel/eslint-parser'
|
||||
update-types: ['version-update:semver-patch']
|
||||
- dependency-name: 'eslint-plugin-vue'
|
||||
update-types: ['version-update:semver-patch']
|
||||
- dependency-name: 'babel-loader'
|
||||
update-types: ['version-update:semver-patch']
|
||||
- dependency-name: 'sinon'
|
||||
update-types: ['version-update:semver-patch']
|
||||
- dependency-name: 'moment-timezone'
|
||||
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:
|
||||
interval: "daily"
|
||||
interval: 'daily'
|
||||
rebase-strategy: 'disabled'
|
||||
labels:
|
||||
- "type:maintenance"
|
||||
- "dependencies"
|
||||
- "pr:daveit"
|
||||
- 'pr:daveit'
|
||||
- 'type:maintenance'
|
||||
- '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:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
config-file: ./.github/codeql/codeql-config.yml
|
||||
languages: javascript
|
||||
queries: security-and-quality
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
88
.github/workflows/e2e-couchdb.yml
vendored
88
.github/workflows/e2e-couchdb.yml
vendored
@ -1,38 +1,88 @@
|
||||
name: "e2e-couchdb"
|
||||
name: 'e2e-couchdb'
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
env:
|
||||
OPENMCT_DATABASE_NAME: openmct
|
||||
COUCH_ADMIN_USER: admin
|
||||
COUCH_ADMIN_PASSWORD: password
|
||||
COUCH_BASE_LOCAL: http://localhost:5984
|
||||
COUCH_NODE_NAME: nonode@nohost
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
jobs:
|
||||
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
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run : docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
||||
- 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
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: npx playwright@1.25.2 install
|
||||
- run: npm install
|
||||
- run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
||||
- run: npm run test:e2e:couchdb
|
||||
- run: ls -latr
|
||||
node-version: 'lts/hydrogen'
|
||||
|
||||
- name: Cache NPM dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
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
|
||||
env:
|
||||
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
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: test-results
|
||||
|
||||
- name: Archive html test results
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
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:
|
||||
push:
|
||||
branches: master
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
jobs:
|
||||
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 }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
steps:
|
||||
- name: Trigger Success
|
||||
uses: actions/github-script@v6
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: "nasa",
|
||||
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
|
||||
node-version: 'lts/hydrogen'
|
||||
|
||||
- name: Cache NPM dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
node-version: '16'
|
||||
- run: npx playwright@1.25.2 install
|
||||
path: ~/.npm
|
||||
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: npm install
|
||||
- run: npm run test:e2e:full
|
||||
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||
- 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
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
path: test-results
|
||||
- name: Test success
|
||||
if: ${{ success() }}
|
||||
|
||||
- name: Remove pr:e2e label (if present)
|
||||
if: always()
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: "nasa",
|
||||
repo: "openmct",
|
||||
body: 'Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
||||
})
|
||||
- name: Test failure
|
||||
if: ${{ failure() }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
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
|
||||
})
|
||||
const { owner, repo, number } = context.issue;
|
||||
const labelToRemove = 'pr:e2e';
|
||||
try {
|
||||
await github.rest.issues.removeLabel({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: number,
|
||||
name: labelToRemove
|
||||
});
|
||||
} catch (error) {
|
||||
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||
}
|
||||
|
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:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: lts/hydrogen
|
||||
- run: npm install
|
||||
- run: |
|
||||
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
||||
@ -26,10 +26,10 @@ jobs:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: lts/hydrogen
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm install
|
||||
- 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:
|
||||
push:
|
||||
branches: master
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [ labeled ]
|
||||
|
||||
types:
|
||||
- labeled
|
||||
- opened
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
jobs:
|
||||
e2e-full:
|
||||
if: ${{ github.event.label.name == 'pr:platform' }}
|
||||
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 }}
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@ -16,19 +22,49 @@ jobs:
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
node_version:
|
||||
- 14
|
||||
- 16
|
||||
- 18
|
||||
- lts/iron
|
||||
- lts/hydrogen
|
||||
architecture:
|
||||
- x64
|
||||
|
||||
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node_version }}
|
||||
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 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:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
- unlabeled
|
||||
- opened
|
||||
- reopened
|
||||
- edited
|
||||
- synchronize
|
||||
- ready_for_review
|
||||
- review_requested
|
||||
- review_request_removed
|
||||
- edited
|
||||
pull_request_review_comment:
|
||||
types:
|
||||
- created
|
||||
|
||||
env:
|
||||
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }}
|
||||
jobs:
|
||||
prcop:
|
||||
runs-on: ubuntu-latest
|
||||
@ -22,5 +22,17 @@ jobs:
|
||||
- name: Linting Pull Request
|
||||
uses: makaroni4/prcop@v1.0.35
|
||||
with:
|
||||
config-file: ".github/workflows/prcop-config.json"
|
||||
config-file: '.github/workflows/prcop-config.json'
|
||||
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
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,6 +15,9 @@
|
||||
*.idea
|
||||
*.iml
|
||||
|
||||
# VSCode
|
||||
.vscode/settings.json
|
||||
|
||||
# Build output
|
||||
target
|
||||
dist
|
||||
|
5
.npmrc
5
.npmrc
@ -1,4 +1,7 @@
|
||||
loglevel=warn
|
||||
|
||||
#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"
|
||||
}
|
185
.webpack/webpack.common.js
Normal file
185
.webpack/webpack.common.js
Normal file
@ -0,0 +1,185 @@
|
||||
/*
|
||||
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
|
||||
- webpack.prod.js - the production configuration for OpenMCT (default)
|
||||
- webpack.dev.js - the development configuration for OpenMCT
|
||||
- webpack.coverage.js - imports webpack.dev.js and adds code coverage
|
||||
There are separate npm scripts to use these configurations, though simply running `npm install`
|
||||
will use the default production configuration.
|
||||
*/
|
||||
import { execSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import { VueLoaderPlugin } from 'vue-loader';
|
||||
import webpack from 'webpack';
|
||||
let gitRevision = 'error-retrieving-revision';
|
||||
let gitBranch = 'error-retrieving-branch';
|
||||
|
||||
const packageDefinition = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
|
||||
|
||||
try {
|
||||
gitRevision = execSync('git rev-parse HEAD').toString().trim();
|
||||
gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
||||
} catch (err) {
|
||||
console.warn(err);
|
||||
}
|
||||
|
||||
const projectRootDir = fileURLToPath(new URL('../', import.meta.url));
|
||||
|
||||
/** @type {import('webpack').Configuration} */
|
||||
const config = {
|
||||
context: projectRootDir,
|
||||
devServer: {
|
||||
client: {
|
||||
progress: true,
|
||||
overlay: {
|
||||
// Disable overlay for runtime errors.
|
||||
// See: https://github.com/webpack/webpack-dev-server/issues/4771
|
||||
runtimeErrors: false
|
||||
}
|
||||
}
|
||||
},
|
||||
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',
|
||||
libraryExport: 'default',
|
||||
libraryTarget: 'umd',
|
||||
publicPath: '',
|
||||
hashFunction: 'xxhash64',
|
||||
clean: true
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.join(projectRootDir, 'src'),
|
||||
legacyRegistry: path.join(projectRootDir, 'src/legacyRegistry'),
|
||||
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'),
|
||||
vue: 'vue/dist/vue.esm-bundler'
|
||||
}
|
||||
},
|
||||
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
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
35
.webpack/webpack.coverage.js
Normal file
35
.webpack/webpack.coverage.js
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
This file extends the webpack.dev.js config to add babel istanbul coverage.
|
||||
OpenMCT Continuous Integration servers use this configuration to add code coverage
|
||||
information to pull requests.
|
||||
*/
|
||||
|
||||
import config from './webpack.dev.js';
|
||||
// eslint-disable-next-line no-undef
|
||||
const CI = process.env.CI === 'true';
|
||||
|
||||
config.devtool = CI ? false : undefined;
|
||||
|
||||
config.devServer.hot = false;
|
||||
|
||||
config.module.rules.push({
|
||||
test: /\.js$/,
|
||||
exclude: /(Spec\.js$)|(node_modules)/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
retainLines: true,
|
||||
// eslint-disable-next-line no-undef
|
||||
plugins: [
|
||||
[
|
||||
'babel-plugin-istanbul',
|
||||
{
|
||||
extension: ['.js', '.vue']
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export default config;
|
48
.webpack/webpack.dev.js
Normal file
48
.webpack/webpack.dev.js
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
This configuration should be used for development purposes. It contains full source map, a
|
||||
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
||||
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
||||
*/
|
||||
import path from 'path';
|
||||
import webpack from 'webpack';
|
||||
import { merge } from 'webpack-merge';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import common from './webpack.common.js';
|
||||
|
||||
export default merge(common, {
|
||||
mode: 'development',
|
||||
watchOptions: {
|
||||
// Since we use require.context, webpack is watching the entire directory.
|
||||
// We need to exclude any files we don't want webpack to watch.
|
||||
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
||||
ignored: [
|
||||
'**/{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
|
||||
'**/*.{sh,md,png,ttf,woff,svg}', // Non source files
|
||||
'**/.*' // dotfiles and dotfolders
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
||||
})
|
||||
],
|
||||
devtool: 'eval-source-map',
|
||||
devServer: {
|
||||
devMiddleware: {
|
||||
writeToDisk: (filePathString) => {
|
||||
const filePath = path.parse(filePathString);
|
||||
const shouldWrite = !filePath.base.includes('hot-update');
|
||||
|
||||
return shouldWrite;
|
||||
}
|
||||
},
|
||||
watchFiles: ['**/*.css'],
|
||||
static: {
|
||||
directory: fileURLToPath(new URL('../dist', import.meta.url)),
|
||||
publicPath: '/dist',
|
||||
watch: false
|
||||
}
|
||||
}
|
||||
});
|
19
.webpack/webpack.prod.js
Normal file
19
.webpack/webpack.prod.js
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
This configuration should be used for production installs.
|
||||
It is the default webpack configuration.
|
||||
*/
|
||||
|
||||
import webpack from 'webpack';
|
||||
import { merge } from 'webpack-merge';
|
||||
|
||||
import common from './webpack.common.js';
|
||||
|
||||
export default merge(common, {
|
||||
mode: 'production',
|
||||
plugins: [
|
||||
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 -->
|
||||
**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)
|
||||
- [Building From Source](#building-from-source)
|
||||
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
||||
@ -26,7 +26,7 @@
|
||||
- [Value Hints](#value-hints)
|
||||
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
||||
- [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)
|
||||
- [`latest` request strategy](#latest-request-strategy)
|
||||
- [`minmax` request strategy](#minmax-request-strategy)
|
||||
@ -44,8 +44,10 @@
|
||||
- [Clocks](#clocks)
|
||||
- [Defining and registering clocks](#defining-and-registering-clocks)
|
||||
- [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)
|
||||
- [Time Modes](#time-modes)
|
||||
- [Time Mode Helper Methods](#time-mode-helper-methods)
|
||||
- [Time Events](#time-events)
|
||||
- [List of Time Events](#list-of-time-events)
|
||||
- [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
|
||||
|
||||
> [!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
|
||||
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
||||
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 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.
|
||||
- `format`: A `function` that takes a raw telemetry value, and returns a
|
||||
human-readable `string` representation of that value. It has one required
|
||||
argument, and three optional arguments that provide context and can be used
|
||||
for returning scaled representations of a value. An example of this is
|
||||
representing time values in a scale such as the time conductor scale. There
|
||||
are multiple ways of representing a point in time, and by providing a minimum
|
||||
scale value, maximum scale value, and a count, it's possible to provide more
|
||||
useful representations of time given the provided limitations.
|
||||
- `value`: The raw telemetry value in its native type.
|
||||
- `minValue`: An **optional** argument specifying the minimum displayed
|
||||
value.
|
||||
- `maxValue`: An **optional** argument specifying the maximum displayed
|
||||
value.
|
||||
- `count`: An **optional** argument specifying the number of displayed
|
||||
values.
|
||||
- `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
|
||||
can be parsed.
|
||||
```ts
|
||||
interface Formatter {
|
||||
key: string; // A string that uniquely identifies this formatter.
|
||||
|
||||
format: (
|
||||
value: any, // The raw telemetry value in its native type.
|
||||
minValue?: number, // An optional argument specifying the minimum displayed value.
|
||||
maxValue?: number, // An optional argument specifying the maximum displayed value.
|
||||
count?: number // An optional argument specifying the number of displayed values.
|
||||
) => string; // Returns a human-readable string representation of the provided value.
|
||||
|
||||
parse: (
|
||||
value: string | any // A string representation of a telemetry value or an already-parsed value.
|
||||
) => any; // Returns the value in its native type. This function should be idempotent.
|
||||
|
||||
validate: (value: string) => boolean; // Takes a string representation of a telemetry value and returns a boolean indicating whether the provided string can be parsed.
|
||||
}
|
||||
```
|
||||
|
||||
##### Built-in Formats
|
||||
|
||||
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
|
||||
|
||||
Formats implement the following interface (provided here as TypeScript for simplicity):
|
||||
|
||||
|
||||
Formats are registered with the Telemetry API using the `addFormat` function. eg.
|
||||
|
||||
``` javascript
|
||||
```javascript
|
||||
openmct.telemetry.addFormat({
|
||||
key: 'number-to-string',
|
||||
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
|
||||
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
|
||||
[in the next section](#defining-and-registering-time-systems).
|
||||
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 [in the next section](#defining-and-registering-time-systems).
|
||||
|
||||
### Time Systems and Bounds
|
||||
|
||||
@ -737,28 +816,38 @@ numbers in UTC terrestrial time.
|
||||
|
||||
#### Getting and Setting the Active Time System
|
||||
|
||||
Once registered, a time system can be activated by calling `timeSystem` with
|
||||
the timeSystem `key` or an instance of the time system. If you are not using a
|
||||
[clock](#clocks), you must also specify valid [bounds](#time-bounds) for the
|
||||
timeSystem.
|
||||
Once registered, a time system can be activated by calling `setTimeSystem` with
|
||||
the timeSystem `key` or an instance of the time system. You can also specify
|
||||
valid [bounds](#time-bounds) for the timeSystem.
|
||||
|
||||
```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:
|
||||
|
||||
```javascript
|
||||
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)
|
||||
event. If you supplied bounds, a [`'bounds'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
||||
Setting the active time system will trigger a [`'timeSystemChanged'`](#time-events)
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
- `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
|
||||
telemetry views.
|
||||
|
||||
If invoked with bounds, it will set the new time bounds system-wide. If invoked
|
||||
without any parameters, it will return the current application-wide time bounds.
|
||||
New bounds can be set system wide by calling `setBounds` with [bounds](#time-bounds).
|
||||
|
||||
``` javascript
|
||||
const ONE_HOUR = 60 * 60 * 1000;
|
||||
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.
|
||||
|
||||
> ⚠️ **Deprecated**
|
||||
> - The method `bounds()` is deprecated and will be removed in a future release. Please use `getBounds()` and `setBounds()` as a replacement.
|
||||
|
||||
### Clocks
|
||||
|
||||
The Time API can be set to follow a clock source which will cause the bounds
|
||||
to be updated automatically whenever the clock source "ticks". A clock is simply
|
||||
an object that supports registration of listeners and periodically invokes its
|
||||
listeners with a number. Open MCT supports registration of new clock sources that
|
||||
tick on almost anything. A tick occurs when the clock invokes callback functions
|
||||
registered by its listeners with a new time value.
|
||||
The Time API requires a clock source which will cause the bounds to be updated
|
||||
automatically whenever the clock source "ticks". A clock is simply an object that
|
||||
supports registration of listeners and periodically invokes its listeners with a
|
||||
number. Open MCT supports registration of new clock sources that tick on almost
|
||||
anything. A tick occurs when the clock invokes callback functions registered by its
|
||||
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)
|
||||
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
|
||||
|
||||
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
|
||||
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`.
|
||||
|
||||
The currently active clock (if any) can be retrieved by calling the same
|
||||
function without any arguments.
|
||||
The currently active clock can be retrieved by calling `getClock`.
|
||||
|
||||
#### 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
|
||||
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();
|
||||
```
|
||||
|
||||
> ⚠️ **Deprecated**
|
||||
> - The method `stopClock()` is deprecated and will be removed in a future release.
|
||||
|
||||
#### Clock Offsets
|
||||
|
||||
When a clock is active, 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 (via its `tick` event, or its
|
||||
`currentValue()` method).
|
||||
When in Real-time [mode](#time-modes), 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 (via its `tick` event, or its `currentValue()` method).
|
||||
|
||||
Unlike bounds, which represent absolute time values, clock offsets represent
|
||||
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
|
||||
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:
|
||||
|
||||
```javascript
|
||||
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
||||
|
||||
openmct.time.clockOffsets({
|
||||
openmct.time.setClockOffsets({
|
||||
start: -FIFTEEN_MINUTES,
|
||||
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
|
||||
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
|
||||
|
||||
@ -919,7 +1082,7 @@ The Time API is a standard event emitter; you can register callbacks for events
|
||||
For example:
|
||||
|
||||
``` javascript
|
||||
openmct.time.on('bounds', function callback (newBounds, tick) {
|
||||
openmct.time.on('boundsChanged', function callback (newBounds, tick) {
|
||||
// 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:
|
||||
|
||||
- `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:
|
||||
- `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
||||
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,
|
||||
and a query for historical data may be necessary, depending on your data
|
||||
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).
|
||||
- `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:
|
||||
- `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
||||
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:
|
||||
- `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
|
||||
|
||||
@ -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.)
|
||||
4. Respond to any discussion. When the reviewer decides it's ready, they
|
||||
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
|
||||
|
||||
Open MCT uses git for software version control, and for branching and
|
||||
merging. The central repository is at
|
||||
https://github.com/nasa/openmct.git.
|
||||
<https://github.com/nasa/openmct.git>.
|
||||
|
||||
### Roles
|
||||
|
||||
@ -116,6 +116,7 @@ the pull request containing the reviewer checklist (from below) and complete
|
||||
the merge back to the master branch.
|
||||
|
||||
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 __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__.
|
||||
@ -132,25 +133,26 @@ changes.
|
||||
|
||||
### Code Standards
|
||||
|
||||
JavaScript sources in Open MCT must satisfy the ESLint rules defined in
|
||||
this repository. This is verified by the command line build.
|
||||
JavaScript sources in Open MCT must satisfy the [ESLint](https://eslint.org/) rules defined in
|
||||
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
|
||||
|
||||
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 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.
|
||||
1. Classes and Vue components should use camel case, first letter capitalized
|
||||
(e.g. SomeClassName).
|
||||
1. Methods, variables, fields, events, and function names should use camelCase,
|
||||
first letter lower-case (e.g. someVariableName).
|
||||
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
|
||||
initialized statically, and never changed) should use only capital
|
||||
1. Constants (variables or fields which are meant to be declared and
|
||||
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
|
||||
1. File names should be the name of the exported class, plus a .js extension
|
||||
(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.
|
||||
1. Named functions are preferred over functions assigned to variables.
|
||||
eg.
|
||||
|
||||
```JavaScript
|
||||
function renameObject(object, newName) {
|
||||
Object.name = newName;
|
||||
}
|
||||
```
|
||||
|
||||
is preferable to
|
||||
|
||||
```JavaScript
|
||||
const rename = (object, newName) => {
|
||||
Object.name = newName;
|
||||
}
|
||||
```
|
||||
|
||||
1. Avoid deep nesting (especially of functions), except where necessary
|
||||
(e.g. due to closure scope).
|
||||
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.
|
||||
1. Within a given function's scope, do not mix declarations and imperative
|
||||
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.
|
||||
1. Avoid the use of "magic" values.
|
||||
eg.
|
||||
|
||||
```JavaScript
|
||||
const UNAUTHORIZED = 401;
|
||||
if (responseCode === UNAUTHORIZED)
|
||||
```
|
||||
|
||||
is preferable to
|
||||
|
||||
```JavaScript
|
||||
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. 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.
|
||||
eg.
|
||||
```
|
||||
|
||||
```txt
|
||||
- telemetryTable
|
||||
- row
|
||||
TableRow.js
|
||||
@ -206,8 +217,10 @@ The following guidelines are provided for anyone contributing source code to the
|
||||
plugin.js
|
||||
pluginSpec.js
|
||||
```
|
||||
|
||||
is preferable to
|
||||
```
|
||||
|
||||
```txt
|
||||
- telemetryTable
|
||||
- components
|
||||
TableRow.vue
|
||||
@ -219,47 +232,10 @@ The following guidelines are provided for anyone contributing source code to the
|
||||
plugin.js
|
||||
pluginSpec.js
|
||||
```
|
||||
|
||||
Deviations from Open MCT code style guidelines require two-party agreement,
|
||||
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 messages should:
|
||||
@ -295,13 +271,13 @@ these standards.
|
||||
|
||||
## 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):
|
||||
|
||||
* _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
|
||||
* _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.
|
||||
|
||||
## 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
|
||||
checklist).
|
||||
|
||||
### Author Checklist
|
||||
|
||||
[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.```
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Open MCT License
|
||||
|
||||
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, Copyright (c) 2014-2024, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||
|
||||
Open MCT is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
|
63
README.md
63
README.md
@ -1,8 +1,10 @@
|
||||
# Open MCT [](http://www.apache.org/licenses/LICENSE-2.0) [](https://lgtm.com/projects/g/nasa/openmct/context:javascript) [](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.
|
||||
|
||||
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!
|
||||
|
||||
@ -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.
|
||||
(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/).
|
||||
|
||||
@ -40,8 +55,12 @@ The clearest examples for developing Open MCT plugins are in the
|
||||
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
||||
our documentation.
|
||||
|
||||
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).
|
||||
> [!NOTE]
|
||||
> 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
|
||||
|
||||
@ -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.
|
||||
|
||||
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)
|
||||
|
||||
## Plugins
|
||||
@ -95,10 +116,10 @@ To run the performance tests:
|
||||
|
||||
`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
|
||||
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/) and our overall security report is available on [LGTM](https://lgtm.com/projects/g/nasa/openmct/). 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
|
||||
|
||||
@ -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/)
|
||||
|
||||
For more on the specifics of our code coverage setup, [see](TESTING.md#code-coverage)
|
||||
|
||||
# Glossary
|
||||
|
||||
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?
|
||||
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. |
|
||||
|
||||
|
120
TESTING.md
Normal file
120
TESTING.md
Normal file
@ -0,0 +1,120 @@
|
||||
# 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
|
||||
|
||||
(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>
|
||||
```
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#*****************************************************************************
|
||||
#* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
#* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
#* as represented by the Administrator of the National Aeronautics and Space
|
||||
#* Administration. All rights reserved.
|
||||
#*
|
||||
|
14
codecov.yml
14
codecov.yml
@ -11,18 +11,18 @@ coverage:
|
||||
informational: true
|
||||
precision: 2
|
||||
round: down
|
||||
range: "66...100"
|
||||
range: '66...100'
|
||||
|
||||
flags:
|
||||
unit:
|
||||
carryforward: true
|
||||
e2e-ci:
|
||||
carryforward: true
|
||||
carryforward: false
|
||||
e2e-stable:
|
||||
carryforward: false
|
||||
e2e-full:
|
||||
carryforward: true
|
||||
carryforward: true
|
||||
|
||||
comment:
|
||||
layout: "reach,diff,flags,files,footer"
|
||||
layout: 'diff,flags,files,footer'
|
||||
behavior: default
|
||||
require_changes: false
|
||||
show_carryforward_flags: true
|
||||
show_carryforward_flags: true
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
as represented by the Administrator of the National Aeronautics and Space
|
||||
Administration. All rights reserved.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
|
@ -53,7 +53,7 @@ requirements.
|
||||
|
||||
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
|
||||
the next expected version number for release.
|
||||
* 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. 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
|
||||
requirements relative to previous stable version. Increment the
|
||||
version number if necessary.
|
||||
@ -138,7 +138,7 @@ numbers by the following process:
|
||||
1. Create a new branch off the `master` branch.
|
||||
2. Remove any suffix from the version number,
|
||||
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.
|
||||
The commit message should reference the sprint being opened,
|
||||
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
|
||||
team should follow a similar process, except that they should
|
||||
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
|
||||
this has completed.
|
||||
|
15
e2e/.eslintrc.cjs
Normal file
15
e2e/.eslintrc.cjs
Normal file
@ -0,0 +1,15 @@
|
||||
/* eslint-disable no-undef */
|
||||
module.exports = {
|
||||
extends: ['plugin:playwright/playwright-test'],
|
||||
rules: {
|
||||
'playwright/max-nested-describe': ['error', { max: 1 }]
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['tests/visual/*.spec.js'],
|
||||
rules: {
|
||||
'playwright/no-wait-for-timeout': 'off'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
@ -1,15 +0,0 @@
|
||||
/* eslint-disable no-undef */
|
||||
module.exports = {
|
||||
"extends": ["plugin:playwright/playwright-test"],
|
||||
"rules": {
|
||||
"playwright/max-nested-describe": ["error", { "max": 1 }]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["tests/visual/*.spec.js"],
|
||||
"rules": {
|
||||
"playwright/no-wait-for-timeout": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
33
e2e/.percy.ci.yml
Normal file
33
e2e/.percy.ci.yml
Normal file
@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
/* Chart Area for Plots */
|
||||
.gl-plot-chart-area{
|
||||
opacity: 0 !important;
|
||||
}
|
||||
|
32
e2e/.percy.nightly.yml
Normal file
32
e2e/.percy.nightly.yml
Normal file
@ -0,0 +1,32 @@
|
||||
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;
|
||||
}
|
||||
/* Chart Area for Plots */
|
||||
.gl-plot-chart-area{
|
||||
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
|
370
e2e/README.md
370
e2e/README.md
@ -8,7 +8,7 @@ This document is designed to capture on the What, Why, and How's of writing and
|
||||
|
||||
1. [Getting Started](#getting-started)
|
||||
2. [Types of Testing](#types-of-e2e-testing)
|
||||
3. [Architecture](#architecture)
|
||||
3. [Architecture](#test-architecture-and-ci)
|
||||
|
||||
## Getting Started
|
||||
|
||||
@ -51,11 +51,13 @@ Next, you should walk through our implementation of Playwright in Open MCT:
|
||||
|
||||
## 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.
|
||||
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.**
|
||||
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".
|
||||
|
||||
@ -72,63 +74,130 @@ 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+)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
- Our Snapshot tests receive a `@snapshot` tag.
|
||||
- Snapshots need to be executed within the official Playwright container to ensure we're using the exact rendering platform in CI and locally.
|
||||
- Snapshots need to be executed within the official Playwright container to ensure we're using the exact rendering platform in CI and locally. To do a valid comparison locally:
|
||||
|
||||
```sh
|
||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:[GET THIS VERSION FROM OUR CIRCLECI CONFIG FILE]-focal /bin/bash
|
||||
// Replace {X.X.X} with the current Playwright version
|
||||
// from our package.json or circleCI configuration file
|
||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
|
||||
npm install
|
||||
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot
|
||||
```
|
||||
|
||||
### (WIP) Updating Snapshots
|
||||
### Updating Snapshots
|
||||
|
||||
When the `@snapshot` tests fail, they will need to be evaluated to see if the failure is an acceptable change or
|
||||
When the `@snapshot` tests fail, they will need to be evaluated to determine if the failure is an acceptable and desireable or an unintended regression.
|
||||
|
||||
To compare a snapshot, run a test and open the html report with the 'Expected' vs 'Actual' screenshot. If the actual screenshot is preferred, then the source-controlled 'Expected' snapshots will need to be updated with the following scripts.
|
||||
|
||||
MacOS
|
||||
|
||||
```
|
||||
npm run test:e2e:updatesnapshots
|
||||
```
|
||||
|
||||
Linux/CI
|
||||
|
||||
```sh
|
||||
// Replace {X.X.X} with the current Playwright version
|
||||
// from our package.json or circleCI configuration file
|
||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
|
||||
npm install
|
||||
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
|
||||
|
||||
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:
|
||||
|
||||
`npm run test:perf`
|
||||
`./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.
|
||||
`./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.
|
||||
|
||||
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
|
||||
|
||||
### Architecture (TODO)
|
||||
### Architecture
|
||||
|
||||
### 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.
|
||||
|
||||
- `./helper` - contains helper functions or scripts which are leveraged directly within the testsuites. i.e. non-default plugin scripts injected into DOM
|
||||
- `./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
|
||||
- `./tests/functional/example/` - tests which specifically verify the example plugins
|
||||
- `./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/framework/` - tests which verify that our testframework functionality and assumptions will continue to work based on further refactoring or playwright version changes
|
||||
- `./tests/performance/` - performance tests
|
||||
- `./tests/visual/` - Visual tests
|
||||
- `./appActions.js` - Contains common fixtures which can be leveraged by testcase authors to quickly move through the application when writing new tests.
|
||||
- `./baseFixture.js` - Contains base fixtures which only extend default `@playwright/test` functionality. The goal is to remove these fixtures as native Playwright APIs improve.
|
||||
|File Path|Description|
|
||||
|:-:|-|
|
||||
|`./helper` | Contains helper functions or scripts which are leveraged directly within the test suites (e.g.: non-default plugin scripts injected into the DOM)|
|
||||
|`./test-data` | Contains test data which is leveraged or generated in the functional, performance, or visual test suites (e.g.: localStorage data).|
|
||||
|`./tests/functional` | The bulk of the tests are contained within this folder to verify the functionality of Open MCT.|
|
||||
|`./tests/functional/example/` | Tests which specifically verify the example plugins (e.g.: Sine Wave Generator).|
|
||||
|`./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/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).|
|
||||
|`./tests/performance/` | Performance tests which should be run on every commit.|
|
||||
|`./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`.
|
||||
|
||||
@ -138,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
|
||||
|
||||
- `./playwright-ci.config.js` - Used when running in CI or to debug CI issues locally
|
||||
- `./playwright-local.config.js` - Used when running locally
|
||||
- `./playwright-performance.config.js` - Used when running performance tests in CI or locally
|
||||
- `./playwright-visual.config.js` - Used to run the visual tests in CI or locally
|
||||
|Config File|Description|
|
||||
|:-:|-|
|
||||
|`./playwright-ci.config.js` | Used when running in CI or to debug CI issues 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
|
||||
|
||||
@ -149,13 +221,17 @@ Test tags are a great way of organizing tests outside of a file structure. To le
|
||||
|
||||
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).
|
||||
- `@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`.
|
||||
- `@localStorage` - Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).
|
||||
- `@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.
|
||||
|Test Tag|Description|
|
||||
|:-:|-|
|
||||
|`@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).|
|
||||
|`@a11y` | Test case or test suite to execute playwright-axe accessibility checks and generate a11y reports.|
|
||||
|`@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`.|
|
||||
|`@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
|
||||
|
||||
@ -174,24 +250,27 @@ CircleCI
|
||||
- Stable e2e tests against ubuntu and chrome
|
||||
- Performance tests against ubuntu and chrome
|
||||
- e2e tests are linted
|
||||
- Visual and a11y tests are run in a single resolution on the default `espresso` theme
|
||||
|
||||
#### 2. Per-Merge Testing
|
||||
|
||||
Github Actions / Workflow
|
||||
|
||||
- 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
|
||||
|
||||
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
|
||||
- CouchDB suite
|
||||
- Visual and a11y Tests are run in the full profile
|
||||
|
||||
Github Actions / Workflow
|
||||
|
||||
- Visual Test baseline generation.
|
||||
- None at the moment
|
||||
|
||||
#### Parallelism and Fast Feedback
|
||||
|
||||
@ -211,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.
|
||||
|
||||
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:
|
||||
|
||||
@ -222,7 +302,7 @@ A testcase and testsuite are to be unmarked as @unstable when:
|
||||
|
||||
#### **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:**
|
||||
|
||||
@ -236,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.
|
||||
- `playwright-chrome`
|
||||
- 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**
|
||||
|
||||
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:**
|
||||
|
||||
Conditionally skipping tests based on browser (**RECOMMENDED**):
|
||||
@ -267,29 +353,154 @@ Skipping based on browser version (Rarely used): <https://github.com/microsoft/p
|
||||
|
||||
## 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.)
|
||||
- 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.
|
||||
#### Test as the User
|
||||
|
||||
### How to write a great test (TODO)
|
||||
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):
|
||||
|
||||
#### How to write a great visual test (TODO)
|
||||
> "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 `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`:
|
||||
|
||||
```js
|
||||
// Fill the "Notes" section with information about the
|
||||
// currently running test and its project.
|
||||
const { testNotes } = page;
|
||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||
await notesInput.fill(testNotes);
|
||||
```
|
||||
|
||||
#### 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
|
||||
|
||||
- Where possible, it is best to mock out third-party network activity to ensure we are testing application behavior of Open MCT.
|
||||
- It is best to be as specific as possible about the expected network request/response structures in creating your mocks.
|
||||
- Make sure to only mock requests which are relevant to the specific behavior being tested.
|
||||
- Where possible, network requests and responses should be treated in an order-agnostic manner, as the order in which certain requests/responses happen is dynamic and subject to change.
|
||||
|
||||
Some examples of mocking network responses in regards to CouchDB can be found in our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) test file.
|
||||
|
||||
### Best Practices
|
||||
|
||||
For now, our best practices exist as self-tested, living documentation in our [exampleTemplate.e2e.spec.js](./tests/framework/exampleTemplate.e2e.spec.js) file.
|
||||
|
||||
### Tips & Tricks (TODO)
|
||||
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
|
||||
|
||||
### Tips & Tricks
|
||||
|
||||
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
|
||||
import { test, expect } from '../../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
|
||||
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
|
||||
|
||||
@ -303,25 +514,17 @@ We leverage the following official Playwright reporters:
|
||||
- Tracefile
|
||||
- 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.
|
||||
|
||||
### 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:
|
||||
|
||||
```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.
|
||||
Please read more about our code coverage [here](../TESTING.md#code-coverage)
|
||||
|
||||
## Other
|
||||
|
||||
@ -371,10 +574,39 @@ A single e2e test in Open MCT is extended to run:
|
||||
- How is Open MCT extending default Playwright functionality?
|
||||
- What about Component Testing?
|
||||
|
||||
### Troubleshooting
|
||||
### Writing Tests
|
||||
|
||||
Playwright provides 3 supported methods of debugging and authoring tests:
|
||||
- A 'watch mode' for running tests locally and debugging on the fly
|
||||
- A 'debug mode' for debugging tests and writing assertions against tests
|
||||
- A 'VSCode plugin' for debugging tests within the VSCode IDE.
|
||||
|
||||
Generally, we encourage folks to use the watch mode and provide a script `npm run test:e2e:watch` which launches the launch mode ui and enables hot reloading on the dev server.
|
||||
|
||||
### 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...'
|
||||
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```
|
||||
|
||||
### Upgrading Playwright
|
||||
|
||||
In order to upgrade from one version of Playwright to another, the version should be updated in several places in both `openmct` and `openmct-yamcs` repos. An easy way to identify these locations is to search for the current version in all files and find/replace.
|
||||
|
||||
For reference, all of the locations where the version should be updated are listed below:
|
||||
|
||||
#### **In `openmct`:**
|
||||
|
||||
- `package.json`
|
||||
- Both packages `@playwright/test` and `playwright-core` should be updated to the same target version.
|
||||
- `.circleci/config.yml`
|
||||
- `.github/workflows/e2e-couchdb.yml`
|
||||
- `.github/workflows/e2e-pr.yml`
|
||||
|
||||
#### **In `openmct-yamcs`:**
|
||||
|
||||
- `package.json`
|
||||
- `@playwright/test` should be updated to the target version.
|
||||
- `.github/workflows/yamcs-quickstart-e2e.yml`
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -35,6 +35,7 @@
|
||||
* @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 | 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'}
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -45,8 +46,17 @@
|
||||
* @property {string} url the relative url to the object (for use with `page.goto()`)
|
||||
*/
|
||||
|
||||
const Buffer = require('buffer').Buffer;
|
||||
const genUuid = require('uuid').v4;
|
||||
/**
|
||||
* Defines parameters to be used in the creation of a notification.
|
||||
* @typedef {Object} CreateNotificationOptions
|
||||
* @property {string} message the message
|
||||
* @property {'info' | 'alert' | 'error'} severity the severity
|
||||
* @property {import('../src/api/notifications/NotificationAPI').NotificationOptions} [notificationOptions] additional options
|
||||
*/
|
||||
|
||||
import { expect } from '@playwright/test';
|
||||
import { Buffer } from 'buffer';
|
||||
import { v4 as genUuid } from 'uuid';
|
||||
|
||||
/**
|
||||
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
||||
@ -56,71 +66,102 @@ const genUuid = require('uuid').v4;
|
||||
* @param {CreateObjectOptions} options
|
||||
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||
*/
|
||||
async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine' }) {
|
||||
if (!name) {
|
||||
name = `${type}:${genUuid()}`;
|
||||
}
|
||||
async function createDomainObjectWithDefaults(
|
||||
page,
|
||||
{ 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
|
||||
// in the correct location, such as a folder, layout, or plot.
|
||||
await page.goto(`${parentUrl}?hideTree=true`);
|
||||
await page.waitForLoadState('networkidle');
|
||||
// Navigate to the parent object. This is necessary to create the object
|
||||
// in the correct location, such as a folder, layout, or plot.
|
||||
await page.goto(`${parentUrl}`);
|
||||
|
||||
//Click the Create button
|
||||
await page.click('button:has-text("Create")');
|
||||
//Click the Create button
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Click the object specified by 'type'
|
||||
await page.click(`li[role='menuitem']:text("${type}")`);
|
||||
// Click the object specified by 'type'
|
||||
await page.click(`li[role='menuitem']:text("${type}")`);
|
||||
|
||||
// Modify the name input field of the domain object to accept 'name'
|
||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||
await nameInput.fill("");
|
||||
await nameInput.fill(name);
|
||||
// Modify the name input field of the domain object to accept 'name'
|
||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||
await nameInput.fill('');
|
||||
await nameInput.fill(name);
|
||||
|
||||
if (page.testNotes) {
|
||||
// Fill the "Notes" section with information about the
|
||||
// currently running test and its project.
|
||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||
await notesInput.fill(page.testNotes);
|
||||
}
|
||||
if (page.testNotes) {
|
||||
// Fill the "Notes" section with information about the
|
||||
// currently running test and its project.
|
||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||
await notesInput.fill(page.testNotes);
|
||||
}
|
||||
|
||||
// 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')
|
||||
]);
|
||||
// If there are any further parameters, fill them in
|
||||
for (const [key, value] of Object.entries(customParameters)) {
|
||||
const input = page.locator(`form[name="mctForm"] ${key}`);
|
||||
await input.fill('');
|
||||
await input.fill(value);
|
||||
}
|
||||
|
||||
// Wait until the URL is updated
|
||||
await page.waitForURL(`**/${parent}/*`);
|
||||
const uuid = await getFocusedObjectUuid(page);
|
||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||
// Click OK button and wait for Navigate event
|
||||
await Promise.all([
|
||||
page.waitForLoadState(),
|
||||
await page.getByRole('button', { name: 'Save' }).click(),
|
||||
// Wait for Save Banner to appear
|
||||
page.waitForSelector('.c-message-banner__message')
|
||||
]);
|
||||
|
||||
if (await _isInEditMode(page, uuid)) {
|
||||
// Save (exit edit mode)
|
||||
await page.locator('button[title="Save"]').click();
|
||||
await page.locator('li[title="Save and Finish Editing"]').click();
|
||||
}
|
||||
// Wait until the URL is updated
|
||||
await page.waitForURL(`**/${parent}/*`);
|
||||
const uuid = await getFocusedObjectUuid(page);
|
||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||
|
||||
return {
|
||||
name,
|
||||
uuid,
|
||||
url: objectUrl
|
||||
};
|
||||
if (await _isInEditMode(page, uuid)) {
|
||||
// Save (exit edit mode)
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
uuid,
|
||||
url: objectUrl
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a notification with the given options.
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {CreateNotificationOptions} createNotificationOptions
|
||||
*/
|
||||
async function createNotification(page, createNotificationOptions) {
|
||||
await page.evaluate((_createNotificationOptions) => {
|
||||
const { message, severity, options } = _createNotificationOptions;
|
||||
const notificationApi = window.openmct.notifications;
|
||||
if (severity === 'info') {
|
||||
notificationApi.info(message, options);
|
||||
} else if (severity === 'alert') {
|
||||
notificationApi.alert(message, options);
|
||||
} else {
|
||||
notificationApi.error(message, options);
|
||||
}
|
||||
}, createNotificationOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand an item in the tree by a given object name.
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {string} name
|
||||
*/
|
||||
async function expandTreePaneItemByName(page, name) {
|
||||
const treePane = page.locator('#tree-pane');
|
||||
const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
|
||||
const expandTriangle = treeItem.locator('.c-disclosure-triangle');
|
||||
await expandTriangle.click();
|
||||
const treePane = page.getByRole('tree', {
|
||||
name: 'Main Tree'
|
||||
});
|
||||
const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
|
||||
const expandTriangle = treeItem.locator('.c-disclosure-triangle');
|
||||
await expandTriangle.click();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,65 +171,149 @@ async function expandTreePaneItemByName(page, name) {
|
||||
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||
*/
|
||||
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||
if (!name) {
|
||||
name = `Plan:${genUuid()}`;
|
||||
}
|
||||
|
||||
// Navigate to the parent object. This is necessary to create the object
|
||||
// in the correct location, such as a folder, layout, or plot.
|
||||
await page.goto(`${parentUrl}?hideTree=true`);
|
||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||
|
||||
//Click the Create button
|
||||
await page.click('button:has-text("Create")');
|
||||
// Navigate to the parent object. This is necessary to create the object
|
||||
// in the correct location, such as a folder, layout, or plot.
|
||||
await page.goto(`${parentUrl}`);
|
||||
|
||||
// Click 'Plan' menu option
|
||||
await page.click(`li:text("Plan")`);
|
||||
// Click the Create button
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Modify the name input field of the domain object to accept 'name'
|
||||
if (name) {
|
||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||
await nameInput.fill("");
|
||||
await nameInput.fill(name);
|
||||
}
|
||||
// Click 'Plan' menu option
|
||||
await page.click(`li:text("Plan")`);
|
||||
|
||||
// Upload buffer from memory
|
||||
await page.locator('input#fileElem').setInputFiles({
|
||||
name: 'plan.txt',
|
||||
mimeType: 'text/plain',
|
||||
buffer: Buffer.from(JSON.stringify(json))
|
||||
});
|
||||
// Modify the name input field of the domain object to accept 'name'
|
||||
const nameInput = page.getByLabel('Title', { exact: true });
|
||||
await nameInput.fill('');
|
||||
await nameInput.fill(name);
|
||||
|
||||
// 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')
|
||||
]);
|
||||
// Upload buffer from memory
|
||||
await page.locator('input#fileElem').setInputFiles({
|
||||
name: 'plan.txt',
|
||||
mimeType: 'text/plain',
|
||||
buffer: Buffer.from(JSON.stringify(json))
|
||||
});
|
||||
|
||||
// Wait until the URL is updated
|
||||
await page.waitForURL(`**/mine/*`);
|
||||
const uuid = await getFocusedObjectUuid(page);
|
||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||
// 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')
|
||||
]);
|
||||
|
||||
return {
|
||||
uuid,
|
||||
name,
|
||||
url: objectUrl
|
||||
};
|
||||
// Wait until the URL is updated
|
||||
await page.waitForURL(`**/${parent}/*`);
|
||||
const uuid = await getFocusedObjectUuid(page);
|
||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||
|
||||
return {
|
||||
uuid,
|
||||
name,
|
||||
url: objectUrl
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
* Create a standardized Telemetry Object (Sine Wave Generator) for use in visual tests
|
||||
* and tests against plotting telemetry (e.g. logPlot tests).
|
||||
* @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'
|
||||
* @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) {
|
||||
await page.goto(url);
|
||||
await page.click('button[title="Show selected item in tree"]');
|
||||
await page.locator('.is-navigated-object').click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.goto(url);
|
||||
await page.getByLabel('Show selected item in tree').click();
|
||||
await page.locator('.is-navigated-object').click({
|
||||
button: 'right'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Expands the entire object tree (every expandable tree item).
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
|
||||
*/
|
||||
async function expandEntireTree(page, treeName = 'Main Tree') {
|
||||
const treeLocator = page.getByRole('tree', {
|
||||
name: treeName
|
||||
});
|
||||
const collapsedTreeItems = treeLocator
|
||||
.getByRole('treeitem', {
|
||||
expanded: false
|
||||
})
|
||||
.locator('span.c-disclosure-triangle.is-enabled');
|
||||
|
||||
while ((await collapsedTreeItems.count()) > 0) {
|
||||
await collapsedTreeItems.nth(0).click();
|
||||
|
||||
// FIXME: Replace hard wait with something event-driven.
|
||||
// Without the wait, this fails periodically due to a race condition
|
||||
// with Vue rendering (loop exits prematurely).
|
||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
||||
await page.waitForTimeout(200);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,12 +323,12 @@ async function openObjectTreeContextMenu(page, url) {
|
||||
* @returns {Promise<string>} the uuid of the focused object
|
||||
*/
|
||||
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 focusedObjectUuid = await page.evaluate((regexp) => {
|
||||
return window.location.href.split('?')[0].match(regexp).at(-1);
|
||||
}, UUIDv4Regexp);
|
||||
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) => {
|
||||
return window.location.href.split('?')[0].match(regexp).at(-1);
|
||||
}, UUIDv4Regexp);
|
||||
|
||||
return focusedObjectUuid;
|
||||
return focusedObjectUuid;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,36 +338,41 @@ async function getFocusedObjectUuid(page) {
|
||||
* URLs returned will be of the form `'./browse/#/mine/<uuid0>/<uuid1>/...'`
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
async function getHashUrlToDomainObject(page, uuid) {
|
||||
const hashUrl = await page.evaluate(async (objectUuid) => {
|
||||
const path = await window.openmct.objects.getOriginalPath(objectUuid);
|
||||
let url = './#/browse/' + [...path].reverse()
|
||||
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
||||
.join('/');
|
||||
async function getHashUrlToDomainObject(page, identifier) {
|
||||
await page.waitForLoadState('load');
|
||||
const hashUrl = await page.evaluate(async (objectIdentifier) => {
|
||||
const path = await window.openmct.objects.getOriginalPath(objectIdentifier);
|
||||
let url =
|
||||
'./#/browse/' +
|
||||
[...path]
|
||||
.reverse()
|
||||
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
||||
.join('/');
|
||||
|
||||
// Drop the vestigial '/ROOT' if it exists
|
||||
if (url.includes('/ROOT')) {
|
||||
url = url.split('/ROOT').join('');
|
||||
}
|
||||
// Drop the vestigial '/ROOT' if it exists
|
||||
if (url.includes('/ROOT')) {
|
||||
url = url.split('/ROOT').join('');
|
||||
}
|
||||
|
||||
return url;
|
||||
}, uuid);
|
||||
return url;
|
||||
}, identifier);
|
||||
|
||||
return hashUrl;
|
||||
return hashUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utilizes the OpenMCT API to detect if the UI is in Edit mode.
|
||||
* @private
|
||||
* @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
|
||||
*/
|
||||
async function _isInEditMode(page, identifier) {
|
||||
// eslint-disable-next-line no-return-await
|
||||
return await page.evaluate(() => window.openmct.editor.isEditing());
|
||||
// eslint-disable-next-line no-return-await
|
||||
return await page.evaluate(() => window.openmct.editor.isEditing());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -251,15 +381,17 @@ async function _isInEditMode(page, identifier) {
|
||||
* @param {boolean} [isFixedTimespan=true] true for fixed timespan mode, false for realtime mode; default is true
|
||||
*/
|
||||
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
||||
// Click 'mode' button
|
||||
await page.locator('.c-mode-button').click();
|
||||
|
||||
// Switch time conductor mode
|
||||
if (isFixedTimespan) {
|
||||
await page.locator('data-testid=conductor-modeOption-fixed').click();
|
||||
} else {
|
||||
await page.locator('data-testid=conductor-modeOption-realtime').click();
|
||||
}
|
||||
// Click 'mode' button
|
||||
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. Note, need to wait here for URL to update as the router is debounced.
|
||||
if (isFixedTimespan) {
|
||||
await page.getByRole('menuitem', { name: /Fixed Timespan/ }).click();
|
||||
await page.waitForURL(/tc\.mode=fixed/);
|
||||
} else {
|
||||
await page.getByRole('menuitem', { name: /Real-Time/ }).click();
|
||||
await page.waitForURL(/tc\.mode=local/);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -267,7 +399,7 @@ async function setTimeConductorMode(page, isFixedTimespan = true) {
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function setFixedTimeMode(page) {
|
||||
await setTimeConductorMode(page, true);
|
||||
await setTimeConductorMode(page, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,14 +407,17 @@ async function setFixedTimeMode(page) {
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function setRealTimeMode(page) {
|
||||
await setTimeConductorMode(page, false);
|
||||
await setTimeConductorMode(page, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} OffsetValues
|
||||
* @property {string | undefined} hours
|
||||
* @property {string | undefined} mins
|
||||
* @property {string | undefined} secs
|
||||
* @property {string | undefined} startHours
|
||||
* @property {string | undefined} startMins
|
||||
* @property {string | undefined} startSecs
|
||||
* @property {string | undefined} endHours
|
||||
* @property {string | undefined} endMins
|
||||
* @property {string | undefined} endSecs
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -291,23 +426,36 @@ async function setRealTimeMode(page) {
|
||||
* @param {OffsetValues} offset
|
||||
* @param {import('@playwright/test').Locator} offsetButton
|
||||
*/
|
||||
async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
||||
await offsetButton.click();
|
||||
async function setTimeConductorOffset(
|
||||
page,
|
||||
{ startHours, startMins, startSecs, endHours, endMins, endSecs }
|
||||
) {
|
||||
if (startHours) {
|
||||
await page.getByRole('spinbutton', { name: 'Start offset hours' }).fill(startHours);
|
||||
}
|
||||
|
||||
if (hours) {
|
||||
await page.fill('.pr-time-controls__hrs', hours);
|
||||
}
|
||||
if (startMins) {
|
||||
await page.getByRole('spinbutton', { name: 'Start offset minutes' }).fill(startMins);
|
||||
}
|
||||
|
||||
if (mins) {
|
||||
await page.fill('.pr-time-controls__mins', mins);
|
||||
}
|
||||
if (startSecs) {
|
||||
await page.getByRole('spinbutton', { name: 'Start offset seconds' }).fill(startSecs);
|
||||
}
|
||||
|
||||
if (secs) {
|
||||
await page.fill('.pr-time-controls__secs', secs);
|
||||
}
|
||||
if (endHours) {
|
||||
await page.getByRole('spinbutton', { name: 'End offset hours' }).fill(endHours);
|
||||
}
|
||||
|
||||
// Click the check button
|
||||
await page.locator('.pr-time__buttons .icon-check').click();
|
||||
if (endMins) {
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -316,8 +464,9 @@ async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
||||
* @param {OffsetValues} offset
|
||||
*/
|
||||
async function setStartOffset(page, offset) {
|
||||
const startOffsetButton = page.locator('data-testid=conductor-start-offset-button');
|
||||
await setTimeConductorOffset(page, offset, startOffsetButton);
|
||||
// Click 'mode' button
|
||||
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||
await setTimeConductorOffset(page, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -326,20 +475,193 @@ async function setStartOffset(page, offset) {
|
||||
* @param {OffsetValues} offset
|
||||
*/
|
||||
async function setEndOffset(page, offset) {
|
||||
const endOffsetButton = page.locator('data-testid=conductor-end-offset-button');
|
||||
await setTimeConductorOffset(page, offset, endOffsetButton);
|
||||
// Click 'mode' button
|
||||
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||
await setTimeConductorOffset(page, offset);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = {
|
||||
createDomainObjectWithDefaults,
|
||||
expandTreePaneItemByName,
|
||||
createPlanFromJSON,
|
||||
openObjectTreeContextMenu,
|
||||
getHashUrlToDomainObject,
|
||||
getFocusedObjectUuid,
|
||||
setFixedTimeMode,
|
||||
setRealTimeMode,
|
||||
setStartOffset,
|
||||
setEndOffset
|
||||
/**
|
||||
* 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 {string} startDate
|
||||
* @param {string} endDate
|
||||
*/
|
||||
async function setTimeConductorBounds(page, startDate, endDate) {
|
||||
// Bring up the time conductor popup
|
||||
expect(await page.locator('.l-shell__time-conductor.c-compact-tc').count()).toBe(1);
|
||||
await page.click('.l-shell__time-conductor.c-compact-tc');
|
||||
|
||||
await setTimeBounds(page, startDate, endDate);
|
||||
|
||||
await page.keyboard.press('Enter');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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"]');
|
||||
}
|
||||
|
||||
export {
|
||||
createDomainObjectWithDefaults,
|
||||
createExampleTelemetryObject,
|
||||
createNotification,
|
||||
createPlanFromJSON,
|
||||
expandEntireTree,
|
||||
expandTreePaneItemByName,
|
||||
getCanvasPixels,
|
||||
getFocusedObjectUuid,
|
||||
getHashUrlToDomainObject,
|
||||
navigateToObjectWithFixedTimeBounds,
|
||||
openObjectTreeContextMenu,
|
||||
renameObjectFromContextMenu,
|
||||
setEndOffset,
|
||||
setFixedTimeMode,
|
||||
setIndependentTimeConductorBounds,
|
||||
setRealTimeMode,
|
||||
setStartOffset,
|
||||
setTimeConductorBounds,
|
||||
waitForPlotsToRender
|
||||
};
|
||||
|
97
e2e/avpFixtures.js
Normal file
97
e2e/avpFixtures.js
Normal file
@ -0,0 +1,97 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { expect, test } from './pluginFixtures.js';
|
||||
|
||||
// Constants for repeated values
|
||||
const TEST_RESULTS_DIR = './test-results';
|
||||
|
||||
/**
|
||||
* 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 */
|
||||
export async function scanForA11yViolations(page, testCaseName, options = {}) {
|
||||
const builder = new AxeBuilder({ page });
|
||||
builder.withTags(['wcag2aa']);
|
||||
// https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
export { expect, test };
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-undef */
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -28,12 +28,12 @@
|
||||
* GitHub issues.
|
||||
*/
|
||||
|
||||
const base = require('@playwright/test');
|
||||
const { expect } = base;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { v4: uuid } = require('uuid');
|
||||
const sinon = require('sinon');
|
||||
import { expect, request, test } from '@playwright/test';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import sinon from 'sinon';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
/**
|
||||
* Takes a `ConsoleMessage` and returns a formatted string. Used to enable console log error detection.
|
||||
@ -43,9 +43,9 @@ const sinon = require('sinon');
|
||||
* @returns {String} formatted string with message type, text, url, and line and column numbers
|
||||
*/
|
||||
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[]>}
|
||||
*/
|
||||
function waitForAnimations(locator) {
|
||||
return locator
|
||||
.evaluate((element) =>
|
||||
Promise.all(
|
||||
element
|
||||
.getAnimations({ subtree: true })
|
||||
.map((animation) => animation.finished)));
|
||||
return locator.evaluate((element) =>
|
||||
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,104 +68,137 @@ function waitForAnimations(locator) {
|
||||
*/
|
||||
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
||||
|
||||
exports.test = base.test.extend({
|
||||
/**
|
||||
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
|
||||
* the Time Indicator Clock to be in a specific state.
|
||||
* Usage:
|
||||
* ```
|
||||
* test.use({
|
||||
* clockOptions: {
|
||||
* now: 0,
|
||||
* shouldAdvanceTime: true
|
||||
* ```
|
||||
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
||||
*
|
||||
* Default: `undefined`
|
||||
*
|
||||
* @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}
|
||||
*/
|
||||
clockOptions: [undefined, { option: true }],
|
||||
overrideClock: [async ({ context, clockOptions }, use) => {
|
||||
if (clockOptions !== undefined) {
|
||||
await context.addInitScript({
|
||||
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js')
|
||||
});
|
||||
await context.addInitScript((options) => {
|
||||
window.__clock = sinon.useFakeTimers(options);
|
||||
}, clockOptions);
|
||||
}
|
||||
|
||||
await use(context);
|
||||
}, {
|
||||
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);
|
||||
}
|
||||
const extendedTest = test.extend({
|
||||
/**
|
||||
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
|
||||
* the Time Indicator Clock to be in a specific state.
|
||||
*
|
||||
* Warning: Has many limitations and secondary side effects in Open MCT.
|
||||
* 1. The tree component does not render.
|
||||
* 2. page.WaitForNavigation does not trigger.
|
||||
*
|
||||
* Usage:
|
||||
* ```js
|
||||
* test.use({
|
||||
* clockOptions: {
|
||||
* now: MISSION_TIME,
|
||||
* shouldAdvanceTime: true
|
||||
* ```
|
||||
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
||||
*
|
||||
* Default: `undefined`
|
||||
*
|
||||
* @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}
|
||||
* @type {import('@types/sinonjs__fake-timers').FakeTimerInstallOpts}
|
||||
*/
|
||||
clockOptions: [undefined, { option: true }],
|
||||
overrideClock: [
|
||||
async ({ context, clockOptions }, use) => {
|
||||
if (clockOptions !== undefined) {
|
||||
await context.addInitScript({
|
||||
path: fileURLToPath(new URL('../node_modules/sinon/pkg/sinon.js', import.meta.url))
|
||||
});
|
||||
await context.addInitScript((options) => {
|
||||
window.__clock = sinon.useFakeTimers(options);
|
||||
}, clockOptions);
|
||||
}
|
||||
|
||||
await use(context);
|
||||
for (const page of context.pages()) {
|
||||
await page.evaluate(() => (window).collectIstanbulCoverage(JSON.stringify((window).__coverage__)));
|
||||
}
|
||||
await use(context);
|
||||
},
|
||||
/**
|
||||
* 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 }, 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);
|
||||
}
|
||||
{
|
||||
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 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.waitForAnimations = waitForAnimations;
|
||||
|
||||
export { expect, request, extendedTest as test, waitForAnimations };
|
||||
|
19
e2e/constants.js
Normal file
19
e2e/constants.js
Normal file
@ -0,0 +1,19 @@
|
||||
/* 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';
|
30
e2e/helper/addInitDataVisualization.js
Normal file
30
e2e/helper/addInitDataVisualization.js
Normal file
@ -0,0 +1,30 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
// This should be used to install the Example User
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.example.ExampleDataVisualizationSourcePlugin());
|
||||
openmct.install(
|
||||
openmct.plugins.InspectorDataVisualization({ type: 'exampleDataVisualizationSource' })
|
||||
);
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -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).
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -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).
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
const staticFaults = true;
|
||||
const openmct = window.openmct;
|
||||
const staticFaults = true;
|
||||
|
||||
openmct.install(openmct.plugins.example.ExampleFaultSource(staticFaults));
|
||||
openmct.install(openmct.plugins.example.ExampleFaultSource(staticFaults));
|
||||
});
|
||||
|
27
e2e/helper/addInitExampleUser.js
Normal file
27
e2e/helper/addInitExampleUser.js
Normal file
@ -0,0 +1,27 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
// This should be used to install the Example User
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.example.ExampleUser());
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -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).
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.FaultManagement());
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.FaultManagement());
|
||||
});
|
||||
|
71
e2e/helper/addInitFileInputObject.js
Normal file
71
e2e/helper/addInitFileInputObject.js
Normal file
@ -0,0 +1,71 @@
|
||||
class DomainObjectViewProvider {
|
||||
constructor(openmct) {
|
||||
this.key = 'doViewProvider';
|
||||
this.name = 'Domain Object View Provider';
|
||||
this.openmct = openmct;
|
||||
}
|
||||
|
||||
canView(domainObject) {
|
||||
return domainObject.type === 'imageFileInput' || domainObject.type === 'jsonFileInput';
|
||||
}
|
||||
|
||||
view(domainObject, objectPath) {
|
||||
let content;
|
||||
|
||||
return {
|
||||
show: function (element) {
|
||||
const body = domainObject.selectFile.body;
|
||||
const type = typeof body;
|
||||
|
||||
content = document.createElement('div');
|
||||
content.id = 'file-input-type';
|
||||
content.textContent = JSON.stringify(type);
|
||||
element.appendChild(content);
|
||||
},
|
||||
destroy: function (element) {
|
||||
element.removeChild(content);
|
||||
content = undefined;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
|
||||
openmct.types.addType('jsonFileInput', {
|
||||
key: 'jsonFileInput',
|
||||
name: 'JSON File Input Object',
|
||||
creatable: true,
|
||||
form: [
|
||||
{
|
||||
name: 'Upload File',
|
||||
key: 'selectFile',
|
||||
control: 'file-input',
|
||||
required: true,
|
||||
text: 'Select File...',
|
||||
type: 'application/json',
|
||||
property: ['selectFile']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
openmct.types.addType('imageFileInput', {
|
||||
key: 'imageFileInput',
|
||||
name: 'Image File Input Object',
|
||||
creatable: true,
|
||||
form: [
|
||||
{
|
||||
name: 'Upload File',
|
||||
key: 'selectFile',
|
||||
control: 'file-input',
|
||||
required: true,
|
||||
text: 'Select File...',
|
||||
type: 'image/*',
|
||||
property: ['selectFile']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -20,29 +20,13 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import {
|
||||
createOpenMct,
|
||||
resetApplicationState
|
||||
} from 'utils/testing';
|
||||
// This should be used to install the re-instal default Notebook plugin with a simple url whitelist.
|
||||
// e.g.
|
||||
// await page.addInitScript({ path: path.join(__dirname, 'addInitNotebookWithUrls.js') });
|
||||
const NOTEBOOK_NAME = 'Notebook';
|
||||
const URL_WHITELIST = ['google.com'];
|
||||
|
||||
describe('UI Components', () => {
|
||||
let openmct;
|
||||
|
||||
beforeEach(done => {
|
||||
openmct = createOpenMct();
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
return resetApplicationState();
|
||||
});
|
||||
|
||||
it('are exposed to users', () => {
|
||||
expect(openmct.components).toBeDefined();
|
||||
});
|
||||
|
||||
it('exposes the object view', () => {
|
||||
expect(openmct.components.ObjectView).toBeDefined();
|
||||
});
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
|
||||
});
|
27
e2e/helper/addInitOperatorStatus.js
Normal file
27
e2e/helper/addInitOperatorStatus.js
Normal file
@ -0,0 +1,27 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
// This should be used to install the Operator Status
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.OperatorStatus());
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -25,6 +25,6 @@
|
||||
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.RestrictedNotebook('CUSTOM_NAME'));
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.RestrictedNotebook('CUSTOM_NAME'));
|
||||
});
|
||||
|
@ -1,27 +1,27 @@
|
||||
(function () {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const PERSISTENCE_KEY = 'persistence-tests';
|
||||
const openmct = window.openmct;
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const PERSISTENCE_KEY = 'persistence-tests';
|
||||
const openmct = window.openmct;
|
||||
|
||||
openmct.objects.addRoot({
|
||||
namespace: 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.addRoot({
|
||||
namespace: 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: []
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,259 +19,277 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const path = require('path');
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function navigateToFaultManagementWithExample(page) {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('./addInitExampleFaultProvider.js', import.meta.url))
|
||||
});
|
||||
|
||||
await navigateToFaultItemInTree(page);
|
||||
await navigateToFaultItemInTree(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function navigateToFaultManagementWithStaticExample(page) {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js') });
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('./addInitExampleFaultProviderStatic.js', import.meta.url))
|
||||
});
|
||||
|
||||
await navigateToFaultItemInTree(page);
|
||||
await navigateToFaultItemInTree(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function navigateToFaultManagementWithoutExample(page) {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('./addInitFaultManagementPlugin.js', import.meta.url))
|
||||
});
|
||||
|
||||
await navigateToFaultItemInTree(page);
|
||||
await navigateToFaultItemInTree(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function navigateToFaultItemInTree(page) {
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
|
||||
// Click text=Fault Management
|
||||
await page.click('text=Fault Management'); // this verifies the plugin has been added
|
||||
const faultManagementTreeItem = page
|
||||
.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
|
||||
*/
|
||||
async function acknowledgeFault(page, rowNumber) {
|
||||
await openFaultRowMenu(page, rowNumber);
|
||||
await page.locator('.c-menu >> text="Acknowledge"').click();
|
||||
// Click [aria-label="Save"]
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
|
||||
await openFaultRowMenu(page, rowNumber);
|
||||
await page.locator('.c-menu >> text="Acknowledge"').click();
|
||||
// Click [aria-label="Save"]
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function shelveMultipleFaults(page, ...nums) {
|
||||
const selectRows = nums.map((num) => {
|
||||
return selectFaultItem(page, num);
|
||||
});
|
||||
await Promise.all(selectRows);
|
||||
const selectRows = nums.map((num) => {
|
||||
return selectFaultItem(page, num);
|
||||
});
|
||||
await Promise.all(selectRows);
|
||||
|
||||
await page.locator('button:has-text("Shelve")').click();
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
await page.locator('button:has-text("Shelve")').click();
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function acknowledgeMultipleFaults(page, ...nums) {
|
||||
const selectRows = nums.map((num) => {
|
||||
return selectFaultItem(page, num);
|
||||
});
|
||||
await Promise.all(selectRows);
|
||||
const selectRows = nums.map((num) => {
|
||||
return selectFaultItem(page, num);
|
||||
});
|
||||
await Promise.all(selectRows);
|
||||
|
||||
await page.locator('button:has-text("Acknowledge")').click();
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
await page.locator('button:has-text("Acknowledge")').click();
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function shelveFault(page, rowNumber) {
|
||||
await openFaultRowMenu(page, rowNumber);
|
||||
await page.locator('.c-menu >> text="Shelve"').click();
|
||||
// Click [aria-label="Save"]
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
await openFaultRowMenu(page, rowNumber);
|
||||
await page.locator('.c-menu >> text="Shelve"').click();
|
||||
// Click [aria-label="Save"]
|
||||
await page.locator('[aria-label="Save"]').click();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
async function clearSearch(page) {
|
||||
await enterSearchTerm(page, '');
|
||||
await enterSearchTerm(page, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function selectFaultItem(page, rowNumber) {
|
||||
// eslint-disable-next-line playwright/no-force-option
|
||||
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
|
||||
await page.locator(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`).check();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function getHighestSeverity(page) {
|
||||
const criticalCount = await page.locator('[title=CRITICAL]').count();
|
||||
const warningCount = await page.locator('[title=WARNING]').count();
|
||||
const criticalCount = await page.locator('[title=CRITICAL]').count();
|
||||
const warningCount = await page.locator('[title=WARNING]').count();
|
||||
|
||||
if (criticalCount > 0) {
|
||||
return 'CRITICAL';
|
||||
} else if (warningCount > 0) {
|
||||
return 'WARNING';
|
||||
}
|
||||
if (criticalCount > 0) {
|
||||
return 'CRITICAL';
|
||||
} else if (warningCount > 0) {
|
||||
return 'WARNING';
|
||||
}
|
||||
|
||||
return 'WATCH';
|
||||
return 'WATCH';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function getLowestSeverity(page) {
|
||||
const warningCount = await page.locator('[title=WARNING]').count();
|
||||
const watchCount = await page.locator('[title=WATCH]').count();
|
||||
const warningCount = await page.locator('[title=WARNING]').count();
|
||||
const watchCount = await page.locator('[title=WATCH]').count();
|
||||
|
||||
if (watchCount > 0) {
|
||||
return 'WATCH';
|
||||
} else if (warningCount > 0) {
|
||||
return 'WARNING';
|
||||
}
|
||||
if (watchCount > 0) {
|
||||
return 'WATCH';
|
||||
} else if (warningCount > 0) {
|
||||
return 'WARNING';
|
||||
}
|
||||
|
||||
return 'CRITICAL';
|
||||
return 'CRITICAL';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} 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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
async function openFaultRowMenu(page, rowNumber) {
|
||||
// select
|
||||
await page.locator(`.c-fault-mgmt-item > .c-fault-mgmt__list-action-button >> nth=${rowNumber - 1}`).click();
|
||||
|
||||
// select
|
||||
await page
|
||||
.locator(`.c-fault-mgmt-item > .c-fault-mgmt__list-action-button >> nth=${rowNumber - 1}`)
|
||||
.click();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = {
|
||||
navigateToFaultManagementWithExample,
|
||||
navigateToFaultManagementWithStaticExample,
|
||||
navigateToFaultManagementWithoutExample,
|
||||
navigateToFaultItemInTree,
|
||||
acknowledgeFault,
|
||||
shelveMultipleFaults,
|
||||
acknowledgeMultipleFaults,
|
||||
shelveFault,
|
||||
changeViewTo,
|
||||
sortFaultsBy,
|
||||
enterSearchTerm,
|
||||
clearSearch,
|
||||
selectFaultItem,
|
||||
getHighestSeverity,
|
||||
getLowestSeverity,
|
||||
getFaultResultCount,
|
||||
getFault,
|
||||
getFaultByName,
|
||||
getFaultName,
|
||||
getFaultSeverity,
|
||||
getFaultNamespace,
|
||||
getFaultTriggerTime,
|
||||
openFaultRowMenu
|
||||
export {
|
||||
acknowledgeFault,
|
||||
acknowledgeMultipleFaults,
|
||||
changeViewTo,
|
||||
clearSearch,
|
||||
enterSearchTerm,
|
||||
getFault,
|
||||
getFaultByName,
|
||||
getFaultName,
|
||||
getFaultNamespace,
|
||||
getFaultResultCount,
|
||||
getFaultSeverity,
|
||||
getFaultTriggerTime,
|
||||
getHighestSeverity,
|
||||
getLowestSeverity,
|
||||
navigateToFaultItemInTree,
|
||||
navigateToFaultManagementWithExample,
|
||||
navigateToFaultManagementWithoutExample,
|
||||
navigateToFaultManagementWithStaticExample,
|
||||
openFaultRowMenu,
|
||||
selectFaultItem,
|
||||
shelveFault,
|
||||
shelveMultipleFaults,
|
||||
sortFaultsBy
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -20,41 +20,131 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { createDomainObjectWithDefaults } = require('../appActions');
|
||||
import { createDomainObjectWithDefaults } from '../appActions.js';
|
||||
|
||||
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
||||
const CUSTOM_NAME = 'CUSTOM_NAME';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function enterTextEntry(page, text) {
|
||||
// Click .c-notebook__drag-area
|
||||
await page.locator(NOTEBOOK_DROP_AREA).click();
|
||||
// Click the 'Add Notebook Entry' area
|
||||
await page.locator(NOTEBOOK_DROP_AREA).click();
|
||||
|
||||
// enter text
|
||||
await page.locator('div.c-ne__text').click();
|
||||
await page.locator('div.c-ne__text').fill(text);
|
||||
await page.locator('div.c-ne__text').press('Enter');
|
||||
// enter text
|
||||
await page.getByLabel('Notebook Entry Input').last().fill(text);
|
||||
await commitEntry(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function dragAndDropEmbed(page, notebookObject) {
|
||||
// Create example telemetry object
|
||||
const swg = await createDomainObjectWithDefaults(page, {
|
||||
type: "Sine Wave Generator"
|
||||
});
|
||||
// Navigate to notebook
|
||||
await page.goto(notebookObject.url);
|
||||
// Expand the tree to reveal the notebook
|
||||
await page.click('button[title="Show selected item in tree"]');
|
||||
// Drag and drop the SWG into the notebook
|
||||
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
||||
// Create example telemetry object
|
||||
const swg = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator'
|
||||
});
|
||||
// Navigate to notebook
|
||||
await page.goto(notebookObject.url);
|
||||
// Expand the tree to reveal the notebook
|
||||
await page.getByLabel('Show selected item in tree').click();
|
||||
// Drag and drop the SWG into the notebook
|
||||
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
||||
await commitEntry(page);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
module.exports = {
|
||||
enterTextEntry,
|
||||
dragAndDropEmbed
|
||||
/**
|
||||
* @private
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function commitEntry(page) {
|
||||
//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: fileURLToPath(new URL('./addInitRestrictedNotebook.js', import.meta.url))
|
||||
});
|
||||
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;
|
||||
}
|
||||
|
||||
export {
|
||||
createNotebookAndEntry,
|
||||
createNotebookEntryAndTags,
|
||||
dragAndDropEmbed,
|
||||
enterTextEntry,
|
||||
lockPage,
|
||||
startAndAddRestrictedNotebookObject
|
||||
};
|
||||
|
174
e2e/helper/planningUtils.js
Normal file
174
e2e/helper/planningUtils.js
Normal file
@ -0,0 +1,174 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { expect } from '../pluginFixtures.js';
|
||||
|
||||
/**
|
||||
* Asserts that the number of activities in the plan view matches the number of
|
||||
* activities in the plan data within the specified time bounds. Performs an assertion
|
||||
* for each activity in the plan data per group, using the earliest activity's
|
||||
* start time as the start bound and the current activity's end time as the end bound.
|
||||
* @param {import('@playwright/test').Page} page the page
|
||||
* @param {object} plan The raw plan json to assert against
|
||||
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||
*/
|
||||
export async function assertPlanActivities(page, plan, objectUrl) {
|
||||
const groups = Object.keys(plan);
|
||||
for (const group of groups) {
|
||||
for (let i = 0; i < plan[group].length; i++) {
|
||||
// Set the startBound to the start time of the first activity in the group
|
||||
const startBound = plan[group][0].start;
|
||||
// Set the endBound to the end time of the current activity
|
||||
let endBound = plan[group][i].end;
|
||||
if (endBound === startBound) {
|
||||
// Prevent oddities with setting start and end bound equal
|
||||
// via URL params
|
||||
endBound += 1;
|
||||
}
|
||||
|
||||
// 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`
|
||||
);
|
||||
|
||||
// Assert that the number of activities in the plan view matches the number of
|
||||
// activities in the plan data within the specified time bounds
|
||||
const eventCount = await page.locator('.activity-bounds').count();
|
||||
expect(eventCount).toEqual(
|
||||
Object.values(plan)
|
||||
.flat()
|
||||
.filter((event) =>
|
||||
activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)
|
||||
).length
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the activities time bounds overlap, false otherwise.
|
||||
* @param {number} start1 the start 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} end2 the end time of the second activity
|
||||
* @returns {boolean} true if the activities overlap, false otherwise
|
||||
*/
|
||||
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
||||
return (
|
||||
(start1 >= start2 && start1 <= end2) ||
|
||||
(end1 >= start2 && end1 <= end2) ||
|
||||
(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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to the plan view, switch to fixed time mode,
|
||||
* and set the bounds to span all activities.
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {object} planJson
|
||||
* @param {string} planObjectUrl
|
||||
*/
|
||||
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
||||
// Get the earliest start value
|
||||
const start = getEarliestStartTime(planJson);
|
||||
// Get the latest end value
|
||||
const end = getLatestEndTime(planJson);
|
||||
// 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`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} planJson
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getEarliestStartTime(planJson) {
|
||||
const activities = Object.values(planJson).flat();
|
||||
return Math.min(...activities.map((activity) => activity.start));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} planJson
|
||||
* @returns {number}
|
||||
*/
|
||||
export function getLatestEndTime(planJson) {
|
||||
const activities = Object.values(planJson).flat();
|
||||
return Math.max(...activities.map((activity) => activity.end));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { waitForPlotsToRender } from '../appActions.js';
|
||||
import { expect } from '../pluginFixtures.js';
|
||||
|
||||
/**
|
||||
* Given a canvas and a set of points, tags the points on the canvas.
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {HTMLCanvasElement} canvas a telemetry item with a plot
|
||||
* @param {Number} xEnd a telemetry item with a plot
|
||||
* @param {Number} yEnd a telemetry item with a plot
|
||||
* @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();
|
||||
}
|
104
e2e/helper/stylingUtils.js
Normal file
104
e2e/helper/stylingUtils.js
Normal file
@ -0,0 +1,104 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
import { expect } from '../pluginFixtures.js';
|
||||
|
||||
/**
|
||||
* Converts a hex color value to its RGB equivalent.
|
||||
*
|
||||
* @param {string} hex - The hex color value. i.e. '#5b0f00'
|
||||
* @returns {string} The RGB equivalent of the hex color.
|
||||
*/
|
||||
function hexToRGB(hex) {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result
|
||||
? `rgb(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)})`
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the background and text color of a given element.
|
||||
*
|
||||
* @param {import('@playwright/test').Page} page - The Playwright page object.
|
||||
* @param {string} borderColorHex - The hex value of the border color to set, or 'No Style'.
|
||||
* @param {string} backgroundColorHex - The hex value of the background color to set, or 'No Style'.
|
||||
* @param {string} textColorHex - The hex value of the text color to set, or 'No Style'.
|
||||
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be set.
|
||||
*/
|
||||
async function setStyles(page, borderColorHex, backgroundColorHex, textColorHex, locator) {
|
||||
await locator.click(); // Assuming the locator is clickable and opens the style setting UI
|
||||
await page.getByLabel('Set border color').click();
|
||||
await page.getByLabel(borderColorHex).click();
|
||||
await page.getByLabel('Set background color').click();
|
||||
await page.getByLabel(backgroundColorHex).click();
|
||||
await page.getByLabel('Set text color').click();
|
||||
await page.getByLabel(textColorHex).click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the styles of an element match the expected values.
|
||||
*
|
||||
* @param {string} expectedBorderColor - The expected border color in RGB format. Default is '#e6b8af' or 'rgb(230, 184, 175)'
|
||||
* @param {string} expectedBackgroundColor - The expected background color in RGB format.
|
||||
* @param {string} expectedTextColor - The expected text color in RGB format. Default is #aaaaaa or 'rgb(170, 170, 170)'
|
||||
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be checked.
|
||||
*/
|
||||
async function checkStyles(
|
||||
expectedBorderColor,
|
||||
expectedBackgroundColor,
|
||||
expectedTextColor,
|
||||
locator
|
||||
) {
|
||||
const layoutStyles = await locator.evaluate((el) => {
|
||||
return {
|
||||
border: window.getComputedStyle(el).getPropertyValue('border-top-color'), //infer the left, right, and bottom
|
||||
background: window.getComputedStyle(el).getPropertyValue('background-color'),
|
||||
fontColor: window.getComputedStyle(el).getPropertyValue('color')
|
||||
};
|
||||
});
|
||||
expect(layoutStyles.border).toContain(expectedBorderColor);
|
||||
expect(layoutStyles.background).toContain(expectedBackgroundColor);
|
||||
expect(layoutStyles.fontColor).toContain(expectedTextColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the font Styles of an element match the expected values.
|
||||
*
|
||||
* @param {string} expectedFontSize - The expected font size in '72px' format. Default is 'Default'
|
||||
* @param {string} expectedFontWeight - The expected font Type. Format as '700' for bold. Default is 'Default'
|
||||
* @param {string} expectedFontFamily - The expected font Type. Format as "\"Andale Mono\", sans-serif". Default is 'Default'
|
||||
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be checked.
|
||||
*/
|
||||
async function checkFontStyles(expectedFontSize, expectedFontWeight, expectedFontFamily, locator) {
|
||||
const layoutStyles = await locator.evaluate((el) => {
|
||||
return {
|
||||
fontSize: window.getComputedStyle(el).getPropertyValue('font-size'),
|
||||
fontWeight: window.getComputedStyle(el).getPropertyValue('font-weight'),
|
||||
fontFamily: window.getComputedStyle(el).getPropertyValue('font-family')
|
||||
};
|
||||
});
|
||||
expect(layoutStyles.fontSize).toContain(expectedFontSize);
|
||||
expect(layoutStyles.fontWeight).toContain(expectedFontWeight);
|
||||
expect(layoutStyles.fontFamily).toContain(expectedFontFamily);
|
||||
}
|
||||
|
||||
export { checkFontStyles, checkStyles, hexToRGB, setStyles };
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -25,6 +25,6 @@
|
||||
// await page.addInitScript({ path: path.join(__dirname, 'useSnowTheme.js') });
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.Snow());
|
||||
const openmct = window.openmct;
|
||||
openmct.install(openmct.plugins.Snow());
|
||||
});
|
||||
|
@ -1,81 +1,82 @@
|
||||
/* eslint-disable no-undef */
|
||||
// playwright.config.js
|
||||
// @ts-check
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { devices } = require('@playwright/test');
|
||||
import { devices } from '@playwright/test';
|
||||
const MAX_FAILURES = 5;
|
||||
const NUM_WORKERS = 2;
|
||||
|
||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||
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
|
||||
testDir: 'tests',
|
||||
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
||||
timeout: 60 * 1000,
|
||||
webServer: {
|
||||
command: 'npm run start:coverage',
|
||||
url: 'http://localhost:8080/#',
|
||||
timeout: 200 * 1000,
|
||||
reuseExistingServer: false
|
||||
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',
|
||||
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
||||
timeout: 60 * 1000,
|
||||
webServer: {
|
||||
command: 'npm run start:coverage',
|
||||
url: 'http://localhost:8080/#',
|
||||
timeout: 200 * 1000,
|
||||
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
|
||||
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'
|
||||
}
|
||||
},
|
||||
{
|
||||
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: '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'
|
||||
}
|
||||
}
|
||||
],
|
||||
reporter: [
|
||||
['list'],
|
||||
[
|
||||
'html',
|
||||
{
|
||||
open: 'never',
|
||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||
}
|
||||
],
|
||||
reporter: [
|
||||
['list'],
|
||||
['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']
|
||||
]
|
||||
['junit', { outputFile: '../test-results/results.xml' }]
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
export default config;
|
||||
|
@ -1,104 +1,106 @@
|
||||
/* eslint-disable no-undef */
|
||||
// playwright.config.js
|
||||
// @ts-check
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const { devices } = require('@playwright/test');
|
||||
import { devices } from '@playwright/test';
|
||||
|
||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||
const config = {
|
||||
retries: 0,
|
||||
testDir: 'tests',
|
||||
testIgnore: '**/*.perf.spec.js',
|
||||
timeout: 30 * 1000,
|
||||
webServer: {
|
||||
command: 'npm run start:coverage',
|
||||
url: 'http://localhost:8080/#',
|
||||
timeout: 120 * 1000,
|
||||
reuseExistingServer: true
|
||||
retries: 0,
|
||||
testDir: 'tests',
|
||||
testIgnore: '**/*.perf.spec.js',
|
||||
timeout: 30 * 1000,
|
||||
webServer: {
|
||||
command: 'npm run start:coverage',
|
||||
url: 'http://localhost:8080/#',
|
||||
timeout: 120 * 1000,
|
||||
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: {
|
||||
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'
|
||||
}
|
||||
},
|
||||
{
|
||||
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
|
||||
}
|
||||
{
|
||||
name: 'MMOC',
|
||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||
grepInvert: /@snapshot/,
|
||||
use: {
|
||||
browserName: 'chromium',
|
||||
viewport: {
|
||||
width: 2560,
|
||||
height: 1440
|
||||
}
|
||||
],
|
||||
reporter: [
|
||||
['list'],
|
||||
['html', {
|
||||
open: 'on-failure',
|
||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
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',
|
||||
{
|
||||
open: 'on-failure',
|
||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
export default config;
|
||||
|
42
e2e/playwright-performance-dev.config.js
Normal file
42
e2e/playwright-performance-dev.config.js
Normal file
@ -0,0 +1,42 @@
|
||||
// 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' }]
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
59
e2e/playwright-performance-prod.config.js
Normal file
59
e2e/playwright-performance-prod.config.js
Normal file
@ -0,0 +1,59 @@
|
||||
// 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' }]
|
||||
]
|
||||
};
|
||||
|
||||
export default 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
|
||||
}
|
||||
]
|
||||
]
|
||||
};
|
||||
|
||||
export default 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;
|
46
e2e/playwright-watch.config.js
Normal file
46
e2e/playwright-watch.config.js
Normal file
@ -0,0 +1,46 @@
|
||||
// playwright.config.js
|
||||
// @ts-check
|
||||
|
||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||
const config = {
|
||||
retries: 0, //Retries are not needed with watch mode
|
||||
testDir: 'tests',
|
||||
timeout: 60 * 1000,
|
||||
webServer: {
|
||||
command: 'npm run start', //Start in dev mode for hot reloading
|
||||
url: 'http://localhost:8080/#',
|
||||
timeout: 200 * 1000,
|
||||
reuseExistingServer: true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
|
||||
},
|
||||
workers: '75%', //Limit to 75% of the CPU to support running with dev server
|
||||
use: {
|
||||
baseURL: 'http://localhost:8080/',
|
||||
headless: true,
|
||||
ignoreHTTPSErrors: true,
|
||||
screenshot: 'only-on-failure',
|
||||
trace: 'on-first-retry',
|
||||
video: 'off'
|
||||
},
|
||||
projects: [
|
||||
{
|
||||
name: 'chrome',
|
||||
testMatch: '**/*.spec.js', // run all tests
|
||||
use: {
|
||||
browserName: 'chromium'
|
||||
}
|
||||
}
|
||||
],
|
||||
reporter: [
|
||||
['list'],
|
||||
[
|
||||
'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' }]
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-undef */
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -26,9 +26,10 @@
|
||||
* and appActions. These fixtures should be generalized across all plugins.
|
||||
*/
|
||||
|
||||
const { test, expect } = require('./baseFixtures');
|
||||
// const { createDomainObjectWithDefaults } = require('./appActions');
|
||||
const path = require('path');
|
||||
// import { createDomainObjectWithDefaults } from './appActions.js';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
import { expect, request, test } from './baseFixtures.js';
|
||||
|
||||
/**
|
||||
* @typedef {Object} ObjectCreateOptions
|
||||
@ -45,8 +46,6 @@ const path = require('path');
|
||||
// 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
|
||||
* 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
|
||||
@ -65,10 +64,7 @@ const path = require('path');
|
||||
|
||||
// await createDomainObjectWithDefaults(page, type, name);
|
||||
|
||||
// // Once object is created, get the uuid from the url
|
||||
// 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];
|
||||
// });
|
||||
// const uuid = getHashUrlToDomainObject(page);
|
||||
|
||||
// createdObjects.set(objectName, uuid);
|
||||
|
||||
@ -120,33 +116,47 @@ const theme = 'espresso';
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
const myItemsFolderName = "My Items";
|
||||
const myItemsFolderName = 'My Items';
|
||||
|
||||
exports.test = test.extend({
|
||||
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
|
||||
theme: [theme, { option: true }],
|
||||
// eslint-disable-next-line no-shadow
|
||||
page: async ({ page, theme }, use, testInfo) => {
|
||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
||||
if (theme === 'snow') {
|
||||
//inject snow theme
|
||||
await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') });
|
||||
}
|
||||
|
||||
// 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 });
|
||||
const extendedTest = test.extend({
|
||||
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
|
||||
theme: [theme, { option: true }],
|
||||
// eslint-disable-next-line no-shadow
|
||||
page: async ({ page, theme }, use, testInfo) => {
|
||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
||||
if (theme === 'snow') {
|
||||
//inject snow theme
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('./helper/useSnowTheme.js', import.meta.url))
|
||||
});
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
export { expect, request, extendedTest as test };
|
||||
|
||||
/**
|
||||
* Takes a readable stream and returns a string.
|
||||
* @param {ReadableStream} readable - the readable stream
|
||||
* @return {Promise<String>} the stringified stream
|
||||
*/
|
||||
export async function streamToString(readable) {
|
||||
let result = '';
|
||||
for await (const chunk of readable) {
|
||||
result += chunk;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -274,10 +274,7 @@
|
||||
"id": "ac0d7eb1-b485-458f-bd2a-a63aa87a3a8a"
|
||||
}
|
||||
],
|
||||
"layoutGrid": [
|
||||
10,
|
||||
10
|
||||
],
|
||||
"layoutGrid": [10, 10],
|
||||
"objectStyles": {
|
||||
"ed63cc29-80e2-4e2b-a472-3d6d4adbf310": {
|
||||
"staticStyle": {
|
||||
@ -1455,9 +1452,7 @@
|
||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||
"telemetry": "any",
|
||||
"operation": "greaterThan",
|
||||
"input": [
|
||||
"120"
|
||||
],
|
||||
"input": ["120"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1475,10 +1470,7 @@
|
||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||
"telemetry": "any",
|
||||
"operation": "between",
|
||||
"input": [
|
||||
"120",
|
||||
"-20"
|
||||
],
|
||||
"input": ["120", "-20"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1496,9 +1488,7 @@
|
||||
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
||||
"telemetry": "any",
|
||||
"operation": "lessThan",
|
||||
"input": [
|
||||
"-20"
|
||||
],
|
||||
"input": ["-20"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1550,9 +1540,7 @@
|
||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||
"telemetry": "any",
|
||||
"operation": "greaterThan",
|
||||
"input": [
|
||||
"120"
|
||||
],
|
||||
"input": ["120"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1570,10 +1558,7 @@
|
||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||
"telemetry": "any",
|
||||
"operation": "between",
|
||||
"input": [
|
||||
"120",
|
||||
"-20"
|
||||
],
|
||||
"input": ["120", "-20"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1591,9 +1576,7 @@
|
||||
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
||||
"telemetry": "any",
|
||||
"operation": "lessThan",
|
||||
"input": [
|
||||
"-20"
|
||||
],
|
||||
"input": ["-20"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1645,9 +1628,7 @@
|
||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||
"telemetry": "any",
|
||||
"operation": "greaterThan",
|
||||
"input": [
|
||||
"150"
|
||||
],
|
||||
"input": ["150"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1665,10 +1646,7 @@
|
||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||
"telemetry": "any",
|
||||
"operation": "between",
|
||||
"input": [
|
||||
"50",
|
||||
"-50"
|
||||
],
|
||||
"input": ["50", "-50"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1720,9 +1698,7 @@
|
||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||
"telemetry": "any",
|
||||
"operation": "greaterThan",
|
||||
"input": [
|
||||
"150"
|
||||
],
|
||||
"input": ["150"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -1740,10 +1716,7 @@
|
||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||
"telemetry": "any",
|
||||
"operation": "between",
|
||||
"input": [
|
||||
"50",
|
||||
"-50"
|
||||
],
|
||||
"input": ["50", "-50"],
|
||||
"metadata": "sin"
|
||||
}
|
||||
]
|
||||
@ -2204,4 +2177,4 @@
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
1080
e2e/test-data/examplePlans/ExamplePlan_Large.json
Normal file
1080
e2e/test-data/examplePlans/ExamplePlan_Large.json
Normal file
File diff suppressed because it is too large
Load Diff
44
e2e/test-data/examplePlans/ExamplePlan_Small1.json
Normal file
44
e2e/test-data/examplePlans/ExamplePlan_Small1.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"name": "Past event 3",
|
||||
"start": 1660493208000,
|
||||
"end": 1660503981000,
|
||||
"type": "Group 1",
|
||||
"color": "orange",
|
||||
"textColor": "white"
|
||||
},
|
||||
{
|
||||
"name": "Past event 4",
|
||||
"start": 1660579608000,
|
||||
"end": 1660624108000,
|
||||
"type": "Group 1",
|
||||
"color": "orange",
|
||||
"textColor": "white"
|
||||
},
|
||||
{
|
||||
"name": "Past event 5",
|
||||
"start": 1660666008000,
|
||||
"end": 1660681529000,
|
||||
"type": "Group 1",
|
||||
"color": "orange",
|
||||
"textColor": "white"
|
||||
}
|
||||
]
|
||||
}
|
38
e2e/test-data/examplePlans/ExamplePlan_Small2.json
Normal file
38
e2e/test-data/examplePlans/ExamplePlan_Small2.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"Group 1": [
|
||||
{
|
||||
"name": "Group 1 event 1",
|
||||
"start": 1650320408000,
|
||||
"end": 1660343797000,
|
||||
"type": "Group 1",
|
||||
"color": "orange",
|
||||
"textColor": "white"
|
||||
},
|
||||
{
|
||||
"name": "Group 1 event 2",
|
||||
"start": 1660005808000,
|
||||
"end": 1660429160000,
|
||||
"type": "Group 1",
|
||||
"color": "yellow",
|
||||
"textColor": "white"
|
||||
}
|
||||
],
|
||||
"Group 2": [
|
||||
{
|
||||
"name": "Group 2 event 1",
|
||||
"start": 1660320408000,
|
||||
"end": 1660420408000,
|
||||
"type": "Group 2",
|
||||
"color": "green",
|
||||
"textColor": "white"
|
||||
},
|
||||
{
|
||||
"name": "Group 2 event 2",
|
||||
"start": 1660406808000,
|
||||
"end": 1690429160000,
|
||||
"type": "Group 2",
|
||||
"color": "blue",
|
||||
"textColor": "white"
|
||||
}
|
||||
]
|
||||
}
|
38
e2e/test-data/examplePlans/ExamplePlan_Small3.json
Normal file
38
e2e/test-data/examplePlans/ExamplePlan_Small3.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"Group 1": [
|
||||
{
|
||||
"name": "Time until birthday",
|
||||
"start": 1650320402000,
|
||||
"end": 1660343797000,
|
||||
"type": "Group 1",
|
||||
"color": "orange",
|
||||
"textColor": "white"
|
||||
},
|
||||
{
|
||||
"name": "Time until supper",
|
||||
"start": 1650320402000,
|
||||
"end": 1650420410000,
|
||||
"type": "Group 2",
|
||||
"color": "blue",
|
||||
"textColor": "white"
|
||||
}
|
||||
],
|
||||
"Group 2": [
|
||||
{
|
||||
"name": "Time since the last time I ate",
|
||||
"start": 1650320102001,
|
||||
"end": 1650320102001,
|
||||
"type": "Group 2",
|
||||
"color": "green",
|
||||
"textColor": "white"
|
||||
},
|
||||
{
|
||||
"name": "Time since last accident",
|
||||
"start": 1650320102002,
|
||||
"end": 1650320102002,
|
||||
"type": "Group 1",
|
||||
"color": "yellow",
|
||||
"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\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},\"e78ca721-fb5e-409b-bf6d-597c87cb716f\":{\"identifier\":{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603880,\"location\":\"mine\",\"created\":1732413601740,\"persisted\":1732413603880},\"c6100044-56be-44b3-acca-6b9fddfb3849\":{\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602460,\"location\":\"mine\",\"created\":1732413602460,\"persisted\":1732413602460}}"
|
||||
},
|
||||
{
|
||||
"name": "mct-recent-objects",
|
||||
"value": "[{\"objectPath\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602460,\"location\":\"mine\",\"created\":1732413602460,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/c6100044-56be-44b3-acca-6b9fddfb3849\",\"domainObject\":{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602460,\"location\":\"mine\",\"created\":1732413602460,\"persisted\":1732413602460}},{\"objectPath\":[{\"identifier\":{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603880,\"location\":\"mine\",\"created\":1732413601740,\"persisted\":1732413603880},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"domainObject\":{\"identifier\":{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603880,\"location\":\"mine\",\"created\":1732413601740,\"persisted\":1732413603880}},{\"objectPath\":[{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},{\"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\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460}}]"
|
||||
},
|
||||
{
|
||||
"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\":\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413601720,\"created\":1732413600920,\"persisted\":1732413601720},\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\":{\"identifier\":{\"key\":\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\",\"namespace\":\"\"},\"name\":\"Overlay Plot with 5s Delay\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with 5s Delay\\nchrome\",\"modified\":1732413603020,\"location\":\"mine\",\"created\":1732413601720,\"persisted\":1732413603020},\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\":{\"identifier\":{\"key\":\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":5000,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602920,\"location\":\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\",\"created\":1732413602420,\"persisted\":1732413602920}}"
|
||||
},
|
||||
{
|
||||
"name": "mct-tree-expanded",
|
||||
"value": "[]"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
File diff suppressed because one or more lines are too long
BIN
e2e/test-data/rick.jpg
Normal file
BIN
e2e/test-data/rick.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -20,69 +20,160 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { test, expect } = require('../../pluginFixtures.js');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions.js');
|
||||
import {
|
||||
createDomainObjectWithDefaults,
|
||||
createNotification,
|
||||
expandEntireTree,
|
||||
openObjectTreeContextMenu
|
||||
} from '../../appActions.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('AppActions', () => {
|
||||
test('createDomainObjectsWithDefaults', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
test('createDomainObjectsWithDefaults', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
const e2eFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: '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, { waitUntil: 'networkidle' });
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
|
||||
await page.goto(timer2.url, { waitUntil: 'networkidle' });
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
|
||||
await page.goto(timer3.url, { waitUntil: 'networkidle' });
|
||||
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, { waitUntil: 'networkidle' });
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
|
||||
await page.goto(folder2.url, { waitUntil: 'networkidle' });
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
|
||||
await page.goto(folder3.url, { waitUntil: 'networkidle' });
|
||||
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}`);
|
||||
});
|
||||
const e2eFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: '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: '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.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// 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('openObjectTreeContextMenu', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
const folder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder'
|
||||
});
|
||||
await openObjectTreeContextMenu(page, folder.url);
|
||||
await expect(page.getByLabel('Menu')).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -26,30 +26,29 @@ relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions ma
|
||||
(`npm start` and ./e2e/webpack-dev-middleware.js)
|
||||
*/
|
||||
|
||||
const { test } = require('../../baseFixtures.js');
|
||||
import { test } from '../../baseFixtures.js';
|
||||
|
||||
test.describe('baseFixtures tests', () => {
|
||||
test('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||
test.fail();
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
//Skip this test for now https://github.com/nasa/openmct/issues/6785
|
||||
test.fixme('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||
test.fail();
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Verify that ../fixtures.js detects console log errors
|
||||
await Promise.all([
|
||||
page.evaluate(() => console.error('This should result in a failure')),
|
||||
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.error('This should result in a failure')),
|
||||
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' });
|
||||
|
||||
});
|
||||
test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
|
||||
//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!
|
||||
]);
|
||||
|
||||
});
|
||||
//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!
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -21,32 +21,32 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Demonstrated:
|
||||
* - Using appActions to leverage existing functions
|
||||
* - Structure
|
||||
* - @unstable annotation
|
||||
* - await, expect, test, describe syntax
|
||||
* - Writing a custom function for a test suite
|
||||
* - Test stub for unfinished test coverage (test.fixme)
|
||||
*
|
||||
* The structure should follow
|
||||
* 1. imports
|
||||
* 2. test.describe()
|
||||
* 3. -> test1
|
||||
* -> test2
|
||||
* -> test3(stub)
|
||||
* 4. Any custom functions
|
||||
*/
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* Demonstrated:
|
||||
* - Using appActions to leverage existing functions
|
||||
* - Structure
|
||||
* - @unstable annotation
|
||||
* - await, expect, test, describe syntax
|
||||
* - Writing a custom function for a test suite
|
||||
* - Test stub for unfinished test coverage (test.fixme)
|
||||
*
|
||||
* The structure should follow
|
||||
* 1. imports
|
||||
* 2. test.describe()
|
||||
* 3. -> test1
|
||||
* -> test2
|
||||
* -> test3(stub)
|
||||
* 4. Any custom functions
|
||||
*/
|
||||
|
||||
// Structure: Some standard Imports. Please update the required pathing.
|
||||
const { test, expect } = require('../../pluginFixtures');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
/**
|
||||
* Structure:
|
||||
@ -58,63 +58,92 @@ const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
* as a part of our test promotion pipeline.
|
||||
*/
|
||||
test.describe('Renaming Timer Object', () => {
|
||||
// Top-level declaration of the Timer object created in beforeEach().
|
||||
// We can then use this throughout the entire test suite.
|
||||
let timer;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
// Top-level declaration of the Timer object created in beforeEach().
|
||||
// We can then use this throughout the entire test suite.
|
||||
let timer;
|
||||
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' });
|
||||
|
||||
// We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
|
||||
// This example will create a Timer object with default properties, under the root folder:
|
||||
timer = await createDomainObjectWithDefaults(page, { type: 'Timer' });
|
||||
// We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
|
||||
// This example will create a Timer object with default properties, under the root folder:
|
||||
timer = await createDomainObjectWithDefaults(page, { type: 'Timer' });
|
||||
|
||||
// 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);
|
||||
// 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);
|
||||
});
|
||||
|
||||
/**
|
||||
* 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'
|
||||
});
|
||||
|
||||
/**
|
||||
* 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
|
||||
// Create Telemetry object within the parent object created above
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
name: 'Telemetry',
|
||||
parent: displayLayout.uuid //reference the display layout in the creation process
|
||||
});
|
||||
});
|
||||
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
|
||||
*/
|
||||
async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
|
||||
// Navigate to the timer object
|
||||
await page.goto(timerUrl);
|
||||
// Navigate to the timer object
|
||||
await page.goto(timerUrl);
|
||||
|
||||
// Click on 3 Dot Menu
|
||||
await page.locator('button[title="More options"]').click();
|
||||
// Click on 3 Dot Menu
|
||||
await page.locator('button[title="More actions"]').click();
|
||||
|
||||
// Click text=Edit Properties...
|
||||
await page.locator('text=Edit Properties...').click();
|
||||
// Click text=Edit Properties...
|
||||
await page.locator('text=Edit Properties...').click();
|
||||
|
||||
// Rename the timer object
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
|
||||
// Rename the timer object
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
|
||||
|
||||
// Click Ok button to Save
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
// Click Ok button to Save
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
}
|
||||
|
325
e2e/tests/framework/generateLocalStorageData.e2e.spec.js
Normal file
325
e2e/tests/framework/generateLocalStorageData.e2e.spec.js
Normal file
@ -0,0 +1,325 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
import { createDomainObjectWithDefaults, createExampleTelemetryObject } from '../../appActions.js';
|
||||
import { MISSION_TIME } from '../../constants.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
const overlayPlotName = 'Overlay Plot with Telemetry Object';
|
||||
|
||||
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 }) => {
|
||||
const parent = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
name: 'Parent Display 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, { waitUntil: 'domcontentloaded' });
|
||||
await page.getByLabel('Edit Object').click();
|
||||
await page.getByLabel('Child Layout 2 Layout', { exact: true }).hover();
|
||||
await page.getByLabel('Move Sub-object Frame').nth(1).click();
|
||||
await page.getByLabel('X:').fill('30');
|
||||
|
||||
await page.getByLabel('Child Layout 1 Layout', { exact: true }).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: fileURLToPath(
|
||||
new URL('../../../e2e/test-data/display_layout_with_child_layouts.json', import.meta.url)
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
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, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Save localStorage for future test execution
|
||||
await context.storageState({
|
||||
path: fileURLToPath(
|
||||
new URL('../../../e2e/test-data/flexible_layout_with_child_layouts.json', import.meta.url)
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
// 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 actions"]').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: fileURLToPath(
|
||||
new URL('../../../e2e/test-data/overlay_plot_storage.json', import.meta.url)
|
||||
)
|
||||
});
|
||||
});
|
||||
// TODO: Merge this with previous test. Edit object created in previous test.
|
||||
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.getByLabel('More actions').click();
|
||||
await page.getByLabel('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', exact: true }).click();
|
||||
//Save localStorage for future test execution
|
||||
await context.storageState({
|
||||
path: fileURLToPath(
|
||||
new URL('../../../e2e/test-data/overlay_plot_with_delay_storage.json', import.meta.url)
|
||||
)
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Validate Overlay Plot with Telemetry Object @localStorage @generatedata', () => {
|
||||
test.use({
|
||||
storageState: fileURLToPath(
|
||||
new URL('../../../e2e/test-data/overlay_plot_storage.json', import.meta.url)
|
||||
)
|
||||
});
|
||||
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
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: fileURLToPath(
|
||||
new URL('../../../e2e/test-data/overlay_plot_with_delay_storage.json', import.meta.url)
|
||||
)
|
||||
});
|
||||
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-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.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
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' });
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -25,22 +25,20 @@ This test suite is dedicated to testing our use of our custom fixtures to verify
|
||||
that they are working as expected.
|
||||
*/
|
||||
|
||||
const { test } = require('../../pluginFixtures.js');
|
||||
import { test } from '../../pluginFixtures.js';
|
||||
|
||||
// eslint-disable-next-line playwright/no-skipped-test
|
||||
test.describe.skip('pluginFixtures tests', () => {
|
||||
// test.use({ domainObjectName: 'Timer' });
|
||||
// let timerUUID;
|
||||
|
||||
// test('Creates a timer object @framework @unstable', ({ 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}/;
|
||||
// expect(uuid).toMatch(uuidRegexp);
|
||||
// timerUUID = uuid;
|
||||
// });
|
||||
|
||||
// test('Provides same uuid for subsequent uses of the same object @framework', ({ domainObject }) => {
|
||||
// const { uuid } = domainObject;
|
||||
// expect(uuid).toEqual(timerUUID);
|
||||
// });
|
||||
// test.use({ domainObjectName: 'Timer' });
|
||||
// let timerUUID;
|
||||
// test('Creates a timer object @framework @unstable', ({ 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}/;
|
||||
// expect(uuid).toMatch(uuidRegexp);
|
||||
// timerUUID = uuid;
|
||||
// });
|
||||
// test('Provides same uuid for subsequent uses of the same object @framework', ({ domainObject }) => {
|
||||
// const { uuid } = domainObject;
|
||||
// expect(uuid).toEqual(timerUUID);
|
||||
// });
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -24,40 +24,36 @@
|
||||
This test suite is dedicated to tests which verify branding related components.
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../baseFixtures.js');
|
||||
import { expect, test } from '../../baseFixtures.js';
|
||||
|
||||
test.describe('Branding tests', () => {
|
||||
test('About Modal launches with basic branding properties', async ({ page }) => {
|
||||
// Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test('About Modal launches with basic branding properties', async ({ page }) => {
|
||||
await page.getByLabel('About Modal').click();
|
||||
|
||||
// Click About button
|
||||
await page.click('.l-shell__app-logo');
|
||||
// Verify that the NASA Logo Appears
|
||||
await expect(page.getByAltText('Open MCT Splash Logo')).toBeVisible();
|
||||
|
||||
// Verify that the NASA Logo Appears
|
||||
await expect(page.locator('.c-about__image')).toBeVisible();
|
||||
// Modify the Build information in 'about' Modal
|
||||
await expect.soft(page.getByLabel('Version Number')).toContainText(/Version: \d/);
|
||||
await expect
|
||||
.soft(page.getByLabel('Build Date'))
|
||||
.toContainText(/Build Date: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun))/);
|
||||
await expect.soft(page.getByLabel('Revision')).toContainText(/Revision: \b[0-9a-f]{5,40}\b/);
|
||||
await expect.soft(page.getByLabel('Branch')).toContainText(/Branch: ./);
|
||||
});
|
||||
test('Verify Links in About Modal @2p', async ({ page }) => {
|
||||
// Click About button
|
||||
await page.getByLabel('About Modal').click();
|
||||
|
||||
// Modify the Build information in 'about' Modal
|
||||
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info').first();
|
||||
await expect(versionInformationLocator).toBeEnabled();
|
||||
await expect.soft(versionInformationLocator).toContainText(/Version: \d/);
|
||||
await expect.soft(versionInformationLocator).toContainText(/Build Date: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun))/);
|
||||
await expect.soft(versionInformationLocator).toContainText(/Revision: \b[0-9a-f]{5,40}\b/);
|
||||
await expect.soft(versionInformationLocator).toContainText(/Branch: ./);
|
||||
});
|
||||
test('Verify Links in About Modal @2p', async ({ page }) => {
|
||||
// Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
|
||||
// Click About button
|
||||
await page.click('.l-shell__app-logo');
|
||||
|
||||
// Verify that clicking on the third party licenses information opens up another tab on licenses url
|
||||
const [page2] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.locator('text=click here for third party licensing information').click()
|
||||
]);
|
||||
await page2.waitForLoadState('networkidle'); //Avoids timing issues with juggler/firefox
|
||||
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
||||
});
|
||||
// Verify that clicking on the third party licenses information opens up another tab on licenses url
|
||||
const [page2] = await Promise.all([
|
||||
page.waitForEvent('popup'),
|
||||
page.getByText('click here for third party licensing information').click()
|
||||
]);
|
||||
await page2.waitForLoadState('domcontentloaded'); //Avoids timing issues with juggler/firefox
|
||||
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
64
e2e/tests/functional/clearDataAction.e2e.spec.js
Normal file
64
e2e/tests/functional/clearDataAction.e2e.spec.js
Normal file
@ -0,0 +1,64 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
Verify that the "Clear Data" menu action performs as expected for various object types.
|
||||
*/
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { expect, test } from '../../pluginFixtures.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 }) => {
|
||||
expect(await page.locator('.c-thumb__image').count()).toBeGreaterThan(0);
|
||||
// Click the "Clear Data" menu action
|
||||
await page.getByTitle('More actions').click();
|
||||
await expect(
|
||||
page.getByRole('menuitem', {
|
||||
name: 'Clear Data for Object'
|
||||
})
|
||||
).toBeEnabled();
|
||||
await page
|
||||
.getByRole('menuitem', {
|
||||
name: 'Clear Data for Object'
|
||||
})
|
||||
.click();
|
||||
|
||||
// Verify that the background image is no longer visible
|
||||
await expect(page.locator(backgroundImageSelector)).toBeHidden();
|
||||
expect(await page.locator('.c-thumb__image').count()).toBe(0);
|
||||
});
|
||||
});
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -21,88 +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');
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe("CouchDB Status Indicator @couchdb", () => {
|
||||
test.use({ failOnConsoleError: false });
|
||||
//TODO BeforeAll Verify CouchDB Connectivity with APIContext
|
||||
test('Shows green if connected', async ({ page }) => {
|
||||
await page.route('**/openmct/mine', route => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
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 is connected")').nth(3)).toBeVisible();
|
||||
test.describe('CouchDB Status Indicator with mocked responses @couchdb', () => {
|
||||
test.use({ failOnConsoleError: false });
|
||||
//TODO BeforeAll Verify CouchDB Connectivity with APIContext
|
||||
test('Shows green if connected', async ({ page }) => {
|
||||
await page.route('**/openmct/mine', (route) => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({})
|
||||
});
|
||||
});
|
||||
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
|
||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
||||
await expect(page.locator('div:has-text("CouchDB is offline")').nth(3)).toBeVisible();
|
||||
//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({})
|
||||
});
|
||||
});
|
||||
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();
|
||||
//Go to baseURL
|
||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||
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 @couchdb", () => {
|
||||
test.use({ failOnConsoleError: false });
|
||||
test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
|
||||
// Store any relevant PUT requests that happen on the page
|
||||
const createMineFolderRequests = [];
|
||||
page.on('request', req => {
|
||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
||||
if (req.method() === 'PUT' && req.url().endsWith('openmct/mine')) {
|
||||
createMineFolderRequests.push(req);
|
||||
}
|
||||
});
|
||||
test.describe('CouchDB initialization with mocked responses @couchdb', () => {
|
||||
test.use({ failOnConsoleError: false });
|
||||
test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
|
||||
const mockedMissingObjectResponseFromCouchDB = {
|
||||
status: 404,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({})
|
||||
};
|
||||
|
||||
// Override the first request to GET openmct/mine to return a 404
|
||||
await page.route('**/openmct/mine', route => {
|
||||
route.fulfill({
|
||||
status: 404,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({})
|
||||
});
|
||||
}, { times: 1 });
|
||||
// Override the first request to GET openmct/mine to return a 404.
|
||||
// This simulates the case of starting Open MCT with a fresh database
|
||||
// and no "My Items" folder created yet.
|
||||
await page.route(
|
||||
'**/mine',
|
||||
(route) => {
|
||||
route.fulfill(mockedMissingObjectResponseFromCouchDB);
|
||||
},
|
||||
{ times: 1 }
|
||||
);
|
||||
|
||||
// Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
// Set up promise to verify that a PUT request to create "My Items"
|
||||
// folder was made.
|
||||
const putMineFolderRequest = page.waitForRequest(
|
||||
(req) => req.url().endsWith('/mine') && req.method() === 'PUT'
|
||||
);
|
||||
|
||||
// Verify that error banner is displayed
|
||||
const bannerMessage = await page.locator('.c-message-banner__message').innerText();
|
||||
expect(bannerMessage).toEqual('Failed to retrieve object mine');
|
||||
// Set up promise to verify that a GET request to retrieve "My Items"
|
||||
// folder was made.
|
||||
const getMineFolderRequest = page.waitForRequest(
|
||||
(req) => req.url().endsWith('/mine') && req.method() === 'GET'
|
||||
);
|
||||
|
||||
// Verify that a PUT request to create "My Items" folder was made
|
||||
await expect.poll(() => createMineFolderRequests.length, {
|
||||
message: 'Verify that PUT request to create "mine" folder was made',
|
||||
timeout: 1000
|
||||
}).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
// Go to baseURL.
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// Wait for both requests to resolve.
|
||||
await Promise.all([putMineFolderRequest, getMineFolderRequest]);
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -24,36 +24,35 @@
|
||||
This test suite is dedicated to tests which verify the basic operations surrounding the example event generator.
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../../pluginFixtures');
|
||||
const { createDomainObjectWithDefaults } = require('../../../appActions');
|
||||
import { createDomainObjectWithDefaults } from '../../../appActions.js';
|
||||
import { expect, test } from '../../../pluginFixtures.js';
|
||||
|
||||
test.describe('Example Event Generator CRUD Operations', () => {
|
||||
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Create a name for the object
|
||||
const newObjectName = 'Test Event Generator';
|
||||
//Create a name for the object
|
||||
const newObjectName = 'Test Event Generator';
|
||||
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Event Message Generator',
|
||||
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);
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Event Message Generator',
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Example Event Generator Telemetry Event Verficiation', () => {
|
||||
|
||||
test.fixme('telemetry is coming in for test event', async ({ page }) => {
|
||||
test.describe('Example Event Generator Telemetry Event Verification', () => {
|
||||
test.fixme('telemetry is coming in for test event', async ({ page }) => {
|
||||
// Go to object created in step one
|
||||
// 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
|
||||
// Verify the telemetry table has a class with "is-sorting asc"
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -24,96 +24,116 @@
|
||||
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets.
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../../../baseFixtures');
|
||||
import { expect, test } from '../../../../baseFixtures.js';
|
||||
|
||||
test.describe('Sine Wave Generator', () => {
|
||||
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({ page, browserName }) => {
|
||||
// eslint-disable-next-line playwright/no-skipped-test
|
||||
test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
|
||||
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({
|
||||
page,
|
||||
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
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Click the Create button
|
||||
await page.click('button:has-text("Create")');
|
||||
//Click the Create button
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
// Click Sine Wave Generator
|
||||
await page.click('text=Sine Wave Generator');
|
||||
// Click Sine Wave Generator
|
||||
await page.click('text=Sine Wave Generator');
|
||||
|
||||
// Verify that the each required field has required indicator
|
||||
// Title
|
||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
||||
// Verify that the each required field has required indicator
|
||||
// Title
|
||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
||||
|
||||
// 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 page.locator('textarea[type="text"]').fill('Optional Note Text');
|
||||
// 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 page.locator('textarea[type="text"]').fill('Optional Note Text');
|
||||
|
||||
// Period
|
||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
// Period
|
||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
|
||||
// Amplitude
|
||||
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
// Amplitude
|
||||
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
|
||||
// Offset
|
||||
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
// Offset
|
||||
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
|
||||
// Data Rate
|
||||
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
// Data Rate
|
||||
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
|
||||
// Phase
|
||||
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
// Phase
|
||||
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
|
||||
// Randomness
|
||||
await expect(page.locator('div:nth-child(9) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||
// Randomness
|
||||
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
|
||||
await page.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 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 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
|
||||
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 expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
||||
// 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 expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
||||
|
||||
// Verify that by removing value from required number field shows invalid indicator
|
||||
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/);
|
||||
// Verify that by removing value from required number field shows invalid indicator
|
||||
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/
|
||||
);
|
||||
|
||||
// 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 expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/valid/);
|
||||
// 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 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
|
||||
// Click .field.control.l-input-sm input >> nth=0
|
||||
await page.locator('.field.control.l-input-sm input').first().click();
|
||||
// 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');
|
||||
// Verify that can change value of number field by up/down arrows keys
|
||||
// Click .field.control.l-input-sm input >> nth=0
|
||||
await page.locator('.field.control.l-input-sm input').first().click();
|
||||
// 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');
|
||||
|
||||
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
||||
await expect(value).toBe('6');
|
||||
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
||||
await expect(value).toBe('6');
|
||||
|
||||
//Click text=OK
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.click('button:has-text("OK")')
|
||||
]);
|
||||
//Click text=OK
|
||||
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||
|
||||
// Verify that the Sine Wave Generator is displayed and correct
|
||||
// Verify object properties
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText('New Sine Wave Generator');
|
||||
// Verify that the Sine Wave Generator is displayed and correct
|
||||
// Verify object properties
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(
|
||||
'New Sine Wave Generator'
|
||||
);
|
||||
|
||||
// Verify canvas rendered and can be interacted with
|
||||
await page.locator('canvas').nth(1).click({
|
||||
position: {
|
||||
x: 341,
|
||||
y: 28
|
||||
}
|
||||
});
|
||||
// Verify canvas rendered and can be interacted with
|
||||
await page
|
||||
.locator('canvas')
|
||||
.nth(1)
|
||||
.click({
|
||||
position: {
|
||||
x: 341,
|
||||
y: 28
|
||||
}
|
||||
});
|
||||
|
||||
// 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
|
||||
await expect(page.locator('.value-to-display-nearestValue')).toContainText(/[+-]?([0-9]*[.])?[0-9]+/);
|
||||
|
||||
});
|
||||
// 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
|
||||
await expect(page.locator('.value-to-display-nearestValue')).toContainText(
|
||||
/[+-]?([0-9]*[.])?[0-9]+/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -24,116 +24,280 @@
|
||||
This test suite is dedicated to tests which verify form functionality in isolation
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../baseFixtures');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const path = require('path');
|
||||
import { fileURLToPath } from 'url';
|
||||
import { v4 as genUuid } from 'uuid';
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
const TEST_FOLDER = 'test folder';
|
||||
const jsonFilePath = 'e2e/test-data/ExampleLayouts.json';
|
||||
const imageFilePath = 'e2e/test-data/rick.jpg';
|
||||
|
||||
test.describe('Form Validation Behavior', () => {
|
||||
test('Required Field indicators appear if title is empty and can be corrected', async ({ page }) => {
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
test('Required Field indicators appear if title is empty and can be corrected', async ({
|
||||
page
|
||||
}) => {
|
||||
//Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await page.click('button:has-text("Create")');
|
||||
await page.click(':nth-match(:text("Folder"), 2)');
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Folder' }).click();
|
||||
|
||||
// Fill in empty string into title and trigger validation with 'Tab'
|
||||
await page.click('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');
|
||||
// Fill in empty string into title and trigger validation with 'Tab'
|
||||
await page.click('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');
|
||||
|
||||
//Required Field Form Validation
|
||||
await expect(page.locator('button:has-text("OK")')).toBeDisabled();
|
||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
||||
//Required Field Form Validation
|
||||
await expect(page.locator('button:has-text("OK")')).toBeDisabled();
|
||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
||||
|
||||
//Correct Form Validation for missing title and trigger validation with 'Tab'
|
||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
||||
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
||||
//Correct Form Validation for missing title and trigger validation with 'Tab'
|
||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
||||
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
||||
|
||||
//Required Field Form Validation is corrected
|
||||
await expect(page.locator('button:has-text("OK")')).toBeEnabled();
|
||||
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
||||
//Required Field Form Validation is corrected
|
||||
await expect(page.locator('button:has-text("OK")')).toBeEnabled();
|
||||
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
||||
|
||||
//Finish Creating Domain Object
|
||||
await Promise.all([
|
||||
page.waitForNavigation(),
|
||||
page.click('button:has-text("OK")')
|
||||
]);
|
||||
//Finish Creating Domain Object
|
||||
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||
|
||||
//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);
|
||||
//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);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Form File Input Behavior', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('../../helper/addInitFileInputObject.js', import.meta.url))
|
||||
});
|
||||
});
|
||||
|
||||
test('Can select a JSON file type', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('menuitem', { name: 'JSON File Input Object' }).click();
|
||||
|
||||
await page.setInputFiles('#fileElem', jsonFilePath);
|
||||
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
const type = await page.locator('#file-input-type').textContent();
|
||||
await expect(type).toBe(`"string"`);
|
||||
});
|
||||
|
||||
test('Can select an image file type', async ({ page }) => {
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
await page.getByRole('menuitem', { name: 'Image File Input Object' }).click();
|
||||
|
||||
await page.setInputFiles('#fileElem', imageFilePath);
|
||||
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
const type = await page.locator('#file-input-type').textContent();
|
||||
await expect(type).toBe(`"object"`);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Persistence operations @addInit', () => {
|
||||
// add non persistable root item
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') });
|
||||
// add non persistable root item
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('../../helper/addNoneditableObject.js', import.meta.url))
|
||||
});
|
||||
});
|
||||
|
||||
test('Persistability should be respected in the create form location field', async ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
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();
|
||||
test('Persistability should be respected in the create form location field', async ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/4323'
|
||||
});
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await page.getByRole('button', { name: 'Create' }).click();
|
||||
|
||||
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.use({ failOnConsoleError: false });
|
||||
test('Editing object properties should generate a single persistence operation', async ({ page }) => {
|
||||
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.use({ failOnConsoleError: false });
|
||||
test('Editing object properties should generate a single persistence operation', async ({
|
||||
page
|
||||
}) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/5616'
|
||||
});
|
||||
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// 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 actions"]');
|
||||
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.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 Plan View', 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 (SWG)', 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 Clock', async ({ page }) => {});
|
||||
test.fixme('Verify correct behavior of number object Hyperlink', async ({ page }) => {});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -24,27 +24,36 @@
|
||||
This test suite is dedicated to tests which verify persistability checks
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../baseFixtures.js');
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const path = require('path');
|
||||
import { expect, test } from '../../baseFixtures.js';
|
||||
|
||||
test.describe('Persistence operations @addInit', () => {
|
||||
// add non persistable root item
|
||||
test.beforeEach(async ({ page }) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') });
|
||||
// add non persistable root item
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.addInitScript({
|
||||
path: fileURLToPath(new URL('../../helper/addNoneditableObject.js', import.meta.url))
|
||||
});
|
||||
});
|
||||
|
||||
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 }) => {
|
||||
await page.goto('./', { waitUntil: 'networkidle' });
|
||||
const menuOptions = page.locator('.c-menu li');
|
||||
|
||||
await page.locator('text=Persistence Testing').first().click({
|
||||
button: 'right'
|
||||
});
|
||||
|
||||
const menuOptions = page.locator('.c-menu li');
|
||||
|
||||
await expect.soft(menuOptions).toContainText(['Open In New Tab', 'View', 'Create Link']);
|
||||
await expect(menuOptions).not.toContainText(['Move', 'Duplicate', 'Remove', 'Add New Folder', 'Edit Properties...', 'Export as JSON', 'Import from JSON']);
|
||||
});
|
||||
await expect.soft(menuOptions).toContainText(['Open In New Tab', 'View', 'Create Link']);
|
||||
await expect(menuOptions).not.toContainText([
|
||||
'Move',
|
||||
'Duplicate',
|
||||
'Remove',
|
||||
'Add New Folder',
|
||||
'Edit Properties...',
|
||||
'Export as JSON',
|
||||
'Import from JSON'
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
@ -1,212 +1,303 @@
|
||||
/*****************************************************************************
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../pluginFixtures');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
|
||||
test.describe('Move & link item tests', () => {
|
||||
test('Create a basic object and verify that it can be moved to another folder', async ({ page, openmctConfig }) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Go to Open MCT
|
||||
await page.goto('./');
|
||||
|
||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Parent Folder'
|
||||
});
|
||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Child Folder',
|
||||
parent: parentFolder.uuid
|
||||
});
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Grandchild Folder',
|
||||
parent: childFolder.uuid
|
||||
});
|
||||
|
||||
// Attempt to move parent to its own grandparent
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
await page.locator('.c-disclosure-triangle >> nth=0').click();
|
||||
|
||||
await page.locator(`a:has-text("Parent Folder") >> nth=0`).click({
|
||||
button: 'right'
|
||||
});
|
||||
|
||||
await page.locator('li.icon-move').click();
|
||||
await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=0').click();
|
||||
await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=1').click();
|
||||
await page.locator('form[name="mctForm"] >> text=Child Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=2').click();
|
||||
await page.locator('form[name="mctForm"] >> text=Grandchild Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('[aria-label="Cancel"]').click();
|
||||
|
||||
// Move Child Folder from Parent Folder to My Items
|
||||
await page.locator('.c-disclosure-triangle >> nth=0').click();
|
||||
await page.locator('.c-disclosure-triangle >> nth=1').click();
|
||||
|
||||
await page.locator(`a:has-text("Child Folder") >> nth=0`).click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.locator('li.icon-move').click();
|
||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
||||
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
|
||||
// Expect that Child Folder is in My Items, the root folder
|
||||
expect(page.locator(`text=${myItemsFolderName} >> nth=0:has(text=Child Folder)`)).toBeTruthy();
|
||||
});
|
||||
test('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({ page, openmctConfig }) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Go to Open MCT
|
||||
await page.goto('./');
|
||||
|
||||
// Create Telemetry Table
|
||||
let telemetryTable = 'Test Telemetry Table';
|
||||
await page.locator('button:has-text("Create")').click();
|
||||
await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
|
||||
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
|
||||
// Finish editing and save Telemetry Table
|
||||
await page.locator('.c-button--menu.c-button--major.icon-save').click();
|
||||
await page.locator('text=Save and Finish Editing').click();
|
||||
|
||||
// Create New Folder Basic Domain Object
|
||||
let folder = 'Test Folder';
|
||||
await page.locator('button:has-text("Create")').click();
|
||||
await page.locator('li[role="menuitem"]:has-text("Folder")').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
|
||||
|
||||
// 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();
|
||||
let okButton = await page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||
let okButtonStateDisabled = await okButton.isDisabled();
|
||||
expect.soft(okButtonStateDisabled).toBeTruthy();
|
||||
|
||||
// Continue test regardless of assertion and create it in My Items
|
||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
|
||||
// Open My Items
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
|
||||
// Select Folder Object and select Move from context menu
|
||||
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').click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.locator('li.icon-move').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();
|
||||
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
||||
let okButton2 = await page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||
let okButtonStateDisabled2 = await okButton2.isDisabled();
|
||||
expect(okButtonStateDisabled2).toBeTruthy();
|
||||
});
|
||||
|
||||
test('Create a basic object and verify that it can be linked to another folder', async ({ page, openmctConfig }) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Go to Open MCT
|
||||
await page.goto('./');
|
||||
|
||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Parent Folder'
|
||||
});
|
||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Child Folder',
|
||||
parent: parentFolder.uuid
|
||||
});
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Grandchild Folder',
|
||||
parent: childFolder.uuid
|
||||
});
|
||||
|
||||
// Attempt to link parent to its own grandparent
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
await page.locator('.c-disclosure-triangle >> nth=0').click();
|
||||
|
||||
await page.locator(`a:has-text("Parent Folder") >> nth=0`).click({
|
||||
button: 'right'
|
||||
});
|
||||
|
||||
await page.locator('li.icon-link').click();
|
||||
await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=0').click();
|
||||
await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=1').click();
|
||||
await page.locator('form[name="mctForm"] >> text=Child Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=2').click();
|
||||
await page.locator('form[name="mctForm"] >> text=Grandchild Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('[aria-label="Cancel"]').click();
|
||||
|
||||
// Link Child Folder from Parent Folder to My Items
|
||||
await page.locator('.c-disclosure-triangle >> nth=0').click();
|
||||
await page.locator('.c-disclosure-triangle >> nth=1').click();
|
||||
|
||||
await page.locator(`a:has-text("Child Folder") >> nth=0`).click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.locator('li.icon-link').click();
|
||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
||||
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
|
||||
// Expect that Child Folder is in My Items, the root folder
|
||||
expect(page.locator(`text=${myItemsFolderName} >> nth=0:has(text=Child Folder)`)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
test.fixme('Cannot move a previously created domain object to non-peristable 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
|
||||
});
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
|
||||
*/
|
||||
|
||||
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Move & link item tests', () => {
|
||||
test('Create a basic object and verify that it can be moved to another folder', async ({
|
||||
page,
|
||||
openmctConfig
|
||||
}) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Go to Open MCT
|
||||
await page.goto('./');
|
||||
|
||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Parent Folder'
|
||||
});
|
||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Child Folder',
|
||||
parent: parentFolder.uuid
|
||||
});
|
||||
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Grandchild Folder',
|
||||
parent: childFolder.uuid
|
||||
});
|
||||
|
||||
// Attempt to move parent to its own grandparent
|
||||
await page.locator('button[title="Show selected item in tree"]').click();
|
||||
|
||||
const treePane = page.getByRole('tree', {
|
||||
name: 'Main Tree'
|
||||
});
|
||||
await treePane
|
||||
.getByRole('treeitem', {
|
||||
name: 'Parent Folder'
|
||||
})
|
||||
.click({
|
||||
button: 'right'
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('menuitem', {
|
||||
name: /Move/
|
||||
})
|
||||
.click();
|
||||
|
||||
const createModalTree = page.getByRole('tree', {
|
||||
name: 'Create Modal Tree'
|
||||
});
|
||||
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: myItemsFolderName
|
||||
});
|
||||
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await myItemsLocatorTreeItem.click();
|
||||
|
||||
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: parentFolder.name
|
||||
});
|
||||
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await parentFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
|
||||
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: new RegExp(childFolder.name)
|
||||
});
|
||||
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await childFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
|
||||
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: grandchildFolder.name
|
||||
});
|
||||
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await grandchildFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
|
||||
await parentFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('[aria-label="Cancel"]').click();
|
||||
|
||||
// Move Child Folder from Parent Folder to My Items
|
||||
await treePane
|
||||
.getByRole('treeitem', {
|
||||
name: new RegExp(childFolder.name)
|
||||
})
|
||||
.click({
|
||||
button: 'right'
|
||||
});
|
||||
await page
|
||||
.getByRole('menuitem', {
|
||||
name: /Move/
|
||||
})
|
||||
.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('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({
|
||||
page,
|
||||
openmctConfig
|
||||
}) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Go to Open MCT
|
||||
await page.goto('./');
|
||||
|
||||
// Create Telemetry Table
|
||||
let telemetryTable = 'Test Telemetry Table';
|
||||
await page.locator('button:has-text("Create")').click();
|
||||
await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
|
||||
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
|
||||
// Finish editing and save Telemetry Table
|
||||
await page.locator('.c-button--menu.c-button--major.icon-save').click();
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// Create New Folder Basic Domain Object
|
||||
let folder = 'Test Folder';
|
||||
await page.locator('button:has-text("Create")').click();
|
||||
await page.locator('li[role="menuitem"]:has-text("Folder")').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
|
||||
|
||||
// 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();
|
||||
let okButton = page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||
let okButtonStateDisabled = await okButton.isDisabled();
|
||||
expect.soft(okButtonStateDisabled).toBeTruthy();
|
||||
|
||||
// Continue test regardless of assertion and create it in My Items
|
||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
||||
await page.locator('button:has-text("OK")').click();
|
||||
|
||||
// Open My Items
|
||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||
|
||||
// Select Folder Object and select Move from context menu
|
||||
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')
|
||||
.click({
|
||||
button: 'right'
|
||||
});
|
||||
await page.locator('li.icon-move').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();
|
||||
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
||||
let okButton2 = page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||
let okButtonStateDisabled2 = await okButton2.isDisabled();
|
||||
expect(okButtonStateDisabled2).toBeTruthy();
|
||||
});
|
||||
|
||||
test('Create a basic object and verify that it can be linked to another folder', async ({
|
||||
page,
|
||||
openmctConfig
|
||||
}) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Go to Open MCT
|
||||
await page.goto('./');
|
||||
|
||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Parent Folder'
|
||||
});
|
||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Child Folder',
|
||||
parent: parentFolder.uuid
|
||||
});
|
||||
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Grandchild Folder',
|
||||
parent: childFolder.uuid
|
||||
});
|
||||
|
||||
// Attempt to move parent to its own grandparent
|
||||
await page.locator('button[title="Show selected item in tree"]').click();
|
||||
|
||||
const treePane = page.getByRole('tree', {
|
||||
name: 'Main Tree'
|
||||
});
|
||||
await treePane
|
||||
.getByRole('treeitem', {
|
||||
name: 'Parent Folder'
|
||||
})
|
||||
.click({
|
||||
button: 'right'
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('menuitem', {
|
||||
name: /Move/
|
||||
})
|
||||
.click();
|
||||
|
||||
const createModalTree = page.getByRole('tree', {
|
||||
name: 'Create Modal Tree'
|
||||
});
|
||||
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: myItemsFolderName
|
||||
});
|
||||
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await myItemsLocatorTreeItem.click();
|
||||
|
||||
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: parentFolder.name
|
||||
});
|
||||
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await parentFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
|
||||
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: new RegExp(childFolder.name)
|
||||
});
|
||||
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await childFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
|
||||
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||
name: grandchildFolder.name
|
||||
});
|
||||
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||
await grandchildFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
|
||||
await parentFolderLocatorTreeItem.click();
|
||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||
await page.locator('[aria-label="Cancel"]').click();
|
||||
|
||||
// Move Child Folder from Parent Folder to My Items
|
||||
await treePane
|
||||
.getByRole('treeitem', {
|
||||
name: new RegExp(childFolder.name)
|
||||
})
|
||||
.click({
|
||||
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
|
||||
}
|
||||
);
|
||||
|
120
e2e/tests/functional/notification.e2e.spec.js
Normal file
120
e2e/tests/functional/notification.e2e.spec.js
Normal file
@ -0,0 +1,120 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
This test suite is dedicated to tests which verify Open MCT's Notification functionality
|
||||
*/
|
||||
|
||||
import { createDomainObjectWithDefaults, createNotification } from '../../appActions.js';
|
||||
import { expect, test } from '../../pluginFixtures.js';
|
||||
|
||||
test.describe('Notifications List', () => {
|
||||
test.fixme('Notifications can be dismissed individually', async ({ page }) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/6820'
|
||||
});
|
||||
|
||||
// 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('Closing notification list after notification banner disappeared does not cause it to open automatically', async ({
|
||||
page
|
||||
}) => {
|
||||
test.info().annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/nasa/openmct/issues/6130'
|
||||
});
|
||||
|
||||
// Go to baseURL
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// Create a new Display Layout object
|
||||
await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
|
||||
|
||||
// Dismiss notification banner
|
||||
await page.getByRole('button', { name: 'Dismiss' }).click();
|
||||
|
||||
// Click on the button "Review 1 Notification"
|
||||
await page.getByRole('button', { name: 'Review 1 Notification' }).click();
|
||||
|
||||
// Verify that Notification List is open
|
||||
await expect(page.getByRole('dialog', { name: 'Overlay' })).toBeVisible();
|
||||
|
||||
// Wait until there is no Notification Banner
|
||||
await expect(page.getByRole('alert')).not.toBeAttached();
|
||||
|
||||
// Click on the "Close" button of the Notification List
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
|
||||
// On the Display Layout object, click on the "Edit" button
|
||||
await page.getByRole('button', { name: 'Edit Object' }).click();
|
||||
|
||||
// Click on the "Save" button
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// Verify that Notification List is NOT open
|
||||
await expect(page.getByRole('dialog', { name: 'Overlay' })).toBeHidden();
|
||||
});
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user