mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 11:09:22 +00:00
Compare commits
546 Commits
git-error-
...
v3.1.1
Author | SHA1 | Date | |
---|---|---|---|
0bf37fc492 | |||
d40204efe3 | |||
ff8288d10e | |||
c1dd82cf5f | |||
e43ddf6a4a | |||
018a64eb86 | |||
b1785da838 | |||
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 | |||
b74b27c464 | |||
d35e161701 | |||
653cb62f9c | |||
19b3232fa0 | |||
19892aab53 | |||
a168ce25cf | |||
189c58f952 | |||
0dfc028e1b | |||
77e93f1aee | |||
394fbbe61b | |||
40afb04f0c | |||
be73b0158a | |||
625205f24b | |||
a706a8b73e | |||
1ddf5e5137 | |||
a79646a915 | |||
d5266e7ac7 | |||
05de7ee2e0 | |||
dad88112c4 | |||
202d6d8c5d | |||
e70bcc414c | |||
7bb4a136d7 | |||
8af3b4309f | |||
bed3d83fd7 | |||
efda42cf6d | |||
e8ee5b3fc9 | |||
393cb9767f | |||
8b5daad65c | |||
fabfecdb3e | |||
a2d8b13204 | |||
4b14d2d6d2 | |||
d545124942 | |||
6abdbfdff0 | |||
500e655476 | |||
5e1f026db2 | |||
d9efae98c8 | |||
091f6406a8 | |||
42a0e503cc | |||
4697352f60 | |||
015c764ab3 | |||
8fe465d9fc | |||
9c1368885a | |||
391c0b2e7c | |||
2ae061dbcd | |||
41fc502564 | |||
b4554d2fc1 | |||
feba5f6d3b | |||
4357d35f4a | |||
5041f80e5b | |||
9e23f79bc8 | |||
bd1e869f6a | |||
e4a36532e7 | |||
2bc2316613 | |||
2fa36b2176 | |||
efa38d779e | |||
951cc6ec0d | |||
ef4b8a9934 | |||
c14b48917e | |||
26165d0a99 | |||
f7cf3f72c2 | |||
cb8e09c9f9 | |||
026eb86f5f | |||
866859a937 | |||
afc54f41f6 | |||
72c980f991 | |||
9bf39a9cd4 | |||
33fd95cb2b | |||
8c92178895 | |||
35bbebbbc7 | |||
ce463babff | |||
27c30132d2 | |||
2bdac56505 | |||
35c42ba43d | |||
6bdb8c9e1c | |||
4a5467aba7 | |||
b85238d7d0 | |||
410b3d6036 | |||
9a727cac2e | |||
be5472ebdb | |||
f39419bc84 | |||
07bf85a623 | |||
425e662d6e | |||
2a689b896f | |||
ffe6fd1941 | |||
cae579f5b3 | |||
a073649e64 | |||
f40e14cb2c | |||
4629fbf115 | |||
500e3bc583 | |||
a65757d197 | |||
f20bb4de10 | |||
1c762f506f | |||
7d900a80b5 | |||
8a06dedf9d | |||
15ab0dae50 | |||
a7ea5afa59 | |||
c231c2d7cb | |||
47fb81ff1c | |||
0efc6987a5 | |||
79d1df39b7 | |||
0c9ea26888 | |||
153538b6bf | |||
798e2d4337 | |||
e3770dc701 | |||
0f12aa1eae | |||
c17efcc157 | |||
90662ce4a7 | |||
84c1526f5e | |||
d73cb2ef70 | |||
07bdbe5108 | |||
291e62687e | |||
efadf9036f | |||
ca928370a4 | |||
6820e0d044 | |||
b8fa89af6e | |||
bbb84c695d | |||
f979e170ee | |||
1d875cb8ca | |||
a584766618 | |||
a671be726b | |||
10ff4e1781 | |||
f1c85933c3 | |||
f2ed518300 | |||
bf8d1561ae | |||
2e1ede1427 | |||
fc3614dfbd | |||
22924f18fc | |||
60f20c64d5 | |||
8dc8a1c0a9 | |||
710259b5f0 | |||
e774eb01f3 | |||
c83ee95d9c | |||
161fca98d5 | |||
f493f031df | |||
71c43dee65 | |||
c10e9ad14c | |||
075ca1f87d | |||
7e1337447f | |||
7e854f078e | |||
2cfd7ac5b6 | |||
6c90798905 | |||
2fa053e80c | |||
488cd82ae1 | |||
d85be3b88e | |||
4d48cf3180 | |||
413cb13edf | |||
70115be727 | |||
97f5528dfc | |||
0e1cc5dc30 | |||
0062191416 | |||
eedc523078 | |||
db97acb61e | |||
43a4bf9606 | |||
0f352087f5 | |||
8ce15521de | |||
c0b0c44dc2 | |||
b9a644cd4f | |||
1afc5ef245 | |||
34442c53c6 | |||
451ca075fe | |||
84f1a61a8d | |||
ea041aaaf9 | |||
ac9420bfa1 | |||
0ebab10578 | |||
cbdb9fc437 | |||
63d2246345 | |||
78002f0a24 | |||
f08fd58486 | |||
730272e165 |
@ -2,17 +2,23 @@ version: 2.1
|
|||||||
executors:
|
executors:
|
||||||
pw-focal-development:
|
pw-focal-development:
|
||||||
docker:
|
docker:
|
||||||
- image: mcr.microsoft.com/playwright:v1.21.1-focal
|
- image: mcr.microsoft.com/playwright:v1.36.2-focal
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
||||||
|
PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
|
||||||
|
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||||
|
ubuntu:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2204:current
|
||||||
|
docker_layer_caching: true
|
||||||
parameters:
|
parameters:
|
||||||
BUST_CACHE:
|
BUST_CACHE:
|
||||||
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
description: 'Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!'
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
commands:
|
commands:
|
||||||
build_and_install:
|
build_and_install:
|
||||||
description: "All steps used to build and install. Will not work on node10"
|
description: 'All steps used to build and install. Will use cache if found'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
@ -21,11 +27,10 @@ commands:
|
|||||||
- restore_cache_cmd:
|
- restore_cache_cmd:
|
||||||
node-version: << parameters.node-version >>
|
node-version: << parameters.node-version >>
|
||||||
- node/install:
|
- node/install:
|
||||||
install-npm: true
|
|
||||||
node-version: << parameters.node-version >>
|
node-version: << parameters.node-version >>
|
||||||
- run: npm install --prefer-offline --no-audit --progress=false
|
- run: npm install --no-audit --progress=false
|
||||||
restore_cache_cmd:
|
restore_cache_cmd:
|
||||||
description: "Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache"
|
description: 'Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
@ -35,35 +40,39 @@ commands:
|
|||||||
equal: [false, << pipeline.parameters.BUST_CACHE >>]
|
equal: [false, << pipeline.parameters.BUST_CACHE >>]
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||||
save_cache_cmd:
|
save_cache_cmd:
|
||||||
description: "Custom command for saving cache."
|
description: 'Custom command for saving cache.'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||||
paths:
|
paths:
|
||||||
- ~/.npm
|
- ~/.npm
|
||||||
- node_modules
|
- node_modules
|
||||||
generate_and_store_version_and_filesystem_artifacts:
|
generate_and_store_version_and_filesystem_artifacts:
|
||||||
description: "Track important packages and files"
|
description: 'Track important packages and files'
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
mkdir /tmp/artifacts
|
[[ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
|
||||||
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt
|
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt || true
|
||||||
npm -v >> /tmp/artifacts/npm-version.txt
|
npm -v >> /tmp/artifacts/npm-version.txt
|
||||||
node -v >> /tmp/artifacts/node-version.txt
|
node -v >> /tmp/artifacts/node-version.txt
|
||||||
ls -latR >> /tmp/artifacts/dir.txt
|
ls -latR >> /tmp/artifacts/dir.txt
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/artifacts/
|
path: /tmp/artifacts/
|
||||||
upload_code_covio:
|
generate_e2e_code_cov_report:
|
||||||
description: "Command to upload code coverage reports to codecov.io"
|
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:
|
steps:
|
||||||
- run: curl -Os https://uploader.codecov.io/latest/linux/codecov;chmod +x codecov;./codecov
|
- run: npm run cov:e2e:report || true
|
||||||
|
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
||||||
orbs:
|
orbs:
|
||||||
node: circleci/node@4.9.0
|
node: circleci/node@5.1.0
|
||||||
browser-tools: circleci/browser-tools@1.3.0
|
browser-tools: circleci/browser-tools@1.3.0
|
||||||
jobs:
|
jobs:
|
||||||
npm-audit:
|
npm-audit:
|
||||||
@ -90,53 +99,95 @@ jobs:
|
|||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
browser:
|
|
||||||
type: string
|
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ "FirefoxESR", <<parameters.browser>> ]
|
|
||||||
steps:
|
|
||||||
- browser-tools/install-firefox:
|
|
||||||
version: "91.7.1esr" #https://archive.mozilla.org/pub/firefox/releases/
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ "FirefoxHeadless", <<parameters.browser>> ]
|
|
||||||
steps:
|
|
||||||
- browser-tools/install-firefox
|
|
||||||
- when:
|
|
||||||
condition:
|
|
||||||
equal: [ "ChromeHeadless", <<parameters.browser>> ]
|
|
||||||
steps:
|
|
||||||
- browser-tools/install-chrome:
|
- browser-tools/install-chrome:
|
||||||
replace-existing: false
|
replace-existing: false
|
||||||
- run: npm run test -- --browsers=<<parameters.browser>>
|
- run: npm run test
|
||||||
|
- run: npm run cov:unit:publish
|
||||||
- save_cache_cmd:
|
- save_cache_cmd:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: dist/reports/tests/
|
path: dist/reports/tests/
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: dist/reports/
|
path: coverage
|
||||||
|
- 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
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
e2e-test:
|
e2e-test:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
suite:
|
suite: #stable or full
|
||||||
type: string
|
type: string
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
parallelism: 4
|
parallelism: 4
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
|
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
||||||
|
condition:
|
||||||
|
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}
|
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
||||||
|
- 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:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
|
- store_artifacts:
|
||||||
|
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
|
||||||
|
e2e-couchdb:
|
||||||
|
parameters:
|
||||||
|
node-version:
|
||||||
|
type: string
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- build_and_install:
|
||||||
|
node-version: <<parameters.node-version>>
|
||||||
|
- run: npx playwright@1.36.2 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
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
perf-test:
|
perf-test:
|
||||||
parameters:
|
parameters:
|
||||||
@ -146,11 +197,41 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
- run: npm run test:perf
|
- run: npm run test:perf:memory
|
||||||
|
- run: npm run test:perf:localhost
|
||||||
|
- run: npm run test:perf:contract
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
|
- store_artifacts:
|
||||||
|
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
|
||||||
|
visual-test:
|
||||||
|
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:<<parameters.suite>>
|
||||||
|
- 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 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
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
workflows:
|
workflows:
|
||||||
overall-circleci-commit-status: #These jobs run on every commit
|
overall-circleci-commit-status: #These jobs run on every commit
|
||||||
@ -158,53 +239,45 @@ workflows:
|
|||||||
- lint:
|
- lint:
|
||||||
name: node16-lint
|
name: node16-lint
|
||||||
node-version: lts/gallium
|
node-version: lts/gallium
|
||||||
- unit-test:
|
|
||||||
name: node14-chrome
|
|
||||||
node-version: lts/fermium
|
|
||||||
browser: ChromeHeadless
|
|
||||||
post-steps:
|
|
||||||
- upload_code_covio
|
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
browser: ChromeHeadless
|
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-ci
|
name: e2e-stable
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
suite: ci
|
suite: stable
|
||||||
- perf-test:
|
- perf-test:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
|
- visual-test:
|
||||||
|
name: visual-test-ci
|
||||||
|
suite: ci
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
|
||||||
the-nightly: #These jobs do not run on PRs, but against master at night
|
the-nightly: #These jobs do not run on PRs, but against master at night
|
||||||
jobs:
|
jobs:
|
||||||
- unit-test:
|
|
||||||
name: node16-firefoxESR-nightly
|
|
||||||
node-version: lts/gallium
|
|
||||||
browser: FirefoxESR
|
|
||||||
- unit-test:
|
|
||||||
name: node14-firefox-nightly
|
|
||||||
node-version: lts/fermium
|
|
||||||
browser: FirefoxHeadless
|
|
||||||
- unit-test:
|
|
||||||
name: node14-chrome-nightly
|
|
||||||
node-version: lts/fermium
|
|
||||||
browser: ChromeHeadless
|
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node16-chrome-nightly
|
name: node16-chrome-nightly
|
||||||
node-version: lts/gallium
|
node-version: lts/gallium
|
||||||
browser: ChromeHeadless
|
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
browser: ChromeHeadless
|
|
||||||
- npm-audit:
|
- npm-audit:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-full-nightly
|
name: e2e-full-nightly
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
suite: full
|
suite: full
|
||||||
|
- perf-test:
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- visual-test:
|
||||||
|
name: visual-test-nightly
|
||||||
|
suite: full
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- e2e-couchdb:
|
||||||
|
node-version: lts/hydrogen
|
||||||
triggers:
|
triggers:
|
||||||
- schedule:
|
- schedule:
|
||||||
cron: "0 0 * * *"
|
cron: '0 0 * * *'
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
499
.cspell.json
Normal file
499
.cspell.json
Normal file
@ -0,0 +1,499 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2",
|
||||||
|
"language": "en,en-us",
|
||||||
|
"words": [
|
||||||
|
"gress",
|
||||||
|
"doctoc",
|
||||||
|
"minmax",
|
||||||
|
"openmct",
|
||||||
|
"datasources",
|
||||||
|
"recieved",
|
||||||
|
"evalute",
|
||||||
|
"Sinewave",
|
||||||
|
"deregistration",
|
||||||
|
"unregisters",
|
||||||
|
"configutation",
|
||||||
|
"configuation",
|
||||||
|
"codecov",
|
||||||
|
"carryforward",
|
||||||
|
"Chacon",
|
||||||
|
"Straub",
|
||||||
|
"OWASP",
|
||||||
|
"Testathon",
|
||||||
|
"exploratorily",
|
||||||
|
"Testathons",
|
||||||
|
"testathon",
|
||||||
|
"npmjs",
|
||||||
|
"publishj",
|
||||||
|
"treeitem",
|
||||||
|
"timespan",
|
||||||
|
"Timespan",
|
||||||
|
"spinbutton",
|
||||||
|
"popout",
|
||||||
|
"textbox",
|
||||||
|
"tablist",
|
||||||
|
"Telem",
|
||||||
|
"codecoverage",
|
||||||
|
"browserless",
|
||||||
|
"networkidle",
|
||||||
|
"nums",
|
||||||
|
"mgmt",
|
||||||
|
"faultname",
|
||||||
|
"gantt",
|
||||||
|
"sharded",
|
||||||
|
"perfromance",
|
||||||
|
"MMOC",
|
||||||
|
"deploysentinel",
|
||||||
|
"codegen",
|
||||||
|
"Unfortuantely",
|
||||||
|
"viewports",
|
||||||
|
"updatesnapshots",
|
||||||
|
"excercised",
|
||||||
|
"Circel",
|
||||||
|
"browsercontexts",
|
||||||
|
"miminum",
|
||||||
|
"testcase",
|
||||||
|
"testsuite",
|
||||||
|
"domcontentloaded",
|
||||||
|
"Tracefile",
|
||||||
|
"lcov",
|
||||||
|
"linecov",
|
||||||
|
"Browserless",
|
||||||
|
"webserver",
|
||||||
|
"yamcs",
|
||||||
|
"quickstart",
|
||||||
|
"subobject",
|
||||||
|
"autosize",
|
||||||
|
"Horz",
|
||||||
|
"vehicula",
|
||||||
|
"Praesent",
|
||||||
|
"pharetra",
|
||||||
|
"Duis",
|
||||||
|
"eget",
|
||||||
|
"arcu",
|
||||||
|
"elementum",
|
||||||
|
"mauris",
|
||||||
|
"Donec",
|
||||||
|
"nunc",
|
||||||
|
"quis",
|
||||||
|
"Proin",
|
||||||
|
"elit",
|
||||||
|
"Nunc",
|
||||||
|
"Aenean",
|
||||||
|
"mollis",
|
||||||
|
"hendrerit",
|
||||||
|
"Vestibulum",
|
||||||
|
"placerat",
|
||||||
|
"velit",
|
||||||
|
"augue",
|
||||||
|
"Quisque",
|
||||||
|
"mattis",
|
||||||
|
"lectus",
|
||||||
|
"rutrum",
|
||||||
|
"Fusce",
|
||||||
|
"tincidunt",
|
||||||
|
"nibh",
|
||||||
|
"blandit",
|
||||||
|
"urna",
|
||||||
|
"Nullam",
|
||||||
|
"congue",
|
||||||
|
"enim",
|
||||||
|
"Morbi",
|
||||||
|
"bibendum",
|
||||||
|
"Vivamus",
|
||||||
|
"imperdiet",
|
||||||
|
"Pellentesque",
|
||||||
|
"cursus",
|
||||||
|
"Aliquam",
|
||||||
|
"orci",
|
||||||
|
"Suspendisse",
|
||||||
|
"amet",
|
||||||
|
"justo",
|
||||||
|
"Etiam",
|
||||||
|
"vestibulum",
|
||||||
|
"ullamcorper",
|
||||||
|
"Cras",
|
||||||
|
"aliquet",
|
||||||
|
"Mauris",
|
||||||
|
"Nulla",
|
||||||
|
"scelerisque",
|
||||||
|
"viverra",
|
||||||
|
"metus",
|
||||||
|
"condimentum",
|
||||||
|
"varius",
|
||||||
|
"nulla",
|
||||||
|
"sapien",
|
||||||
|
"Curabitur",
|
||||||
|
"tristique",
|
||||||
|
"Nonsectetur",
|
||||||
|
"convallis",
|
||||||
|
"accumsan",
|
||||||
|
"lacus",
|
||||||
|
"posuere",
|
||||||
|
"turpis",
|
||||||
|
"egestas",
|
||||||
|
"feugiat",
|
||||||
|
"tortor",
|
||||||
|
"faucibus",
|
||||||
|
"euismod",
|
||||||
|
"pratices",
|
||||||
|
"pathing",
|
||||||
|
"pases",
|
||||||
|
"testcases",
|
||||||
|
"Noneditable",
|
||||||
|
"listitem",
|
||||||
|
"Gantt",
|
||||||
|
"timelist",
|
||||||
|
"timestrip",
|
||||||
|
"networkevents",
|
||||||
|
"fetchpriority",
|
||||||
|
"persistable",
|
||||||
|
"Persistable",
|
||||||
|
"persistability",
|
||||||
|
"Persistability",
|
||||||
|
"testdata",
|
||||||
|
"Testdata",
|
||||||
|
"metdata",
|
||||||
|
"timeconductor",
|
||||||
|
"contenteditable",
|
||||||
|
"autoscale",
|
||||||
|
"Autoscale",
|
||||||
|
"prepan",
|
||||||
|
"sinewave",
|
||||||
|
"cyanish",
|
||||||
|
"driv",
|
||||||
|
"searchbox",
|
||||||
|
"datetime",
|
||||||
|
"timeframe",
|
||||||
|
"recents",
|
||||||
|
"recentobjects",
|
||||||
|
"gsearch",
|
||||||
|
"Disp",
|
||||||
|
"Cloc",
|
||||||
|
"noselect",
|
||||||
|
"requestfailed",
|
||||||
|
"viewlarge",
|
||||||
|
"Imageurl",
|
||||||
|
"thumbstrip",
|
||||||
|
"checkmark",
|
||||||
|
"Unshelve",
|
||||||
|
"autosized",
|
||||||
|
"chacskaylo",
|
||||||
|
"numberfield",
|
||||||
|
"OPENMCT",
|
||||||
|
"Autoflow",
|
||||||
|
"Timelist",
|
||||||
|
"faultmanagement",
|
||||||
|
"GEOSPATIAL",
|
||||||
|
"geospatial",
|
||||||
|
"plotspatial",
|
||||||
|
"annnotation",
|
||||||
|
"keystrings",
|
||||||
|
"undelete",
|
||||||
|
"sometag",
|
||||||
|
"containee",
|
||||||
|
"composability",
|
||||||
|
"mutables",
|
||||||
|
"Mutables",
|
||||||
|
"composee",
|
||||||
|
"handleoutsideclick",
|
||||||
|
"Datetime",
|
||||||
|
"Perc",
|
||||||
|
"autodismiss",
|
||||||
|
"filetree",
|
||||||
|
"deeptailor",
|
||||||
|
"keystring",
|
||||||
|
"reindex",
|
||||||
|
"unlisten",
|
||||||
|
"symbolsfont",
|
||||||
|
"ellipsize",
|
||||||
|
"dismissable",
|
||||||
|
"TIMESYSTEM",
|
||||||
|
"Metadatas",
|
||||||
|
"stalenes",
|
||||||
|
"receieves",
|
||||||
|
"unsub",
|
||||||
|
"callbacktwo",
|
||||||
|
"unsubscribetwo",
|
||||||
|
"telem",
|
||||||
|
"Telemetery",
|
||||||
|
"unemitted",
|
||||||
|
"granually",
|
||||||
|
"timesystem",
|
||||||
|
"metadatas",
|
||||||
|
"iteratees",
|
||||||
|
"metadatum",
|
||||||
|
"printj",
|
||||||
|
"sprintf",
|
||||||
|
"unlisteners",
|
||||||
|
"amts",
|
||||||
|
"reregistered",
|
||||||
|
"hudsonfoo",
|
||||||
|
"onclone",
|
||||||
|
"autoflow",
|
||||||
|
"xdescribe",
|
||||||
|
"mockmct",
|
||||||
|
"Autoflowed",
|
||||||
|
"plotly",
|
||||||
|
"relayout",
|
||||||
|
"Plotly",
|
||||||
|
"Yaxis",
|
||||||
|
"showlegend",
|
||||||
|
"textposition",
|
||||||
|
"xaxis",
|
||||||
|
"automargin",
|
||||||
|
"fixedrange",
|
||||||
|
"yaxis",
|
||||||
|
"Axistype",
|
||||||
|
"showline",
|
||||||
|
"bglayer",
|
||||||
|
"autorange",
|
||||||
|
"hoverinfo",
|
||||||
|
"dotful",
|
||||||
|
"Dotful",
|
||||||
|
"cartesianlayer",
|
||||||
|
"scatterlayer",
|
||||||
|
"textfont",
|
||||||
|
"ampm",
|
||||||
|
"cdef",
|
||||||
|
"horz",
|
||||||
|
"STYLEABLE",
|
||||||
|
"styleable",
|
||||||
|
"afff",
|
||||||
|
"shdw",
|
||||||
|
"braintree",
|
||||||
|
"vals",
|
||||||
|
"Subobject",
|
||||||
|
"Shdw",
|
||||||
|
"Movebar",
|
||||||
|
"inspectable",
|
||||||
|
"Stringformatter",
|
||||||
|
"sclk",
|
||||||
|
"Objectpath",
|
||||||
|
"Keystring",
|
||||||
|
"duplicatable",
|
||||||
|
"composees",
|
||||||
|
"Composees",
|
||||||
|
"Composee",
|
||||||
|
"callthrough",
|
||||||
|
"objectpath",
|
||||||
|
"createable",
|
||||||
|
"noneditable",
|
||||||
|
"Classname",
|
||||||
|
"classname",
|
||||||
|
"selectedfaults",
|
||||||
|
"accum",
|
||||||
|
"newpersisted",
|
||||||
|
"Metadatum",
|
||||||
|
"MCWS",
|
||||||
|
"YAMCS",
|
||||||
|
"frameid",
|
||||||
|
"containerid",
|
||||||
|
"mmgis",
|
||||||
|
"PERC",
|
||||||
|
"curval",
|
||||||
|
"viewbox",
|
||||||
|
"mutablegauge",
|
||||||
|
"Flatbush",
|
||||||
|
"flatbush",
|
||||||
|
"Indicies",
|
||||||
|
"Marqueed",
|
||||||
|
"NSEW",
|
||||||
|
"nsew",
|
||||||
|
"vrover",
|
||||||
|
"gimbled",
|
||||||
|
"Pannable",
|
||||||
|
"unsynced",
|
||||||
|
"Unsynced",
|
||||||
|
"pannable",
|
||||||
|
"autoscroll",
|
||||||
|
"TIMESTRIP",
|
||||||
|
"TWENTYFOUR",
|
||||||
|
"FULLSIZE",
|
||||||
|
"intialize",
|
||||||
|
"Timestrip",
|
||||||
|
"spyon",
|
||||||
|
"Unlistener",
|
||||||
|
"multipane",
|
||||||
|
"DATESTRING",
|
||||||
|
"akhenry",
|
||||||
|
"Niklas",
|
||||||
|
"Hertzen",
|
||||||
|
"Kash",
|
||||||
|
"Nouroozi",
|
||||||
|
"Bostock",
|
||||||
|
"BOSTOCK",
|
||||||
|
"Arnout",
|
||||||
|
"Kazemier",
|
||||||
|
"Karolis",
|
||||||
|
"Narkevicius",
|
||||||
|
"Ashkenas",
|
||||||
|
"Madhavan",
|
||||||
|
"Iskren",
|
||||||
|
"Ivov",
|
||||||
|
"Chernev",
|
||||||
|
"Borshchov",
|
||||||
|
"painterro",
|
||||||
|
"sheetjs",
|
||||||
|
"Yuxi",
|
||||||
|
"ACITON",
|
||||||
|
"localstorage",
|
||||||
|
"Linkto",
|
||||||
|
"Painterro",
|
||||||
|
"Editability",
|
||||||
|
"filteredsnapshots",
|
||||||
|
"Fromimage",
|
||||||
|
"muliple",
|
||||||
|
"notebookstorage",
|
||||||
|
"Andpage",
|
||||||
|
"pixelize",
|
||||||
|
"Quickstart",
|
||||||
|
"indexhtml",
|
||||||
|
"youradminpassword",
|
||||||
|
"chttpd",
|
||||||
|
"sourcefiles",
|
||||||
|
"USERPASS",
|
||||||
|
"XPUT",
|
||||||
|
"adipiscing",
|
||||||
|
"eiusmod",
|
||||||
|
"tempor",
|
||||||
|
"incididunt",
|
||||||
|
"labore",
|
||||||
|
"dolore",
|
||||||
|
"aliqua",
|
||||||
|
"perspiciatis",
|
||||||
|
"iteree",
|
||||||
|
"submodels",
|
||||||
|
"symlog",
|
||||||
|
"Plottable",
|
||||||
|
"antisymlog",
|
||||||
|
"docstrings",
|
||||||
|
"webglcontextlost",
|
||||||
|
"gridlines",
|
||||||
|
"Xaxis",
|
||||||
|
"Crosshairs",
|
||||||
|
"telemetrylimit",
|
||||||
|
"xscale",
|
||||||
|
"yscale",
|
||||||
|
"untracks",
|
||||||
|
"swatched",
|
||||||
|
"NULLVALUE",
|
||||||
|
"unobserver",
|
||||||
|
"unsubscriber",
|
||||||
|
"drap",
|
||||||
|
"Averager",
|
||||||
|
"averager",
|
||||||
|
"movecolumnfromindex",
|
||||||
|
"callout",
|
||||||
|
"Konqueror",
|
||||||
|
"unmark",
|
||||||
|
"hitarea",
|
||||||
|
"Hitarea",
|
||||||
|
"Unmark",
|
||||||
|
"controlbar",
|
||||||
|
"reactified",
|
||||||
|
"perc",
|
||||||
|
"DHMS",
|
||||||
|
"timespans",
|
||||||
|
"timeframes",
|
||||||
|
"Timesystems",
|
||||||
|
"Hilite",
|
||||||
|
"datetimes",
|
||||||
|
"momentified",
|
||||||
|
"ucontents",
|
||||||
|
"TIMELIST",
|
||||||
|
"Timeframe",
|
||||||
|
"Guirk",
|
||||||
|
"resizeable",
|
||||||
|
"iframing",
|
||||||
|
"Btns",
|
||||||
|
"Ctrls",
|
||||||
|
"Chakra",
|
||||||
|
"Petch",
|
||||||
|
"propor",
|
||||||
|
"phoneandtablet",
|
||||||
|
"desktopandtablet",
|
||||||
|
"Imgs",
|
||||||
|
"UNICODES",
|
||||||
|
"datatable",
|
||||||
|
"csvg",
|
||||||
|
"cpath",
|
||||||
|
"cellipse",
|
||||||
|
"xlink",
|
||||||
|
"cstyle",
|
||||||
|
"bfill",
|
||||||
|
"ctitle",
|
||||||
|
"eicon",
|
||||||
|
"interactability",
|
||||||
|
"AFFORDANCES",
|
||||||
|
"affordance",
|
||||||
|
"scrollcontainer",
|
||||||
|
"Icomoon",
|
||||||
|
"icomoon",
|
||||||
|
"configurability",
|
||||||
|
"btns",
|
||||||
|
"AUTOFLOW",
|
||||||
|
"DATETIME",
|
||||||
|
"infobubble",
|
||||||
|
"thumbsbubble",
|
||||||
|
"codehilite",
|
||||||
|
"vscroll",
|
||||||
|
"bgsize",
|
||||||
|
"togglebutton",
|
||||||
|
"Hacskaylo",
|
||||||
|
"noie",
|
||||||
|
"fullscreen",
|
||||||
|
"horiz",
|
||||||
|
"menubutton",
|
||||||
|
"SNAPSHOTTING",
|
||||||
|
"snapshotting",
|
||||||
|
"PAINTERRO",
|
||||||
|
"ptro",
|
||||||
|
"PLOTLY",
|
||||||
|
"gridlayer",
|
||||||
|
"xtick",
|
||||||
|
"ytick",
|
||||||
|
"subobjects",
|
||||||
|
"Ucontents",
|
||||||
|
"Userand",
|
||||||
|
"Userbefore",
|
||||||
|
"brdr",
|
||||||
|
"pushs",
|
||||||
|
"ALPH",
|
||||||
|
"Recents",
|
||||||
|
"Qbert",
|
||||||
|
"Infobubble",
|
||||||
|
"haslink",
|
||||||
|
"VPID",
|
||||||
|
"vpid",
|
||||||
|
"updatedtest",
|
||||||
|
"KHTML",
|
||||||
|
"Chromezilla",
|
||||||
|
"Safarifox",
|
||||||
|
"deregistering",
|
||||||
|
"hundredtized",
|
||||||
|
"dhms",
|
||||||
|
"unthrottled",
|
||||||
|
"Codecov",
|
||||||
|
"dont",
|
||||||
|
"mediump",
|
||||||
|
"sinonjs",
|
||||||
|
"generatedata",
|
||||||
|
"grandsearch",
|
||||||
|
"websockets",
|
||||||
|
"swgs",
|
||||||
|
"memlab",
|
||||||
|
"devmode"
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
323
.eslintrc.js
323
.eslintrc.js
@ -1,270 +1,183 @@
|
|||||||
const LEGACY_FILES = ["example/**"];
|
const LEGACY_FILES = ['example/**'];
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"env": {
|
env: {
|
||||||
"browser": true,
|
browser: true,
|
||||||
"es6": true,
|
es6: true,
|
||||||
"jasmine": true,
|
jasmine: true,
|
||||||
"amd": true
|
amd: true
|
||||||
},
|
},
|
||||||
"globals": {
|
globals: {
|
||||||
"_": "readonly"
|
_: 'readonly'
|
||||||
},
|
},
|
||||||
"extends": [
|
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
|
||||||
"eslint:recommended",
|
extends: [
|
||||||
"plugin:compat/recommended",
|
'eslint:recommended',
|
||||||
"plugin:vue/recommended",
|
'plugin:compat/recommended',
|
||||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
'plugin:vue/vue3-recommended',
|
||||||
|
'plugin:you-dont-need-lodash-underscore/compatible',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'plugin:no-unsanitized/DOM'
|
||||||
],
|
],
|
||||||
"parser": "vue-eslint-parser",
|
parser: 'vue-eslint-parser',
|
||||||
"parserOptions": {
|
parserOptions: {
|
||||||
"parser": "@babel/eslint-parser",
|
parser: '@babel/eslint-parser',
|
||||||
"requireConfigFile": false,
|
requireConfigFile: false,
|
||||||
"allowImportExportEverywhere": true,
|
allowImportExportEverywhere: true,
|
||||||
"ecmaVersion": 2015,
|
ecmaVersion: 2015,
|
||||||
"ecmaFeatures": {
|
ecmaFeatures: {
|
||||||
"impliedStrict": true
|
impliedStrict: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
"you-dont-need-lodash-underscore/omit": "off",
|
'simple-import-sort/imports': 'warn',
|
||||||
"you-dont-need-lodash-underscore/throttle": "off",
|
'simple-import-sort/exports': 'warn',
|
||||||
"you-dont-need-lodash-underscore/flatten": "off",
|
'vue/no-deprecated-dollar-listeners-api': 'warn',
|
||||||
"you-dont-need-lodash-underscore/get": "off",
|
'vue/no-deprecated-events-api': 'warn',
|
||||||
"no-bitwise": "error",
|
'vue/no-v-for-template-key': 'off',
|
||||||
"curly": "error",
|
'vue/no-v-for-template-key-on-child': 'error',
|
||||||
"eqeqeq": "error",
|
'prettier/prettier': 'error',
|
||||||
"guard-for-in": "error",
|
'you-dont-need-lodash-underscore/omit': 'off',
|
||||||
"no-extend-native": "error",
|
'you-dont-need-lodash-underscore/throttle': 'off',
|
||||||
"no-inner-declarations": "off",
|
'you-dont-need-lodash-underscore/flatten': 'off',
|
||||||
"no-use-before-define": ["error", "nofunc"],
|
'you-dont-need-lodash-underscore/get': 'off',
|
||||||
"no-caller": "error",
|
'no-bitwise': 'error',
|
||||||
"no-irregular-whitespace": "error",
|
curly: 'error',
|
||||||
"no-new": "error",
|
eqeqeq: 'error',
|
||||||
"no-shadow": "error",
|
'guard-for-in': 'error',
|
||||||
"no-undef": "error",
|
'no-extend-native': 'error',
|
||||||
"no-unused-vars": [
|
'no-inner-declarations': 'off',
|
||||||
"error",
|
'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",
|
vars: 'all',
|
||||||
"args": "none"
|
args: 'none'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-console": "off",
|
'no-console': 'off',
|
||||||
"no-trailing-spaces": "error",
|
'new-cap': [
|
||||||
"space-before-function-paren": [
|
'error',
|
||||||
"error",
|
|
||||||
{
|
{
|
||||||
"anonymous": "always",
|
capIsNew: false,
|
||||||
"asyncArrow": "always",
|
properties: false
|
||||||
"named": "never"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"array-bracket-spacing": "error",
|
'dot-notation': 'error',
|
||||||
"space-in-parens": "error",
|
|
||||||
"space-before-blocks": "error",
|
|
||||||
"comma-dangle": "error",
|
|
||||||
"eol-last": "error",
|
|
||||||
"new-cap": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"capIsNew": false,
|
|
||||||
"properties": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dot-notation": "error",
|
|
||||||
"indent": ["error", 4],
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-case-declarations
|
// https://eslint.org/docs/rules/no-case-declarations
|
||||||
"no-case-declarations": "error",
|
'no-case-declarations': 'error',
|
||||||
// https://eslint.org/docs/rules/max-classes-per-file
|
// https://eslint.org/docs/rules/max-classes-per-file
|
||||||
"max-classes-per-file": ["error", 1],
|
'max-classes-per-file': ['error', 1],
|
||||||
// https://eslint.org/docs/rules/no-eq-null
|
// https://eslint.org/docs/rules/no-eq-null
|
||||||
"no-eq-null": "error",
|
'no-eq-null': 'error',
|
||||||
// https://eslint.org/docs/rules/no-eval
|
// https://eslint.org/docs/rules/no-eval
|
||||||
"no-eval": "error",
|
'no-eval': 'error',
|
||||||
// https://eslint.org/docs/rules/no-floating-decimal
|
|
||||||
"no-floating-decimal": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-globals
|
// https://eslint.org/docs/rules/no-implicit-globals
|
||||||
"no-implicit-globals": "error",
|
'no-implicit-globals': 'error',
|
||||||
// https://eslint.org/docs/rules/no-implied-eval
|
// https://eslint.org/docs/rules/no-implied-eval
|
||||||
"no-implied-eval": "error",
|
'no-implied-eval': 'error',
|
||||||
// https://eslint.org/docs/rules/no-lone-blocks
|
// https://eslint.org/docs/rules/no-lone-blocks
|
||||||
"no-lone-blocks": "error",
|
'no-lone-blocks': 'error',
|
||||||
// https://eslint.org/docs/rules/no-loop-func
|
// https://eslint.org/docs/rules/no-loop-func
|
||||||
"no-loop-func": "error",
|
'no-loop-func': 'error',
|
||||||
// https://eslint.org/docs/rules/no-new-func
|
// https://eslint.org/docs/rules/no-new-func
|
||||||
"no-new-func": "error",
|
'no-new-func': 'error',
|
||||||
// https://eslint.org/docs/rules/no-new-wrappers
|
// https://eslint.org/docs/rules/no-new-wrappers
|
||||||
"no-new-wrappers": "error",
|
'no-new-wrappers': 'error',
|
||||||
// https://eslint.org/docs/rules/no-octal-escape
|
// https://eslint.org/docs/rules/no-octal-escape
|
||||||
"no-octal-escape": "error",
|
'no-octal-escape': 'error',
|
||||||
// https://eslint.org/docs/rules/no-proto
|
// https://eslint.org/docs/rules/no-proto
|
||||||
"no-proto": "error",
|
'no-proto': 'error',
|
||||||
// https://eslint.org/docs/rules/no-return-await
|
// https://eslint.org/docs/rules/no-return-await
|
||||||
"no-return-await": "error",
|
'no-return-await': 'error',
|
||||||
// https://eslint.org/docs/rules/no-script-url
|
// https://eslint.org/docs/rules/no-script-url
|
||||||
"no-script-url": "error",
|
'no-script-url': 'error',
|
||||||
// https://eslint.org/docs/rules/no-self-compare
|
// https://eslint.org/docs/rules/no-self-compare
|
||||||
"no-self-compare": "error",
|
'no-self-compare': 'error',
|
||||||
// https://eslint.org/docs/rules/no-sequences
|
// https://eslint.org/docs/rules/no-sequences
|
||||||
"no-sequences": "error",
|
'no-sequences': 'error',
|
||||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||||
"no-unmodified-loop-condition": "error",
|
'no-unmodified-loop-condition': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-call
|
// https://eslint.org/docs/rules/no-useless-call
|
||||||
"no-useless-call": "error",
|
'no-useless-call': 'error',
|
||||||
// https://eslint.org/docs/rules/wrap-iife
|
|
||||||
"wrap-iife": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-nested-ternary
|
// https://eslint.org/docs/rules/no-nested-ternary
|
||||||
"no-nested-ternary": "error",
|
'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
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||||
"no-useless-computed-key": "error",
|
'no-useless-computed-key': 'error',
|
||||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
|
||||||
"rest-spread-spacing": ["error"],
|
|
||||||
// https://eslint.org/docs/rules/no-var
|
// https://eslint.org/docs/rules/no-var
|
||||||
"no-var": "error",
|
'no-var': 'error',
|
||||||
// https://eslint.org/docs/rules/one-var
|
// https://eslint.org/docs/rules/one-var
|
||||||
"one-var": ["error", "never"],
|
'one-var': ['error', 'never'],
|
||||||
// https://eslint.org/docs/rules/default-case-last
|
// https://eslint.org/docs/rules/default-case-last
|
||||||
"default-case-last": "error",
|
'default-case-last': 'error',
|
||||||
// https://eslint.org/docs/rules/default-param-last
|
// https://eslint.org/docs/rules/default-param-last
|
||||||
"default-param-last": "error",
|
'default-param-last': 'error',
|
||||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||||
"grouped-accessor-pairs": "error",
|
'grouped-accessor-pairs': 'error',
|
||||||
// https://eslint.org/docs/rules/no-constructor-return
|
// https://eslint.org/docs/rules/no-constructor-return
|
||||||
"no-constructor-return": "error",
|
'no-constructor-return': 'error',
|
||||||
// https://eslint.org/docs/rules/array-callback-return
|
// https://eslint.org/docs/rules/array-callback-return
|
||||||
"array-callback-return": "error",
|
'array-callback-return': 'error',
|
||||||
// https://eslint.org/docs/rules/no-invalid-this
|
// https://eslint.org/docs/rules/no-invalid-this
|
||||||
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
|
'no-invalid-this': 'error', // Believe this one actually surfaces some bugs
|
||||||
// https://eslint.org/docs/rules/func-style
|
// https://eslint.org/docs/rules/func-style
|
||||||
"func-style": ["error", "declaration"],
|
'func-style': ['error', 'declaration'],
|
||||||
// https://eslint.org/docs/rules/no-unused-expressions
|
// https://eslint.org/docs/rules/no-unused-expressions
|
||||||
"no-unused-expressions": "error",
|
'no-unused-expressions': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-concat
|
// https://eslint.org/docs/rules/no-useless-concat
|
||||||
"no-useless-concat": "error",
|
'no-useless-concat': 'error',
|
||||||
// https://eslint.org/docs/rules/radix
|
// https://eslint.org/docs/rules/radix
|
||||||
"radix": "error",
|
radix: 'error',
|
||||||
// https://eslint.org/docs/rules/require-await
|
// https://eslint.org/docs/rules/require-await
|
||||||
"require-await": "error",
|
'require-await': 'error',
|
||||||
// https://eslint.org/docs/rules/no-alert
|
// https://eslint.org/docs/rules/no-alert
|
||||||
"no-alert": "error",
|
'no-alert': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-constructor
|
// https://eslint.org/docs/rules/no-useless-constructor
|
||||||
"no-useless-constructor": "error",
|
'no-useless-constructor': 'error',
|
||||||
// https://eslint.org/docs/rules/no-duplicate-imports
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
||||||
"no-duplicate-imports": "error",
|
'no-duplicate-imports': 'error',
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-coercion
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
||||||
"no-implicit-coercion": "error",
|
'no-implicit-coercion': 'error',
|
||||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||||
"no-unneeded-ternary": "error",
|
'no-unneeded-ternary': 'error',
|
||||||
// https://eslint.org/docs/rules/semi
|
"unicorn/filename-case": [
|
||||||
"semi": ["error", "always"],
|
|
||||||
// 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",
|
"error",
|
||||||
4,
|
|
||||||
{
|
{
|
||||||
"attribute": 1,
|
"cases": {
|
||||||
"baseIndent": 0,
|
"pascalCase": true
|
||||||
"closeBracket": 0,
|
|
||||||
"alignAttributesVertically": true,
|
|
||||||
"ignores": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/html-self-closing": ["error",
|
|
||||||
{
|
|
||||||
"html": {
|
|
||||||
"void": "never",
|
|
||||||
"normal": "never",
|
|
||||||
"component": "always"
|
|
||||||
},
|
},
|
||||||
"svg": "always",
|
"ignore": [
|
||||||
"math": "always"
|
"^.*\\.js$"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"vue/max-attributes-per-line": ["error", {
|
'vue/first-attribute-linebreak': 'error',
|
||||||
"singleline": 1,
|
'vue/multiline-html-element-content-newline': 'off',
|
||||||
"multiline": 1,
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
}],
|
'vue/multi-word-component-names': 'off', // TODO enable, align with conventions
|
||||||
"vue/first-attribute-linebreak": "error",
|
'vue/no-mutating-props': 'off'
|
||||||
"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": [
|
overrides: [
|
||||||
{
|
{
|
||||||
"files": LEGACY_FILES,
|
files: LEGACY_FILES,
|
||||||
"rules": {
|
rules: {
|
||||||
"no-unused-vars": [
|
'no-unused-vars': [
|
||||||
"warn",
|
'warn',
|
||||||
{
|
{
|
||||||
"vars": "all",
|
vars: 'all',
|
||||||
"args": "none",
|
args: 'none',
|
||||||
"varsIgnorePattern": "controller"
|
varsIgnorePattern: 'controller'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-nested-ternary": "off",
|
'no-nested-ternary': 'off',
|
||||||
"no-var": "off",
|
'no-var': 'off',
|
||||||
"one-var": "off"
|
'one-var': 'off'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
12
.git-blame-ignore-revs
Normal file
12
.git-blame-ignore-revs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# git-blame ignored revisions
|
||||||
|
# To configure, run:
|
||||||
|
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
|
# Requires Git > 2.23
|
||||||
|
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
|
||||||
|
|
||||||
|
# Copyright year update 2022
|
||||||
|
4a9744e916d24122a81092f6b7950054048ba860
|
||||||
|
# Copyright year update 2023
|
||||||
|
8040b275fcf2ba71b42cd72d4daa64bb25c19c2d
|
||||||
|
# Apply `prettier` formatting
|
||||||
|
caa7bc6faebc204f67aedae3e35fb0d0d3ce27a7
|
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -13,7 +13,7 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
|||||||
### Author Checklist
|
### Author Checklist
|
||||||
|
|
||||||
* [ ] Changes address original issue?
|
* [ ] Changes address original issue?
|
||||||
* [ ] Unit tests included and/or updated with changes?
|
* [ ] Tests included and/or updated with changes?
|
||||||
* [ ] Command line build passes?
|
* [ ] Command line build passes?
|
||||||
* [ ] Has this been smoke tested?
|
* [ ] Has this been smoke tested?
|
||||||
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
||||||
@ -21,9 +21,9 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
|||||||
### Reviewer Checklist
|
### Reviewer Checklist
|
||||||
|
|
||||||
* [ ] Changes appear to address issue?
|
* [ ] Changes appear to address issue?
|
||||||
|
* [ ] Reviewer has tested changes by following the provided instructions?
|
||||||
* [ ] Changes appear not to be breaking changes?
|
* [ ] Changes appear not to be breaking changes?
|
||||||
* [ ] Appropriate unit tests included?
|
* [ ] Appropriate automated tests included?
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
* [ ] 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 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)
|
* [ ] Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)
|
||||||
|
1
.github/codeql/codeql-config.yml
vendored
Normal file
1
.github/codeql/codeql-config.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
name: 'Custom CodeQL config'
|
48
.github/dependabot.yml
vendored
48
.github/dependabot.yml
vendored
@ -1,24 +1,38 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: 'npm'
|
||||||
directory: "/"
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'weekly'
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
labels:
|
labels:
|
||||||
- "type:maintenance"
|
- 'pr:daveit'
|
||||||
- "dependencies"
|
- 'pr:e2e'
|
||||||
- "pr:e2e"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
- "pr:visual"
|
- 'pr:platform'
|
||||||
- "pr:platform"
|
ignore:
|
||||||
|
#We have to source the playwright container which is not detected by Dependabot
|
||||||
- package-ecosystem: "github-actions"
|
- dependency-name: '@playwright/test'
|
||||||
directory: "/"
|
- 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']
|
||||||
|
- dependency-name: 'moment-timezone'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: '@types/lodash'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- package-ecosystem: 'github-actions'
|
||||||
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'daily'
|
||||||
labels:
|
labels:
|
||||||
- "type:maintenance"
|
- 'pr:daveit'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
|
23
.github/release.yml
vendored
Normal file
23
.github/release.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
changelog:
|
||||||
|
categories:
|
||||||
|
- title: 🏕 Features
|
||||||
|
labels:
|
||||||
|
- type:feature
|
||||||
|
- title: 🎉 Enhancements
|
||||||
|
labels:
|
||||||
|
- type:enhancement
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- type:feature
|
||||||
|
- title: 🔧 Maintenance
|
||||||
|
labels:
|
||||||
|
- type:maintenance
|
||||||
|
- title: ⚡ Performance
|
||||||
|
labels:
|
||||||
|
- performance
|
||||||
|
- title: 👒 Dependencies
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
- title: 🐛 Bug Fixes
|
||||||
|
labels:
|
||||||
|
- '*'
|
9
.github/workflows/codeql-analysis.yml
vendored
9
.github/workflows/codeql-analysis.yml
vendored
@ -1,11 +1,10 @@
|
|||||||
|
name: 'CodeQL'
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master, 'release/*']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [master, 'release/*']
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**/*Spec.js'
|
- '**/*Spec.js'
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
@ -34,7 +33,9 @@ jobs:
|
|||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
with:
|
with:
|
||||||
|
config-file: ./.github/codeql/codeql-config.yml
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
queries: security-and-quality
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
89
.github/workflows/e2e-couchdb.yml
vendored
Normal file
89
.github/workflows/e2e-couchdb.yml
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
name: 'e2e-couchdb'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
jobs:
|
||||||
|
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
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
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.36.2 install
|
||||||
|
|
||||||
|
- name: Start CouchDB Docker Container and Init with Setup Scripts
|
||||||
|
run: |
|
||||||
|
export $(cat src/plugins/persistence/couch/.env.ci | xargs)
|
||||||
|
docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
||||||
|
sleep 3
|
||||||
|
bash src/plugins/persistence/couch/setup-couchdb.sh
|
||||||
|
bash src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
||||||
|
|
||||||
|
- name: Run CouchDB Tests and publish to deploysentinel
|
||||||
|
env:
|
||||||
|
DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }}
|
||||||
|
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha }}
|
||||||
|
run: npm run test:e2e:couchdb
|
||||||
|
|
||||||
|
- name: Publish Results to Codecov.io
|
||||||
|
env:
|
||||||
|
SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: npm run cov:e2e:full:publish
|
||||||
|
|
||||||
|
- name: Archive test results
|
||||||
|
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}`);
|
||||||
|
}
|
79
.github/workflows/e2e-pr.yml
vendored
79
.github/workflows/e2e-pr.yml
vendored
@ -1,61 +1,68 @@
|
|||||||
name: "e2e-pr"
|
name: 'e2e-pr'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
e2e-full:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger Success
|
|
||||||
uses: actions/github-script@v6
|
|
||||||
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/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: 'lts/hydrogen'
|
||||||
- run: npx playwright@1.21.1 install
|
|
||||||
- run: npm install
|
- name: Cache NPM dependencies
|
||||||
- run: npm run test:e2e:full
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npx playwright@1.36.2 install
|
||||||
|
- run: npx playwright install chrome-beta
|
||||||
|
- 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
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: test-results
|
path: test-results
|
||||||
- name: Test success
|
|
||||||
if: ${{ success() }}
|
- name: Remove pr:e2e label (if present)
|
||||||
|
if: always()
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
github.rest.issues.createComment({
|
const { owner, repo, number } = context.issue;
|
||||||
issue_number: context.issue.number,
|
const labelToRemove = 'pr:e2e';
|
||||||
owner: "nasa",
|
try {
|
||||||
repo: "openmct",
|
await github.rest.issues.removeLabel({
|
||||||
body: 'Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
owner,
|
||||||
})
|
repo,
|
||||||
- name: Test failure
|
issue_number: number,
|
||||||
if: ${{ failure() }}
|
name: labelToRemove
|
||||||
uses: actions/github-script@v6
|
});
|
||||||
with:
|
} catch (error) {
|
||||||
script: |
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
github.rest.issues.createComment({
|
}
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: "nasa",
|
|
||||||
repo: "openmct",
|
|
||||||
body: 'Failure ❌ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
|
||||||
})
|
|
25
.github/workflows/e2e-visual.yml
vendored
25
.github/workflows/e2e-visual.yml
vendored
@ -1,25 +0,0 @@
|
|||||||
name: "e2e-visual"
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- labeled
|
|
||||||
- opened
|
|
||||||
schedule:
|
|
||||||
- cron: '28 21 * * 1-5'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
e2e-visual:
|
|
||||||
if: ${{ github.event.label.name == 'pr:visual' }} || ${{ github.event.workflow_dispatch }} || ${{ github.event.schedule }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- run: npx playwright@1.21.1 install
|
|
||||||
- run: npm install
|
|
||||||
- name: Run the e2e visual tests
|
|
||||||
run: npm run test:e2e:visual
|
|
||||||
env:
|
|
||||||
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
|
|
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
|
|
98
.github/workflows/lighthouse.yml
vendored
98
.github/workflows/lighthouse.yml
vendored
@ -1,98 +0,0 @@
|
|||||||
name: lighthouse
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'Which branch do you want to test?' # Limited to branch for now
|
|
||||||
required: false
|
|
||||||
default: 'master'
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- labeled
|
|
||||||
jobs:
|
|
||||||
lighthouse-pr:
|
|
||||||
if: ${{ github.event.label.name == 'pr:lighthouse' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Master for Baseline
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: master #explicitly checkout master for baseline
|
|
||||||
- name: Install Node 16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci against master to generate baseline and ignore exit codes
|
|
||||||
run: lhci autorun || true
|
|
||||||
- name: Perform clean checkout of PR
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
clean: true
|
|
||||||
- name: Install Node version which is compatible with PR
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci with PR
|
|
||||||
run: lhci autorun
|
|
||||||
env:
|
|
||||||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
||||||
lighthouse-nightly:
|
|
||||||
if: ${{ github.event.schedule }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Install Node 16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci against master to generate baseline
|
|
||||||
run: lhci autorun
|
|
||||||
env:
|
|
||||||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
||||||
lighthouse-dispatch:
|
|
||||||
if: ${{ github.event.workflow_dispatch }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.version }}
|
|
||||||
- name: Install Node 14
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci against master to generate baseline
|
|
||||||
run: lhci autorun
|
|
||||||
|
|
12
.github/workflows/npm-prerelease.yml
vendored
12
.github/workflows/npm-prerelease.yml
vendored
@ -14,9 +14,13 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: lts/hydrogen
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: |
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
||||||
|
npm whoami
|
||||||
|
npm publish --access=public --tag unstable openmct
|
||||||
|
# - run: npm test
|
||||||
|
|
||||||
publish-npm-prerelease:
|
publish-npm-prerelease:
|
||||||
needs: build
|
needs: build
|
||||||
@ -25,9 +29,9 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: lts/hydrogen
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm publish --access public --tag unstable
|
- run: npm publish --access=public --tag unstable
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
54
.github/workflows/pr-platform.yml
vendored
54
.github/workflows/pr-platform.yml
vendored
@ -1,13 +1,19 @@
|
|||||||
name: "pr-platform"
|
name: 'pr-platform'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ labeled ]
|
types:
|
||||||
|
- labeled
|
||||||
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
pr-platform:
|
||||||
if: ${{ github.event.label.name == 'pr:platform' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:platform') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -16,19 +22,49 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
node_version:
|
node_version:
|
||||||
- 14
|
- lts/gallium
|
||||||
- 16
|
- lts/hydrogen
|
||||||
- 18
|
|
||||||
architecture:
|
architecture:
|
||||||
- x64
|
- x64
|
||||||
|
|
||||||
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
- run: npm install
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ matrix.node_version }}-
|
||||||
|
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
- run: npm run lint -- --quiet
|
- run: npm run lint -- --quiet
|
||||||
|
|
||||||
|
- name: Remove pr:platform label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:platform';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
||||||
|
2
.github/workflows/prcop-config.json
vendored
2
.github/workflows/prcop-config.json
vendored
@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"name": "descriptionRegexp",
|
"name": "descriptionRegexp",
|
||||||
"config": {
|
"config": {
|
||||||
"regexp": "x] Testing instructions",
|
"regexp": "[x|X]] Testing instructions",
|
||||||
"errorMessage": ":police_officer: PR Description does not confirm that associated issue(s) contain Testing instructions"
|
"errorMessage": ":police_officer: PR Description does not confirm that associated issue(s) contain Testing instructions"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
2
.github/workflows/prcop.yml
vendored
2
.github/workflows/prcop.yml
vendored
@ -22,5 +22,5 @@ jobs:
|
|||||||
- name: Linting Pull Request
|
- name: Linting Pull Request
|
||||||
uses: makaroni4/prcop@v1.0.35
|
uses: makaroni4/prcop@v1.0.35
|
||||||
with:
|
with:
|
||||||
config-file: ".github/workflows/prcop-config.json"
|
config-file: '.github/workflows/prcop-config.json'
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
22
.gitignore
vendored
22
.gitignore
vendored
@ -15,8 +15,6 @@
|
|||||||
*.idea
|
*.idea
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
# External dependencies
|
|
||||||
|
|
||||||
# Build output
|
# Build output
|
||||||
target
|
target
|
||||||
dist
|
dist
|
||||||
@ -24,30 +22,28 @@ dist
|
|||||||
# Mac OS X Finder
|
# Mac OS X Finder
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
# Closed source libraries
|
|
||||||
closed-lib
|
|
||||||
|
|
||||||
# Node, Bower dependencies
|
# Node, Bower dependencies
|
||||||
node_modules
|
node_modules
|
||||||
bower_components
|
bower_components
|
||||||
|
|
||||||
# Protractor logs
|
|
||||||
protractor/logs
|
|
||||||
|
|
||||||
# npm-debug log
|
# npm-debug log
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
||||||
# karma reports
|
# karma reports
|
||||||
report.*.json
|
report.*.json
|
||||||
|
|
||||||
# Lighthouse reports
|
|
||||||
.lighthouseci
|
|
||||||
|
|
||||||
# e2e test artifacts
|
# e2e test artifacts
|
||||||
test-results
|
test-results
|
||||||
allure-results
|
html-test-results
|
||||||
|
|
||||||
package-lock.json
|
# couchdb scripting artifacts
|
||||||
|
src/plugins/persistence/couch/.env.local
|
||||||
|
index.html.bak
|
||||||
|
|
||||||
# codecov artifacts
|
# codecov artifacts
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
codecov
|
codecov
|
||||||
|
|
||||||
|
# :(
|
||||||
|
package-lock.json
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
# https://github.com/nasa/openmct/issues/4992
|
# https://github.com/nasa/openmct/issues/4992
|
||||||
!/example/**/*
|
!/example/**/*
|
||||||
|
|
||||||
# We will remove this in https://github.com/nasa/openmct/issues/4922
|
|
||||||
!/app.js
|
|
||||||
|
|
||||||
# ...except for these files in the above folders.
|
# ...except for these files in the above folders.
|
||||||
/src/**/*Spec.js
|
/src/**/*Spec.js
|
||||||
/src/**/test/
|
/src/**/test/
|
||||||
@ -25,3 +22,9 @@
|
|||||||
!index.html
|
!index.html
|
||||||
!openmct.js
|
!openmct.js
|
||||||
!SECURITY.md
|
!SECURITY.md
|
||||||
|
|
||||||
|
# Add e2e tests to npm package
|
||||||
|
!/e2e/**/*
|
||||||
|
|
||||||
|
# ... except our test-data folder files.
|
||||||
|
/e2e/test-data/*.json
|
||||||
|
3
.npmrc
3
.npmrc
@ -2,3 +2,6 @@ loglevel=warn
|
|||||||
|
|
||||||
#Prevent folks from ignoring an important error when building from source
|
#Prevent folks from ignoring an important error when building from source
|
||||||
engine-strict=true
|
engine-strict=true
|
||||||
|
|
||||||
|
# Dont include lockfile
|
||||||
|
package-lock=false
|
27
.prettierignore
Normal file
27
.prettierignore
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Docs
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
target
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Mac OS X Finder
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Node dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# npm-debug log
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
# karma reports
|
||||||
|
report.*.json
|
||||||
|
|
||||||
|
# e2e test artifacts
|
||||||
|
test-results
|
||||||
|
html-test-results
|
||||||
|
|
||||||
|
# codecov artifacts
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
|
codecov
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "none",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 100,
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
188
.webpack/webpack.common.js
Normal file
188
.webpack/webpack.common.js
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
/* global __dirname module */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
|
||||||
|
- webpack.prod.js - the production configuration for OpenMCT (default)
|
||||||
|
- 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.
|
||||||
|
*/
|
||||||
|
const path = require('path');
|
||||||
|
const packageDefinition = require('../package.json');
|
||||||
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
|
||||||
|
const { VueLoaderPlugin } = require('vue-loader');
|
||||||
|
let gitRevision = 'error-retrieving-revision';
|
||||||
|
let gitBranch = 'error-retrieving-branch';
|
||||||
|
|
||||||
|
try {
|
||||||
|
gitRevision = require('child_process').execSync('git rev-parse HEAD').toString().trim();
|
||||||
|
gitBranch = require('child_process')
|
||||||
|
.execSync('git rev-parse --abbrev-ref HEAD')
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
|
/** @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',
|
||||||
|
libraryTarget: 'umd',
|
||||||
|
publicPath: '',
|
||||||
|
hashFunction: 'xxhash64',
|
||||||
|
clean: true
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.join(projectRootDir, 'src'),
|
||||||
|
legacyRegistry: path.join(projectRootDir, 'src/legacyRegistry'),
|
||||||
|
saveAs: 'file-saver/src/FileSaver.js',
|
||||||
|
csv: 'comma-separated-values',
|
||||||
|
EventEmitter: 'eventemitter3',
|
||||||
|
bourbon: 'bourbon.scss',
|
||||||
|
'plotly-basic': 'plotly.js-basic-dist',
|
||||||
|
'plotly-gl2d': 'plotly.js-gl2d-dist',
|
||||||
|
'd3-scale': path.join(projectRootDir, 'node_modules/d3-scale/dist/d3-scale.min.js'),
|
||||||
|
printj: path.join(projectRootDir, 'node_modules/printj/dist/printj.min.js'),
|
||||||
|
styles: path.join(projectRootDir, 'src/styles'),
|
||||||
|
MCT: path.join(projectRootDir, 'src/MCT'),
|
||||||
|
testUtils: path.join(projectRootDir, 'src/utils/testUtils.js'),
|
||||||
|
objectUtils: path.join(projectRootDir, 'src/api/objects/object-utils.js'),
|
||||||
|
utils: path.join(projectRootDir, 'src/utils'),
|
||||||
|
vue: path.join(projectRootDir, 'node_modules/@vue/compat/dist/vue.esm-bundler.js'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
||||||
|
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
||||||
|
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
||||||
|
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
|
||||||
|
}),
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: 'src/images/favicons',
|
||||||
|
to: 'favicons'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: './index.html',
|
||||||
|
transform: function (content) {
|
||||||
|
return content.toString().replace(/dist\//g, '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'src/plugins/imagery/layers',
|
||||||
|
to: 'imagery'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[name].css'
|
||||||
|
}),
|
||||||
|
// 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',
|
||||||
|
compatConfig: {
|
||||||
|
MODE: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
type: 'asset/source'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(jpg|jpeg|png|svg)$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'images/[name][ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.ico$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'icons/[name][ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(woff|woff2?|eot|ttf)$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'fonts/[name][ext]'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
stats: 'errors-warnings',
|
||||||
|
performance: {
|
||||||
|
// We should eventually consider chunking to decrease
|
||||||
|
// these values
|
||||||
|
maxEntrypointSize: 27000000,
|
||||||
|
maxAssetSize: 27000000
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
37
.webpack/webpack.coverage.js
Normal file
37
.webpack/webpack.coverage.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/* global module */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This file extends the webpack.dev.js config to add babel istanbul coverage.
|
||||||
|
OpenMCT Continuous Integration servers use this configuration to add code coverage
|
||||||
|
information to pull requests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const config = require('./webpack.dev');
|
||||||
|
// 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']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = config;
|
50
.webpack/webpack.dev.js
Normal file
50
.webpack/webpack.dev.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/* global __dirname module */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This configuration should be used for development purposes. It contains full source map, a
|
||||||
|
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
||||||
|
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
||||||
|
*/
|
||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
|
const common = require('./webpack.common');
|
||||||
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
|
module.exports = 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: path.join(__dirname, '..', '/dist'),
|
||||||
|
publicPath: '/dist',
|
||||||
|
watch: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
22
.webpack/webpack.prod.js
Normal file
22
.webpack/webpack.prod.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/* global __dirname module */
|
||||||
|
|
||||||
|
/*
|
||||||
|
This configuration should be used for production installs.
|
||||||
|
It is the default webpack configuration.
|
||||||
|
*/
|
||||||
|
const path = require('path');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
|
const common = require('./webpack.common');
|
||||||
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
|
module.exports = merge(common, {
|
||||||
|
mode: 'production',
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_ROOT_RELATIVE__: '""'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
devtool: 'source-map'
|
||||||
|
});
|
406
API.md
406
API.md
@ -2,10 +2,13 @@
|
|||||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
**Table of Contents**
|
**Table of Contents**
|
||||||
|
|
||||||
- [Building Applications With Open MCT](#building-applications-with-open-mct)
|
- [Developing Applications With Open MCT](#developing-applications-with-open-mct)
|
||||||
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
||||||
- [Building From Source](#building-from-source)
|
- [Building From Source](#building-from-source)
|
||||||
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
||||||
|
- [Types](#types)
|
||||||
|
- [Using Types](#using-types)
|
||||||
|
- [Limitations](#limitations)
|
||||||
- [Plugins](#plugins)
|
- [Plugins](#plugins)
|
||||||
- [Defining and Installing a New Plugin](#defining-and-installing-a-new-plugin)
|
- [Defining and Installing a New Plugin](#defining-and-installing-a-new-plugin)
|
||||||
- [Domain Objects and Identifiers](#domain-objects-and-identifiers)
|
- [Domain Objects and Identifiers](#domain-objects-and-identifiers)
|
||||||
@ -23,7 +26,7 @@
|
|||||||
- [Value Hints](#value-hints)
|
- [Value Hints](#value-hints)
|
||||||
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
||||||
- [Telemetry Providers](#telemetry-providers)
|
- [Telemetry Providers](#telemetry-providers)
|
||||||
- [Telemetry Requests and Responses.](#telemetry-requests-and-responses)
|
- [Telemetry Requests and Responses](#telemetry-requests-and-responses)
|
||||||
- [Request Strategies **draft**](#request-strategies-draft)
|
- [Request Strategies **draft**](#request-strategies-draft)
|
||||||
- [`latest` request strategy](#latest-request-strategy)
|
- [`latest` request strategy](#latest-request-strategy)
|
||||||
- [`minmax` request strategy](#minmax-request-strategy)
|
- [`minmax` request strategy](#minmax-request-strategy)
|
||||||
@ -41,8 +44,10 @@
|
|||||||
- [Clocks](#clocks)
|
- [Clocks](#clocks)
|
||||||
- [Defining and registering clocks](#defining-and-registering-clocks)
|
- [Defining and registering clocks](#defining-and-registering-clocks)
|
||||||
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
||||||
- [Stopping an active clock](#stopping-an-active-clock)
|
- [⚠️ \[DEPRECATED\] Stopping an active clock](#️-deprecated-stopping-an-active-clock)
|
||||||
- [Clock Offsets](#clock-offsets)
|
- [Clock Offsets](#clock-offsets)
|
||||||
|
- [Time Modes](#time-modes)
|
||||||
|
- [Time Mode Helper Methods](#time-mode-helper-methods)
|
||||||
- [Time Events](#time-events)
|
- [Time Events](#time-events)
|
||||||
- [List of Time Events](#list-of-time-events)
|
- [List of Time Events](#list-of-time-events)
|
||||||
- [The Time Conductor](#the-time-conductor)
|
- [The Time Conductor](#the-time-conductor)
|
||||||
@ -57,7 +62,7 @@
|
|||||||
|
|
||||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
# Building Applications With Open MCT
|
# Developing Applications With Open MCT
|
||||||
|
|
||||||
## Scope and purpose of this document
|
## Scope and purpose of this document
|
||||||
|
|
||||||
@ -72,8 +77,7 @@ MCT, as well as addressing some common developer use cases.
|
|||||||
## Building From Source
|
## Building From Source
|
||||||
|
|
||||||
The latest version of Open MCT is available from [our GitHub repository](https://github.com/nasa/openmct).
|
The latest version of Open MCT is available from [our GitHub repository](https://github.com/nasa/openmct).
|
||||||
If you have `git`, and `node` installed, you can build Open MCT with the
|
If you have `git`, and `node` installed, you can build Open MCT with the commands
|
||||||
commands
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/nasa/openmct.git
|
git clone https://github.com/nasa/openmct.git
|
||||||
@ -90,6 +94,9 @@ well as assets such as html, css, and images necessary for the UI.
|
|||||||
|
|
||||||
## Starting an Open MCT application
|
## Starting an Open MCT application
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Open MCT provides a development server via `webpack-dev-server` (`npm start`). **This should be used for development purposes only and should never be deployed to a production environment**.
|
||||||
|
|
||||||
To start a minimally functional Open MCT application, it is necessary to
|
To start a minimally functional Open MCT application, it is necessary to
|
||||||
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
||||||
the application. The tutorials walk through the process of getting Open MCT up
|
the application. The tutorials walk through the process of getting Open MCT up
|
||||||
@ -134,6 +141,48 @@ do anything with the application initially. Any of these plugins can, in
|
|||||||
principle, be replaced with a custom plugin. The included plugins are
|
principle, be replaced with a custom plugin. The included plugins are
|
||||||
documented in the [Included Plugins](#included-plugins) section.
|
documented in the [Included Plugins](#included-plugins) section.
|
||||||
|
|
||||||
|
## Types
|
||||||
|
|
||||||
|
The Open MCT library includes its own TypeScript declaration files which can be
|
||||||
|
used to provide code hints and typechecking in your own Open MCT application.
|
||||||
|
|
||||||
|
Open MCT's type declarations are generated via `tsc` from JSDoc-style comment
|
||||||
|
blocks. For more information on this, [check out TypeScript's documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html).
|
||||||
|
|
||||||
|
### Using Types
|
||||||
|
|
||||||
|
In order to use Open MCT's provided types in your own application, create a
|
||||||
|
`jsconfig.js` at the root of your project with this minimal configuration:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"target": "es6",
|
||||||
|
"checkJs": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"paths": {
|
||||||
|
"openmct": ["node_modules/openmct/dist/openmct.d.ts"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, simply import and use `openmct` in your application:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import openmct from "openmct";
|
||||||
|
```
|
||||||
|
|
||||||
|
### Limitations
|
||||||
|
|
||||||
|
The effort to add types for Open MCT's public API is ongoing, and the provided
|
||||||
|
type declarations may be incomplete.
|
||||||
|
|
||||||
|
If you would like to contribute types to Open MCT, please check out
|
||||||
|
[TypeScript's documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html) on generating type declarations from JSDoc-style comment blocks.
|
||||||
|
Then read through our [contributing guide](https://github.com/nasa/openmct/blob/f7cf3f72c2efd46da7ce5719c5e52c8806d166f0/CONTRIBUTING.md) and open a PR!
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
||||||
### Defining and Installing a New Plugin
|
### Defining and Installing a New Plugin
|
||||||
@ -190,10 +239,10 @@ looks like this:
|
|||||||
|
|
||||||
The main attributes to note are the `identifier`, and `type` attributes.
|
The main attributes to note are the `identifier`, and `type` attributes.
|
||||||
|
|
||||||
* `identifier`: A composite key that provides a universally unique identifier
|
- `identifier`: A composite key that provides a universally unique identifier
|
||||||
for this object. The `namespace` and `key` are used to identify the object.
|
for this object. The `namespace` and `key` are used to identify the object.
|
||||||
The `key` must be unique within the namespace.
|
The `key` must be unique within the namespace.
|
||||||
* `type`: All objects in Open MCT have a type. Types allow you to form an
|
- `type`: All objects in Open MCT have a type. Types allow you to form an
|
||||||
ontology of knowledge and provide an abstraction for grouping, visualizing,
|
ontology of knowledge and provide an abstraction for grouping, visualizing,
|
||||||
and interpreting data. Details on how to define a new object type are
|
and interpreting data. Details on how to define a new object type are
|
||||||
provided below.
|
provided below.
|
||||||
@ -207,6 +256,7 @@ Custom types may be registered via the `addType` function on the Open MCT Type
|
|||||||
registry.
|
registry.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.types.addType('example.my-type', {
|
openmct.types.addType('example.my-type', {
|
||||||
name: "My Type",
|
name: "My Type",
|
||||||
@ -216,20 +266,21 @@ openmct.types.addType('example.my-type', {
|
|||||||
```
|
```
|
||||||
|
|
||||||
The `addType` function accepts two arguments:
|
The `addType` function accepts two arguments:
|
||||||
* A `string` key identifying the type. This key is used when specifying a type
|
|
||||||
|
- A `string` key identifying the type. This key is used when specifying a type
|
||||||
for an object. We recommend prefixing your types with a namespace to avoid
|
for an object. We recommend prefixing your types with a namespace to avoid
|
||||||
conflicts with other plugins.
|
conflicts with other plugins.
|
||||||
* An object type specification. An object type definition supports the following
|
- An object type specification. An object type definition supports the following
|
||||||
attributes
|
attributes
|
||||||
* `name`: a `string` naming this object type
|
- `name`: a `string` naming this object type
|
||||||
* `description`: a `string` specifying a longer-form description of this type
|
- `description`: a `string` specifying a longer-form description of this type
|
||||||
* `initialize`: a `function` which initializes the model for new domain objects
|
- `initialize`: a `function` which initializes the model for new domain objects
|
||||||
of this type. This can be used for setting default values on an object when
|
of this type. This can be used for setting default values on an object when
|
||||||
it is instantiated.
|
it is instantiated.
|
||||||
* `creatable`: A `boolean` indicating whether users should be allowed to create
|
- `creatable`: A `boolean` indicating whether users should be allowed to create
|
||||||
this type (default: `false`). This will determine whether the type appears
|
this type (default: `false`). This will determine whether the type appears
|
||||||
in the `Create` menu.
|
in the `Create` menu.
|
||||||
* `cssClass`: A `string` specifying a CSS class to apply to each representation
|
- `cssClass`: A `string` specifying a CSS class to apply to each representation
|
||||||
of this object. This is used for specifying an icon to appear next to each
|
of this object. This is used for specifying an icon to appear next to each
|
||||||
object of this type.
|
object of this type.
|
||||||
|
|
||||||
@ -247,6 +298,7 @@ as a hierarchy of telemetry-providing domain objects in this fashion.
|
|||||||
To do so, use the `addRoot` method of the object API.
|
To do so, use the `addRoot` method of the object API.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.objects.addRoot({
|
openmct.objects.addRoot({
|
||||||
namespace: "example.namespace",
|
namespace: "example.namespace",
|
||||||
@ -261,6 +313,7 @@ level objects, or a function that returns a promise for an identifier or an arra
|
|||||||
When using the `getAll` method of the object API, they will be returned in order of priority.
|
When using the `getAll` method of the object API, they will be returned in order of priority.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.objects.addRoot(identifier, openmct.priority.LOW); // low = -1000, will appear last in composition or tree
|
openmct.objects.addRoot(identifier, openmct.priority.LOW); // low = -1000, will appear last in composition or tree
|
||||||
openmct.objects.addRoot(otherIdentifier, openmct.priority.HIGH); // high = 1000, will appear first in composition or tree
|
openmct.objects.addRoot(otherIdentifier, openmct.priority.HIGH); // high = 1000, will appear first in composition or tree
|
||||||
@ -288,11 +341,12 @@ openmct.objects.addProvider('example.namespace', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The `addProvider` function takes two arguments:
|
The `addProvider` function takes two arguments:
|
||||||
|
|
||||||
* `namespace`: A `string` representing the namespace that this object provider
|
- `namespace`: A `string` representing the namespace that this object provider
|
||||||
will provide objects for.
|
will provide objects for.
|
||||||
* `provider`: An `object` with a single function, `get`. This function accepts an
|
- `provider`: An `object` with a single function, `get`. This function accepts an
|
||||||
[Identifier](#domain-objects-and-identifiers) for the object to be provided.
|
[Identifier](#domain-objects-and-identifiers) for the object to be provided.
|
||||||
It is expected that the `get` function will return a
|
It is expected that the `get` function will return a
|
||||||
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
||||||
@ -324,12 +378,13 @@ openmct.composition.addProvider({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The `addProvider` function accepts a Composition Provider object as its sole
|
The `addProvider` function accepts a Composition Provider object as its sole
|
||||||
argument. A Composition Provider is a javascript object exposing two functions:
|
argument. A Composition Provider is a javascript object exposing two functions:
|
||||||
* `appliesTo`: A `function` that accepts a `domainObject` argument, and returns
|
- `appliesTo`: A `function` that accepts a `domainObject` argument, and returns
|
||||||
a `boolean` value indicating whether this composition provider applies to the
|
a `boolean` value indicating whether this composition provider applies to the
|
||||||
given object.
|
given object.
|
||||||
* `load`: A `function` that accepts a `domainObject` as an argument, and returns
|
- `load`: A `function` that accepts a `domainObject` as an argument, and returns
|
||||||
a `Promise` that resolves with an array of [Identifier](#domain-objects-and-identifiers).
|
a `Promise` that resolves with an array of [Identifier](#domain-objects-and-identifiers).
|
||||||
These identifiers will be used to fetch Domain Objects from an [Object Provider](#object-provider)
|
These identifiers will be used to fetch Domain Objects from an [Object Provider](#object-provider)
|
||||||
|
|
||||||
@ -390,7 +445,7 @@ A telemetry object is a domain object with a telemetry property. To take an exa
|
|||||||
{
|
{
|
||||||
"key": "value",
|
"key": "value",
|
||||||
"name": "Value",
|
"name": "Value",
|
||||||
"units": "kilograms",
|
"unit": "kilograms",
|
||||||
"format": "float",
|
"format": "float",
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 100,
|
"max": 100,
|
||||||
@ -425,29 +480,27 @@ attribute | type | flags | notes
|
|||||||
`name` | string | optional | a human readable label for this field. If omitted, defaults to `key`.
|
`name` | string | optional | a human readable label for this field. If omitted, defaults to `key`.
|
||||||
`source` | string | optional | identifies the property of a datum where this value is stored. If omitted, defaults to `key`.
|
`source` | string | optional | identifies the property of a datum where this value is stored. If omitted, defaults to `key`.
|
||||||
`format` | string | optional | a specific format identifier, mapping to a formatter. If omitted, uses a default formatter. For enumerations, use `enum`. For timestamps, use `utc` if you are using utc dates, otherwise use a key mapping to your custom date format.
|
`format` | string | optional | a specific format identifier, mapping to a formatter. If omitted, uses a default formatter. For enumerations, use `enum`. For timestamps, use `utc` if you are using utc dates, otherwise use a key mapping to your custom date format.
|
||||||
`units` | string | optional | the units of this value, e.g. `km`, `seconds`, `parsecs`
|
`unit` | string | optional | the unit of this value, e.g. `km`, `seconds`, `parsecs`
|
||||||
`min` | number | optional | the minimum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a min value.
|
`min` | number | optional | the minimum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a min value.
|
||||||
`max` | number | optional | the maximum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a max value.
|
`max` | number | optional | the maximum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a max value.
|
||||||
`enumerations` | array | optional | for objects where `format` is `"enum"`, this array tracks all possible enumerations of the value. Each entry in this array is an object, with a `value` property that is the numerical value of the enumeration, and a `string` property that is the text value of the enumeration. ex: `{"value": 0, "string": "OFF"}`. If you use an enumerations array, `min` and `max` will be set automatically for you.
|
`enumerations` | array | optional | for objects where `format` is `"enum"`, this array tracks all possible enumerations of the value. Each entry in this array is an object, with a `value` property that is the numerical value of the enumeration, and a `string` property that is the text value of the enumeration. ex: `{"value": 0, "string": "OFF"}`. If you use an enumerations array, `min` and `max` will be set automatically for you.
|
||||||
|
|
||||||
|
|
||||||
###### Value Hints
|
###### Value Hints
|
||||||
|
|
||||||
Each telemetry value description has an object defining hints. Keys in this object represent the hint itself, and the value represents the weight of that hint. A lower weight means the hint has a higher priority. For example, multiple values could be hinted for use as the y-axis of a plot (raw, engineering), but the highest priority would be the default choice. Likewise, a table will use hints to determine the default order of columns.
|
Each telemetry value description has an object defining hints. Keys in this object represent the hint itself, and the value represents the weight of that hint. A lower weight means the hint has a higher priority. For example, multiple values could be hinted for use as the y-axis of a plot (raw, engineering), but the highest priority would be the default choice. Likewise, a table will use hints to determine the default order of columns.
|
||||||
|
|
||||||
Known hints:
|
Known hints:
|
||||||
|
|
||||||
* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
- `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
||||||
* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
- `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
||||||
* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
- `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
||||||
* `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file.
|
- `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file.
|
||||||
|
|
||||||
##### The Time Conductor and Telemetry
|
##### The Time Conductor and Telemetry
|
||||||
|
|
||||||
Open MCT provides a number of ways to pivot through data and link data via time. The Time Conductor helps synchronize multiple views around the same time.
|
Open MCT provides a number of ways to pivot through data and link data via time. The Time Conductor helps synchronize multiple views around the same time.
|
||||||
|
|
||||||
In order for the time conductor to work, there will always be an active "time system". All telemetry metadata *must* have a telemetry value with a `key` that matches the `key` of the active time system. You can use the `source` attribute on the value metadata to remap this to a different field in the telemetry datum-- especially useful if you are working with disparate datasources that have different field mappings.
|
In order for the time conductor to work, there will always be an active "time system". All telemetry metadata _must_ have a telemetry value with a `key` that matches the `key` of the active time system. You can use the `source` attribute on the value metadata to remap this to a different field in the telemetry datum-- especially useful if you are working with disparate datasources that have different field mappings.
|
||||||
|
|
||||||
|
|
||||||
#### Telemetry Providers
|
#### Telemetry Providers
|
||||||
|
|
||||||
@ -455,14 +508,14 @@ Telemetry providers are responsible for providing historical and real-time telem
|
|||||||
|
|
||||||
A telemetry provider is a javascript object with up to four methods:
|
A telemetry provider is a javascript object with up to four methods:
|
||||||
|
|
||||||
* `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options).
|
- `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options).
|
||||||
* `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function.
|
- `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function.
|
||||||
* `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object.
|
- `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object.
|
||||||
* `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests.
|
- `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests.
|
||||||
* `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for.
|
- `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for.
|
||||||
* `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition.
|
- `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition.
|
||||||
* `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for.
|
- `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for.
|
||||||
* `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object.
|
- `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object.
|
||||||
|
|
||||||
Telemetry providers are registered by calling `openmct.telemetry.addProvider(provider)`, e.g.
|
Telemetry providers are registered by calling `openmct.telemetry.addProvider(provider)`, e.g.
|
||||||
|
|
||||||
@ -475,7 +528,7 @@ openmct.telemetry.addProvider({
|
|||||||
|
|
||||||
Note: it is not required to implement all of the methods on every provider. Depending on the complexity of your implementation, it may be helpful to instantiate and register your realtime, historical, and metadata providers separately.
|
Note: it is not required to implement all of the methods on every provider. Depending on the complexity of your implementation, it may be helpful to instantiate and register your realtime, historical, and metadata providers separately.
|
||||||
|
|
||||||
#### Telemetry Requests and Responses.
|
#### Telemetry Requests and Responses
|
||||||
|
|
||||||
Telemetry requests support time bounded queries. A call to a _Telemetry Provider_'s `request` function will include an `options` argument. These are simply javascript objects with attributes for the request parameters. An example of a telemetry request object with a start and end time is included below:
|
Telemetry requests support time bounded queries. A call to a _Telemetry Provider_'s `request` function will include an `options` argument. These are simply javascript objects with attributes for the request parameters. An example of a telemetry request object with a start and end time is included below:
|
||||||
|
|
||||||
@ -508,6 +561,7 @@ the number of results it desires. The `size` parameter is a hint; views
|
|||||||
must not assume the response will have the exact number of results requested.
|
must not assume the response will have the exact number of results requested.
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
start: 1487981997240,
|
start: 1487981997240,
|
||||||
@ -523,6 +577,7 @@ This strategy says "I want the latest data point in this time range". A provide
|
|||||||
##### `minmax` request strategy
|
##### `minmax` request strategy
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
start: 1487981997240,
|
start: 1487981997240,
|
||||||
@ -540,8 +595,8 @@ MinMax queries are issued by plots, and may be issued by other types as well. T
|
|||||||
Telemetry format objects define how to interpret and display telemetry data.
|
Telemetry format objects define how to interpret and display telemetry data.
|
||||||
They have a simple structure:
|
They have a simple structure:
|
||||||
|
|
||||||
* `key`: A `string` that uniquely identifies this formatter.
|
- `key`: A `string` that uniquely identifies this formatter.
|
||||||
* `format`: A `function` that takes a raw telemetry value, and returns a
|
- `format`: A `function` that takes a raw telemetry value, and returns a
|
||||||
human-readable `string` representation of that value. It has one required
|
human-readable `string` representation of that value. It has one required
|
||||||
argument, and three optional arguments that provide context and can be used
|
argument, and three optional arguments that provide context and can be used
|
||||||
for returning scaled representations of a value. An example of this is
|
for returning scaled representations of a value. An example of this is
|
||||||
@ -549,16 +604,16 @@ They have a simple structure:
|
|||||||
are multiple ways of representing a point in time, and by providing a minimum
|
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
|
scale value, maximum scale value, and a count, it's possible to provide more
|
||||||
useful representations of time given the provided limitations.
|
useful representations of time given the provided limitations.
|
||||||
* `value`: The raw telemetry value in its native type.
|
- `value`: The raw telemetry value in its native type.
|
||||||
* `minValue`: An __optional__ argument specifying the minimum displayed
|
- `minValue`: An **optional** argument specifying the minimum displayed
|
||||||
value.
|
value.
|
||||||
* `maxValue`: An __optional__ argument specifying the maximum displayed
|
- `maxValue`: An **optional** argument specifying the maximum displayed
|
||||||
value.
|
value.
|
||||||
* `count`: An __optional__ argument specifying the number of displayed
|
- `count`: An **optional** argument specifying the number of displayed
|
||||||
values.
|
values.
|
||||||
* `parse`: A `function` that takes a `string` representation of a telemetry
|
- `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.
|
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
|
- `validate`: A `function` that takes a `string` representation of a telemetry
|
||||||
value, and returns a `boolean` value indicating whether the provided string
|
value, and returns a `boolean` value indicating whether the provided string
|
||||||
can be parsed.
|
can be parsed.
|
||||||
|
|
||||||
@ -584,9 +639,9 @@ openmct.telemetry.addFormat({
|
|||||||
#### Telemetry Data
|
#### Telemetry Data
|
||||||
|
|
||||||
A single telemetry point is considered a Datum, and is represented by a standard
|
A single telemetry point is considered a Datum, and is represented by a standard
|
||||||
javascript object. Realtime subscriptions (obtained via __subscribe__) will
|
javascript object. Realtime subscriptions (obtained via **subscribe**) will
|
||||||
invoke the supplied callback once for each telemetry datum recieved. Telemetry
|
invoke the supplied callback once for each telemetry datum recieved. Telemetry
|
||||||
requests (obtained via __request__) will return a promise for an array of
|
requests (obtained via **request**) will return a promise for an array of
|
||||||
telemetry datums.
|
telemetry datums.
|
||||||
|
|
||||||
##### Telemetry Datums
|
##### Telemetry Datums
|
||||||
@ -623,7 +678,6 @@ For an example of a limit evaluator, take a look at `examples/generator/Sinewave
|
|||||||
|
|
||||||
The APIs for requesting telemetry from Open MCT -- e.g. for use in custom views -- are currently in draft state and are being revised. If you'd like to experiment with them before they are finalized, please contact the team via the contact-us link on our website.
|
The APIs for requesting telemetry from Open MCT -- e.g. for use in custom views -- are currently in draft state and are being revised. If you'd like to experiment with them before they are finalized, please contact the team via the contact-us link on our website.
|
||||||
|
|
||||||
|
|
||||||
## Time API
|
## Time API
|
||||||
|
|
||||||
Open MCT provides API for managing the temporal state of the application.
|
Open MCT provides API for managing the temporal state of the application.
|
||||||
@ -636,8 +690,9 @@ state of the application, and emits events to inform listeners when the state ch
|
|||||||
|
|
||||||
Because the data displayed tends to be time domain data, Open MCT must always
|
Because the data displayed tends to be time domain data, Open MCT must always
|
||||||
have at least one time system installed and activated. When you download Open
|
have at least one time system installed and activated. When you download Open
|
||||||
MCT, it will be pre-configured to use the UTC time system, which is installed and activated, along with other default plugins, in `index.html`. Installing and activating a time system is simple, and is covered
|
MCT, it will be pre-configured to use the UTC time system, which is installed and activated,
|
||||||
[in the next section](#defining-and-registering-time-systems).
|
along with other default plugins, in `index.html`. Installing and activating a time system
|
||||||
|
is simple, and is covered [in the next section](#defining-and-registering-time-systems).
|
||||||
|
|
||||||
### Time Systems and Bounds
|
### Time Systems and Bounds
|
||||||
|
|
||||||
@ -665,80 +720,98 @@ is configured and activated by default from `index.html` in the default
|
|||||||
installation of Open MCT if you download the source from GitHub. Some details of
|
installation of Open MCT if you download the source from GitHub. Some details of
|
||||||
each of the required properties is provided below.
|
each of the required properties is provided below.
|
||||||
|
|
||||||
* `key`: A `string` that uniquely identifies this time system.
|
- `key`: A `string` that uniquely identifies this time system.
|
||||||
* `name`: A `string` providing a brief human readable label. If the [Time Conductor](#the-time-conductor)
|
- `name`: A `string` providing a brief human readable label. If the [Time Conductor](#the-time-conductor)
|
||||||
plugin is enabled, this name will identify the time system in a dropdown menu.
|
plugin is enabled, this name will identify the time system in a dropdown menu.
|
||||||
* `cssClass`: A class name `string` that will be applied to the time system when
|
- `cssClass`: A class name `string` that will be applied to the time system when
|
||||||
it appears in the UI. This will be used to represent the time system with an icon.
|
it appears in the UI. This will be used to represent the time system with an icon.
|
||||||
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
||||||
or a custom class can be used here.
|
or a custom class can be used here.
|
||||||
* `timeFormat`: A `string` corresponding to the key of a registered
|
- `timeFormat`: A `string` corresponding to the key of a registered
|
||||||
[telemetry time format](#telemetry-formats). The format will be used for
|
[telemetry time format](#telemetry-formats). The format will be used for
|
||||||
displaying discrete timestamps from telemetry streams when this time system is
|
displaying discrete timestamps from telemetry streams when this time system is
|
||||||
activated. If the [UTCTimeSystem](#included-plugins) is enabled, then the `utc`
|
activated. If the [UTCTimeSystem](#included-plugins) is enabled, then the `utc`
|
||||||
format can be used if this is a utc-based time system
|
format can be used if this is a utc-based time system
|
||||||
* `durationFormat`: A `string` corresponding to the key of a registered
|
- `durationFormat`: A `string` corresponding to the key of a registered
|
||||||
[telemetry time format](#telemetry-formats). The format will be used for
|
[telemetry time format](#telemetry-formats). The format will be used for
|
||||||
displaying time ranges, for example `00:15:00` might be used to represent a time
|
displaying time ranges, for example `00:15:00` might be used to represent a time
|
||||||
period of fifteen minutes. These are used by the Time Conductor plugin to specify
|
period of fifteen minutes. These are used by the Time Conductor plugin to specify
|
||||||
relative time offsets. If the [UTCTimeSystem](#included-plugins) is enabled,
|
relative time offsets. If the [UTCTimeSystem](#included-plugins) is enabled,
|
||||||
then the `duration` format can be used if this is a utc-based time system
|
then the `duration` format can be used if this is a utc-based time system
|
||||||
* `isUTCBased`: A `boolean` that defines whether this time system represents
|
- `isUTCBased`: A `boolean` that defines whether this time system represents
|
||||||
numbers in UTC terrestrial time.
|
numbers in UTC terrestrial time.
|
||||||
|
|
||||||
#### Getting and Setting the Active Time System
|
#### Getting and Setting the Active Time System
|
||||||
|
|
||||||
Once registered, a time system can be activated by calling `timeSystem` with
|
Once registered, a time system can be activated by calling `setTimeSystem` with
|
||||||
the timeSystem `key` or an instance of the time system. If you are not using a
|
the timeSystem `key` or an instance of the time system. You can also specify
|
||||||
[clock](#clocks), you must also specify valid [bounds](#time-bounds) for the
|
valid [bounds](#time-bounds) for the timeSystem.
|
||||||
timeSystem.
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.time.timeSystem('utc', bounds);
|
openmct.time.setTimeSystem('utc', bounds);
|
||||||
|
```
|
||||||
|
|
||||||
|
The current time system can be retrieved as well by calling `getTimeSystem`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
openmct.time.getTimeSystem();
|
||||||
```
|
```
|
||||||
|
|
||||||
A time system can be immediately activated after registration:
|
A time system can be immediately activated after registration:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.time.addTimeSystem(utcTimeSystem);
|
openmct.time.addTimeSystem(utcTimeSystem);
|
||||||
openmct.time.timeSystem(utcTimeSystem, bounds);
|
openmct.time.setTimeSystem(utcTimeSystem, bounds);
|
||||||
```
|
```
|
||||||
|
|
||||||
Setting the active time system will trigger a [`'timeSystem'`](#time-events)
|
Setting the active time system will trigger a [`'timeSystemChanged'`](#time-events)
|
||||||
event. If you supplied bounds, a [`'bounds'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
event. If you supplied bounds, a [`'boundsChanged'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `timeSystem()` is deprecated. Please use `getTimeSystem()` and `setTimeSystem()` as a replacement.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Time Bounds
|
#### Time Bounds
|
||||||
|
|
||||||
The TimeAPI provides a getter/setter for querying and setting time bounds. Time
|
The TimeAPI provides a getter and setter for querying and setting time bounds. Time
|
||||||
bounds are simply an object with a `start` and an end `end` attribute.
|
bounds are simply an object with a `start` and an end `end` attribute.
|
||||||
|
|
||||||
* `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
- `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
||||||
This will be used as the beginning of the time period displayed by time-responsive
|
This will be used as the beginning of the time period displayed by time-responsive
|
||||||
telemetry views.
|
telemetry views.
|
||||||
* `end`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
- `end`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
||||||
This will be used as the end of the time period displayed by time-responsive
|
This will be used as the end of the time period displayed by time-responsive
|
||||||
telemetry views.
|
telemetry views.
|
||||||
|
|
||||||
If invoked with bounds, it will set the new time bounds system-wide. If invoked
|
New bounds can be set system wide by calling `setBounds` with [bounds](#time-bounds).
|
||||||
without any parameters, it will return the current application-wide time bounds.
|
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
const ONE_HOUR = 60 * 60 * 1000;
|
const ONE_HOUR = 60 * 60 * 1000;
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
openmct.time.bounds({start: now - ONE_HOUR, now);
|
openmct.time.setBounds({start: now - ONE_HOUR, now);
|
||||||
```
|
```
|
||||||
|
|
||||||
To respond to bounds change events, listen for the [`'bounds'`](#time-events)
|
Calling `getBounds` will return the current application-wide time bounds.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.getBounds();
|
||||||
|
```
|
||||||
|
|
||||||
|
To respond to bounds change events, listen for the [`'boundsChanged'`](#time-events)
|
||||||
event.
|
event.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `bounds()` is deprecated and will be removed in a future release. Please use `getBounds()` and `setBounds()` as a replacement.
|
||||||
|
|
||||||
### Clocks
|
### Clocks
|
||||||
|
|
||||||
The Time API can be set to follow a clock source which will cause the bounds
|
The Time API requires a clock source which will cause the bounds to be updated
|
||||||
to be updated automatically whenever the clock source "ticks". A clock is simply
|
automatically whenever the clock source "ticks". A clock is simply an object that
|
||||||
an object that supports registration of listeners and periodically invokes its
|
supports registration of listeners and periodically invokes its listeners with a
|
||||||
listeners with a number. Open MCT supports registration of new clock sources that
|
number. Open MCT supports registration of new clock sources that tick on almost
|
||||||
tick on almost anything. A tick occurs when the clock invokes callback functions
|
anything. A tick occurs when the clock invokes callback functions registered by its
|
||||||
registered by its listeners with a new time value.
|
listeners with a new time value.
|
||||||
|
|
||||||
An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js)
|
An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js)
|
||||||
which emits the current time in UTC every 100ms. Clocks can tick on anything. For
|
which emits the current time in UTC every 100ms. Clocks can tick on anything. For
|
||||||
@ -754,28 +827,28 @@ context of the active [Time System](#defining-and-registering-time-systems).
|
|||||||
|
|
||||||
A clock is an object that defines certain required metadata and functions:
|
A clock is an object that defines certain required metadata and functions:
|
||||||
|
|
||||||
* `key`: A `string` uniquely identifying this clock. This can be used later to
|
- `key`: A `string` uniquely identifying this clock. This can be used later to
|
||||||
reference the clock in places such as the [Time Conductor configuration](#time-conductor-configuration)
|
reference the clock in places such as the [Time Conductor configuration](#time-conductor-configuration)
|
||||||
* `cssClass`: A `string` identifying a CSS class to apply to this clock when it's
|
- `cssClass`: A `string` identifying a CSS class to apply to this clock when it's
|
||||||
displayed in the UI. This will be used to represent the time system with an icon.
|
displayed in the UI. This will be used to represent the time system with an icon.
|
||||||
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
||||||
or a custom class can be used here.
|
or a custom class can be used here.
|
||||||
* `name`: A `string` providing a human-readable identifier for the clock source.
|
- `name`: A `string` providing a human-readable identifier for the clock source.
|
||||||
This will be displayed in the clock selector menu in the Time Conductor UI
|
This will be displayed in the clock selector menu in the Time Conductor UI
|
||||||
component, if active.
|
component, if active.
|
||||||
* `description`: An __optional__ `string` providing a longer description of the
|
- `description`: An **optional** `string` providing a longer description of the
|
||||||
clock. The description will be visible in the clock selection menu in the Time
|
clock. The description will be visible in the clock selection menu in the Time
|
||||||
Conductor plugin.
|
Conductor plugin.
|
||||||
* `on`: A `function` supporting registration of a new callback that will be
|
- `on`: A `function` supporting registration of a new callback that will be
|
||||||
invoked when the clock next ticks. It will be invoked with two arguments:
|
invoked when the clock next ticks. It will be invoked with two arguments:
|
||||||
* `eventName`: A `string` specifying the event to listen on. For now, clocks
|
- `eventName`: A `string` specifying the event to listen on. For now, clocks
|
||||||
support one event - `tick`.
|
support one event - `tick`.
|
||||||
* `callback`: A `function` that will be invoked when this clock ticks. The
|
- `callback`: A `function` that will be invoked when this clock ticks. The
|
||||||
function must be invoked with one parameter - a `number` representing a valid
|
function must be invoked with one parameter - a `number` representing a valid
|
||||||
time in the current time system.
|
time in the current time system.
|
||||||
* `off`: A `function` that allows deregistration of a tick listener. It accepts
|
- `off`: A `function` that allows deregistration of a tick listener. It accepts
|
||||||
the same arguments as `on`.
|
the same arguments as `on`.
|
||||||
* `currentValue`: A `function` that returns a `number` representing a point in
|
- `currentValue`: A `function` that returns a `number` representing a point in
|
||||||
time in the active time system. It should be the last value provided by a tick,
|
time in the active time system. It should be the last value provided by a tick,
|
||||||
or some default value if no ticking has yet occurred.
|
or some default value if no ticking has yet occurred.
|
||||||
|
|
||||||
@ -806,24 +879,31 @@ An example clock implementation is provided in the form of the [LocalClock](http
|
|||||||
|
|
||||||
#### Getting and setting active clock
|
#### Getting and setting active clock
|
||||||
|
|
||||||
Once registered a clock can be activated by calling the `clock` function on the
|
Once registered a clock can be activated by calling the `setClock` function on the
|
||||||
Time API passing in the key or instance of a registered clock. Only one clock
|
Time API passing in the key or instance of a registered clock. Only one clock
|
||||||
may be active at once, so activating a clock will deactivate any currently
|
may be active at once, so activating a clock will deactivate any currently
|
||||||
active clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock.
|
active clock and start the new clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock.
|
||||||
|
|
||||||
Setting the clock triggers a [`'clock'`](#time-events) event, followed by a [`'clockOffsets'`](#time-events) event, and then a [`'bounds'`](#time-events) event as the offsets are applied to the clock's currentValue().
|
|
||||||
|
|
||||||
|
Setting the clock triggers a [`'clockChanged'`](#time-events) event, followed by a [`'clockOffsetsChanged'`](#time-events) event, and then a [`'boundsChanged'`](#time-events) event as the offsets are applied to the clock's currentValue().
|
||||||
|
|
||||||
```
|
```
|
||||||
openmct.time.clock(someClock, clockOffsets);
|
openmct.time.setClock(someClock, clockOffsets);
|
||||||
```
|
```
|
||||||
|
|
||||||
Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`.
|
Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`.
|
||||||
|
|
||||||
The currently active clock (if any) can be retrieved by calling the same
|
The currently active clock can be retrieved by calling `getClock`.
|
||||||
function without any arguments.
|
|
||||||
|
|
||||||
#### Stopping an active clock
|
```
|
||||||
|
openmct.time.getClock();
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `clock()` is deprecated and will be removed in a future release. Please use `getClock()` and `setClock()` as a replacement.
|
||||||
|
|
||||||
|
#### ⚠️ [DEPRECATED] Stopping an active clock
|
||||||
|
|
||||||
|
_As of July 2023, this method will be deprecated. Open MCT will always have a ticking clock._
|
||||||
|
|
||||||
The `stopClock` method can be used to stop an active clock, and to clear it. It
|
The `stopClock` method can be used to stop an active clock, and to clear it. It
|
||||||
will stop the clock from ticking, and set the active clock to `undefined`.
|
will stop the clock from ticking, and set the active clock to `undefined`.
|
||||||
@ -832,37 +912,95 @@ will stop the clock from ticking, and set the active clock to `undefined`.
|
|||||||
openmct.time.stopClock();
|
openmct.time.stopClock();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `stopClock()` is deprecated and will be removed in a future release.
|
||||||
|
|
||||||
#### Clock Offsets
|
#### Clock Offsets
|
||||||
|
|
||||||
When a clock is active, the time bounds of the application will be updated
|
When in Real-time [mode](#time-modes), the time bounds of the application will be updated automatically each time the
|
||||||
automatically each time the clock "ticks". The bounds are calculated based on
|
clock "ticks". The bounds are calculated based on the current value provided by
|
||||||
the current value provided by the active clock (via its `tick` event, or its
|
the active clock (via its `tick` event, or its `currentValue()` method).
|
||||||
`currentValue()` method).
|
|
||||||
|
|
||||||
Unlike bounds, which represent absolute time values, clock offsets represent
|
Unlike bounds, which represent absolute time values, clock offsets represent
|
||||||
relative time spans. Offsets are defined as an object with two properties:
|
relative time spans. Offsets are defined as an object with two properties:
|
||||||
|
|
||||||
* `start`: A `number` that must be < 0 and which is used to calculate the start
|
- `start`: A `number` that must be < 0 and which is used to calculate the start
|
||||||
bounds on each clock tick. The start offset will be calculated relative to the
|
bounds on each clock tick. The start offset will be calculated relative to the
|
||||||
value provided by a clock's tick callback, or its `currentValue()` function.
|
value provided by a clock's tick callback, or its `currentValue()` function.
|
||||||
* `end`: A `number` that must be >= 0 and which is used to calculate the end
|
- `end`: A `number` that must be >= 0 and which is used to calculate the end
|
||||||
bounds on each clock tick.
|
bounds on each clock tick.
|
||||||
|
|
||||||
The `clockOffsets` function can be used to get or set clock offsets. For example,
|
The `setClockOffsets` function can be used to get or set clock offsets. For example,
|
||||||
to show the last fifteen minutes in a ms-based time system:
|
to show the last fifteen minutes in a ms-based time system:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
||||||
|
|
||||||
openmct.time.clockOffsets({
|
openmct.time.setClockOffsets({
|
||||||
start: -FIFTEEN_MINUTES,
|
start: -FIFTEEN_MINUTES,
|
||||||
end: 0
|
end: 0
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
__Note:__ Setting the clock offsets will trigger an immediate bounds change, as
|
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.
|
new bounds will be calculated based on the `currentValue()` of the active clock.
|
||||||
Clock offsets are only relevant when a clock source is active.
|
Clock offsets are only relevant when in Real-time [mode](#time-modes).
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `clockOffsets()` is deprecated and will be removed in a future release. Please use `getClockOffsets()` and `setClockOffsets()` as a replacement.
|
||||||
|
|
||||||
|
### Time Modes
|
||||||
|
|
||||||
|
There are two time modes in Open MCT, "Fixed" and "Real-time". In Real-time mode the
|
||||||
|
time bounds of the application will be updated automatically each time the clock "ticks".
|
||||||
|
The bounds are calculated based on the current value provided by the active clock. In
|
||||||
|
Fixed mode, the time bounds are set for a specified time range. When Open MCT is first
|
||||||
|
initialized, it will be in Real-time mode.
|
||||||
|
|
||||||
|
The `setMode` method can be used to set the current time mode. It accepts a mode argument,
|
||||||
|
`'realtime'` or `'fixed'` and it also accepts an optional [offsets](#clock-offsets)/[bounds](#time-bounds) argument dependent
|
||||||
|
on the current mode.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.setMode('fixed');
|
||||||
|
openmct.time.setMode('fixed', bounds); // with optional bounds
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.setMode('realtime');
|
||||||
|
openmct.time.setMode('realtime', offsets); // with optional offsets
|
||||||
|
```
|
||||||
|
|
||||||
|
The `getMode` method will return the current time mode, either `'realtime'` or `'fixed'`.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.getMode();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Time Mode Helper Methods
|
||||||
|
|
||||||
|
There are two methods available to determine the current time mode in Open MCT programmatically,
|
||||||
|
`isRealTime` and `isFixed`. Each one will return a boolean value based on the current mode.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
if (openmct.time.isRealTime()) {
|
||||||
|
// do real-time stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
if (openmct.time.isFixed()) {
|
||||||
|
// do fixed-time stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Time Events
|
### Time Events
|
||||||
|
|
||||||
@ -871,7 +1009,7 @@ The Time API is a standard event emitter; you can register callbacks for events
|
|||||||
For example:
|
For example:
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
openmct.time.on('bounds', function callback (newBounds, tick) {
|
openmct.time.on('boundsChanged', function callback (newBounds, tick) {
|
||||||
// Do something with new bounds
|
// Do something with new bounds
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -880,11 +1018,11 @@ openmct.time.on('bounds', function callback (newBounds, tick) {
|
|||||||
|
|
||||||
The events emitted by the Time API are:
|
The events emitted by the Time API are:
|
||||||
|
|
||||||
* `bounds`: emitted whenever the bounds change. The callback will be invoked
|
- `boundsChanged`: emitted whenever the bounds change. The callback will be invoked
|
||||||
with two arguments:
|
with two arguments:
|
||||||
* `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
- `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
||||||
representing a new time period bound by the specified start and send times.
|
representing a new time period bound by the specified start and send times.
|
||||||
* `tick`: A `boolean` indicating whether or not this bounds change is due to
|
- `tick`: A `boolean` indicating whether or not this bounds change is due to
|
||||||
a "tick" from a [clock source](#clocks). This information can be useful
|
a "tick" from a [clock source](#clocks). This information can be useful
|
||||||
when determining a strategy for fetching telemetry data in response to a
|
when determining a strategy for fetching telemetry data in response to a
|
||||||
bounds change event. For example, if the bounds change was automatic, and
|
bounds change event. For example, if the bounds change was automatic, and
|
||||||
@ -895,16 +1033,24 @@ The events emitted by the Time API are:
|
|||||||
If `tick` is false,then the bounds change was not due to an automatic tick,
|
If `tick` is false,then the bounds change was not due to an automatic tick,
|
||||||
and a query for historical data may be necessary, depending on your data
|
and a query for historical data may be necessary, depending on your data
|
||||||
caching strategy, and how significantly the start bound has changed.
|
caching strategy, and how significantly the start bound has changed.
|
||||||
* `timeSystem`: emitted whenever the active time system changes. The callback will be invoked with a single argument:
|
- `timeSystemChanged`: emitted whenever the active time system changes. The callback will be invoked with a single argument:
|
||||||
* `timeSystem`: The newly active [time system](#defining-and-registering-time-systems).
|
- `timeSystem`: The newly active [time system](#defining-and-registering-time-systems).
|
||||||
* `clock`: emitted whenever the clock changes. The callback will be invoked
|
- `clockChanged`: emitted whenever the clock changes. The callback will be invoked
|
||||||
with a single argument:
|
with a single argument:
|
||||||
* `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
- `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
||||||
clock has been deactivated.
|
clock has been deactivated.
|
||||||
* `clockOffsets`: emitted whenever the active clock offsets change. The
|
- `clockOffsetsChanged`: emitted whenever the active clock offsets change. The
|
||||||
callback will be invoked with a single argument:
|
callback will be invoked with a single argument:
|
||||||
* `clockOffsets`: The new [clock offsets](#clock-offsets).
|
- `clockOffsets`: The new [clock offsets](#clock-offsets).
|
||||||
|
- `modeChanged`: emitted whenever the time [mode](#time-modes) changed. The callback will
|
||||||
|
be invoked with one argument:
|
||||||
|
- `mode`: A string representation of the current time mode, either `'realtime'` or `'fixed'`.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated Events** (These will be removed in a future release):
|
||||||
|
> - `bounds` → `boundsChanged`
|
||||||
|
> - `timeSystem` → `timeSystemChanged`
|
||||||
|
> - `clock` → `clockChanged`
|
||||||
|
> - `clockOffsets` → `clockOffsetsChanged`
|
||||||
|
|
||||||
### The Time Conductor
|
### The Time Conductor
|
||||||
|
|
||||||
@ -929,29 +1075,29 @@ array is an object with some properties specifying configuration. The configurat
|
|||||||
options specified are slightly different depending on whether or not it is for
|
options specified are slightly different depending on whether or not it is for
|
||||||
an active clock mode.
|
an active clock mode.
|
||||||
|
|
||||||
__Configuration for Fixed Time Mode (no active clock)__
|
**Configuration for Fixed Time Mode (no active clock)**
|
||||||
|
|
||||||
* `timeSystem`: A `string`, the key for the time system that this configuration
|
- `timeSystem`: A `string`, the key for the time system that this configuration
|
||||||
relates to.
|
relates to.
|
||||||
* `bounds`: A [`Time Bounds`](#time-bounds) object. These bounds will be applied
|
- `bounds`: A [`Time Bounds`](#time-bounds) object. These bounds will be applied
|
||||||
when the user selects the time system specified in the previous `timeSystem`
|
when the user selects the time system specified in the previous `timeSystem`
|
||||||
property.
|
property.
|
||||||
* `zoomOutLimit`: An __optional__ `number` specifying the longest period of time
|
- `zoomOutLimit`: An **optional** `number` specifying the longest period of time
|
||||||
that can be represented by the conductor when zooming. If a `zoomOutLimit` is
|
that can be represented by the conductor when zooming. If a `zoomOutLimit` is
|
||||||
provided, then a `zoomInLimit` must also be provided. If provided, the zoom
|
provided, then a `zoomInLimit` must also be provided. If provided, the zoom
|
||||||
slider will automatically become available in the Time Conductor UI.
|
slider will automatically become available in the Time Conductor UI.
|
||||||
* `zoomInLimit`: An __optional__ `number` specifying the shortest period of time
|
- `zoomInLimit`: An **optional** `number` specifying the shortest period of time
|
||||||
that can be represented by the conductor when zooming. If a `zoomInLimit` is
|
that can be represented by the conductor when zooming. If a `zoomInLimit` is
|
||||||
provided, then a `zoomOutLimit` must also be provided. If provided, the zoom
|
provided, then a `zoomOutLimit` must also be provided. If provided, the zoom
|
||||||
slider will automatically become available in the Time Conductor UI.
|
slider will automatically become available in the Time Conductor UI.
|
||||||
|
|
||||||
__Configuration for Active Clock__
|
**Configuration for Active Clock**
|
||||||
|
|
||||||
* `clock`: A `string`, the `key` of the clock that this configuration applies to.
|
- `clock`: A `string`, the `key` of the clock that this configuration applies to.
|
||||||
* `timeSystem`: A `string`, the key for the time system that this configuration
|
- `timeSystem`: A `string`, the key for the time system that this configuration
|
||||||
relates to. Separate configuration must be provided for each time system that you
|
relates to. Separate configuration must be provided for each time system that you
|
||||||
wish to be available to users when they select the specified clock.
|
wish to be available to users when they select the specified clock.
|
||||||
* `clockOffsets`: A [`clockOffsets`](#clock-offsets) object that will be
|
- `clockOffsets`: A [`clockOffsets`](#clock-offsets) object that will be
|
||||||
automatically applied when the combination of clock and time system specified in
|
automatically applied when the combination of clock and time system specified in
|
||||||
this configuration is selected from the UI.
|
this configuration is selected from the UI.
|
||||||
|
|
||||||
@ -1018,6 +1164,7 @@ A simple indicator with an icon and some text can be created and added with mini
|
|||||||
of this type exposes functions for customizing the text, icon, and style of the indicator.
|
of this type exposes functions for customizing the text, icon, and style of the indicator.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
var myIndicator = openmct.indicators.simpleIndicator();
|
var myIndicator = openmct.indicators.simpleIndicator();
|
||||||
myIndicator.text("Hello World!");
|
myIndicator.text("Hello World!");
|
||||||
@ -1029,20 +1176,20 @@ By default, the indicator will appear as an information icon. Hovering over the
|
|||||||
reveal the text set via the call to `.text()`. The Indicator object returned by the API
|
reveal the text set via the call to `.text()`. The Indicator object returned by the API
|
||||||
call exposes a number of functions for customizing the content and appearance of the indicator:
|
call exposes a number of functions for customizing the content and appearance of the indicator:
|
||||||
|
|
||||||
* `.text([text])`: Gets or sets the text shown when the user hovers over the indicator.
|
- `.text([text])`: Gets or sets the text shown when the user hovers over the indicator.
|
||||||
Accepts an __optional__ `string` argument that, if provided, will be used to set the text.
|
Accepts an **optional** `string` argument that, if provided, will be used to set the text.
|
||||||
Hovering over the indicator will expand it to its full size, revealing this text alongside
|
Hovering over the indicator will expand it to its full size, revealing this text alongside
|
||||||
the icon. Returns the currently set text as a `string`.
|
the icon. Returns the currently set text as a `string`.
|
||||||
* `.description([description])`: Gets or sets the indicator's description. Accepts an
|
- `.description([description])`: Gets or sets the indicator's description. Accepts an
|
||||||
__optional__ `string` argument that, if provided, will be used to set the text. The description
|
**optional** `string` argument that, if provided, will be used to set the text. The description
|
||||||
allows for more detail to be provided in a tooltip when the user hovers over the indicator.
|
allows for more detail to be provided in a tooltip when the user hovers over the indicator.
|
||||||
Returns the currently set text as a `string`.
|
Returns the currently set text as a `string`.
|
||||||
* `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an __optional__
|
- `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an **optional**
|
||||||
`string` parameter to be used to set the class applied to the indicator. Any of
|
`string` parameter to be used to set the class applied to the indicator. Any of
|
||||||
[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs)
|
[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs)
|
||||||
may be used here, or a custom CSS class can be provided. Returns the currently defined CSS
|
may be used here, or a custom CSS class can be provided. Returns the currently defined CSS
|
||||||
class as a `string`.
|
class as a `string`.
|
||||||
* `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional __
|
- `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional__
|
||||||
`string` parameter to be used to set a status class applied to the indicator. May be used to apply
|
`string` parameter to be used to set a status class applied to the indicator. May be used to apply
|
||||||
different colors to indicate status.
|
different colors to indicate status.
|
||||||
|
|
||||||
@ -1069,6 +1216,7 @@ Open MCT provides some built-in priority values that can be used in the applicat
|
|||||||
### Priority Types
|
### Priority Types
|
||||||
|
|
||||||
Currently, the Open MCT Priority API provides (type: numeric value):
|
Currently, the Open MCT Priority API provides (type: numeric value):
|
||||||
|
|
||||||
- HIGH: 1000
|
- HIGH: 1000
|
||||||
- Default: 0
|
- Default: 0
|
||||||
- LOW: -1000
|
- LOW: -1000
|
||||||
|
@ -10,7 +10,7 @@ accept changes from external contributors.
|
|||||||
|
|
||||||
The short version:
|
The short version:
|
||||||
|
|
||||||
1. Write your contribution or describe your idea in the form of an [GitHub issue](https://github.com/nasa/openmct/issues/new/choose) or [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions)
|
1. Write your contribution or describe your idea in the form of a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose) or [start a GitHub discussion](https://github.com/nasa/openmct/discussions).
|
||||||
2. Make sure your contribution meets code, test, and commit message
|
2. Make sure your contribution meets code, test, and commit message
|
||||||
standards as described below.
|
standards as described below.
|
||||||
3. Submit a pull request from a topic branch back to `master`. Include a check
|
3. Submit a pull request from a topic branch back to `master`. Include a check
|
||||||
@ -24,7 +24,7 @@ The short version:
|
|||||||
|
|
||||||
Open MCT uses git for software version control, and for branching and
|
Open MCT uses git for software version control, and for branching and
|
||||||
merging. The central repository is at
|
merging. The central repository is at
|
||||||
https://github.com/nasa/openmct.git.
|
<https://github.com/nasa/openmct.git>.
|
||||||
|
|
||||||
### Roles
|
### Roles
|
||||||
|
|
||||||
@ -116,6 +116,7 @@ the pull request containing the reviewer checklist (from below) and complete
|
|||||||
the merge back to the master branch.
|
the merge back to the master branch.
|
||||||
|
|
||||||
Additionally:
|
Additionally:
|
||||||
|
|
||||||
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
||||||
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
||||||
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
||||||
@ -132,14 +133,15 @@ changes.
|
|||||||
|
|
||||||
### Code Standards
|
### Code Standards
|
||||||
|
|
||||||
JavaScript sources in Open MCT must satisfy the ESLint rules defined in
|
JavaScript sources in Open MCT must satisfy the [ESLint](https://eslint.org/) rules defined in
|
||||||
this repository. This is verified by the command line build.
|
this repository. [Prettier](https://prettier.io/) is used in conjunction with ESLint to enforce code style
|
||||||
|
via automated formatting. These are verified by the command line build.
|
||||||
|
|
||||||
#### Code Guidelines
|
#### Code Guidelines
|
||||||
|
|
||||||
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
||||||
|
|
||||||
1. Write clean code. Here’s a good summary - https://github.com/ryanmcdermott/clean-code-javascript.
|
1. Write clean code. Here’s a good summary - <https://github.com/ryanmcdermott/clean-code-javascript>.
|
||||||
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
||||||
1. Include non-JSDoc comments as-needed for explaining private variables,
|
1. Include non-JSDoc comments as-needed for explaining private variables,
|
||||||
methods, or algorithms when they are non-obvious. Otherwise code
|
methods, or algorithms when they are non-obvious. Otherwise code
|
||||||
@ -159,21 +161,25 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
||||||
1. Named functions are preferred over functions assigned to variables.
|
1. Named functions are preferred over functions assigned to variables.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
function renameObject(object, newName) {
|
function renameObject(object, newName) {
|
||||||
Object.name = newName;
|
Object.name = newName;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const rename = (object, newName) => {
|
const rename = (object, newName) => {
|
||||||
Object.name = newName;
|
Object.name = newName;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Avoid deep nesting (especially of functions), except where necessary
|
1. Avoid deep nesting (especially of functions), except where necessary
|
||||||
(e.g. due to closure scope).
|
(e.g. due to closure scope).
|
||||||
1. End with a single new-line character.
|
1. End with a single new-line character.
|
||||||
1. Always use ES6 `Class`es and inheritence rather than the pre-ES6 prototypal
|
1. Always use ES6 `Class`es and inheritance rather than the pre-ES6 prototypal
|
||||||
pattern.
|
pattern.
|
||||||
1. Within a given function's scope, do not mix declarations and imperative
|
1. Within a given function's scope, do not mix declarations and imperative
|
||||||
code, and present these in the following order:
|
code, and present these in the following order:
|
||||||
@ -182,19 +188,24 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
||||||
1. Avoid the use of "magic" values.
|
1. Avoid the use of "magic" values.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const UNAUTHORIZED = 401;
|
const UNAUTHORIZED = 401;
|
||||||
if (responseCode === UNAUTHORIZED)
|
if (responseCode === UNAUTHORIZED)
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
if (responseCode === 401)
|
if (responseCode === 401)
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
||||||
1. Test specs should reside alongside the source code they test, not in a separate directory.
|
1. Unit Test specs should reside alongside the source code they test, not in a separate directory.
|
||||||
1. Organize code by feature, not by type.
|
1. Organize code by feature, not by type.
|
||||||
eg.
|
eg.
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- row
|
- row
|
||||||
TableRow.js
|
TableRow.js
|
||||||
@ -206,8 +217,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- components
|
- components
|
||||||
TableRow.vue
|
TableRow.vue
|
||||||
@ -219,47 +232,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Deviations from Open MCT code style guidelines require two-party agreement,
|
Deviations from Open MCT code style guidelines require two-party agreement,
|
||||||
typically from the author of the change and its reviewer.
|
typically from the author of the change and its reviewer.
|
||||||
|
|
||||||
### Test Standards
|
|
||||||
|
|
||||||
Automated testing shall occur whenever changes are merged into the main
|
|
||||||
development branch and must be confirmed alongside any pull request.
|
|
||||||
|
|
||||||
Automated tests are tests which exercise plugins, API, and utility classes.
|
|
||||||
Tests are subject to code review along with the actual implementation, to
|
|
||||||
ensure that tests are applicable and useful.
|
|
||||||
|
|
||||||
Examples of useful tests:
|
|
||||||
* Tests which replicate bugs (or their root causes) to verify their
|
|
||||||
resolution.
|
|
||||||
* Tests which reflect details from software specifications.
|
|
||||||
* Tests which exercise edge or corner cases among inputs.
|
|
||||||
* Tests which verify expected interactions with other components in the
|
|
||||||
system.
|
|
||||||
|
|
||||||
#### Guidelines
|
|
||||||
* 100% statement coverage is achievable and desirable.
|
|
||||||
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
|
|
||||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
|
||||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
|
||||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
|
||||||
* Where builtin functions have been mocked, be sure to clear them between tests.
|
|
||||||
* Test at an appropriate level of isolation. Eg.
|
|
||||||
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
|
||||||
* You do not need to test that the view switcher works, there should be separate tests for that.
|
|
||||||
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
|
||||||
* Use your best judgement when deciding on appropriate scope.
|
|
||||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
|
||||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
|
||||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
|
||||||
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
|
|
||||||
|
|
||||||
#### Examples
|
|
||||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
|
||||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
|
||||||
|
|
||||||
### Commit Message Standards
|
### Commit Message Standards
|
||||||
|
|
||||||
Commit messages should:
|
Commit messages should:
|
||||||
@ -295,13 +271,13 @@ these standards.
|
|||||||
|
|
||||||
## Issue Reporting
|
## Issue Reporting
|
||||||
|
|
||||||
Issues are tracked at https://github.com/nasa/openmct/issues.
|
Issues are tracked at <https://github.com/nasa/openmct/issues>.
|
||||||
|
|
||||||
Issue severity is categorized as follows (in ascending order):
|
Issue severity is categorized as follows (in ascending order):
|
||||||
|
|
||||||
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
||||||
* _Medium_: Some impairment of use, but simple workarounds exist
|
* _Medium_: Some impairment of use, but simple workarounds exist
|
||||||
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though.
|
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though. Complex workarounds exist.
|
||||||
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
||||||
|
|
||||||
## Check Lists
|
## Check Lists
|
||||||
@ -310,22 +286,4 @@ The following check lists should be completed and attached to pull requests
|
|||||||
when they are filed (author checklist) and when they are merged (reviewer
|
when they are filed (author checklist) and when they are merged (reviewer
|
||||||
checklist).
|
checklist).
|
||||||
|
|
||||||
### Author Checklist
|
|
||||||
|
|
||||||
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
||||||
|
|
||||||
### Reviewer Checklist
|
|
||||||
|
|
||||||
* [ ] Changes appear to address issue?
|
|
||||||
* [ ] Changes appear not to be breaking changes?
|
|
||||||
* [ ] Appropriate unit tests included?
|
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
|
||||||
* [ ] Commit messages meet standards?
|
|
||||||
* [ ] Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)
|
|
||||||
* [ ] Has associated issue been labelled `bug`? (only applicable if this PR is for a bug fix)
|
|
||||||
* [ ] List of Acceptance Tests Performed.
|
|
||||||
|
|
||||||
Write out a small list of tests performed with just enough detail for another developer on the team
|
|
||||||
to execute.
|
|
||||||
|
|
||||||
i.e. ```When Clicking on Add button, new `object` appears in dropdown.```
|
|
@ -1,6 +1,6 @@
|
|||||||
# Open MCT License
|
# 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-2023, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||||
|
|
||||||
Open MCT is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
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.
|
||||||
|
|
||||||
|
125
README.md
125
README.md
@ -1,50 +1,49 @@
|
|||||||
# 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.
|
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
||||||
|
|
||||||
Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
> [!NOTE]
|
||||||
|
> Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
||||||
|
|
||||||
|
|
||||||
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
||||||
|
|
||||||
## See Open MCT in Action
|

|
||||||
|
|
||||||
Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/).
|
|
||||||

|
|
||||||
|
|
||||||
## Open MCT v2.0.0
|
|
||||||
Support for our legacy bundle-based API, and the libraries that it was built on (like Angular 1.x), have now been removed entirely from this repository.
|
|
||||||
|
|
||||||
For now if you have an Open MCT application that makes use of the legacy API, [a plugin](https://github.com/nasa/openmct-legacy-plugin) is provided that bootstraps the legacy bundling mechanism and API. This plugin will not be maintained over the long term however, and the legacy support plugin will not be tested for compatibility with future versions of Open MCT. It is provided for convenience only.
|
|
||||||
|
|
||||||
### How do I know if I am using legacy API?
|
|
||||||
You might still be using legacy API if your source code
|
|
||||||
|
|
||||||
* Contains files named bundle.js, or bundle.json,
|
|
||||||
* Makes calls to `openmct.$injector()`, or `openmct.$angular`,
|
|
||||||
* Makes calls to `openmct.legacyRegistry`, `openmct.legacyExtension`, or `openmct.legacyBundle`.
|
|
||||||
|
|
||||||
|
|
||||||
### 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.
|
|
||||||
|
|
||||||
## Building and Running Open MCT Locally
|
## Building and Running Open MCT Locally
|
||||||
|
|
||||||
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
||||||
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
||||||
|
|
||||||
1. Clone the source code
|
1. Clone the source code:
|
||||||
|
|
||||||
`git clone https://github.com/nasa/openmct.git`
|
```
|
||||||
|
git clone https://github.com/nasa/openmct.git
|
||||||
|
```
|
||||||
|
|
||||||
2. Install development dependencies. Note: Check the package.json engine for our tested and supported node versions.
|
2. (Optional) Install the correct node version using [nvm](https://github.com/nvm-sh/nvm):
|
||||||
|
|
||||||
`npm install`
|
```
|
||||||
|
nvm install
|
||||||
|
```
|
||||||
|
|
||||||
3. Run a local development server
|
3. Install development dependencies (Note: Check the `package.json` engine for our tested and supported node versions):
|
||||||
|
|
||||||
`npm start`
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
4. Run a local development server:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
||||||
|
|
||||||
|
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
@ -56,19 +55,23 @@ The clearest examples for developing Open MCT plugins are in the
|
|||||||
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
||||||
our documentation.
|
our documentation.
|
||||||
|
|
||||||
We want Open MCT to be as easy to use, install, run, and develop for as
|
> [!NOTE]
|
||||||
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
> We want Open MCT to be as easy to use, install, run, and develop for as
|
||||||
|
> possible, and your feedback will help us get there!
|
||||||
|
> Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose),
|
||||||
|
> [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions),
|
||||||
|
> or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
||||||
|
|
||||||
## Building Applications With Open MCT
|
## Developing Applications With Open MCT
|
||||||
|
|
||||||
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
For more on developing with Open MCT, see our documentation for a guide on [Developing Applications with Open MCT](./API.md#starting-an-open-mct-application).
|
||||||
|
|
||||||
See our documentation for a guide on [building Applications with Open MCT](https://github.com/nasa/openmct/blob/master/API.md#starting-an-open-mct-application).
|
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
||||||
|
|
||||||
|
The project uses `nvm` to ensure the node and npm version used, is coherent in all projects. Install nvm (non-windows), [here](https://github.com/nvm-sh/nvm) or the windows equivalent [here](https://github.com/coreybutler/nvm-windows)
|
||||||
|
|
||||||
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
@ -80,11 +83,14 @@ that is intended to be added or removed as a single unit.
|
|||||||
As well as providing an extension mechanism, most of the core Open MCT codebase is also
|
As well as providing an extension mechanism, most of the core Open MCT codebase is also
|
||||||
written as plugins.
|
written as plugins.
|
||||||
|
|
||||||
For information on writing plugins, please see [our API documentation](https://github.com/nasa/openmct/blob/master/API.md#plugins).
|
For information on writing plugins, please see [our API documentation](./API.md#plugins).
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
Tests are written for [Jasmine 3](https://jasmine.github.io/api/3.1/global)
|
Our automated test coverage comes in the form of unit, e2e, visual, performance, and security tests.
|
||||||
|
|
||||||
|
### Unit Tests
|
||||||
|
Unit Tests are written for [Jasmine](https://jasmine.github.io/api/edge/global)
|
||||||
and run by [Karma](http://karma-runner.github.io). To run:
|
and run by [Karma](http://karma-runner.github.io). To run:
|
||||||
|
|
||||||
`npm test`
|
`npm test`
|
||||||
@ -93,16 +99,33 @@ The test suite is configured to load any scripts ending with `Spec.js` found
|
|||||||
in the `src` hierarchy. Full configuration details are found in
|
in the `src` hierarchy. Full configuration details are found in
|
||||||
`karma.conf.js`. By convention, unit test scripts should be located
|
`karma.conf.js`. By convention, unit test scripts should be located
|
||||||
alongside the units that they test; for example, `src/foo/Bar.js` would be
|
alongside the units that they test; for example, `src/foo/Bar.js` would be
|
||||||
tested by `src/foo/BarSpec.js`. (For legacy reasons, some existing tests may
|
tested by `src/foo/BarSpec.js`.
|
||||||
be located in separate `test` folders near the units they test, but the
|
|
||||||
naming convention is otherwise the same.)
|
|
||||||
|
|
||||||
### Test Reporting
|
### e2e, Visual, and Performance tests
|
||||||
|
The e2e, Visual, and Performance tests are written for playwright and run by playwright's new test runner [@playwright/test](https://playwright.dev/).
|
||||||
|
|
||||||
When `npm test` is run, test results will be written as HTML to
|
To run the e2e tests which are part of every commit:
|
||||||
`dist/reports/tests/`. Code coverage information is written to `dist/reports/coverage`.
|
|
||||||
|
|
||||||
Code Coverage Reports are available from [codecov.io](https://app.codecov.io/gh/nasa/openmct/)
|
`npm run test:e2e:stable`
|
||||||
|
|
||||||
|
To run the visual test suite:
|
||||||
|
|
||||||
|
`npm run test:e2e:visual`
|
||||||
|
|
||||||
|
To run the performance tests:
|
||||||
|
|
||||||
|
`npm run test:perf`
|
||||||
|
|
||||||
|
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/). 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
|
||||||
|
|
||||||
|
Each test suite generates a report in CircleCI. For a complete overview of testing functionality, please see our [Circle CI Test Insights Dashboard](https://app.circleci.com/insights/github/nasa/openmct/workflows/the-nightly/overview?branch=master&reporting-window=last-30-days)
|
||||||
|
|
||||||
|
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/)
|
||||||
|
|
||||||
# Glossary
|
# Glossary
|
||||||
|
|
||||||
@ -143,3 +166,19 @@ documentation, may presume an understanding of these terms.
|
|||||||
user makes another such choice.)
|
user makes another such choice.)
|
||||||
* _namespace_: A name used to identify a persistence store. A running open MCT
|
* _namespace_: A name used to identify a persistence store. A running open MCT
|
||||||
application could potentially use multiple persistence stores, with the
|
application could potentially use multiple persistence stores, with the
|
||||||
|
|
||||||
|
## Open MCT v2.0.0
|
||||||
|
Support for our legacy bundle-based API, and the libraries that it was built on (like Angular 1.x), have now been removed entirely from this repository.
|
||||||
|
|
||||||
|
For now if you have an Open MCT application that makes use of the legacy API, [a plugin](https://github.com/nasa/openmct-legacy-plugin) is provided that bootstraps the legacy bundling mechanism and API. This plugin will not be maintained over the long term however, and the legacy support plugin will not be tested for compatibility with future versions of Open MCT. It is provided for convenience only.
|
||||||
|
|
||||||
|
### How do I know if I am using legacy API?
|
||||||
|
You might still be using legacy API if your source code
|
||||||
|
|
||||||
|
* Contains files named bundle.js, or bundle.json,
|
||||||
|
* Makes calls to `openmct.$injector()`, or `openmct.$angular`,
|
||||||
|
* Makes calls to `openmct.legacyRegistry`, `openmct.legacyExtension`, or `openmct.legacyBundle`.
|
||||||
|
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
50
TESTING.md
Normal file
50
TESTING.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
* 100% statement coverage is achievable and desirable.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### Limitations in our code coverage reporting
|
||||||
|
|
||||||
|
Our code coverage implementation has two known limitations:
|
||||||
|
- [Variability and accuracy](https://github.com/nasa/openmct/issues/5811)
|
||||||
|
- [Vue instrumentation](https://github.com/nasa/openmct/issues/4973)
|
84
app.js
84
app.js
@ -1,84 +0,0 @@
|
|||||||
/*global process*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Usage:
|
|
||||||
*
|
|
||||||
* npm install minimist express
|
|
||||||
* node app.js [options]
|
|
||||||
*/
|
|
||||||
|
|
||||||
const options = require('minimist')(process.argv.slice(2));
|
|
||||||
const express = require('express');
|
|
||||||
const app = express();
|
|
||||||
const fs = require('fs');
|
|
||||||
const request = require('request');
|
|
||||||
|
|
||||||
// Defaults
|
|
||||||
options.port = options.port || options.p || 8080;
|
|
||||||
options.host = options.host || 'localhost';
|
|
||||||
options.directory = options.directory || options.D || '.';
|
|
||||||
|
|
||||||
// Show command line options
|
|
||||||
if (options.help || options.h) {
|
|
||||||
console.log("\nUsage: node app.js [options]\n");
|
|
||||||
console.log("Options:");
|
|
||||||
console.log(" --help, -h Show this message.");
|
|
||||||
console.log(" --port, -p <number> Specify port.");
|
|
||||||
console.log(" --directory, -D <bundle> Serve files from specified directory.");
|
|
||||||
console.log("");
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
app.disable('x-powered-by');
|
|
||||||
|
|
||||||
app.use('/proxyUrl', function proxyRequest(req, res, next) {
|
|
||||||
console.log('Proxying request to: ', req.query.url);
|
|
||||||
req.pipe(request({
|
|
||||||
url: req.query.url,
|
|
||||||
strictSSL: false
|
|
||||||
}).on('error', next)).pipe(res);
|
|
||||||
});
|
|
||||||
|
|
||||||
class WatchRunPlugin {
|
|
||||||
apply(compiler) {
|
|
||||||
compiler.hooks.emit.tapAsync('WatchRunPlugin', (compilation, callback) => {
|
|
||||||
console.log('Begin compile at ' + new Date());
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const webpack = require('webpack');
|
|
||||||
const webpackConfig = require('./webpack.dev.js');
|
|
||||||
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
|
||||||
webpackConfig.plugins.push(new WatchRunPlugin());
|
|
||||||
|
|
||||||
webpackConfig.entry.openmct = [
|
|
||||||
'webpack-hot-middleware/client?reload=true',
|
|
||||||
webpackConfig.entry.openmct
|
|
||||||
];
|
|
||||||
|
|
||||||
const compiler = webpack(webpackConfig);
|
|
||||||
|
|
||||||
app.use(require('webpack-dev-middleware')(
|
|
||||||
compiler,
|
|
||||||
{
|
|
||||||
publicPath: '/dist',
|
|
||||||
stats: 'errors-warnings'
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
app.use(require('webpack-hot-middleware')(
|
|
||||||
compiler,
|
|
||||||
{}
|
|
||||||
));
|
|
||||||
|
|
||||||
// Expose index.html for development users.
|
|
||||||
app.get('/', function (req, res) {
|
|
||||||
fs.createReadStream('index.html').pipe(res);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finally, open the HTTP server and log the instance to the console
|
|
||||||
app.listen(options.port, options.host, function () {
|
|
||||||
console.log('Open MCT application running at %s:%s', options.host, options.port);
|
|
||||||
});
|
|
@ -1,9 +0,0 @@
|
|||||||
// This is a Babel config that webpack.coverage.js uses in order to instrument
|
|
||||||
// code with coverage instrumentation.
|
|
||||||
const babelConfig = {
|
|
||||||
plugins: [['babel-plugin-istanbul', {
|
|
||||||
extension: ['.js', '.vue']
|
|
||||||
}]]
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = babelConfig;
|
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#* Open MCT, Copyright (c) 2014-2022, United States Government
|
#* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
#* as represented by the Administrator of the National Aeronautics and Space
|
#* as represented by the Administrator of the National Aeronautics and Space
|
||||||
#* Administration. All rights reserved.
|
#* Administration. All rights reserved.
|
||||||
#*
|
#*
|
||||||
|
21
codecov.yml
21
codecov.yml
@ -11,19 +11,18 @@ coverage:
|
|||||||
informational: true
|
informational: true
|
||||||
precision: 2
|
precision: 2
|
||||||
round: down
|
round: down
|
||||||
range: "66...100"
|
range: '66...100'
|
||||||
|
|
||||||
ignore:
|
flags:
|
||||||
|
unit:
|
||||||
parsers:
|
carryforward: false
|
||||||
gcov:
|
e2e-stable:
|
||||||
branch_detection:
|
carryforward: false
|
||||||
conditional: true
|
e2e-full:
|
||||||
loop: true
|
carryforward: true
|
||||||
method: false
|
|
||||||
macro: false
|
|
||||||
|
|
||||||
comment:
|
comment:
|
||||||
layout: "reach,diff,flags,files,footer"
|
layout: 'diff,flags,files,footer'
|
||||||
behavior: default
|
behavior: default
|
||||||
require_changes: false
|
require_changes: false
|
||||||
|
show_carryforward_flags: true
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
Open MCT, Copyright (c) 2014-2022, United States Government
|
Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
as represented by the Administrator of the National Aeronautics and Space
|
as represented by the Administrator of the National Aeronautics and Space
|
||||||
Administration. All rights reserved.
|
Administration. All rights reserved.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<hr>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
209
docs/gendocs.js
209
docs/gendocs.js
@ -1,209 +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.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*global require,process,__dirname,GLOBAL*/
|
|
||||||
/*jslint nomen: false */
|
|
||||||
|
|
||||||
|
|
||||||
// Usage:
|
|
||||||
// node gendocs.js --in <source directory> --out <dest directory>
|
|
||||||
|
|
||||||
var CONSTANTS = {
|
|
||||||
DIAGRAM_WIDTH: 800,
|
|
||||||
DIAGRAM_HEIGHT: 500
|
|
||||||
},
|
|
||||||
TOC_HEAD = "# Table of Contents";
|
|
||||||
|
|
||||||
GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be defined
|
|
||||||
(function () {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var fs = require("fs"),
|
|
||||||
mkdirp = require("mkdirp"),
|
|
||||||
path = require("path"),
|
|
||||||
glob = require("glob"),
|
|
||||||
marked = require("marked"),
|
|
||||||
split = require("split"),
|
|
||||||
stream = require("stream"),
|
|
||||||
nomnoml = require('nomnoml'),
|
|
||||||
toc = require("markdown-toc"),
|
|
||||||
Canvas = require('canvas'),
|
|
||||||
header = fs.readFileSync(path.resolve(__dirname, 'header.html')),
|
|
||||||
footer = fs.readFileSync(path.resolve(__dirname, 'footer.html')),
|
|
||||||
options = require("minimist")(process.argv.slice(2));
|
|
||||||
|
|
||||||
// Convert from nomnoml source to a target PNG file.
|
|
||||||
function renderNomnoml(source, target) {
|
|
||||||
var canvas =
|
|
||||||
new Canvas(CONSTANTS.DIAGRAM_WIDTH, CONSTANTS.DIAGRAM_HEIGHT);
|
|
||||||
nomnoml.draw(canvas, source, 1.0);
|
|
||||||
canvas.pngStream().pipe(fs.createWriteStream(target));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stream transform.
|
|
||||||
// Pulls out nomnoml diagrams from fenced code blocks and renders them
|
|
||||||
// as PNG files in the output directory, prefixed with a provided name.
|
|
||||||
// The fenced code blocks will be replaced with Markdown in the
|
|
||||||
// output of this stream.
|
|
||||||
function nomnomlifier(outputDirectory, prefix) {
|
|
||||||
var transform = new stream.Transform({ objectMode: true }),
|
|
||||||
isBuilding = false,
|
|
||||||
counter = 1,
|
|
||||||
outputPath,
|
|
||||||
source = "";
|
|
||||||
|
|
||||||
transform._transform = function (chunk, encoding, done) {
|
|
||||||
if (!isBuilding) {
|
|
||||||
if (chunk.trim().indexOf("```nomnoml") === 0) {
|
|
||||||
var outputFilename = prefix + '-' + counter + '.png';
|
|
||||||
outputPath = path.join(outputDirectory, outputFilename);
|
|
||||||
this.push([
|
|
||||||
"\n\n\n"
|
|
||||||
].join(""));
|
|
||||||
isBuilding = true;
|
|
||||||
source = "";
|
|
||||||
counter += 1;
|
|
||||||
} else {
|
|
||||||
// Otherwise, pass through
|
|
||||||
this.push(chunk + '\n');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (chunk.trim() === "```") {
|
|
||||||
// End nomnoml
|
|
||||||
renderNomnoml(source, outputPath);
|
|
||||||
isBuilding = false;
|
|
||||||
} else {
|
|
||||||
source += chunk + '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
|
|
||||||
return transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert from Github-flavored Markdown to HTML
|
|
||||||
function gfmifier(renderTOC) {
|
|
||||||
var transform = new stream.Transform({ objectMode: true }),
|
|
||||||
markdown = "";
|
|
||||||
transform._transform = function (chunk, encoding, done) {
|
|
||||||
markdown += chunk;
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
transform._flush = function (done) {
|
|
||||||
if (renderTOC){
|
|
||||||
// Prepend table of contents
|
|
||||||
markdown =
|
|
||||||
[ TOC_HEAD, toc(markdown).content, "", markdown ].join("\n");
|
|
||||||
}
|
|
||||||
this.push(header);
|
|
||||||
this.push(marked(markdown));
|
|
||||||
this.push(footer);
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
return transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom renderer for marked; converts relative links from md to html,
|
|
||||||
// and makes headings linkable.
|
|
||||||
function CustomRenderer() {
|
|
||||||
var renderer = new marked.Renderer(),
|
|
||||||
customRenderer = Object.create(renderer);
|
|
||||||
customRenderer.heading = function (text, level) {
|
|
||||||
var escapedText = (text || "").trim().toLowerCase().replace(/\W/g, "-"),
|
|
||||||
aOpen = "<a name=\"" + escapedText + "\" href=\"#" + escapedText + "\">",
|
|
||||||
aClose = "</a>";
|
|
||||||
return aOpen + renderer.heading.apply(renderer, arguments) + aClose;
|
|
||||||
};
|
|
||||||
// Change links to .md files to .html
|
|
||||||
customRenderer.link = function (href, title, text) {
|
|
||||||
// ...but only if they look like relative paths
|
|
||||||
return (href || "").indexOf(":") === -1 && href[0] !== "/" ?
|
|
||||||
renderer.link(href.replace(/\.md/, ".html"), title, text) :
|
|
||||||
renderer.link.apply(renderer, arguments);
|
|
||||||
};
|
|
||||||
return customRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
options['in'] = options['in'] || options.i;
|
|
||||||
options.out = options.out || options.o;
|
|
||||||
|
|
||||||
marked.setOptions({
|
|
||||||
renderer: new CustomRenderer(),
|
|
||||||
gfm: true,
|
|
||||||
tables: true,
|
|
||||||
breaks: false,
|
|
||||||
pedantic: false,
|
|
||||||
sanitize: true,
|
|
||||||
smartLists: true,
|
|
||||||
smartypants: false
|
|
||||||
});
|
|
||||||
|
|
||||||
// Convert all markdown files.
|
|
||||||
// First, pull out nomnoml diagrams.
|
|
||||||
// Then, convert remaining Markdown to HTML.
|
|
||||||
glob(options['in'] + "/**/*.md", {}, function (err, files) {
|
|
||||||
files.forEach(function (file) {
|
|
||||||
var destination = file.replace(options['in'], options.out)
|
|
||||||
.replace(/md$/, "html"),
|
|
||||||
destPath = path.dirname(destination),
|
|
||||||
prefix = path.basename(destination).replace(/\.html$/, ""),
|
|
||||||
//Determine whether TOC should be rendered for this file based
|
|
||||||
//on regex provided as command line option
|
|
||||||
renderTOC = file.match(options['suppress-toc'] || "") === null;
|
|
||||||
|
|
||||||
mkdirp(destPath, function (err) {
|
|
||||||
fs.createReadStream(file, { encoding: 'utf8' })
|
|
||||||
.pipe(split())
|
|
||||||
.pipe(nomnomlifier(destPath, prefix))
|
|
||||||
.pipe(gfmifier(renderTOC))
|
|
||||||
.pipe(fs.createWriteStream(destination, {
|
|
||||||
encoding: 'utf8'
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Also copy over all HTML, CSS, or PNG files
|
|
||||||
glob(options['in'] + "/**/*.@(html|css|png)", {}, function (err, files) {
|
|
||||||
files.forEach(function (file) {
|
|
||||||
var destination = file.replace(options['in'], options.out),
|
|
||||||
destPath = path.dirname(destination),
|
|
||||||
streamOptions = {};
|
|
||||||
if (file.match(/png$/)) {
|
|
||||||
streamOptions.encoding = null;
|
|
||||||
} else {
|
|
||||||
streamOptions.encoding = 'utf8';
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdirp(destPath, function (err) {
|
|
||||||
fs.createReadStream(file, streamOptions)
|
|
||||||
.pipe(fs.createWriteStream(destination, streamOptions));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}());
|
|
@ -1,9 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="//nasa.github.io/openmct/static/res/css/styles.css">
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="//nasa.github.io/openmct/static/res/css/documentation.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
## Sections
|
## Sections
|
||||||
|
|
||||||
* The [API](api/) document is generated from inline documentation
|
* The [API](api/) uses inline documentation
|
||||||
using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
|
using [TypeScript](https://www.typescriptlang.org) and some legacy [JSDoc](https://jsdoc.app/). It describes the JavaScript objects and
|
||||||
functions that make up the software platform.
|
functions that make up the software platform.
|
||||||
|
|
||||||
* The [Development Process](process/) document describes the
|
* The [Development Process](process/) document describes the
|
||||||
|
@ -53,7 +53,7 @@ requirements.
|
|||||||
|
|
||||||
Additionally, the following project-specific standards will be used:
|
Additionally, the following project-specific standards will be used:
|
||||||
|
|
||||||
* During development, a "-SNAPSHOT" suffix shall be appended to the
|
* During development, a "-next" suffix shall be appended to the
|
||||||
version number. The version number before the suffix shall reflect
|
version number. The version number before the suffix shall reflect
|
||||||
the next expected version number for release.
|
the next expected version number for release.
|
||||||
* Prior to a 1.0.0 release, the _minor_ version will be incremented
|
* Prior to a 1.0.0 release, the _minor_ version will be incremented
|
||||||
@ -93,7 +93,7 @@ numbers by the following process:
|
|||||||
|
|
||||||
1. Update version number in `package.json`
|
1. Update version number in `package.json`
|
||||||
1. Checkout branch created for the last sprint that has been successfully tested.
|
1. Checkout branch created for the last sprint that has been successfully tested.
|
||||||
2. Remove a `-SNAPSHOT` suffix from the version in `package.json`.
|
2. Remove a `-next` suffix from the version in `package.json`.
|
||||||
3. Verify that resulting version number meets semantic versioning
|
3. Verify that resulting version number meets semantic versioning
|
||||||
requirements relative to previous stable version. Increment the
|
requirements relative to previous stable version. Increment the
|
||||||
version number if necessary.
|
version number if necessary.
|
||||||
@ -138,7 +138,7 @@ numbers by the following process:
|
|||||||
1. Create a new branch off the `master` branch.
|
1. Create a new branch off the `master` branch.
|
||||||
2. Remove any suffix from the version number,
|
2. Remove any suffix from the version number,
|
||||||
or increment the _patch_ version if there is no suffix.
|
or increment the _patch_ version if there is no suffix.
|
||||||
3. Append a `-SNAPSHOT` suffix.
|
3. Append a `-next` suffix.
|
||||||
4. Commit changes to `package.json` on the `master` branch.
|
4. Commit changes to `package.json` on the `master` branch.
|
||||||
The commit message should reference the sprint being opened,
|
The commit message should reference the sprint being opened,
|
||||||
preferably by a URL reference to the associated Milestone in
|
preferably by a URL reference to the associated Milestone in
|
||||||
@ -150,6 +150,6 @@ numbers by the following process:
|
|||||||
Projects dependent on Open MCT being co-developed by the Open MCT
|
Projects dependent on Open MCT being co-developed by the Open MCT
|
||||||
team should follow a similar process, except that they should
|
team should follow a similar process, except that they should
|
||||||
additionally update their dependency on Open MCT to point to the
|
additionally update their dependency on Open MCT to point to the
|
||||||
latest archive when removing their `-SNAPSHOT` status, and
|
latest archive when removing their `-next` status, and
|
||||||
that they should be pointed back to the `master` branch after
|
that they should be pointed back to the `master` branch after
|
||||||
this has completed.
|
this has completed.
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"extends": ["plugin:playwright/playwright-test"],
|
extends: ['plugin:playwright/playwright-test'],
|
||||||
"overrides": [
|
rules: {
|
||||||
|
'playwright/max-nested-describe': ['error', { max: 1 }]
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
{
|
{
|
||||||
"files": ["tests/visual/*.spec.js"],
|
files: ['tests/visual/*.spec.js'],
|
||||||
"rules": {
|
rules: {
|
||||||
"playwright/no-wait-for-timeout": "off"
|
'playwright/no-wait-for-timeout': 'off'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
24
e2e/.percy.ci.yml
Normal file
24
e2e/.percy.ci.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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;
|
||||||
|
}
|
24
e2e/.percy.nightly.yml
Normal file
24
e2e/.percy.nightly.yml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
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;
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
version: 2
|
|
||||||
snapshot:
|
|
||||||
widths: [1024, 2000]
|
|
||||||
min-height: 1440 # px
|
|
||||||
|
|
555
e2e/README.md
Normal file
555
e2e/README.md
Normal file
@ -0,0 +1,555 @@
|
|||||||
|
# e2e testing
|
||||||
|
|
||||||
|
This document captures information specific to the e2e testing of Open MCT. For general information about testing, please see [the Open MCT README](https://github.com/nasa/openmct/blob/master/README.md#tests).
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
This document is designed to capture on the What, Why, and How's of writing and running e2e tests in Open MCT. Please use the built-in Github Table of Contents functionality at the top left of this page or the markup.
|
||||||
|
|
||||||
|
1. [Getting Started](#getting-started)
|
||||||
|
2. [Types of Testing](#types-of-e2e-testing)
|
||||||
|
3. [Architecture](#test-architecture-and-ci)
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
While our team does our best to lower the barrier to entry to working with our e2e framework and Open MCT, there is a bit of work required to get from 0 to 1 test contributed.
|
||||||
|
|
||||||
|
### Getting started with Playwright
|
||||||
|
|
||||||
|
If this is your first time ever using the Playwright framework, we recommend going through the [Getting Started Guide](https://playwright.dev/docs/next/intro) which can be completed in about 15 minutes. This will give you a concise tour of Playwright's functionality and an understanding of the official Playwright documentation which we leverage in Open MCT.
|
||||||
|
|
||||||
|
### Getting started with Open MCT's implementation of Playwright
|
||||||
|
|
||||||
|
Once you've got an understanding of Playwright, you'll need a baseline understanding of Open MCT:
|
||||||
|
|
||||||
|
1. Follow the steps [Building and Running Open MCT Locally](../README.md#building-and-running-open-mct-locally)
|
||||||
|
2. Once you're serving Open MCT locally, create a 'Display Layout' object. Save it.
|
||||||
|
3. Create a 'Plot' Object (e.g.: 'Stacked Plot')
|
||||||
|
4. Create an Example Telemetry Object (e.g.: 'Sine Wave Generator')
|
||||||
|
5. Expand the Tree and note the hierarchy of objects which were created.
|
||||||
|
6. Navigate to the Demo Display Layout Object to edit and modify the embedded plot.
|
||||||
|
7. Modify the embedded plot with Telemetry Data.
|
||||||
|
|
||||||
|
What you've created is a display which mimics the display that a mission control operator might use to understand and model telemetry data.
|
||||||
|
|
||||||
|
Recreate the steps above with Playwright's codegen tool:
|
||||||
|
|
||||||
|
1. `npm run start` in a terminal window to serve Open MCT locally
|
||||||
|
2. `npx @playwright/test install` to install playwright and dependencies
|
||||||
|
3. Open another terminal window and start the Playwright codegen application `npx playwright codegen`
|
||||||
|
4. Navigate the browser to `http://localhost:8080`
|
||||||
|
5. Click the Create button and notice how your actions in the browser are being recorded in the Playwright Inspector
|
||||||
|
6. Continue through the steps 2-6 above
|
||||||
|
|
||||||
|
What you've created is an automated test which mimics the creation of a mission control display.
|
||||||
|
|
||||||
|
Next, you should walk through our implementation of Playwright in Open MCT:
|
||||||
|
|
||||||
|
1. Close any terminals which are serving up a local instance of Open MCT
|
||||||
|
2. Run our 'Getting Started' test in debug mode with `npm run test:e2e:local -- exampleTemplate --debug`
|
||||||
|
3. Step through each test step in the Playwright Inspector to see how we leverage Playwright's capabilities to test 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:
|
||||||
|
|
||||||
|
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.**
|
||||||
|
|
||||||
|
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".
|
||||||
|
|
||||||
|
We do not want to interleave visual and functional testing inside the same suite because visual test verification of correctness must happen with a 3rd party service. This service is not available when executing these tests in other contexts (i.e. VIPER).
|
||||||
|
|
||||||
|
### Functional Testing
|
||||||
|
|
||||||
|
The bulk of our e2e coverage lies in "functional" test coverage which verifies that Open MCT is functionally correct as well as defining _how we expect it to behave_. This enables us to test the application exactly as a user would, while prescribing exactly how a user can interact with the application via a web browser.
|
||||||
|
|
||||||
|
### Visual Testing
|
||||||
|
|
||||||
|
Visual Testing is an essential part of our e2e strategy as it ensures that the application _appears_ correctly to a user while it compliments the functional e2e suite. It would be impractical to make thousands of assertions functional assertions on the look and feel of the application. Visual testing is interested in getting the DOM into a specified state and then comparing that it has not changed against a baseline.
|
||||||
|
|
||||||
|
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` 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).
|
||||||
|
|
||||||
|
At present, we are using percy with two configuration files: `./e2e/.percy.nightly.yml` and `./e2e/.percy.ci.yml`. This is mainly to reduce the number of snapshots.
|
||||||
|
|
||||||
|
### Advanced: Snapshot Testing (Not Recommended)
|
||||||
|
|
||||||
|
While snapshot testing offers a precise way to detect changes in your application without relying on third-party services like Percy.io, we've found that it doesn't offer any advantages over visual testing in our use-cases. Therefore, snapshot testing is **not recommended** for further implementation.
|
||||||
|
|
||||||
|
#### CI vs Manual Checks
|
||||||
|
Snapshot tests can be reliably executed in Continuous Integration (CI) environments but lack the manual oversight provided by visual testing platforms like Percy.io. This means they may miss issues that a human reviewer could catch during manual checks.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
A single visual test assertion in Percy.io can be executed across 10 different browser and resolution combinations without additional setup, providing comprehensive testing with minimal configuration. In contrast, a snapshot test is restricted to a single OS and browser resolution, requiring more effort to achieve the same level of coverage.
|
||||||
|
|
||||||
|
|
||||||
|
#### Further Reading
|
||||||
|
For those interested in the mechanics of snapshot testing with Playwright, you can refer to the [Playwright Snapshots Documentation](https://playwright.dev/docs/test-snapshots). However, keep in mind that we do not recommend using this approach.
|
||||||
|
|
||||||
|
|
||||||
|
#### 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. To do a valid comparison locally:
|
||||||
|
|
||||||
|
```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
|
||||||
|
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot
|
||||||
|
```
|
||||||
|
|
||||||
|
### Updating Snapshots
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
## Performance Testing
|
||||||
|
|
||||||
|
The open source performance tests function in three ways which match their naming and folder structure:
|
||||||
|
|
||||||
|
`./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.
|
||||||
|
|
||||||
|
## Test Architecture and CI
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
|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/` | Visual tests.|
|
||||||
|
|`./tests/visual/component/` | Visual 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`.
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
Where possible, we try to run Open MCT without modification or configuration change so that the Open MCT doesn't fail exclusively in "test mode" or in "production mode".
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|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.config.js` | Used to run the visual tests in CI or locally|
|
||||||
|
|
||||||
|
#### Test Tags
|
||||||
|
|
||||||
|
Test tags are a great way of organizing tests outside of a file structure. To learn more see the official documentation [here](https://playwright.dev/docs/test-annotations#tag-tests).
|
||||||
|
|
||||||
|
Current list of test tags:
|
||||||
|
|
||||||
|
|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).|
|
||||||
|
|`@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.|
|
||||||
|
|`@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
|
||||||
|
|
||||||
|
The cheapest time to catch a bug is pre-merge. Unfortuantely, this is the most expensive time to run all of the tests since each merge event can consist of hundreds of commits. For this reason, we're selective in _what we run_ as much as _when we run it_.
|
||||||
|
|
||||||
|
We leverage CircleCI to run tests against each commit and inject the Test Reports which are generated by Playwright so that they team can keep track of flaky and [historical test trends](https://app.circleci.com/insights/github/nasa/openmct/workflows/overall-circleci-commit-status/tests?branch=master&reporting-window=last-30-days)
|
||||||
|
|
||||||
|
We leverage Github Actions / Workflows to execute tests as it gives us the ability to run against multiple operating systems with greater control over git event triggers (i.e. Run on a PR Comment event).
|
||||||
|
|
||||||
|
Our CI environment consists of 3 main modes of operation:
|
||||||
|
|
||||||
|
#### 1. Per-Commit Testing
|
||||||
|
|
||||||
|
CircleCI
|
||||||
|
|
||||||
|
- Stable e2e tests against ubuntu and chrome
|
||||||
|
- Performance tests against ubuntu and chrome
|
||||||
|
- e2e tests are linted
|
||||||
|
- Visual 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'
|
||||||
|
- 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, firefox, and an MMOC resolution profile
|
||||||
|
- Performance tests against ubuntu and chrome
|
||||||
|
- CouchDB suite
|
||||||
|
- Visual Tests are run in the full profile
|
||||||
|
|
||||||
|
Github Actions / Workflow
|
||||||
|
|
||||||
|
- None at the moment
|
||||||
|
|
||||||
|
#### Parallelism and Fast Feedback
|
||||||
|
|
||||||
|
In order to provide fast feedback in the Per-Commit context, we try to keep total test feedback at 5 minutes or less. That is to say, A developer should have a pass/fail result in under 5 minutes.
|
||||||
|
|
||||||
|
Playwright has native support for semi-intelligent sharding. Read about it [here](https://playwright.dev/docs/test-parallel#shard-tests-between-multiple-machines).
|
||||||
|
|
||||||
|
We will be adjusting the parallelization of the Per-Commit tests to keep below the 5 minute total runtime threshold.
|
||||||
|
|
||||||
|
In addition to the Parallelization of Test Runners (Sharding), we're also running two concurrent threads on every Shard. This is the functional limit of what CircelCI Agents can support from a memory and CPU resource constraint.
|
||||||
|
|
||||||
|
So for every commit, Playwright is effectively running 4 x 2 concurrent browsercontexts to keep the overall runtime to a miminum.
|
||||||
|
|
||||||
|
At the same time, we don't want to waste CI resources on parallel runs, so we've configured each shard to fail after 5 test failures. Test failure logs are recorded and stored to allow fast triage.
|
||||||
|
|
||||||
|
#### Test Promotion
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
A testcase and testsuite are to be unmarked as @unstable when:
|
||||||
|
|
||||||
|
1. They run as part of "full" run 5 times without failure.
|
||||||
|
2. They've been by a Open MCT Developer 5 times in the closed source repo without failure.
|
||||||
|
|
||||||
|
### Cross-browser and Cross-operating system
|
||||||
|
|
||||||
|
#### **What's supported:**
|
||||||
|
|
||||||
|
We are leveraging the `browserslist` project to declare our supported list of browsers. We support macOS, Windows, and ubuntu 20+.
|
||||||
|
|
||||||
|
#### **Where it's tested:**
|
||||||
|
|
||||||
|
We lint on `browserslist` to ensure that we're not implementing deprecated browser APIs and are aware of browser API improvements over time.
|
||||||
|
|
||||||
|
We also have the need to execute our e2e tests across this published list of browsers. Our browsers and browser version matrix is found inside of our `./playwright-*.config.js`, but mostly follows in order of bleeding edge to stable:
|
||||||
|
|
||||||
|
- `playwright-chromium channel:beta`
|
||||||
|
- A beta version of Chromium from official chromium channels. As close to the bleeding edge as we can get.
|
||||||
|
- `playwright-chromium`
|
||||||
|
- 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**):
|
||||||
|
|
||||||
|
```js
|
||||||
|
test('Can adjust image brightness/contrast by dragging the sliders', 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');
|
||||||
|
|
||||||
|
// ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Conditionally skipping tests based on OS:
|
||||||
|
|
||||||
|
```js
|
||||||
|
test('Can adjust image brightness/contrast by dragging the sliders', async ({ page }) => {
|
||||||
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
|
test.skip(process.platform === 'darwin', 'This test needs to be updated to work with MacOS');
|
||||||
|
|
||||||
|
// ...
|
||||||
|
```
|
||||||
|
|
||||||
|
Skipping based on browser version (Rarely used): <https://github.com/microsoft/playwright/discussions/17318>
|
||||||
|
|
||||||
|
## Test Design, Best Practices, and Tips & Tricks
|
||||||
|
|
||||||
|
### Test Design
|
||||||
|
|
||||||
|
#### Test as the User
|
||||||
|
|
||||||
|
In general, strive to test only through the UI as a user would. As stated in the [Playwright Best Practices](https://playwright.dev/docs/best-practices#test-user-visible-behavior):
|
||||||
|
|
||||||
|
> "Automated tests should verify that the application code works for the end users, and avoid relying on implementation details such as things which users will not typically use, see, or even know about such as the name of a function, whether something is an array, or the CSS class of some element. The end user will see or interact with what is rendered on the page, so your test should typically only see/interact with the same rendered output."
|
||||||
|
|
||||||
|
By adhering to this principle, we can create tests that are both robust and reflective of actual user experiences.
|
||||||
|
|
||||||
|
#### How to make tests robust to function in other contexts (VISTA, COUCHDB, YAMCS, VIPER, etc.)
|
||||||
|
1. Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`. This ensures that your tests will create unique instances of objects for your test to interact with.
|
||||||
|
1. Do not assert on the order or structure of objects available unless you created them yourself. These tests may be used against a persistent datastore like couchdb with many objects in the tree.
|
||||||
|
1. Do not search for your created objects. Open MCT does not performance uniqueness checks so it's possible that your tests will break when run twice.
|
||||||
|
1. Avoid creating locator aliases. This likely means that you're compensating for a bad locator. Improve the application instead.
|
||||||
|
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });` instead of `{ waitUntil: 'networkidle' }`. Tests run against deployments with websockets often have issues with the networkidle detection.
|
||||||
|
|
||||||
|
#### How to make tests faster and more resilient
|
||||||
|
1. Avoid app interaction when possible. The best way of doing this is to navigate directly by URL:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// You can capture the CreatedObjectInfo returned from this appAction:
|
||||||
|
const clock = await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
||||||
|
|
||||||
|
// ...and use its `url` property to navigate directly to it later in the test:
|
||||||
|
await page.goto(clock.url);
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });`
|
||||||
|
- Initial navigation should _almost_ always use the `{ waitUntil: 'domcontentloaded' }` option.
|
||||||
|
1. Avoid repeated setup to test a single assertion. Write longer tests with multiple soft assertions.
|
||||||
|
This ensures that your changes will be picked up with large refactors.
|
||||||
|
|
||||||
|
### 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/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.
|
||||||
|
|
||||||
|
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
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
|
||||||
|
test.describe('foo test suite', () => {
|
||||||
|
|
||||||
|
// All subsequent tests in this suite will override the clock
|
||||||
|
test.use({
|
||||||
|
clockOptions: {
|
||||||
|
now: 1732413600000, // A timestamp given as milliseconds since the epoch
|
||||||
|
shouldAdvanceTime: true // Should the clock tick?
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('bar test', async ({ page }) => {
|
||||||
|
// ...
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
More info and options for `overrideClock` can be found in [baseFixtures.js](baseFixtures.js)
|
||||||
|
|
||||||
|
- Working with multiple pages
|
||||||
|
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
|
||||||
|
|
||||||
|
Test Reporting is done through official Playwright reporters and the CI Systems which execute them.
|
||||||
|
|
||||||
|
We leverage the following official Playwright reporters:
|
||||||
|
|
||||||
|
- HTML
|
||||||
|
- junit
|
||||||
|
- github annotations
|
||||||
|
- Tracefile
|
||||||
|
- Screenshots
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Our e2e code coverage is captured and combined with our unit test coverage. For more information, please see our [code coverage documentation](../TESTING.md)
|
||||||
|
|
||||||
|
#### Generating 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:
|
||||||
|
|
||||||
|
```npm run cov:e2e:report```
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
## Other
|
||||||
|
|
||||||
|
### About e2e testing
|
||||||
|
|
||||||
|
e2e testing is an industry-standard approach to automating the testing of web-based UIs such as Open MCT. Broadly speaking, e2e tests differentiate themselves from unit tests by preferring replication of real user interactions over execution of raw JavaScript functions.
|
||||||
|
|
||||||
|
Historically, the abstraction necessary to replicate real user behavior meant that:
|
||||||
|
|
||||||
|
- e2e tests were "expensive" due to how much code each test executed. The closer a test replicates the user, the more code is needed run during test execution. Unit tests could run smaller units of code more efficiently.
|
||||||
|
- e2e tests were flaky due to network conditions or the underlying protocols associated with testing a browser.
|
||||||
|
- e2e frameworks relied on a browser communication standard which lacked the observability and controls necessary needed to reach the code paths possible with unit and integration tests.
|
||||||
|
- e2e frameworks provided insufficient debug information on test failure
|
||||||
|
|
||||||
|
However, as the web ecosystem has matured to the point where mission-critical UIs can be written for the web (Open MCT), the e2e testing tools have matured as well. There are now fewer "trade-offs" when choosing to write an e2e test over any other type of test.
|
||||||
|
|
||||||
|
Modern e2e frameworks:
|
||||||
|
|
||||||
|
- Bypass the surface layer of the web-application-under-test and use a raw debugging protocol to observe and control application and browser state.
|
||||||
|
- These new browser-internal protocols enable near-instant, bi-directional communication between test code and the browser, speeding up test execution and making the tests as reliable as the application itself.
|
||||||
|
- Provide test debug tooling which enables developers to pinpoint failure
|
||||||
|
|
||||||
|
Furthermore, the abstraction necessary to run e2e tests as a user enables them to be extended to run within a variety of contexts. This matches the extensible design of Open MCT.
|
||||||
|
|
||||||
|
A single e2e test in Open MCT is extended to run:
|
||||||
|
|
||||||
|
- Against a matrix of browser versions.
|
||||||
|
- Against a matrix of OS platforms.
|
||||||
|
- Against a local development version of Open MCT.
|
||||||
|
- A version of Open MCT loaded as a dependency (VIPER, VISTA, etc)
|
||||||
|
- Against a variety of data sources or telemetry endpoints.
|
||||||
|
|
||||||
|
### Why Playwright?
|
||||||
|
|
||||||
|
[Playwright](https://playwright.dev/) was chosen as our e2e framework because it solves a few VIPER Mission needs:
|
||||||
|
|
||||||
|
1. First-class support for Automated Performance Testing
|
||||||
|
2. Official Chrome, Chrome Canary, and iPad Capabilities
|
||||||
|
3. Support for Browserless.io to run tests in a "hermetically sealed" environment
|
||||||
|
4. Ability to generate code coverage reports
|
||||||
|
|
||||||
|
### FAQ
|
||||||
|
|
||||||
|
- How does this help NASA missions?
|
||||||
|
- When should I write an e2e test instead of a unit test?
|
||||||
|
- When should I write a functional vs visual test?
|
||||||
|
- How is Open MCT extending default Playwright functionality?
|
||||||
|
- What about Component Testing?
|
||||||
|
|
||||||
|
### Troubleshooting
|
||||||
|
|
||||||
|
- 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`
|
668
e2e/appActions.js
Normal file
668
e2e/appActions.js
Normal file
@ -0,0 +1,668 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fixtures in this file are to be used to consolidate common actions performed by the
|
||||||
|
* various test suites. The goal is only to avoid duplication of code across test suites and not to abstract
|
||||||
|
* away the underlying functionality of the application. For more about the App Action pattern, see /e2e/README.md)
|
||||||
|
*
|
||||||
|
* For example, if two functions are nearly identical in
|
||||||
|
* timer.e2e.spec.js and notebook.e2e.spec.js, that function should be generalized and moved into this file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines parameters to be used in the creation of a domain object.
|
||||||
|
* @typedef {Object} CreateObjectOptions
|
||||||
|
* @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'}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains information about the newly created domain object.
|
||||||
|
* @typedef {Object} CreatedObjectInfo
|
||||||
|
* @property {string} name the name of the created object
|
||||||
|
* @property {string} uuid the uuid of the created object
|
||||||
|
* @property {string} url the relative url to the object (for use with `page.goto()`)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
const Buffer = require('buffer').Buffer;
|
||||||
|
const genUuid = require('uuid').v4;
|
||||||
|
const { expect } = require('@playwright/test');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
||||||
|
* in the e2e suite when uninterested in properties of the objects themselves.
|
||||||
|
*
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {CreateObjectOptions} options
|
||||||
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||||
|
*/
|
||||||
|
async function createDomainObjectWithDefaults(
|
||||||
|
page,
|
||||||
|
{ type, name, parent = 'mine', customParameters = {} }
|
||||||
|
) {
|
||||||
|
if (!name) {
|
||||||
|
name = `${type}:${genUuid()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
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}`);
|
||||||
|
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Wait until the URL is updated
|
||||||
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
|
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
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.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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a Plan object from JSON with the provided options.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {*} options
|
||||||
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||||
|
*/
|
||||||
|
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
||||||
|
if (!name) {
|
||||||
|
name = `Plan:${genUuid()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
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}`);
|
||||||
|
|
||||||
|
// Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click 'Plan' menu option
|
||||||
|
await page.click(`li:text("Plan")`);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// Upload buffer from memory
|
||||||
|
await page.locator('input#fileElem').setInputFiles({
|
||||||
|
name: 'plan.txt',
|
||||||
|
mimeType: 'text/plain',
|
||||||
|
buffer: Buffer.from(JSON.stringify(json))
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.locator('button:has-text("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'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the UUID of the currently focused object by parsing the current URL
|
||||||
|
* and returning the last UUID in the path.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @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);
|
||||||
|
|
||||||
|
return focusedObjectUuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hashUrl to the domainObject given its uuid.
|
||||||
|
* Useful for directly navigating to the given domainObject.
|
||||||
|
*
|
||||||
|
* URLs returned will be of the form `'./browse/#/mine/<uuid0>/<uuid1>/...'`
|
||||||
|
*
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @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, 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('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}, identifier);
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the time conductor mode to either fixed timespan or realtime mode.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @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.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/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the time conductor to fixed timespan mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function setFixedTimeMode(page) {
|
||||||
|
await setTimeConductorMode(page, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the time conductor to realtime mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function setRealTimeMode(page) {
|
||||||
|
await setTimeConductorMode(page, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} OffsetValues
|
||||||
|
* @property {string | undefined} startHours
|
||||||
|
* @property {string | undefined} startMins
|
||||||
|
* @property {string | undefined} startSecs
|
||||||
|
* @property {string | undefined} endHours
|
||||||
|
* @property {string | undefined} endMins
|
||||||
|
* @property {string | undefined} endSecs
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the values (hours, mins, secs) for the TimeConductor offsets when in realtime mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {OffsetValues} offset
|
||||||
|
* @param {import('@playwright/test').Locator} offsetButton
|
||||||
|
*/
|
||||||
|
async function setTimeConductorOffset(
|
||||||
|
page,
|
||||||
|
{ startHours, startMins, startSecs, endHours, endMins, endSecs }
|
||||||
|
) {
|
||||||
|
if (startHours) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'Start offset hours' }).fill(startHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startMins) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'Start offset minutes' }).fill(startMins);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startSecs) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'Start offset seconds' }).fill(startSecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endHours) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'End offset hours' }).fill(endHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the values (hours, mins, secs) for the start time offset when in realtime mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {OffsetValues} offset
|
||||||
|
*/
|
||||||
|
async function setStartOffset(page, offset) {
|
||||||
|
// Click 'mode' button
|
||||||
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the values (hours, mins, secs) for the end time offset when in realtime mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {OffsetValues} offset
|
||||||
|
*/
|
||||||
|
async function setEndOffset(page, offset) {
|
||||||
|
// Click 'mode' button
|
||||||
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
module.exports = {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createExampleTelemetryObject,
|
||||||
|
createNotification,
|
||||||
|
createPlanFromJSON,
|
||||||
|
expandEntireTree,
|
||||||
|
expandTreePaneItemByName,
|
||||||
|
getCanvasPixels,
|
||||||
|
getHashUrlToDomainObject,
|
||||||
|
getFocusedObjectUuid,
|
||||||
|
navigateToObjectWithFixedTimeBounds,
|
||||||
|
openObjectTreeContextMenu,
|
||||||
|
setFixedTimeMode,
|
||||||
|
setRealTimeMode,
|
||||||
|
setStartOffset,
|
||||||
|
setEndOffset,
|
||||||
|
setTimeConductorBounds,
|
||||||
|
setIndependentTimeConductorBounds,
|
||||||
|
waitForPlotsToRender,
|
||||||
|
renameObjectFromContextMenu
|
||||||
|
};
|
206
e2e/baseFixtures.js
Normal file
206
e2e/baseFixtures.js
Normal file
@ -0,0 +1,206 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This file is dedicated to extending the base functionality of the `@playwright/test` framework.
|
||||||
|
* The functions in this file should be viewed as temporary or a shim to be removed as the RFEs in
|
||||||
|
* the Playwright GitHub repo are implemented. Functions which serve those RFEs are marked with corresponding
|
||||||
|
* GitHub issues.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const base = require('@playwright/test');
|
||||||
|
const { expect, request } = base;
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const { v4: uuid } = require('uuid');
|
||||||
|
const sinon = require('sinon');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a `ConsoleMessage` and returns a formatted string. Used to enable console log error detection.
|
||||||
|
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
||||||
|
* @private
|
||||||
|
* @param {import('@playwright/test').ConsoleMessage} msg
|
||||||
|
* @returns {String} formatted string with message type, text, url, and line and column numbers
|
||||||
|
*/
|
||||||
|
function _consoleMessageToString(msg) {
|
||||||
|
const { url, lineNumber, columnNumber } = msg.location();
|
||||||
|
|
||||||
|
return `[${msg.type()}] ${msg.text()} at (${url} ${lineNumber}:${columnNumber})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for all animations within the given element and subtrees to finish. Useful when
|
||||||
|
* verifying that css transitions have completed.
|
||||||
|
* @see {@link https://github.com/microsoft/playwright/issues/15660 Github RFE}
|
||||||
|
* @param {import('@playwright/test').Locator} locator
|
||||||
|
* @return {Promise<Animation[]>}
|
||||||
|
*/
|
||||||
|
function waitForAnimations(locator) {
|
||||||
|
return locator.evaluate((element) =>
|
||||||
|
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is part of our codecoverage shim.
|
||||||
|
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Example Project}
|
||||||
|
* @constant {string}
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* 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: 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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
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.request = request;
|
||||||
|
exports.waitForAnimations = waitForAnimations;
|
18
e2e/constants.js
Normal file
18
e2e/constants.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* eslint-disable prettier/prettier */
|
||||||
|
/**
|
||||||
|
* Constants which may be used across all e2e tests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time Constants
|
||||||
|
* - Used for overriding the browser clock in tests.
|
||||||
|
*/
|
||||||
|
export const MISSION_TIME = 1732413600000; // Saturday, November 23, 2024 6:00:00 PM GMT-08:00 (Thanksgiving Dinner Time)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL Constants
|
||||||
|
* - This is the URL that the browser will be directed to when running visual tests. This URL
|
||||||
|
* - hides the tree and inspector to prevent visual noise
|
||||||
|
* - sets the time bounds to a fixed range
|
||||||
|
*/
|
||||||
|
export const VISUAL_URL = './#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
|
@ -1,41 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
|
|
||||||
// This file extends the base functionality of the playwright test framework
|
|
||||||
const base = require('@playwright/test');
|
|
||||||
const { expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes a `ConsoleMessage` and returns a formatted string
|
|
||||||
* @param {import('@playwright/test').ConsoleMessage} msg
|
|
||||||
* @returns {String} formatted string with message type, text, url, and line and column numbers
|
|
||||||
*/
|
|
||||||
function consoleMessageToString(msg) {
|
|
||||||
const { url, lineNumber, columnNumber } = msg.location();
|
|
||||||
|
|
||||||
return `[${msg.type()}] ${msg.text()}
|
|
||||||
at (${url} ${lineNumber}:${columnNumber})`;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.test = base.test.extend({
|
|
||||||
page: async ({ baseURL, page }, use) => {
|
|
||||||
const messages = [];
|
|
||||||
page.on('console', (msg) => messages.push(msg));
|
|
||||||
await use(page);
|
|
||||||
messages.forEach(
|
|
||||||
msg => expect.soft(msg.type(), `Console error detected: ${consoleMessageToString(msg)}`).not.toEqual('error')
|
|
||||||
);
|
|
||||||
},
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -20,28 +20,9 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
import {
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
createOpenMct,
|
|
||||||
resetApplicationState
|
|
||||||
} from '../../src/utils/testing';
|
|
||||||
|
|
||||||
describe("The Example Fault Source Plugin", () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
let openmct;
|
const openmct = window.openmct;
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
openmct = createOpenMct();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
return resetApplicationState(openmct);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('is not installed by default', () => {
|
|
||||||
expect(openmct.faults.provider).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can be installed', () => {
|
|
||||||
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
||||||
expect(openmct.faults.provider).not.toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
});
|
30
e2e/helper/addInitExampleFaultProviderStatic.js
Normal file
30
e2e/helper/addInitExampleFaultProviderStatic.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This 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;
|
||||||
|
|
||||||
|
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-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This should be used to install the Example User
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.example.ExampleUser());
|
||||||
|
});
|
28
e2e/helper/addInitFaultManagementPlugin.js
Normal file
28
e2e/helper/addInitFaultManagementPlugin.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This 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());
|
||||||
|
});
|
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));
|
||||||
|
});
|
32
e2e/helper/addInitNotebookWithUrls.js
Normal file
32
e2e/helper/addInitNotebookWithUrls.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This 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'];
|
||||||
|
|
||||||
|
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-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This 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-2023, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -20,9 +20,9 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
// this will be called from the test suite with
|
// This should be used to install the non-default Restricted Notebook plugin since it is not installed by default.
|
||||||
|
// e.g.
|
||||||
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||||
// it will install the RestrictedNotebook since it is not installed by default
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
27
e2e/helper/addNoneditableObject.js
Normal file
27
e2e/helper/addNoneditableObject.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
(function () {
|
||||||
|
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: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
293
e2e/helper/faultUtils.js
Normal file
293
e2e/helper/faultUtils.js
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function navigateToFaultManagementWithExample(page) {
|
||||||
|
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
||||||
|
|
||||||
|
await navigateToFaultItemInTree(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function navigateToFaultManagementWithStaticExample(page) {
|
||||||
|
await page.addInitScript({
|
||||||
|
path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js')
|
||||||
|
});
|
||||||
|
|
||||||
|
await navigateToFaultItemInTree(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function navigateToFaultManagementWithoutExample(page) {
|
||||||
|
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
||||||
|
|
||||||
|
await navigateToFaultItemInTree(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function navigateToFaultItemInTree(page) {
|
||||||
|
await page.goto('./', { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function shelveMultipleFaults(page, ...nums) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function acknowledgeMultipleFaults(page, ...nums) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function changeViewTo(page, 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function enterSearchTerm(page, 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, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function selectFaultItem(page, rowNumber) {
|
||||||
|
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();
|
||||||
|
|
||||||
|
if (criticalCount > 0) {
|
||||||
|
return 'CRITICAL';
|
||||||
|
} else if (warningCount > 0) {
|
||||||
|
return 'WARNING';
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
if (watchCount > 0) {
|
||||||
|
return 'WATCH';
|
||||||
|
} else if (warningCount > 0) {
|
||||||
|
return 'WARNING';
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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}`
|
||||||
|
);
|
||||||
|
|
||||||
|
return fault;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
function getFaultByName(page, name) {
|
||||||
|
const fault = page.locator(`.c-fault-mgmt__list-faultname:has-text("${name}")`);
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
};
|
149
e2e/helper/notebookUtils.js
Normal file
149
e2e/helper/notebookUtils.js
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
const { createDomainObjectWithDefaults } = require('../appActions');
|
||||||
|
|
||||||
|
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
||||||
|
const CUSTOM_NAME = 'CUSTOM_NAME';
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function enterTextEntry(page, text) {
|
||||||
|
// Click the 'Add Notebook Entry' area
|
||||||
|
await page.locator(NOTEBOOK_DROP_AREA).click();
|
||||||
|
|
||||||
|
// enter text
|
||||||
|
await page.getByLabel('Notebook Entry Display').last().click();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
return createDomainObjectWithDefaults(page, {
|
||||||
|
type: CUSTOM_NAME,
|
||||||
|
name: 'Restricted Test Notebook'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function lockPage(page) {
|
||||||
|
const commitButton = page.locator('button:has-text("Commit Entries")');
|
||||||
|
await commitButton.click();
|
||||||
|
|
||||||
|
//Wait until Lock Banner is visible
|
||||||
|
await page.locator('text=Lock Page').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object and adds an entry.
|
||||||
|
* @param {import('@playwright/test').Page} - page to load
|
||||||
|
* @param {number} [iterations = 1] - the number of entries to create
|
||||||
|
*/
|
||||||
|
async function createNotebookAndEntry(page, iterations = 1) {
|
||||||
|
const notebook = createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
await enterTextEntry(page, `Entry ${iteration}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object, adds an entry, and adds a tag.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {number} [iterations = 1] - the number of entries (and tags) to create
|
||||||
|
*/
|
||||||
|
async function createNotebookEntryAndTags(page, iterations = 1) {
|
||||||
|
const notebook = await createNotebookAndEntry(page, iterations);
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.locator(`[aria-label="Notebook Entry"] >> nth = ${iteration}`).click();
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Driving" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
||||||
|
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Science" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
module.exports = {
|
||||||
|
enterTextEntry,
|
||||||
|
dragAndDropEmbed,
|
||||||
|
startAndAddRestrictedNotebookObject,
|
||||||
|
lockPage,
|
||||||
|
createNotebookEntryAndTags,
|
||||||
|
createNotebookAndEntry
|
||||||
|
};
|
112
e2e/helper/planningUtils.js
Normal file
112
e2e/helper/planningUtils.js
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import { expect } from '../pluginFixtures';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
const activities = Object.values(planJson).flat();
|
||||||
|
// Get the earliest start value
|
||||||
|
const start = Math.min(...activities.map((activity) => activity.start));
|
||||||
|
// Get the latest end value
|
||||||
|
const end = Math.max(...activities.map((activity) => activity.end));
|
||||||
|
// Set the start and end bounds to the earliest start and latest end
|
||||||
|
await page.goto(
|
||||||
|
`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
30
e2e/helper/useSnowTheme.js
Normal file
30
e2e/helper/useSnowTheme.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This should be used to install the Snow theme for Open MCT. Espresso is the default
|
||||||
|
// e.g.
|
||||||
|
// await page.addInitScript({ path: path.join(__dirname, 'useSnowTheme.js') });
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.Snow());
|
||||||
|
});
|
@ -4,38 +4,42 @@
|
|||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { devices } = require('@playwright/test');
|
const { devices } = require('@playwright/test');
|
||||||
|
const MAX_FAILURES = 5;
|
||||||
|
const NUM_WORKERS = 2;
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 1,
|
retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
|
||||||
testDir: 'tests',
|
testDir: 'tests',
|
||||||
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
||||||
timeout: 60 * 1000,
|
timeout: 60 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start',
|
command: 'npm run start:coverage',
|
||||||
port: 8080,
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: !process.env.CI
|
reuseExistingServer: false
|
||||||
},
|
},
|
||||||
maxFailures: process.env.CI ? 5 : undefined, //Limits failures to 5 to reduce CI Waste
|
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
||||||
workers: 2, //Limit to 2 for CircleCI Agent
|
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
||||||
use: {
|
use: {
|
||||||
baseURL: 'http://localhost:8080/',
|
baseURL: 'http://localhost:8080/',
|
||||||
headless: true,
|
headless: true,
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
screenshot: 'only-on-failure',
|
screenshot: 'only-on-failure',
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
video: 'on-first-retry'
|
video: 'off'
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: 'chrome',
|
name: 'chrome',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium'
|
browserName: 'chromium'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'MMOC',
|
name: 'MMOC',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
grepInvert: /@snapshot/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
@ -44,23 +48,36 @@ const config = {
|
|||||||
height: 1440
|
height: 1440
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
/*{
|
{
|
||||||
name: 'ipad',
|
name: 'firefox',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'webkit',
|
browserName: 'firefox'
|
||||||
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['html', {
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
open: 'never',
|
open: 'never',
|
||||||
outputFolder: '../test-results/html/'
|
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' }],
|
||||||
|
['@deploysentinel/playwright']
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,20 +12,20 @@ const config = {
|
|||||||
testIgnore: '**/*.perf.spec.js',
|
testIgnore: '**/*.perf.spec.js',
|
||||||
timeout: 30 * 1000,
|
timeout: 30 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start',
|
command: 'npm run start:coverage',
|
||||||
port: 8080,
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: !process.env.CI
|
reuseExistingServer: true
|
||||||
},
|
},
|
||||||
workers: 1,
|
workers: 1,
|
||||||
use: {
|
use: {
|
||||||
browserName: "chromium",
|
browserName: 'chromium',
|
||||||
baseURL: 'http://localhost:8080/',
|
baseURL: 'http://localhost:8080/',
|
||||||
headless: false,
|
headless: false,
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
screenshot: 'only-on-failure',
|
screenshot: 'only-on-failure',
|
||||||
trace: 'retain-on-failure',
|
trace: 'retain-on-failure',
|
||||||
video: 'retain-on-failure'
|
video: 'off'
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
@ -36,6 +36,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'MMOC',
|
name: 'MMOC',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
grepInvert: /@snapshot/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
@ -44,21 +45,62 @@ const config = {
|
|||||||
height: 1440
|
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',
|
name: 'ipad',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grep: /@ipad/,
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'webkit',
|
browserName: 'webkit',
|
||||||
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
],
|
],
|
||||||
reporter: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['html', {
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
open: 'on-failure',
|
open: 'on-failure',
|
||||||
outputFolder: '../test-results'
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
43
e2e/playwright-performance-dev.config.js
Normal file
43
e2e/playwright-performance-dev.config.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
|
testDir: 'tests/performance/',
|
||||||
|
testMatch: '*.contract.perf.spec.js', //Run everything except contract tests which require marks in dev mode
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Only run in serial with 1 worker
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start', //need development mode for performance.marks and others
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: false
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: false, //HTTP performance varies!
|
||||||
|
screenshot: 'off',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testIgnore: '*.memory.perf.spec.js', //Do not run memory tests without proper flags. Shouldn't get here
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
60
e2e/playwright-performance-prod.config.js
Normal file
60
e2e/playwright-performance-prod.config.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
|
testDir: 'tests/performance/',
|
||||||
|
testIgnore: '*.contract.perf.spec.js', //Run everything except contract tests which require marks in dev mode
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Only run in serial with 1 worker
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start:prod', //Production mode
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: false //Must be run with this option to prevent dev mode
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: false, //HTTP performance varies!
|
||||||
|
screenshot: 'off',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome-memory',
|
||||||
|
testMatch: '*.memory.perf.spec.js', //Only run memory tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-notifications',
|
||||||
|
'--use-fake-ui-for-media-stream',
|
||||||
|
'--use-fake-device-for-media-stream',
|
||||||
|
'--js-flags=--no-move-object-start --expose-gc',
|
||||||
|
'--enable-precise-memory-info',
|
||||||
|
'--display=:100'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testIgnore: '*.memory.perf.spec.js', //Do not run memory tests without proper flags
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = config;
|
@ -1,41 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
||||||
const config = {
|
|
||||||
retries: 1, //Only for debugging purposes
|
|
||||||
testDir: 'tests/performance/',
|
|
||||||
timeout: 60 * 1000,
|
|
||||||
workers: 1, //Only run in serial with 1 worker
|
|
||||||
webServer: {
|
|
||||||
command: 'npm run start',
|
|
||||||
port: 8080,
|
|
||||||
timeout: 200 * 1000,
|
|
||||||
reuseExistingServer: !process.env.CI
|
|
||||||
},
|
|
||||||
use: {
|
|
||||||
browserName: "chromium",
|
|
||||||
baseURL: 'http://localhost:8080/',
|
|
||||||
headless: Boolean(process.env.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;
|
|
@ -2,30 +2,52 @@
|
|||||||
// playwright.config.js
|
// playwright.config.js
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 0, // visual tests should never retry due to snapshot comparison errors
|
retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
||||||
testDir: 'tests/visual',
|
testDir: 'tests/visual',
|
||||||
timeout: 90 * 1000,
|
testMatch: '**/*.visual.spec.js', // only run visual tests
|
||||||
workers: 1, // visual tests should never run in parallel due to test pollution
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start',
|
command: 'npm run start:coverage',
|
||||||
port: 8080,
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: !process.env.CI
|
reuseExistingServer: !process.env.CI
|
||||||
},
|
},
|
||||||
use: {
|
use: {
|
||||||
browserName: "chromium",
|
|
||||||
baseURL: 'http://localhost:8080/',
|
baseURL: 'http://localhost:8080/',
|
||||||
headless: true, // this needs to remain headless to avoid visual changes due to GPU
|
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
screenshot: 'on',
|
screenshot: 'only-on-failure',
|
||||||
trace: 'off',
|
trace: 'on-first-retry',
|
||||||
video: 'on'
|
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: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['junit', { outputFile: 'test-results/results.xml' }]
|
['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
|
||||||
|
}
|
||||||
|
]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
160
e2e/pluginFixtures.js
Normal file
160
e2e/pluginFixtures.js
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The file contains custom fixtures which extend the base functionality of the Playwright fixtures
|
||||||
|
* and appActions. These fixtures should be generalized across all plugins.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect, request } = require('./baseFixtures');
|
||||||
|
// const { createDomainObjectWithDefaults } = require('./appActions');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ObjectCreateOptions
|
||||||
|
* @property {string} type
|
||||||
|
* @property {string} name
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* **NOTE: This feature is a work-in-progress and should not currently be used.**
|
||||||
|
*
|
||||||
|
* Used to create a new domain object as a part of getOrCreateDomainObject.
|
||||||
|
* @type {Map<string, string>}
|
||||||
|
*/
|
||||||
|
// const createdObjects = new Map();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* about object creation, while providing a consistent interface to retrieving objects in a persistentContext.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {ObjectCreateOptions} options
|
||||||
|
* @returns {Promise<string>} uuid of the domain object
|
||||||
|
*/
|
||||||
|
// async function getOrCreateDomainObject(page, options) {
|
||||||
|
// const { type, name } = options;
|
||||||
|
// const objectName = name ? `${type}:${name}` : type;
|
||||||
|
|
||||||
|
// if (createdObjects.has(objectName)) {
|
||||||
|
// return createdObjects.get(objectName);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// await createDomainObjectWithDefaults(page, type, name);
|
||||||
|
|
||||||
|
// const uuid = getHashUrlToDomainObject(page);
|
||||||
|
|
||||||
|
// createdObjects.set(objectName, uuid);
|
||||||
|
|
||||||
|
// return uuid;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* **NOTE: This feature is a work-in-progress and should not currently be used.**
|
||||||
|
*
|
||||||
|
* If provided, these options will be used to get or create the desired domain object before
|
||||||
|
* any tests or test hooks have run.
|
||||||
|
* The `uuid` of the `domainObject` will then be available to use within the scoped tests.
|
||||||
|
*
|
||||||
|
* ### Example:
|
||||||
|
* ```js
|
||||||
|
* test.describe("My test suite", () => {
|
||||||
|
* test.use({ objectCreateOptions: { type: "Telemetry Table", name: "My Telemetry Table" }});
|
||||||
|
* test("'My Telemetry Table' is created and provides a uuid", async ({ page, domainObject }) => {
|
||||||
|
* const { uuid } = domainObject;
|
||||||
|
* expect(uuid).toBeDefined();
|
||||||
|
* }))
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* @type {ObjectCreateOptions}
|
||||||
|
*/
|
||||||
|
// const objectCreateOptions = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default theme for VIPER and Open MCT is the 'espresso' theme. Overriding this value with 'snow' in our playwright config.js
|
||||||
|
* will override the default theme by injecting the 'snow' theme on launch.
|
||||||
|
*
|
||||||
|
* ### Example:
|
||||||
|
* ```js
|
||||||
|
* projects: [
|
||||||
|
* {
|
||||||
|
* name: 'chrome-snow-theme',
|
||||||
|
* use: {
|
||||||
|
* browserName: 'chromium',
|
||||||
|
* theme: 'snow'
|
||||||
|
* ```
|
||||||
|
* @type {'snow' | 'espresso'}
|
||||||
|
*/
|
||||||
|
const theme = 'espresso';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the "My Items" folder in the domain object tree.
|
||||||
|
*
|
||||||
|
* Default: `"My Items"`
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.expect = expect;
|
||||||
|
exports.request = request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a readable stream and returns a string.
|
||||||
|
* @param {ReadableStream} readable - the readable stream
|
||||||
|
* @return {Promise<String>} the stringified stream
|
||||||
|
*/
|
||||||
|
exports.streamToString = async function (readable) {
|
||||||
|
let result = '';
|
||||||
|
for await (const chunk of readable) {
|
||||||
|
result += chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
2180
e2e/test-data/ExampleLayouts.json
Normal file
2180
e2e/test-data/ExampleLayouts.json
Normal file
File diff suppressed because one or more lines are too long
@ -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"
|
||||||
|
}
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
e2e/test-data/memory-leak-detection.json
Normal file
1
e2e/test-data/memory-leak-detection.json
Normal file
File diff suppressed because one or more lines are too long
22
e2e/test-data/overlay_plot_storage.json
Normal file
22
e2e/test-data/overlay_plot_storage.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},\"20e7d5fe-9cf8-4099-8957-9453a8954c67\":{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960},\"2db521a9-996d-4d04-a171-93f4c5c220af\":{\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-recent-objects",
|
||||||
|
"value": "[{\"objectPath\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/2db521a9-996d-4d04-a171-93f4c5c220af\",\"domainObject\":{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540}},{\"objectPath\":[{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"domainObject\":{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960}},{\"objectPath\":[{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine\",\"domainObject\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540}}]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413601340,\"created\":1732413600580,\"persisted\":1732413601340},\"98161570-a735-4a50-9c75-11b346ad3789\":{\"identifier\":{\"key\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"namespace\":\"\"},\"name\":\"Overlay Plot with 5s Delay\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with 5s Delay\\nchrome\",\"modified\":1732413602660,\"location\":\"mine\",\"created\":1732413601340,\"persisted\":1732413602660},\"477e60bb-4cba-4603-b4c9-2281ccf7e054\":{\"identifier\":{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":5000,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602520,\"location\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"created\":1732413602040,\"persisted\":1732413602520}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
e2e/test-data/recycled_local_storage.json
Normal file
26
e2e/test-data/recycled_local_storage.json
Normal file
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,77 +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 tests which verify form functionality.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { test, expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
const TEST_FOLDER = 'test folder';
|
|
||||||
|
|
||||||
test.describe('forms set', () => {
|
|
||||||
test('New folder form has title as required field', async ({ page }) => {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('/', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Click button:has-text("Create")
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
// Click :nth-match(:text("Folder"), 2)
|
|
||||||
await page.click(':nth-match(:text("Folder"), 2)');
|
|
||||||
// Click text=Properties Title Notes >> input[type="text"]
|
|
||||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
|
||||||
// Fill text=Properties Title Notes >> input[type="text"]
|
|
||||||
await page.fill('text=Properties Title Notes >> input[type="text"]', '');
|
|
||||||
// Press Tab
|
|
||||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
|
||||||
|
|
||||||
const okButton = page.locator('text=OK');
|
|
||||||
|
|
||||||
await expect(okButton).toBeDisabled();
|
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
|
||||||
|
|
||||||
// Click text=Properties Title Notes >> input[type="text"]
|
|
||||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
|
||||||
// Fill text=Properties Title Notes >> input[type="text"]
|
|
||||||
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
|
||||||
// Press Tab
|
|
||||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
|
||||||
|
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
|
||||||
|
|
||||||
// Click text=OK
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('text=OK')
|
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(TEST_FOLDER);
|
|
||||||
});
|
|
||||||
test.fixme('Create all object types and verify correctness', async ({ page }) => {
|
|
||||||
//Create the following Domain Objects with their unique Object Types
|
|
||||||
// Sine Wave Generator (number object)
|
|
||||||
// Timer Object
|
|
||||||
// Plan View Object
|
|
||||||
// Clock Object
|
|
||||||
// Hyperlink
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,63 +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 tests which verify branding related components.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { test } = require('../fixtures.js');
|
|
||||||
const { expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
test.describe('Branding tests', () => {
|
|
||||||
test('About Modal launches with basic branding properties', async ({ page }) => {
|
|
||||||
// Go to baseURL
|
|
||||||
await page.goto('/', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Click About button
|
|
||||||
await page.click('.l-shell__app-logo');
|
|
||||||
|
|
||||||
// Verify that the NASA Logo Appears
|
|
||||||
await expect(await page.locator('.c-about__image')).toBeVisible();
|
|
||||||
|
|
||||||
// Modify the Build information in 'about' Modal
|
|
||||||
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info');
|
|
||||||
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', 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()
|
|
||||||
]);
|
|
||||||
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,63 +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 tests which verify the basic operations surrounding the example event generator.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { test } = require('../../fixtures.js');
|
|
||||||
const { expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
test.describe('Example Event Generator Operations', () => {
|
|
||||||
test('Can create example event generator with a name', async ({ page }) => {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('/', { waitUntil: 'networkidle' });
|
|
||||||
// let's make an event generator
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
|
||||||
// Click li:has-text("Event Message Generator")
|
|
||||||
await page.locator('li:has-text("Event Message Generator")').click();
|
|
||||||
// Click text=Properties Title Notes >> input[type="text"]
|
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
|
||||||
// Fill text=Properties Title Notes >> input[type="text"]
|
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill('Test Event Generator');
|
|
||||||
// Press Enter
|
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').press('Enter');
|
|
||||||
// Click text=OK
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation({ url: /.*&view=table/ }),
|
|
||||||
page.locator('text=OK').click()
|
|
||||||
]);
|
|
||||||
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Test Event Generator');
|
|
||||||
// Click button:has-text("Fixed Timespan")
|
|
||||||
await page.locator('button:has-text("Fixed Timespan")').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
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 }) => {
|
|
||||||
// Go to object created in step one
|
|
||||||
// Verify the telemetry table has a class with "is-sorting asc"
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,167 +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 tests which verify the basic operations surrounding conditionSets.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { test } = require('../../../fixtures.js');
|
|
||||||
const { expect } = require('@playwright/test');
|
|
||||||
|
|
||||||
test.describe('Sine Wave Generator', () => {
|
|
||||||
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({ page }) => {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('/', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// 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(['c-form-row__state-indicator 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');
|
|
||||||
|
|
||||||
// Period
|
|
||||||
await expect(page.locator('.c-form__section div:nth-child(4) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req']);
|
|
||||||
|
|
||||||
// Amplitude
|
|
||||||
await expect(page.locator('.c-form__section div:nth-child(5) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req']);
|
|
||||||
|
|
||||||
// Offset
|
|
||||||
await expect(page.locator('.c-form__section div:nth-child(6) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req']);
|
|
||||||
|
|
||||||
// Data Rate
|
|
||||||
await expect(page.locator('.c-form__section div:nth-child(7) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req']);
|
|
||||||
|
|
||||||
// Phase
|
|
||||||
await expect(page.locator('.c-form__section div:nth-child(8) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req']);
|
|
||||||
|
|
||||||
// Randomness
|
|
||||||
await expect(page.locator('.c-form__section div:nth-child(9) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator 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(['c-form-row__state-indicator req 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('non empty');
|
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(['c-form-row__state-indicator req 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('.c-form__section div:nth-child(4) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req 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('.c-form__section div:nth-child(4) .form-row .c-form-row__state-indicator')).toHaveClass(['c-form-row__state-indicator req 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');
|
|
||||||
|
|
||||||
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
|
||||||
await expect(value).toBe('6');
|
|
||||||
|
|
||||||
// Click .c-form-row__state-indicator.grows
|
|
||||||
await page.locator('.c-form-row__state-indicator.grows').click();
|
|
||||||
|
|
||||||
// Click text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]
|
|
||||||
await page.locator('text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]').click();
|
|
||||||
|
|
||||||
// Click .c-form-row__state-indicator >> nth=0
|
|
||||||
await page.locator('.c-form-row__state-indicator').first().click();
|
|
||||||
|
|
||||||
// Fill text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]
|
|
||||||
await page.locator('text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]').fill('New Sine Wave Generator');
|
|
||||||
|
|
||||||
// Double click div:nth-child(4) .form-row .c-form-row__controls
|
|
||||||
await page.locator('div:nth-child(4) .form-row .c-form-row__controls').dblclick();
|
|
||||||
|
|
||||||
// Click .field.control.l-input-sm input >> nth=0
|
|
||||||
await page.locator('.field.control.l-input-sm input').first().click();
|
|
||||||
|
|
||||||
// Click div:nth-child(4) .form-row .c-form-row__state-indicator
|
|
||||||
await page.locator('div:nth-child(4) .form-row .c-form-row__state-indicator').click();
|
|
||||||
|
|
||||||
// Click .field.control.l-input-sm input >> nth=0
|
|
||||||
await page.locator('.field.control.l-input-sm input').first().click();
|
|
||||||
|
|
||||||
// Click .field.control.l-input-sm input >> nth=0
|
|
||||||
await page.locator('.field.control.l-input-sm input').first().click();
|
|
||||||
|
|
||||||
// Click div:nth-child(5) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(5) .form-row .c-form-row__controls .form-control .field input').click();
|
|
||||||
|
|
||||||
// Click div:nth-child(5) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(5) .form-row .c-form-row__controls .form-control .field input').click();
|
|
||||||
|
|
||||||
// Click div:nth-child(5) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(5) .form-row .c-form-row__controls .form-control .field input').click();
|
|
||||||
|
|
||||||
// Click div:nth-child(6) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(6) .form-row .c-form-row__controls .form-control .field input').click();
|
|
||||||
|
|
||||||
// Double click div:nth-child(7) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(7) .form-row .c-form-row__controls .form-control .field input').dblclick();
|
|
||||||
|
|
||||||
// Click div:nth-child(7) .form-row .c-form-row__state-indicator
|
|
||||||
await page.locator('div:nth-child(7) .form-row .c-form-row__state-indicator').click();
|
|
||||||
|
|
||||||
// Click div:nth-child(7) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(7) .form-row .c-form-row__controls .form-control .field input').click();
|
|
||||||
|
|
||||||
// Fill div:nth-child(7) .form-row .c-form-row__controls .form-control .field input
|
|
||||||
await page.locator('div:nth-child(7) .form-row .c-form-row__controls .form-control .field input').fill('3');
|
|
||||||
|
|
||||||
//Click text=OK
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('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 canvas rendered
|
|
||||||
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]+/);
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
169
e2e/tests/framework/appActions.e2e.spec.js
Normal file
169
e2e/tests/framework/appActions.e2e.spec.js
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createNotification,
|
||||||
|
expandEntireTree
|
||||||
|
} = require('../../appActions.js');
|
||||||
|
|
||||||
|
test.describe('AppActions', () => {
|
||||||
|
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);
|
||||||
|
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.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click the object specified by 'type'
|
||||||
|
await page.click(`li[role='menuitem']:text("Clock")`);
|
||||||
|
await expandEntireTree(page, 'Create Modal Tree');
|
||||||
|
const locatorTree = page.getByRole('tree', {
|
||||||
|
name: 'Create Modal Tree'
|
||||||
|
});
|
||||||
|
const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
|
||||||
|
expect(await locatorTreeCollapsedItems.count()).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
54
e2e/tests/framework/baseFixtures.e2e.spec.js
Normal file
54
e2e/tests/framework/baseFixtures.e2e.spec.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to testing our use of the playwright framework as it
|
||||||
|
relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions made in our dev environment
|
||||||
|
(`npm start` and ./e2e/webpack-dev-middleware.js)
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
|
test.describe('baseFixtures tests', () => {
|
||||||
|
//Skip this test for now https://github.com/nasa/openmct/issues/6785
|
||||||
|
test.fixme('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||||
|
test.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!
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
//Verify that ../fixtures.js detects console log errors
|
||||||
|
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!
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
177
e2e/tests/framework/exampleTemplate.e2e.spec.js
Normal file
177
e2e/tests/framework/exampleTemplate.e2e.spec.js
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This test suite 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');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure:
|
||||||
|
* Try to keep a single describe block per logical groups of tests.
|
||||||
|
* If your test runtime exceeds 5 minutes or 500 lines, it's likely that it will need to be split.
|
||||||
|
*
|
||||||
|
* Annotations:
|
||||||
|
* Please use the @unstable tag at the end of the test title so that our automation can pick it up
|
||||||
|
* 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: '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' });
|
||||||
|
|
||||||
|
// 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'
|
||||||
|
});
|
||||||
|
// 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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure:
|
||||||
|
* Custom functions should be declared last.
|
||||||
|
* We are leaning on JSDoc pretty heavily to describe functionality. It is not required, but highly recommended.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an example of a function which is shared between testcases in this test suite. When refactoring, we'll be looking
|
||||||
|
* for common functionality which makes sense to generalize for the entire test framework.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} timerUrl The URL of the timer object to be renamed
|
||||||
|
* @param {string} newNameForTimer New name for object
|
||||||
|
*/
|
||||||
|
async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
|
||||||
|
// Navigate to the timer object
|
||||||
|
await page.goto(timerUrl);
|
||||||
|
|
||||||
|
// Click on 3 Dot Menu
|
||||||
|
await page.locator('button[title="More options"]').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);
|
||||||
|
|
||||||
|
// Click Ok button to Save
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
}
|
259
e2e/tests/framework/generateLocalStorageData.e2e.spec.js
Normal file
259
e2e/tests/framework/generateLocalStorageData.e2e.spec.js
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2022, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
/**
|
||||||
|
* This test suite is dedicated to generating LocalStorage via Session Storage to be used
|
||||||
|
* in some visual test suites like controlledClock.visual.spec.js. This suite should run to completion
|
||||||
|
* and generate an artifact in ./e2e/test-data/<name>_storage.json . This will run
|
||||||
|
* on every commit to ensure that this object still loads into tests correctly and will retain the
|
||||||
|
* *.e2e.spec.js suffix.
|
||||||
|
*
|
||||||
|
* TODO: Provide additional validation of object properties as it grows.
|
||||||
|
* Verification of object properties happens in this file before the test-data is generated,
|
||||||
|
* and is additionally verified in the validation test suites below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createExampleTelemetryObject
|
||||||
|
} = require('../../appActions.js');
|
||||||
|
const { MISSION_TIME } = require('../../constants.js');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const overlayPlotName = 'Overlay Plot with Telemetry Object';
|
||||||
|
|
||||||
|
test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
|
||||||
|
test.use({
|
||||||
|
clockOptions: {
|
||||||
|
now: MISSION_TIME,
|
||||||
|
shouldAdvanceTime: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Visual test for the generated object here
|
||||||
|
// - Move to using appActions to create the overlay plot
|
||||||
|
// and embedded standard telemetry object
|
||||||
|
test('Generate Overlay Plot with Telemetry Object', async ({ page, context }) => {
|
||||||
|
// Create Overlay Plot
|
||||||
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Overlay Plot',
|
||||||
|
name: overlayPlotName
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create Telemetry Object
|
||||||
|
const exampleTelemetry = await createExampleTelemetryObject(page);
|
||||||
|
|
||||||
|
// Make Link from Telemetry Object to Overlay Plot
|
||||||
|
await page.locator('button[title="More options"]').click();
|
||||||
|
|
||||||
|
// Select 'Create Link' from dropdown
|
||||||
|
await page.getByRole('menuitem', { name: ' Create Link' }).click();
|
||||||
|
|
||||||
|
// Search and Select for overlay Plot within Create Modal
|
||||||
|
await page.getByRole('dialog').getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('dialog')
|
||||||
|
.getByRole('searchbox', { name: 'Search Input' })
|
||||||
|
.fill(overlayPlot.name);
|
||||||
|
await page
|
||||||
|
.getByRole('treeitem', { name: new RegExp(overlayPlot.name) })
|
||||||
|
.locator('a')
|
||||||
|
.click();
|
||||||
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
|
await page.goto(overlayPlot.url);
|
||||||
|
|
||||||
|
// TODO: Flesh Out Assertions against created Objects
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlotName);
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('list', { name: 'Plot Series Properties' })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// TODO: Modify the Overlay Plot to use fixed Scaling
|
||||||
|
// TODO: Verify Autoscaling.
|
||||||
|
|
||||||
|
// TODO: Fix accessibility of Plot Series Properties tables
|
||||||
|
// Assert that the Plot Series properties have the correct values
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Value")~[role=cell]:has-text("sin")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[role=cell]:has-text("Line Method")~[role=cell]:has-text("Linear interpolation")'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Markers")~[role=cell]:has-text("Point: 2px")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Alarm Markers")~[role=cell]:has-text("Enabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Limit Lines")~[role=cell]:has-text("Disabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
await page.goto(exampleTelemetry.url);
|
||||||
|
await page.getByRole('tab', { name: 'Properties' }).click();
|
||||||
|
|
||||||
|
// TODO: assert Example Telemetry property values
|
||||||
|
// await page.goto(exampleTelemetry.url);
|
||||||
|
|
||||||
|
// Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/overlay_plot_storage.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// TODO: Merge this with previous test. Edit object created in previous test.
|
||||||
|
test('Generate Overlay Plot with 5s Delay', async ({ page, context }) => {
|
||||||
|
// add overlay plot with defaults
|
||||||
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Overlay Plot',
|
||||||
|
name: 'Overlay Plot with 5s Delay'
|
||||||
|
});
|
||||||
|
|
||||||
|
const swgWith5sDelay = await createExampleTelemetryObject(page, overlayPlot.uuid);
|
||||||
|
|
||||||
|
await page.goto(swgWith5sDelay.url);
|
||||||
|
await page.getByTitle('More options').click();
|
||||||
|
await page.getByRole('menuitem', { name: ' Edit Properties...' }).click();
|
||||||
|
|
||||||
|
//Edit Example Telemetry Object to include 5s loading Delay
|
||||||
|
await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000');
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
page.waitForNavigation(),
|
||||||
|
page.locator('text=OK').click(),
|
||||||
|
//Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// focus the overlay plot
|
||||||
|
await page.goto(overlayPlot.url);
|
||||||
|
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlot.name);
|
||||||
|
|
||||||
|
// Clear Recently Viewed
|
||||||
|
await page.getByRole('button', { name: 'Clear Recently Viewed' }).click();
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
//Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/overlay_plot_with_delay_storage.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Validate Overlay Plot with Telemetry Object @localStorage @generatedata', () => {
|
||||||
|
test.use({
|
||||||
|
storageState: path.join(__dirname, '../../../e2e/test-data/overlay_plot_storage.json')
|
||||||
|
});
|
||||||
|
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('a').filter({ hasText: overlayPlotName }).click();
|
||||||
|
// TODO: Flesh Out Assertions against created Objects
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlotName);
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('list', { name: 'Plot Series Properties' })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// TODO: Modify the Overlay Plot to use fixed Scaling
|
||||||
|
// TODO: Verify Autoscaling.
|
||||||
|
|
||||||
|
// TODO: Fix accessibility of Plot Series Properties tables
|
||||||
|
// Assert that the Plot Series properties have the correct values
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Value")~[role=cell]:has-text("sin")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[role=cell]:has-text("Line Method")~[role=cell]:has-text("Linear interpolation")'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Markers")~[role=cell]:has-text("Point: 2px")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Alarm Markers")~[role=cell]:has-text("Enabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Limit Lines")~[role=cell]:has-text("Disabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Validate Overlay Plot with 5s Delay Telemetry Object @localStorage @generatedata', () => {
|
||||||
|
test.use({
|
||||||
|
storageState: path.join(
|
||||||
|
__dirname,
|
||||||
|
'../../../e2e/test-data/overlay_plot_with_delay_storage.json'
|
||||||
|
)
|
||||||
|
});
|
||||||
|
test('Validate Overlay Plot with Telemetry Object', async ({ page }) => {
|
||||||
|
const plotName = 'Overlay Plot with 5s Delay';
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('a').filter({ hasText: plotName }).click();
|
||||||
|
// TODO: Flesh Out Assertions against created Objects
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(plotName);
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await page
|
||||||
|
.getByRole('list', { name: 'Plot Series Properties' })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// TODO: Modify the Overlay Plot to use fixed Scaling
|
||||||
|
// TODO: Verify Autoscaling.
|
||||||
|
|
||||||
|
// TODO: Fix accessibility of Plot Series Properties tables
|
||||||
|
// Assert that the Plot Series properties have the correct values
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Value")~[role=cell]:has-text("sin")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator(
|
||||||
|
'[role=cell]:has-text("Line Method")~[role=cell]:has-text("Linear interpolation")'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Markers")~[role=cell]:has-text("Point: 2px")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Alarm Markers")~[role=cell]:has-text("Enabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page.locator('[role=cell]:has-text("Limit Lines")~[role=cell]:has-text("Disabled")')
|
||||||
|
).toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
44
e2e/tests/framework/pluginFixtures.e2e.spec.js
Normal file
44
e2e/tests/framework/pluginFixtures.e2e.spec.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to testing our use of our custom fixtures to verify
|
||||||
|
that they are working as expected.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test } = require('../../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);
|
||||||
|
// });
|
||||||
|
});
|
65
e2e/tests/functional/branding.e2e.spec.js
Normal file
65
e2e/tests/functional/branding.e2e.spec.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to tests which verify branding related components.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
|
test.describe('Branding tests', () => {
|
||||||
|
test('About Modal launches with basic branding properties', async ({ page }) => {
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Click About button
|
||||||
|
await page.click('.l-shell__app-logo');
|
||||||
|
|
||||||
|
// Verify that the NASA Logo Appears
|
||||||
|
await expect(page.locator('.c-about__image')).toBeVisible();
|
||||||
|
|
||||||
|
// 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: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// 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();
|
||||||
|
});
|
||||||
|
});
|
118
e2e/tests/functional/couchdb.e2e.spec.js
Normal file
118
e2e/tests/functional/couchdb.e2e.spec.js
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This test suite is meant to be executed against a couchdb container. More doc to come
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
|
|
||||||
|
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({})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
|
waitUntil: 'networkidle'
|
||||||
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB is connected")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Shows red if not connected', async ({ page }) => {
|
||||||
|
await page.route('**/openmct/**', (route) => {
|
||||||
|
route.fulfill({
|
||||||
|
status: 503,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify({})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Go to baseURL
|
||||||
|
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 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.
|
||||||
|
// 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 }
|
||||||
|
);
|
||||||
|
|
||||||
|
// 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'
|
||||||
|
);
|
||||||
|
|
||||||
|
// 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'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Go to baseURL.
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Wait for both requests to resolve.
|
||||||
|
await Promise.all([putMineFolderRequest, getMineFolderRequest]);
|
||||||
|
});
|
||||||
|
});
|
58
e2e/tests/functional/example/eventGenerator.e2e.spec.js
Normal file
58
e2e/tests/functional/example/eventGenerator.e2e.spec.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to tests which verify the basic operations surrounding the example event generator.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
|
const { createDomainObjectWithDefaults } = require('../../../appActions');
|
||||||
|
|
||||||
|
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: 'domcontentloaded' });
|
||||||
|
|
||||||
|
//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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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 }) => {
|
||||||
|
// Go to object created in step one
|
||||||
|
// Verify the telemetry table has a class with "is-sorting asc"
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,139 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// 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 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/);
|
||||||
|
|
||||||
|
// 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/);
|
||||||
|
|
||||||
|
// 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/);
|
||||||
|
|
||||||
|
// 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 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 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');
|
||||||
|
|
||||||
|
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")')]);
|
||||||
|
|
||||||
|
// 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 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]+/
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
302
e2e/tests/functional/forms.e2e.spec.js
Normal file
302
e2e/tests/functional/forms.e2e.spec.js
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to tests which verify form functionality in isolation
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
|
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||||
|
const genUuid = require('uuid').v4;
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
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: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
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');
|
||||||
|
|
||||||
|
//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');
|
||||||
|
|
||||||
|
//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")')]);
|
||||||
|
|
||||||
|
//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: path.join(__dirname, '../../helper', 'addInitFileInputObject.js')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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 }) => {
|
||||||
|
await page.addInitScript({
|
||||||
|
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
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.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
await page.click('text=Condition Set');
|
||||||
|
|
||||||
|
await page.locator('form[name="mctForm"] >> text=Persistence Testing').click();
|
||||||
|
|
||||||
|
const okButton = page.locator('button:has-text("OK")');
|
||||||
|
await expect(okButton).toBeDisabled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Persistence operations @couchdb', () => {
|
||||||
|
test.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 options"]');
|
||||||
|
await page.click('li[title="Edit properties of this object."]');
|
||||||
|
|
||||||
|
// Modify the display format from default 12hr -> 24hr and click 'Save'
|
||||||
|
await page
|
||||||
|
.locator('select[aria-label="12 or 24 hour clock"]')
|
||||||
|
.selectOption({ value: 'clock24' });
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
await expect
|
||||||
|
.poll(() => putRequestCount, {
|
||||||
|
message: 'Verify a single PUT request was made to persist the object',
|
||||||
|
timeout: 1000
|
||||||
|
})
|
||||||
|
.toEqual(1);
|
||||||
|
});
|
||||||
|
test('Can create an object after a conflict error @couchdb @2p', async ({
|
||||||
|
page,
|
||||||
|
openmctConfig
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5982'
|
||||||
|
});
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
// Instantiate a second page/tab
|
||||||
|
const page2 = await page.context().newPage();
|
||||||
|
|
||||||
|
// Both pages: Go to baseURL
|
||||||
|
await Promise.all([
|
||||||
|
page.goto('./', { waitUntil: 'networkidle' }),
|
||||||
|
page2.goto('./', { waitUntil: 'networkidle' })
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Slow down the test a bit
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `Expand ${myItemsFolderName} folder` })
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page2.getByRole('button', { name: `Expand ${myItemsFolderName} folder` })
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Both pages: Click the Create button
|
||||||
|
await Promise.all([
|
||||||
|
page.click('button:has-text("Create")'),
|
||||||
|
page2.click('button:has-text("Create")')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Both pages: Click "Clock" in the Create menu
|
||||||
|
await Promise.all([
|
||||||
|
page.click(`li[role='menuitem']:text("Clock")`),
|
||||||
|
page2.click(`li[role='menuitem']:text("Clock")`)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Generate unique names for both objects
|
||||||
|
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
|
const nameInput2 = page2.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
|
|
||||||
|
// Both pages: Fill in the 'Name' form field.
|
||||||
|
await Promise.all([
|
||||||
|
nameInput.fill(''),
|
||||||
|
nameInput.fill(`Clock:${genUuid()}`),
|
||||||
|
nameInput2.fill(''),
|
||||||
|
nameInput2.fill(`Clock:${genUuid()}`)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Both pages: Fill the "Notes" section with information about the
|
||||||
|
// currently running test and its project.
|
||||||
|
const testNotes = page.testNotes;
|
||||||
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
const notesInput2 = page2.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
await Promise.all([notesInput.fill(testNotes), notesInput2.fill(testNotes)]);
|
||||||
|
|
||||||
|
// Page 2: Click "OK" to create the domain object and wait for navigation.
|
||||||
|
// This will update the composition of the parent folder, setting the
|
||||||
|
// conditions for a conflict error from the first page.
|
||||||
|
await Promise.all([
|
||||||
|
page2.waitForLoadState(),
|
||||||
|
page2.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page2.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Close Page 2, we're done with it.
|
||||||
|
await page2.close();
|
||||||
|
|
||||||
|
// Page 1: Click "OK" to create the domain object and wait for navigation.
|
||||||
|
// This will trigger a conflict error upon attempting to update
|
||||||
|
// the composition of the parent folder.
|
||||||
|
await Promise.all([
|
||||||
|
page.waitForLoadState(),
|
||||||
|
page.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Page 1: Verify that the conflict has occurred and an error notification is displayed.
|
||||||
|
await expect(
|
||||||
|
page.locator('.c-message-banner__message', {
|
||||||
|
hasText: 'Conflict detected while saving mine'
|
||||||
|
})
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Page 1: Start logging console errors from this point on
|
||||||
|
let errors = [];
|
||||||
|
page.on('console', (msg) => {
|
||||||
|
if (msg.type() === 'error') {
|
||||||
|
errors.push(msg.text());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Page 1: Try to create a clock with the page that received the conflict.
|
||||||
|
const clockAfterConflict = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Clock'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Page 1: Wait for save progress dialog to appear/disappear
|
||||||
|
await page
|
||||||
|
.locator('.c-message-banner__message', {
|
||||||
|
hasText:
|
||||||
|
'Do not navigate away from this page or close this browser tab while this message is displayed.',
|
||||||
|
state: 'visible'
|
||||||
|
})
|
||||||
|
.waitFor({ state: 'hidden' });
|
||||||
|
|
||||||
|
// Page 1: Navigate to 'My Items' and verify that the second clock was created
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
await expect(
|
||||||
|
page.locator(`.c-grid-item__name[title="${clockAfterConflict.name}"]`)
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Verify no console errors occurred
|
||||||
|
expect(errors).toHaveLength(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Form Correctness by Object Type', () => {
|
||||||
|
test.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 }) => {});
|
||||||
|
});
|
59
e2e/tests/functional/menu.e2e.spec.js
Normal file
59
e2e/tests/functional/menu.e2e.spec.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
/*
|
||||||
|
This test suite is dedicated to tests which verify persistability checks
|
||||||
|
*/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
test.describe('Persistence operations @addInit', () => {
|
||||||
|
// add non persistable root item
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.addInitScript({
|
||||||
|
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Non-persistable objects should not show persistence related actions', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('text=Persistence Testing').first().click({
|
||||||
|
button: 'right'
|
||||||
|
});
|
||||||
|
|
||||||
|
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'
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user