mirror of
https://github.com/nasa/openmct.git
synced 2025-06-26 11:09:22 +00:00
Compare commits
196 Commits
omm-large-
...
large-valu
Author | SHA1 | Date | |
---|---|---|---|
98200b1dba | |||
61e7050391 | |||
3f51516da9 | |||
541a022f36 | |||
c7b5ecbd68 | |||
6776cc308f | |||
95ac919ddf | |||
2a1064cbab | |||
8e917b2679 | |||
0be106f29e | |||
9f7b3b9225 | |||
e9b94c308b | |||
64740e133f | |||
c27ad469f6 | |||
e09a7aebae | |||
b87459dfd7 | |||
ca06a6a047 | |||
95e3ab25a4 | |||
f9db6433a1 | |||
cbac2c1c82 | |||
a8678aa739 | |||
244e3b7938 | |||
42b13c4dfb | |||
351800b32a | |||
6db390a71a | |||
9ece4e55dc | |||
0a497483f2 | |||
a52577e729 | |||
a495e86231 | |||
bada228b8f | |||
3f80b53ea6 | |||
99a3e3fc32 | |||
2d92223e16 | |||
f21685e216 | |||
6c92e31036 | |||
82b1760b0e | |||
87feb0db34 | |||
c53073b339 | |||
57743e5918 | |||
f3b819a786 | |||
50694f600c | |||
10f3e13e4d | |||
9be9c5e28e | |||
58aeac94ac | |||
1e3097f54b | |||
6a9ff91d93 | |||
accfbc96ab | |||
9942bbbc0f | |||
4287cd5413 | |||
ee6ca11558 | |||
676bb81eab | |||
c6305697c0 | |||
0421936874 | |||
95e686038d | |||
f705bf9a61 | |||
50559ac502 | |||
f0ef93dd3f | |||
3ae14cf786 | |||
194eb43607 | |||
3c2b032526 | |||
d4e51cbaf1 | |||
7c58b19c3e | |||
16e1ac2529 | |||
4885c816dc | |||
42b545917c | |||
85974fc5f1 | |||
761d4ce7e4 | |||
5b1298f221 | |||
662d14354c | |||
e386036dbf | |||
6e79e5e2b0 | |||
32529ff6b2 | |||
92329b3d8e | |||
cde8fbbb0d | |||
795d7a7ec7 | |||
5031010a00 | |||
ac22bebe76 | |||
d08ea62932 | |||
293f25df19 | |||
9c22bcfb3e | |||
3b0e05ed14 | |||
ff7f55574d | |||
58f869b21b | |||
834a19f996 | |||
1d7cd64652 | |||
68ed7bf0e5 | |||
4b39ef3235 | |||
b685b9582e | |||
d8ac209a96 | |||
f254d4f078 | |||
c75a82dca5 | |||
9423591e4d | |||
5a7174bf2a | |||
d305443445 | |||
bd5cb8139c | |||
022dffd419 | |||
4c5de37cff | |||
fb5bbde154 | |||
9a01cee5fa | |||
8b2d3b0622 | |||
60df9e79c1 | |||
5a1e544a4c | |||
040ef0b998 | |||
f77287530b | |||
3cc93c0656 | |||
d71287b318 | |||
943a40680f | |||
351e6a0fbf | |||
1f514dde3d | |||
47121cfbe8 | |||
44c4d4ff47 | |||
dc1d046822 | |||
cdb20b9950 | |||
a9158a90d5 | |||
07373817b0 | |||
9247951456 | |||
47c5863edf | |||
295bfe9294 | |||
1c6214fe79 | |||
4cab97cb4b | |||
0bafdad605 | |||
4d375ec765 | |||
47b44cebba | |||
fea68381a7 | |||
356c90ca45 | |||
7e12a45960 | |||
804dbf0cab | |||
caa7bc6fae | |||
172e0b23fd | |||
5df7971438 | |||
b39d5e8bcc | |||
c5188397e4 | |||
225fa22c72 | |||
2c3b6fa540 | |||
496ab4d5a3 | |||
aad9e51262 | |||
ba4353aacb | |||
9f079255f1 | |||
f5eacc504b | |||
26fa1653e3 | |||
b7c68f715b | |||
549a579bf3 | |||
fe677fa359 | |||
1bbc3789ec | |||
636849885b | |||
6f2b20eee9 | |||
e38821cc1f | |||
4345d216f7 | |||
84a12c7833 | |||
ad8445114f | |||
bcd50dfa35 | |||
a798ddf05e | |||
7af7e68779 | |||
c200999659 | |||
ddeeff4822 | |||
5610846147 | |||
88fde47932 | |||
2a0faba35f | |||
a47abf5f96 | |||
968eee6698 | |||
43d56a68bb | |||
f055a8a0c7 | |||
2820237d60 | |||
dbdc9bb4e2 | |||
a9a98380f2 | |||
e3ab085dd5 | |||
519135527b | |||
fc37f6e05b | |||
ab1df89396 | |||
9ee5ab96f3 | |||
8b2c6e3fb3 | |||
b8b0a08eeb | |||
633b6be2fd | |||
4963aff8a0 | |||
6786be54fa | |||
b081389e68 | |||
7a3ec3a241 | |||
c0c383bf18 | |||
fe1c99de12 | |||
2e60da0401 | |||
bc3a5408b4 | |||
344bf8eed3 | |||
cbb3368937 | |||
b7a671d392 | |||
4f10a93ef5 | |||
f8186e4b4e | |||
4e0c364d89 | |||
f3bed9c651 | |||
4d93907d58 | |||
6f656a6783 | |||
767fb6c5fd | |||
b0a0b4bb58 | |||
340f4a9e79 | |||
3007b28b0f | |||
20789601b4 | |||
a56cfed732 |
@ -2,19 +2,23 @@ version: 2.1
|
|||||||
executors:
|
executors:
|
||||||
pw-focal-development:
|
pw-focal-development:
|
||||||
docker:
|
docker:
|
||||||
- image: mcr.microsoft.com/playwright:v1.29.0-focal
|
- image: mcr.microsoft.com/playwright:v1.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_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
|
||||||
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||||
|
ubuntu:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2204:current
|
||||||
|
docker_layer_caching: true
|
||||||
parameters:
|
parameters:
|
||||||
BUST_CACHE:
|
BUST_CACHE:
|
||||||
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
description: 'Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!'
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
commands:
|
commands:
|
||||||
build_and_install:
|
build_and_install:
|
||||||
description: "All steps used to build and install. Will use cache if found"
|
description: 'All steps used to build and install. Will use cache if found'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
@ -23,53 +27,52 @@ commands:
|
|||||||
- restore_cache_cmd:
|
- restore_cache_cmd:
|
||||||
node-version: << parameters.node-version >>
|
node-version: << parameters.node-version >>
|
||||||
- node/install:
|
- node/install:
|
||||||
install-npm: true
|
|
||||||
node-version: << parameters.node-version >>
|
node-version: << parameters.node-version >>
|
||||||
- run: npm install --prefer-offline --no-audit --progress=false
|
- run: npm install --no-audit --progress=false
|
||||||
restore_cache_cmd:
|
restore_cache_cmd:
|
||||||
description: "Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache"
|
description: 'Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- when:
|
- when:
|
||||||
condition:
|
condition:
|
||||||
equal: [false, << pipeline.parameters.BUST_CACHE >> ]
|
equal: [false, << pipeline.parameters.BUST_CACHE >>]
|
||||||
steps:
|
steps:
|
||||||
- restore_cache:
|
- restore_cache:
|
||||||
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||||
save_cache_cmd:
|
save_cache_cmd:
|
||||||
description: "Custom command for saving cache."
|
description: 'Custom command for saving cache.'
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- save_cache:
|
- save_cache:
|
||||||
key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
|
||||||
paths:
|
paths:
|
||||||
- ~/.npm
|
- ~/.npm
|
||||||
- node_modules
|
- node_modules
|
||||||
generate_and_store_version_and_filesystem_artifacts:
|
generate_and_store_version_and_filesystem_artifacts:
|
||||||
description: "Track important packages and files"
|
description: 'Track important packages and files'
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
mkdir /tmp/artifacts
|
[[ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
|
||||||
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt
|
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt || true
|
||||||
npm -v >> /tmp/artifacts/npm-version.txt
|
npm -v >> /tmp/artifacts/npm-version.txt
|
||||||
node -v >> /tmp/artifacts/node-version.txt
|
node -v >> /tmp/artifacts/node-version.txt
|
||||||
ls -latR >> /tmp/artifacts/dir.txt
|
ls -latR >> /tmp/artifacts/dir.txt
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/artifacts/
|
path: /tmp/artifacts/
|
||||||
generate_e2e_code_cov_report:
|
generate_e2e_code_cov_report:
|
||||||
description: "Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test"
|
description: 'Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test'
|
||||||
parameters:
|
parameters:
|
||||||
suite:
|
suite:
|
||||||
type: string
|
type: string
|
||||||
steps:
|
steps:
|
||||||
- run: npm run cov:e2e:report || true
|
- run: npm run cov:e2e:report || true
|
||||||
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
- run: npm run cov:e2e:<<parameters.suite>>:publish
|
||||||
orbs:
|
orbs:
|
||||||
node: circleci/node@4.9.0
|
node: circleci/node@5.1.0
|
||||||
browser-tools: circleci/browser-tools@1.3.0
|
browser-tools: circleci/browser-tools@1.3.0
|
||||||
jobs:
|
jobs:
|
||||||
npm-audit:
|
npm-audit:
|
||||||
@ -110,7 +113,11 @@ jobs:
|
|||||||
path: dist/reports/tests/
|
path: dist/reports/tests/
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: coverage
|
path: coverage
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
e2e-test:
|
e2e-test:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
@ -124,12 +131,16 @@ jobs:
|
|||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
||||||
condition:
|
condition:
|
||||||
equal: [ "full", <<parameters.suite>> ]
|
equal: ['full', <<parameters.suite>>]
|
||||||
steps:
|
steps:
|
||||||
- run: npx playwright install chrome-beta
|
- run: npx playwright install chrome-beta
|
||||||
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
||||||
- generate_e2e_code_cov_report:
|
- when:
|
||||||
suite: <<parameters.suite>>
|
condition:
|
||||||
|
equal: [42, 42] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_e2e_code_cov_report:
|
||||||
|
suite: <<parameters.suite>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
@ -138,7 +149,46 @@ jobs:
|
|||||||
path: coverage
|
path: coverage
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
|
e2e-couchdb:
|
||||||
|
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
|
||||||
perf-test:
|
perf-test:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
@ -154,65 +204,78 @@ jobs:
|
|||||||
path: test-results
|
path: test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always 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:
|
visual-test:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
node-version:
|
||||||
type: string
|
type: string
|
||||||
|
suite:
|
||||||
|
type: string # ci or full
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
- run: npm run test:e2e:visual
|
- run: npm run test:e2e:visual:<<parameters.suite>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
workflows:
|
workflows:
|
||||||
overall-circleci-commit-status: #These jobs run on every commit
|
overall-circleci-commit-status: #These jobs run on every commit
|
||||||
jobs:
|
jobs:
|
||||||
- lint:
|
- lint:
|
||||||
name: node14-lint
|
name: node16-lint
|
||||||
node-version: lts/fermium
|
node-version: lts/gallium
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-stable
|
name: e2e-stable
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
suite: stable
|
suite: stable
|
||||||
- perf-test:
|
- perf-test:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
- visual-test:
|
- visual-test:
|
||||||
node-version: lts/gallium
|
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: node14-chrome-nightly
|
|
||||||
node-version: lts/fermium
|
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node16-chrome-nightly
|
name: node16-chrome-nightly
|
||||||
node-version: lts/gallium
|
node-version: lts/gallium
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
- npm-audit:
|
- npm-audit:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-full-nightly
|
name: e2e-full-nightly
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
suite: full
|
suite: full
|
||||||
- perf-test:
|
- perf-test:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
- visual-test:
|
- visual-test:
|
||||||
node-version: lts/gallium
|
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:
|
||||||
|
496
.cspell.json
Normal file
496
.cspell.json
Normal file
@ -0,0 +1,496 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
442
.eslintrc.js
442
.eslintrc.js
@ -1,271 +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'
|
||||||
|
],
|
||||||
|
parser: 'vue-eslint-parser',
|
||||||
|
parserOptions: {
|
||||||
|
parser: '@babel/eslint-parser',
|
||||||
|
requireConfigFile: false,
|
||||||
|
allowImportExportEverywhere: true,
|
||||||
|
ecmaVersion: 2015,
|
||||||
|
ecmaFeatures: {
|
||||||
|
impliedStrict: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'simple-import-sort/imports': 'warn',
|
||||||
|
'simple-import-sort/exports': 'warn',
|
||||||
|
'vue/no-deprecated-dollar-listeners-api': 'warn',
|
||||||
|
'vue/no-deprecated-events-api': 'warn',
|
||||||
|
'vue/no-v-for-template-key': 'off',
|
||||||
|
'vue/no-v-for-template-key-on-child': 'error',
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'you-dont-need-lodash-underscore/omit': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/throttle': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/flatten': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/get': 'off',
|
||||||
|
'no-bitwise': 'error',
|
||||||
|
curly: 'error',
|
||||||
|
eqeqeq: 'error',
|
||||||
|
'guard-for-in': 'error',
|
||||||
|
'no-extend-native': 'error',
|
||||||
|
'no-inner-declarations': 'off',
|
||||||
|
'no-use-before-define': ['error', 'nofunc'],
|
||||||
|
'no-caller': 'error',
|
||||||
|
'no-irregular-whitespace': 'error',
|
||||||
|
'no-new': 'error',
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-undef': 'error',
|
||||||
|
'no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
args: 'none'
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"parser": "vue-eslint-parser",
|
'no-console': 'off',
|
||||||
"parserOptions": {
|
'new-cap': [
|
||||||
"parser": "@babel/eslint-parser",
|
'error',
|
||||||
"requireConfigFile": false,
|
{
|
||||||
"allowImportExportEverywhere": true,
|
capIsNew: false,
|
||||||
"ecmaVersion": 2015,
|
properties: false
|
||||||
"ecmaFeatures": {
|
}
|
||||||
"impliedStrict": true
|
],
|
||||||
}
|
'dot-notation': 'error',
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"you-dont-need-lodash-underscore/omit": "off",
|
|
||||||
"you-dont-need-lodash-underscore/throttle": "off",
|
|
||||||
"you-dont-need-lodash-underscore/flatten": "off",
|
|
||||||
"you-dont-need-lodash-underscore/get": "off",
|
|
||||||
"no-bitwise": "error",
|
|
||||||
"curly": "error",
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"no-extend-native": "error",
|
|
||||||
"no-inner-declarations": "off",
|
|
||||||
"no-use-before-define": ["error", "nofunc"],
|
|
||||||
"no-caller": "error",
|
|
||||||
"no-irregular-whitespace": "error",
|
|
||||||
"no-new": "error",
|
|
||||||
"no-shadow": "error",
|
|
||||||
"no-undef": "error",
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-console": "off",
|
|
||||||
"no-trailing-spaces": "error",
|
|
||||||
"space-before-function-paren": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"anonymous": "always",
|
|
||||||
"asyncArrow": "always",
|
|
||||||
"named": "never"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"array-bracket-spacing": "error",
|
|
||||||
"space-in-parens": "error",
|
|
||||||
"space-before-blocks": "error",
|
|
||||||
"comma-dangle": "error",
|
|
||||||
"eol-last": "error",
|
|
||||||
"new-cap": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"capIsNew": false,
|
|
||||||
"properties": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dot-notation": "error",
|
|
||||||
"indent": ["error", 4],
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-case-declarations
|
// https://eslint.org/docs/rules/no-case-declarations
|
||||||
"no-case-declarations": "error",
|
'no-case-declarations': 'error',
|
||||||
// https://eslint.org/docs/rules/max-classes-per-file
|
// https://eslint.org/docs/rules/max-classes-per-file
|
||||||
"max-classes-per-file": ["error", 1],
|
'max-classes-per-file': ['error', 1],
|
||||||
// https://eslint.org/docs/rules/no-eq-null
|
// https://eslint.org/docs/rules/no-eq-null
|
||||||
"no-eq-null": "error",
|
'no-eq-null': 'error',
|
||||||
// https://eslint.org/docs/rules/no-eval
|
// https://eslint.org/docs/rules/no-eval
|
||||||
"no-eval": "error",
|
'no-eval': 'error',
|
||||||
// https://eslint.org/docs/rules/no-floating-decimal
|
// https://eslint.org/docs/rules/no-implicit-globals
|
||||||
"no-floating-decimal": "error",
|
'no-implicit-globals': 'error',
|
||||||
// https://eslint.org/docs/rules/no-implicit-globals
|
// https://eslint.org/docs/rules/no-implied-eval
|
||||||
"no-implicit-globals": "error",
|
'no-implied-eval': 'error',
|
||||||
// https://eslint.org/docs/rules/no-implied-eval
|
// https://eslint.org/docs/rules/no-lone-blocks
|
||||||
"no-implied-eval": "error",
|
'no-lone-blocks': 'error',
|
||||||
// https://eslint.org/docs/rules/no-lone-blocks
|
// https://eslint.org/docs/rules/no-loop-func
|
||||||
"no-lone-blocks": "error",
|
'no-loop-func': 'error',
|
||||||
// https://eslint.org/docs/rules/no-loop-func
|
// https://eslint.org/docs/rules/no-new-func
|
||||||
"no-loop-func": "error",
|
'no-new-func': 'error',
|
||||||
// https://eslint.org/docs/rules/no-new-func
|
// https://eslint.org/docs/rules/no-new-wrappers
|
||||||
"no-new-func": "error",
|
'no-new-wrappers': 'error',
|
||||||
// https://eslint.org/docs/rules/no-new-wrappers
|
// https://eslint.org/docs/rules/no-octal-escape
|
||||||
"no-new-wrappers": "error",
|
'no-octal-escape': 'error',
|
||||||
// https://eslint.org/docs/rules/no-octal-escape
|
// https://eslint.org/docs/rules/no-proto
|
||||||
"no-octal-escape": "error",
|
'no-proto': 'error',
|
||||||
// https://eslint.org/docs/rules/no-proto
|
// https://eslint.org/docs/rules/no-return-await
|
||||||
"no-proto": "error",
|
'no-return-await': 'error',
|
||||||
// https://eslint.org/docs/rules/no-return-await
|
// https://eslint.org/docs/rules/no-script-url
|
||||||
"no-return-await": "error",
|
'no-script-url': 'error',
|
||||||
// https://eslint.org/docs/rules/no-script-url
|
// https://eslint.org/docs/rules/no-self-compare
|
||||||
"no-script-url": "error",
|
'no-self-compare': 'error',
|
||||||
// https://eslint.org/docs/rules/no-self-compare
|
// https://eslint.org/docs/rules/no-sequences
|
||||||
"no-self-compare": "error",
|
'no-sequences': 'error',
|
||||||
// https://eslint.org/docs/rules/no-sequences
|
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||||
"no-sequences": "error",
|
'no-unmodified-loop-condition': 'error',
|
||||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
// https://eslint.org/docs/rules/no-useless-call
|
||||||
"no-unmodified-loop-condition": "error",
|
'no-useless-call': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-call
|
// https://eslint.org/docs/rules/no-nested-ternary
|
||||||
"no-useless-call": "error",
|
'no-nested-ternary': 'error',
|
||||||
// https://eslint.org/docs/rules/wrap-iife
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||||
"wrap-iife": "error",
|
'no-useless-computed-key': 'error',
|
||||||
// https://eslint.org/docs/rules/no-nested-ternary
|
// https://eslint.org/docs/rules/no-var
|
||||||
"no-nested-ternary": "error",
|
'no-var': 'error',
|
||||||
// https://eslint.org/docs/rules/switch-colon-spacing
|
// https://eslint.org/docs/rules/one-var
|
||||||
"switch-colon-spacing": "error",
|
'one-var': ['error', 'never'],
|
||||||
// https://eslint.org/docs/rules/no-useless-computed-key
|
// https://eslint.org/docs/rules/default-case-last
|
||||||
"no-useless-computed-key": "error",
|
'default-case-last': 'error',
|
||||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
// https://eslint.org/docs/rules/default-param-last
|
||||||
"rest-spread-spacing": ["error"],
|
'default-param-last': 'error',
|
||||||
// https://eslint.org/docs/rules/no-var
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||||
"no-var": "error",
|
'grouped-accessor-pairs': 'error',
|
||||||
// https://eslint.org/docs/rules/one-var
|
// https://eslint.org/docs/rules/no-constructor-return
|
||||||
"one-var": ["error", "never"],
|
'no-constructor-return': 'error',
|
||||||
// https://eslint.org/docs/rules/default-case-last
|
// https://eslint.org/docs/rules/array-callback-return
|
||||||
"default-case-last": "error",
|
'array-callback-return': 'error',
|
||||||
// https://eslint.org/docs/rules/default-param-last
|
// https://eslint.org/docs/rules/no-invalid-this
|
||||||
"default-param-last": "error",
|
'no-invalid-this': 'error', // Believe this one actually surfaces some bugs
|
||||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
// https://eslint.org/docs/rules/func-style
|
||||||
"grouped-accessor-pairs": "error",
|
'func-style': ['error', 'declaration'],
|
||||||
// https://eslint.org/docs/rules/no-constructor-return
|
// https://eslint.org/docs/rules/no-unused-expressions
|
||||||
"no-constructor-return": "error",
|
'no-unused-expressions': 'error',
|
||||||
// https://eslint.org/docs/rules/array-callback-return
|
// https://eslint.org/docs/rules/no-useless-concat
|
||||||
"array-callback-return": "error",
|
'no-useless-concat': 'error',
|
||||||
// https://eslint.org/docs/rules/no-invalid-this
|
// https://eslint.org/docs/rules/radix
|
||||||
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
|
radix: 'error',
|
||||||
// https://eslint.org/docs/rules/func-style
|
// https://eslint.org/docs/rules/require-await
|
||||||
"func-style": ["error", "declaration"],
|
'require-await': 'error',
|
||||||
// https://eslint.org/docs/rules/no-unused-expressions
|
// https://eslint.org/docs/rules/no-alert
|
||||||
"no-unused-expressions": "error",
|
'no-alert': 'error',
|
||||||
// https://eslint.org/docs/rules/no-useless-concat
|
// https://eslint.org/docs/rules/no-useless-constructor
|
||||||
"no-useless-concat": "error",
|
'no-useless-constructor': 'error',
|
||||||
// https://eslint.org/docs/rules/radix
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
||||||
"radix": "error",
|
'no-duplicate-imports': 'error',
|
||||||
// https://eslint.org/docs/rules/require-await
|
|
||||||
"require-await": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-alert
|
|
||||||
"no-alert": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-useless-constructor
|
|
||||||
"no-useless-constructor": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-coercion
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
||||||
"no-implicit-coercion": "error",
|
'no-implicit-coercion': 'error',
|
||||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||||
"no-unneeded-ternary": "error",
|
'no-unneeded-ternary': 'error',
|
||||||
// https://eslint.org/docs/rules/semi
|
"unicorn/filename-case": [
|
||||||
"semi": ["error", "always"],
|
"error",
|
||||||
// https://eslint.org/docs/rules/no-multi-spaces
|
{
|
||||||
"no-multi-spaces": "error",
|
"cases": {
|
||||||
// https://eslint.org/docs/rules/key-spacing
|
"pascalCase": true
|
||||||
"key-spacing": ["error", {
|
},
|
||||||
"afterColon": true
|
"ignore": [
|
||||||
}],
|
"^.*\\.js$"
|
||||||
// https://eslint.org/docs/rules/keyword-spacing
|
]
|
||||||
"keyword-spacing": ["error", {
|
}
|
||||||
"before": true,
|
],
|
||||||
"after": true
|
'vue/first-attribute-linebreak': 'error',
|
||||||
}],
|
'vue/multiline-html-element-content-newline': 'off',
|
||||||
// https://eslint.org/docs/rules/comma-spacing
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
// Also requires one line code fix
|
'vue/multi-word-component-names': 'off', // TODO enable, align with conventions
|
||||||
"comma-spacing": ["error", {
|
'vue/no-mutating-props': 'off'
|
||||||
"after": true
|
},
|
||||||
}],
|
overrides: [
|
||||||
//https://eslint.org/docs/rules/no-whitespace-before-property
|
{
|
||||||
"no-whitespace-before-property": "error",
|
files: LEGACY_FILES,
|
||||||
// https://eslint.org/docs/rules/object-curly-newline
|
rules: {
|
||||||
"object-curly-newline": ["error", {
|
'no-unused-vars': [
|
||||||
"consistent": true,
|
'warn',
|
||||||
"multiline": true
|
{
|
||||||
}],
|
vars: 'all',
|
||||||
// https://eslint.org/docs/rules/object-property-newline
|
args: 'none',
|
||||||
"object-property-newline": "error",
|
varsIgnorePattern: 'controller'
|
||||||
// https://eslint.org/docs/rules/brace-style
|
}
|
||||||
"brace-style": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
||||||
"no-multiple-empty-lines": ["error", {"max": 1}],
|
|
||||||
// https://eslint.org/docs/rules/operator-linebreak
|
|
||||||
"operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}],
|
|
||||||
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
||||||
"padding-line-between-statements": ["error", {
|
|
||||||
"blankLine": "always",
|
|
||||||
"prev": "multiline-block-like",
|
|
||||||
"next": "*"
|
|
||||||
}, {
|
|
||||||
"blankLine": "always",
|
|
||||||
"prev": "*",
|
|
||||||
"next": "return"
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/space-infix-ops
|
|
||||||
"space-infix-ops": "error",
|
|
||||||
// https://eslint.org/docs/rules/space-unary-ops
|
|
||||||
"space-unary-ops": ["error", {
|
|
||||||
"words": true,
|
|
||||||
"nonwords": false
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/arrow-spacing
|
|
||||||
"arrow-spacing": "error",
|
|
||||||
// https://eslint.org/docs/rules/semi-spacing
|
|
||||||
"semi-spacing": ["error", {
|
|
||||||
"before": false,
|
|
||||||
"after": true
|
|
||||||
}],
|
|
||||||
|
|
||||||
"vue/html-indent": [
|
|
||||||
"error",
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
"attribute": 1,
|
|
||||||
"baseIndent": 0,
|
|
||||||
"closeBracket": 0,
|
|
||||||
"alignAttributesVertically": true,
|
|
||||||
"ignores": []
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"vue/html-self-closing": ["error",
|
'no-nested-ternary': 'off',
|
||||||
{
|
'no-var': 'off',
|
||||||
"html": {
|
'one-var': 'off'
|
||||||
"void": "never",
|
}
|
||||||
"normal": "never",
|
}
|
||||||
"component": "always"
|
]
|
||||||
},
|
|
||||||
"svg": "always",
|
|
||||||
"math": "always"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/max-attributes-per-line": ["error", {
|
|
||||||
"singleline": 1,
|
|
||||||
"multiline": 1,
|
|
||||||
}],
|
|
||||||
"vue/first-attribute-linebreak": "error",
|
|
||||||
"vue/multiline-html-element-content-newline": "off",
|
|
||||||
"vue/singleline-html-element-content-newline": "off",
|
|
||||||
"vue/multi-word-component-names": "off", // TODO enable, align with conventions
|
|
||||||
"vue/no-mutating-props": "off"
|
|
||||||
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": LEGACY_FILES,
|
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none",
|
|
||||||
"varsIgnorePattern": "controller"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-nested-ternary": "off",
|
|
||||||
"no-var": "off",
|
|
||||||
"one-var": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
12
.git-blame-ignore-revs
Normal file
12
.git-blame-ignore-revs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# git-blame ignored revisions
|
||||||
|
# To configure, run:
|
||||||
|
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
|
# Requires Git > 2.23
|
||||||
|
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
|
||||||
|
|
||||||
|
# Copyright year update 2022
|
||||||
|
4a9744e916d24122a81092f6b7950054048ba860
|
||||||
|
# Copyright year update 2023
|
||||||
|
8040b275fcf2ba71b42cd72d4daa64bb25c19c2d
|
||||||
|
# Apply `prettier` formatting
|
||||||
|
caa7bc6faebc204f67aedae3e35fb0d0d3ce27a7
|
53
.github/dependabot.yml
vendored
53
.github/dependabot.yml
vendored
@ -1,35 +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:
|
||||||
- "pr:e2e"
|
- 'pr:daveit'
|
||||||
- "type:maintenance"
|
- 'pr:e2e'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
- "pr:platform"
|
- 'pr:platform'
|
||||||
ignore:
|
ignore:
|
||||||
#We have to source the playwright container which is not detected by Dependabot
|
#We have to source the playwright container which is not detected by Dependabot
|
||||||
- dependency-name: "@playwright/test"
|
- dependency-name: '@playwright/test'
|
||||||
- dependency-name: "playwright-core"
|
- dependency-name: 'playwright-core'
|
||||||
#Lots of noise in these type patch releases.
|
#Lots of noise in these type patch releases.
|
||||||
- dependency-name: "@babel/eslint-parser"
|
- dependency-name: '@babel/eslint-parser'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- dependency-name: "eslint-plugin-vue"
|
- dependency-name: 'eslint-plugin-vue'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- dependency-name: "babel-loader"
|
- dependency-name: 'babel-loader'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- dependency-name: "sinon"
|
- dependency-name: 'sinon'
|
||||||
update-types: ["version-update:semver-patch"]
|
update-types: ['version-update:semver-patch']
|
||||||
- package-ecosystem: "github-actions"
|
- dependency-name: 'moment-timezone'
|
||||||
directory: "/"
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: '@types/lodash'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- package-ecosystem: 'github-actions'
|
||||||
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'daily'
|
||||||
labels:
|
labels:
|
||||||
- "type:maintenance"
|
- 'pr:daveit'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
|
85
.github/workflows/e2e-couchdb.yml
vendored
85
.github/workflows/e2e-couchdb.yml
vendored
@ -1,38 +1,89 @@
|
|||||||
name: "e2e-couchdb"
|
name: 'e2e-couchdb'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
env:
|
schedule:
|
||||||
OPENMCT_DATABASE_NAME: openmct
|
- cron: '0 0 * * *'
|
||||||
COUCH_ADMIN_USER: admin
|
|
||||||
COUCH_ADMIN_PASSWORD: password
|
|
||||||
COUCH_BASE_LOCAL: http://localhost:5984
|
|
||||||
COUCH_NODE_NAME: nonode@nohost
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e-couchdb:
|
e2e-couchdb:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e:couchdb' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e:couchdb') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.action == 'opened'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run : docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
|
||||||
- run : sleep 3 # wait until CouchDB has started (TODO: there must be a better way)
|
|
||||||
- run : bash src/plugins/persistence/couch/setup-couchdb.sh
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: 'lts/hydrogen'
|
||||||
- run: npx playwright@1.29.0 install
|
|
||||||
- run: npm install
|
- name: Cache NPM dependencies
|
||||||
- run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
uses: actions/cache@v3
|
||||||
- run: npm run test:e2e:couchdb
|
with:
|
||||||
- run: ls -latr
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- run: npx playwright@1.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
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: test-results
|
path: test-results
|
||||||
|
|
||||||
- name: Archive html test results
|
- name: Archive html test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
|
|
||||||
|
- name: Remove pr:e2e:couchdb label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:e2e:couchdb';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
||||||
|
78
.github/workflows/e2e-pr.yml
vendored
78
.github/workflows/e2e-pr.yml
vendored
@ -1,62 +1,68 @@
|
|||||||
name: "e2e-pr"
|
name: 'e2e-pr'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
e2e-full:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger Success
|
|
||||||
uses: actions/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.29.0 install
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
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: npx playwright install chrome-beta
|
||||||
- run: npm install
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
- run: npm run test:e2e:full
|
- run: npm run test:e2e:full -- --max-failures=40
|
||||||
|
- run: npm run cov:e2e:report || true
|
||||||
|
- shell: bash
|
||||||
|
env:
|
||||||
|
SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: |
|
||||||
|
npm run cov:e2e:full:publish
|
||||||
- name: Archive test results
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: test-results
|
path: test-results
|
||||||
- name: Test success
|
|
||||||
if: ${{ success() }}
|
- name: Remove pr:e2e label (if present)
|
||||||
|
if: always()
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
github.rest.issues.createComment({
|
const { owner, repo, number } = context.issue;
|
||||||
issue_number: context.issue.number,
|
const labelToRemove = 'pr:e2e';
|
||||||
owner: "nasa",
|
try {
|
||||||
repo: "openmct",
|
await github.rest.issues.removeLabel({
|
||||||
body: 'Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
owner,
|
||||||
})
|
repo,
|
||||||
- name: Test failure
|
issue_number: number,
|
||||||
if: ${{ failure() }}
|
name: labelToRemove
|
||||||
uses: actions/github-script@v6
|
});
|
||||||
with:
|
} catch (error) {
|
||||||
script: |
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
github.rest.issues.createComment({
|
}
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: "nasa",
|
|
||||||
repo: "openmct",
|
|
||||||
body: 'Failure ❌ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
|
||||||
})
|
|
21
.github/workflows/e2e.yml
vendored
21
.github/workflows/e2e.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
name: "e2e"
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'Which branch do you want to test?' # Limited to branch for now
|
|
||||||
required: false
|
|
||||||
default: 'master'
|
|
||||||
jobs:
|
|
||||||
e2e:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.version }}
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- run: npm install
|
|
||||||
- name: Run the e2e tests
|
|
||||||
run: npm run test:e2e:ci
|
|
4
.github/workflows/npm-prerelease.yml
vendored
4
.github/workflows/npm-prerelease.yml
vendored
@ -14,7 +14,7 @@ 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: |
|
- run: |
|
||||||
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
||||||
@ -29,7 +29,7 @@ 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
|
||||||
|
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.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 }}
|
||||||
|
5
.npmrc
5
.npmrc
@ -1,4 +1,7 @@
|
|||||||
loglevel=warn
|
loglevel=warn
|
||||||
|
|
||||||
#Prevent folks from ignoring an important error when building from source
|
#Prevent folks from ignoring an important error when building from source
|
||||||
engine-strict=true
|
engine-strict=true
|
||||||
|
|
||||||
|
# Dont include lockfile
|
||||||
|
package-lock=false
|
27
.prettierignore
Normal file
27
.prettierignore
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Docs
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
target
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Mac OS X Finder
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Node dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# npm-debug log
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
# karma reports
|
||||||
|
report.*.json
|
||||||
|
|
||||||
|
# e2e test artifacts
|
||||||
|
test-results
|
||||||
|
html-test-results
|
||||||
|
|
||||||
|
# codecov artifacts
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
|
codecov
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "none",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 100,
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
@ -8,169 +8,164 @@ This is the OpenMCT common webpack file. It is imported by the other three webpa
|
|||||||
There are separate npm scripts to use these configurations, though simply running `npm install`
|
There are separate npm scripts to use these configurations, though simply running `npm install`
|
||||||
will use the default production configuration.
|
will use the default production configuration.
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const packageDefinition = require("../package.json");
|
const packageDefinition = require('../package.json');
|
||||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const webpack = require("webpack");
|
const webpack = require('webpack');
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
|
|
||||||
const { VueLoaderPlugin } = require("vue-loader");
|
const { VueLoaderPlugin } = require('vue-loader');
|
||||||
let gitRevision = "error-retrieving-revision";
|
let gitRevision = 'error-retrieving-revision';
|
||||||
let gitBranch = "error-retrieving-branch";
|
let gitBranch = 'error-retrieving-branch';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gitRevision = require("child_process")
|
gitRevision = require('child_process').execSync('git rev-parse HEAD').toString().trim();
|
||||||
.execSync("git rev-parse HEAD")
|
gitBranch = require('child_process')
|
||||||
.toString()
|
.execSync('git rev-parse --abbrev-ref HEAD')
|
||||||
.trim();
|
.toString()
|
||||||
gitBranch = require("child_process")
|
.trim();
|
||||||
.execSync("git rev-parse --abbrev-ref HEAD")
|
|
||||||
.toString()
|
|
||||||
.trim();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn(err);
|
console.warn(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
const projectRootDir = path.resolve(__dirname, "..");
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
/** @type {import('webpack').Configuration} */
|
/** @type {import('webpack').Configuration} */
|
||||||
const config = {
|
const config = {
|
||||||
context: projectRootDir,
|
context: projectRootDir,
|
||||||
entry: {
|
entry: {
|
||||||
openmct: "./openmct.js",
|
openmct: './openmct.js',
|
||||||
generatorWorker: "./example/generator/generatorWorker.js",
|
generatorWorker: './example/generator/generatorWorker.js',
|
||||||
couchDBChangesFeed:
|
couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js',
|
||||||
"./src/plugins/persistence/couch/CouchChangesFeed.js",
|
inMemorySearchWorker: './src/api/objects/InMemorySearchWorker.js',
|
||||||
inMemorySearchWorker: "./src/api/objects/InMemorySearchWorker.js",
|
espressoTheme: './src/plugins/themes/espresso-theme.scss',
|
||||||
espressoTheme: "./src/plugins/themes/espresso-theme.scss",
|
snowTheme: './src/plugins/themes/snow-theme.scss'
|
||||||
snowTheme: "./src/plugins/themes/snow-theme.scss"
|
},
|
||||||
},
|
output: {
|
||||||
output: {
|
globalObject: 'this',
|
||||||
globalObject: "this",
|
filename: '[name].js',
|
||||||
filename: "[name].js",
|
path: path.resolve(projectRootDir, 'dist'),
|
||||||
path: path.resolve(projectRootDir, "dist"),
|
library: 'openmct',
|
||||||
library: "openmct",
|
libraryTarget: 'umd',
|
||||||
libraryTarget: "umd",
|
publicPath: '',
|
||||||
publicPath: "",
|
hashFunction: 'xxhash64',
|
||||||
hashFunction: "xxhash64",
|
clean: true
|
||||||
clean: true
|
},
|
||||||
},
|
resolve: {
|
||||||
resolve: {
|
alias: {
|
||||||
alias: {
|
'@': path.join(projectRootDir, 'src'),
|
||||||
"@": path.join(projectRootDir, "src"),
|
legacyRegistry: path.join(projectRootDir, 'src/legacyRegistry'),
|
||||||
legacyRegistry: path.join(projectRootDir, "src/legacyRegistry"),
|
saveAs: 'file-saver/src/FileSaver.js',
|
||||||
saveAs: "file-saver/src/FileSaver.js",
|
csv: 'comma-separated-values',
|
||||||
csv: "comma-separated-values",
|
EventEmitter: 'eventemitter3',
|
||||||
EventEmitter: "eventemitter3",
|
bourbon: 'bourbon.scss',
|
||||||
bourbon: "bourbon.scss",
|
'plotly-basic': 'plotly.js-basic-dist',
|
||||||
"plotly-basic": "plotly.js-basic-dist",
|
'plotly-gl2d': 'plotly.js-gl2d-dist',
|
||||||
"plotly-gl2d": "plotly.js-gl2d-dist",
|
'd3-scale': path.join(projectRootDir, 'node_modules/d3-scale/dist/d3-scale.min.js'),
|
||||||
"d3-scale": path.join(
|
printj: path.join(projectRootDir, 'node_modules/printj/dist/printj.min.js'),
|
||||||
projectRootDir,
|
styles: path.join(projectRootDir, 'src/styles'),
|
||||||
"node_modules/d3-scale/dist/d3-scale.min.js"
|
MCT: path.join(projectRootDir, 'src/MCT'),
|
||||||
),
|
testUtils: path.join(projectRootDir, 'src/utils/testUtils.js'),
|
||||||
printj: path.join(
|
objectUtils: path.join(projectRootDir, 'src/api/objects/object-utils.js'),
|
||||||
projectRootDir,
|
utils: path.join(projectRootDir, 'src/utils'),
|
||||||
"node_modules/printj/dist/printj.min.js"
|
vue: path.join(projectRootDir, 'node_modules/@vue/compat/dist/vue.esm-bundler.js'),
|
||||||
),
|
|
||||||
styles: path.join(projectRootDir, "src/styles"),
|
|
||||||
MCT: path.join(projectRootDir, "src/MCT"),
|
|
||||||
testUtils: path.join(projectRootDir, "src/utils/testUtils.js"),
|
|
||||||
objectUtils: path.join(
|
|
||||||
projectRootDir,
|
|
||||||
"src/api/objects/object-utils.js"
|
|
||||||
),
|
|
||||||
"kdbush": path.join(projectRootDir, "node_modules/kdbush/kdbush.min.js"),
|
|
||||||
utils: path.join(projectRootDir, "src/utils")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
|
||||||
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
|
||||||
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
|
||||||
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
|
|
||||||
}),
|
|
||||||
new VueLoaderPlugin(),
|
|
||||||
new CopyWebpackPlugin({
|
|
||||||
patterns: [
|
|
||||||
{
|
|
||||||
from: "src/images/favicons",
|
|
||||||
to: "favicons"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "./index.html",
|
|
||||||
transform: function (content) {
|
|
||||||
return content.toString().replace(/dist\//g, "");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
from: "src/plugins/imagery/layers",
|
|
||||||
to: "imagery"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}),
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: "[name].css",
|
|
||||||
chunkFilename: "[name].css"
|
|
||||||
})
|
|
||||||
],
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.(sc|sa|c)ss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{
|
|
||||||
loader: "css-loader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: "resolve-url-loader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: "sass-loader",
|
|
||||||
options: { sourceMap: true }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
use: "vue-loader"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
type: "asset/source"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(jpg|jpeg|png|svg)$/,
|
|
||||||
type: "asset/resource",
|
|
||||||
generator: {
|
|
||||||
filename: "images/[name][ext]"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.ico$/,
|
|
||||||
type: "asset/resource",
|
|
||||||
generator: {
|
|
||||||
filename: "icons/[name][ext]"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2?|eot|ttf)$/,
|
|
||||||
type: "asset/resource",
|
|
||||||
generator: {
|
|
||||||
filename: "fonts/[name][ext]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
stats: "errors-warnings",
|
|
||||||
performance: {
|
|
||||||
// We should eventually consider chunking to decrease
|
|
||||||
// these values
|
|
||||||
maxEntrypointSize: 27000000,
|
|
||||||
maxAssetSize: 27000000
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
||||||
|
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
||||||
|
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
||||||
|
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
|
||||||
|
}),
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: 'src/images/favicons',
|
||||||
|
to: 'favicons'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: './index.html',
|
||||||
|
transform: function (content) {
|
||||||
|
return content.toString().replace(/dist\//g, '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'src/plugins/imagery/layers',
|
||||||
|
to: 'imagery'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[name].css'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(sc|sa|c)ss$/,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
{
|
||||||
|
loader: 'css-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'resolve-url-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: { sourceMap: true }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
compilerOptions: {
|
||||||
|
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;
|
module.exports = config;
|
||||||
|
@ -6,32 +6,32 @@ OpenMCT Continuous Integration servers use this configuration to add code covera
|
|||||||
information to pull requests.
|
information to pull requests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const config = require("./webpack.dev");
|
const config = require('./webpack.dev');
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const CI = process.env.CI === "true";
|
const CI = process.env.CI === 'true';
|
||||||
|
|
||||||
config.devtool = CI ? false : undefined;
|
config.devtool = CI ? false : undefined;
|
||||||
|
|
||||||
config.devServer.hot = false;
|
config.devServer.hot = false;
|
||||||
|
|
||||||
config.module.rules.push({
|
config.module.rules.push({
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /(Spec\.js$)|(node_modules)/,
|
exclude: /(Spec\.js$)|(node_modules)/,
|
||||||
use: {
|
use: {
|
||||||
loader: "babel-loader",
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
retainLines: true,
|
retainLines: true,
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
"babel-plugin-istanbul",
|
'babel-plugin-istanbul',
|
||||||
{
|
{
|
||||||
extension: [".js", ".vue"]
|
extension: ['.js', '.vue']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -5,55 +5,54 @@ This configuration should be used for development purposes. It contains full sou
|
|||||||
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
||||||
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const webpack = require("webpack");
|
const webpack = require('webpack');
|
||||||
const { merge } = require("webpack-merge");
|
const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
const common = require("./webpack.common");
|
const common = require('./webpack.common');
|
||||||
const projectRootDir = path.resolve(__dirname, "..");
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: "development",
|
mode: 'development',
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
// Since we use require.context, webpack is watching the entire directory.
|
// Since we use require.context, webpack is watching the entire directory.
|
||||||
// We need to exclude any files we don't want webpack to watch.
|
// We need to exclude any files we don't want webpack to watch.
|
||||||
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
||||||
ignored: [
|
ignored: [
|
||||||
"**/{node_modules,dist,docs,e2e}", // All files in node_modules, dist, docs, e2e,
|
'**/{node_modules,dist,docs,e2e}', // All files in node_modules, dist, docs, e2e,
|
||||||
"**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}", // Config files
|
'**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}', // Config files
|
||||||
"**/*.{sh,md,png,ttf,woff,svg}", // Non source files
|
'**/*.{sh,md,png,ttf,woff,svg}', // Non source files
|
||||||
"**/.*" // dotfiles and dotfolders
|
'**/.*' // dotfiles and dotfolders
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
resolve: {
|
plugins: [
|
||||||
alias: {
|
new webpack.DefinePlugin({
|
||||||
vue: path.join(projectRootDir, "node_modules/vue/dist/vue.js")
|
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
||||||
}
|
})
|
||||||
},
|
],
|
||||||
plugins: [
|
devtool: 'eval-source-map',
|
||||||
new webpack.DefinePlugin({
|
devServer: {
|
||||||
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
devMiddleware: {
|
||||||
})
|
writeToDisk: (filePathString) => {
|
||||||
],
|
const filePath = path.parse(filePathString);
|
||||||
devtool: "eval-source-map",
|
const shouldWrite = !filePath.base.includes('hot-update');
|
||||||
devServer: {
|
|
||||||
devMiddleware: {
|
|
||||||
writeToDisk: (filePathString) => {
|
|
||||||
const filePath = path.parse(filePathString);
|
|
||||||
const shouldWrite = !filePath.base.includes("hot-update");
|
|
||||||
|
|
||||||
return shouldWrite;
|
return shouldWrite;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watchFiles: ["**/*.css"],
|
watchFiles: ['**/*.css'],
|
||||||
static: {
|
static: {
|
||||||
directory: path.join(__dirname, "..", "/dist"),
|
directory: path.join(__dirname, '..', '/dist'),
|
||||||
publicPath: "/dist",
|
publicPath: '/dist',
|
||||||
watch: false
|
watch: false
|
||||||
},
|
},
|
||||||
client: {
|
client: {
|
||||||
progress: true,
|
progress: true,
|
||||||
overlay: true
|
overlay: {
|
||||||
}
|
// Disable overlay for runtime errors.
|
||||||
|
// See: https://github.com/webpack/webpack-dev-server/issues/4771
|
||||||
|
runtimeErrors: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,24 +4,19 @@
|
|||||||
This configuration should be used for production installs.
|
This configuration should be used for production installs.
|
||||||
It is the default webpack configuration.
|
It is the default webpack configuration.
|
||||||
*/
|
*/
|
||||||
const path = require("path");
|
const path = require('path');
|
||||||
const webpack = require("webpack");
|
const webpack = require('webpack');
|
||||||
const { merge } = require("webpack-merge");
|
const { merge } = require('webpack-merge');
|
||||||
|
|
||||||
const common = require("./webpack.common");
|
const common = require('./webpack.common');
|
||||||
const projectRootDir = path.resolve(__dirname, "..");
|
const projectRootDir = path.resolve(__dirname, '..');
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
mode: "production",
|
mode: 'production',
|
||||||
resolve: {
|
plugins: [
|
||||||
alias: {
|
new webpack.DefinePlugin({
|
||||||
vue: path.join(projectRootDir, "node_modules/vue/dist/vue.min.js")
|
__OPENMCT_ROOT_RELATIVE__: '""'
|
||||||
}
|
})
|
||||||
},
|
],
|
||||||
plugins: [
|
devtool: 'source-map'
|
||||||
new webpack.DefinePlugin({
|
|
||||||
__OPENMCT_ROOT_RELATIVE__: '""'
|
|
||||||
})
|
|
||||||
],
|
|
||||||
devtool: "source-map"
|
|
||||||
});
|
});
|
||||||
|
6
API.md
6
API.md
@ -2,7 +2,7 @@
|
|||||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
**Table of Contents**
|
**Table of Contents**
|
||||||
|
|
||||||
- [Building Applications With Open MCT](#developing-applications-with-open-mct)
|
- [Developing Applications With Open MCT](#developing-applications-with-open-mct)
|
||||||
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
||||||
- [Building From Source](#building-from-source)
|
- [Building From Source](#building-from-source)
|
||||||
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
||||||
@ -26,7 +26,7 @@
|
|||||||
- [Value Hints](#value-hints)
|
- [Value Hints](#value-hints)
|
||||||
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
||||||
- [Telemetry Providers](#telemetry-providers)
|
- [Telemetry Providers](#telemetry-providers)
|
||||||
- [Telemetry Requests and Responses.](#telemetry-requests-and-responses)
|
- [Telemetry Requests and Responses](#telemetry-requests-and-responses)
|
||||||
- [Request Strategies **draft**](#request-strategies-draft)
|
- [Request Strategies **draft**](#request-strategies-draft)
|
||||||
- [`latest` request strategy](#latest-request-strategy)
|
- [`latest` request strategy](#latest-request-strategy)
|
||||||
- [`minmax` request strategy](#minmax-request-strategy)
|
- [`minmax` request strategy](#minmax-request-strategy)
|
||||||
@ -873,6 +873,8 @@ function without any arguments.
|
|||||||
|
|
||||||
#### Stopping an active clock
|
#### 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`.
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ The short version:
|
|||||||
for review.)
|
for review.)
|
||||||
4. Respond to any discussion. When the reviewer decides it's ready, they
|
4. Respond to any discussion. When the reviewer decides it's ready, they
|
||||||
will merge back `master` and fill out their own check list.
|
will merge back `master` and fill out their own check list.
|
||||||
5. If you are a first-time contributor, please see [this discussion](https://github.com/nasa/openmct/discussions/3821) for further information.
|
5. If you are a first-time contributor, please see [this discussion](https://github.com/nasa/openmct/discussions/3821) for further information.
|
||||||
|
|
||||||
## Contribution Process
|
## Contribution Process
|
||||||
|
|
||||||
Open MCT uses git for software version control, and for branching and
|
Open MCT uses git for software version control, and for branching and
|
||||||
merging. The central repository is at
|
merging. The central repository is at
|
||||||
https://github.com/nasa/openmct.git.
|
<https://github.com/nasa/openmct.git>.
|
||||||
|
|
||||||
### Roles
|
### Roles
|
||||||
|
|
||||||
@ -116,6 +116,7 @@ the pull request containing the reviewer checklist (from below) and complete
|
|||||||
the merge back to the master branch.
|
the merge back to the master branch.
|
||||||
|
|
||||||
Additionally:
|
Additionally:
|
||||||
|
|
||||||
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
||||||
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
||||||
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
||||||
@ -132,25 +133,26 @@ changes.
|
|||||||
|
|
||||||
### Code Standards
|
### Code Standards
|
||||||
|
|
||||||
JavaScript sources in Open MCT must satisfy the ESLint rules defined in
|
JavaScript sources in Open MCT must satisfy the [ESLint](https://eslint.org/) rules defined in
|
||||||
this repository. This is verified by the command line build.
|
this repository. [Prettier](https://prettier.io/) is used in conjunction with ESLint to enforce code style
|
||||||
|
via automated formatting. These are verified by the command line build.
|
||||||
|
|
||||||
#### Code Guidelines
|
#### Code Guidelines
|
||||||
|
|
||||||
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
||||||
|
|
||||||
1. Write clean code. Here’s a good summary - https://github.com/ryanmcdermott/clean-code-javascript.
|
1. Write clean code. Here’s a good summary - <https://github.com/ryanmcdermott/clean-code-javascript>.
|
||||||
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
||||||
1. Include non-JSDoc comments as-needed for explaining private variables,
|
1. Include non-JSDoc comments as-needed for explaining private variables,
|
||||||
methods, or algorithms when they are non-obvious. Otherwise code
|
methods, or algorithms when they are non-obvious. Otherwise code
|
||||||
should be self-documenting.
|
should be self-documenting.
|
||||||
1. Classes and Vue components should use camel case, first letter capitalized
|
1. Classes and Vue components should use camel case, first letter capitalized
|
||||||
(e.g. SomeClassName).
|
(e.g. SomeClassName).
|
||||||
1. Methods, variables, fields, events, and function names should use camelCase,
|
1. Methods, variables, fields, events, and function names should use camelCase,
|
||||||
first letter lower-case (e.g. someVariableName).
|
first letter lower-case (e.g. someVariableName).
|
||||||
1. Source files that export functions should use camelCase, first letter lower-case (eg. testTools.js)
|
1. Source files that export functions should use camelCase, first letter lower-case (eg. testTools.js)
|
||||||
1. Constants (variables or fields which are meant to be declared and
|
1. Constants (variables or fields which are meant to be declared and
|
||||||
initialized statically, and never changed) should use only capital
|
initialized statically, and never changed) should use only capital
|
||||||
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
letters, with underscores between words (e.g. SOME_CONSTANT). They should always be declared as `const`s
|
||||||
1. File names should be the name of the exported class, plus a .js extension
|
1. File names should be the name of the exported class, plus a .js extension
|
||||||
(e.g. SomeClassName.js).
|
(e.g. SomeClassName.js).
|
||||||
@ -159,21 +161,25 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
(e.g. as arguments to a forEach call). Anonymous functions should always be arrow functions.
|
||||||
1. Named functions are preferred over functions assigned to variables.
|
1. Named functions are preferred over functions assigned to variables.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
function renameObject(object, newName) {
|
function renameObject(object, newName) {
|
||||||
Object.name = newName;
|
Object.name = newName;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const rename = (object, newName) => {
|
const rename = (object, newName) => {
|
||||||
Object.name = newName;
|
Object.name = newName;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Avoid deep nesting (especially of functions), except where necessary
|
1. Avoid deep nesting (especially of functions), except where necessary
|
||||||
(e.g. due to closure scope).
|
(e.g. due to closure scope).
|
||||||
1. End with a single new-line character.
|
1. End with a single new-line character.
|
||||||
1. Always use ES6 `Class`es and inheritance rather than the pre-ES6 prototypal
|
1. Always use ES6 `Class`es and inheritance rather than the pre-ES6 prototypal
|
||||||
pattern.
|
pattern.
|
||||||
1. Within a given function's scope, do not mix declarations and imperative
|
1. Within a given function's scope, do not mix declarations and imperative
|
||||||
code, and present these in the following order:
|
code, and present these in the following order:
|
||||||
@ -182,19 +188,24 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
||||||
1. Avoid the use of "magic" values.
|
1. Avoid the use of "magic" values.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const UNAUTHORIZED = 401;
|
const UNAUTHORIZED = 401;
|
||||||
if (responseCode === UNAUTHORIZED)
|
if (responseCode === UNAUTHORIZED)
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
if (responseCode === 401)
|
if (responseCode === 401)
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
||||||
1. Test specs should reside alongside the source code they test, not in a separate directory.
|
1. Unit Test specs should reside alongside the source code they test, not in a separate directory.
|
||||||
1. Organize code by feature, not by type.
|
1. Organize code by feature, not by type.
|
||||||
eg.
|
eg.
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- row
|
- row
|
||||||
TableRow.js
|
TableRow.js
|
||||||
@ -206,8 +217,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- components
|
- components
|
||||||
TableRow.vue
|
TableRow.vue
|
||||||
@ -219,47 +232,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Deviations from Open MCT code style guidelines require two-party agreement,
|
Deviations from Open MCT code style guidelines require two-party agreement,
|
||||||
typically from the author of the change and its reviewer.
|
typically from the author of the change and its reviewer.
|
||||||
|
|
||||||
### Test Standards
|
|
||||||
|
|
||||||
Automated testing shall occur whenever changes are merged into the main
|
|
||||||
development branch and must be confirmed alongside any pull request.
|
|
||||||
|
|
||||||
Automated tests are tests which exercise plugins, API, and utility classes.
|
|
||||||
Tests are subject to code review along with the actual implementation, to
|
|
||||||
ensure that tests are applicable and useful.
|
|
||||||
|
|
||||||
Examples of useful tests:
|
|
||||||
* Tests which replicate bugs (or their root causes) to verify their
|
|
||||||
resolution.
|
|
||||||
* Tests which reflect details from software specifications.
|
|
||||||
* Tests which exercise edge or corner cases among inputs.
|
|
||||||
* Tests which verify expected interactions with other components in the
|
|
||||||
system.
|
|
||||||
|
|
||||||
#### Guidelines
|
|
||||||
* 100% statement coverage is achievable and desirable.
|
|
||||||
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
|
|
||||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
|
||||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
|
||||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
|
||||||
* Where builtin functions have been mocked, be sure to clear them between tests.
|
|
||||||
* Test at an appropriate level of isolation. Eg.
|
|
||||||
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
|
||||||
* You do not need to test that the view switcher works, there should be separate tests for that.
|
|
||||||
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
|
||||||
* Use your best judgement when deciding on appropriate scope.
|
|
||||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
|
||||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
|
||||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
|
||||||
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
|
|
||||||
|
|
||||||
#### Examples
|
|
||||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
|
||||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
|
||||||
|
|
||||||
### Commit Message Standards
|
### Commit Message Standards
|
||||||
|
|
||||||
Commit messages should:
|
Commit messages should:
|
||||||
@ -295,13 +271,13 @@ these standards.
|
|||||||
|
|
||||||
## Issue Reporting
|
## Issue Reporting
|
||||||
|
|
||||||
Issues are tracked at https://github.com/nasa/openmct/issues.
|
Issues are tracked at <https://github.com/nasa/openmct/issues>.
|
||||||
|
|
||||||
Issue severity is categorized as follows (in ascending order):
|
Issue severity is categorized as follows (in ascending order):
|
||||||
|
|
||||||
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
||||||
* _Medium_: Some impairment of use, but simple workarounds exist
|
* _Medium_: Some impairment of use, but simple workarounds exist
|
||||||
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though.
|
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though. Complex workarounds exist.
|
||||||
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
||||||
|
|
||||||
## Check Lists
|
## Check Lists
|
||||||
@ -310,22 +286,4 @@ The following check lists should be completed and attached to pull requests
|
|||||||
when they are filed (author checklist) and when they are merged (reviewer
|
when they are filed (author checklist) and when they are merged (reviewer
|
||||||
checklist).
|
checklist).
|
||||||
|
|
||||||
### Author Checklist
|
|
||||||
|
|
||||||
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
||||||
|
|
||||||
### Reviewer Checklist
|
|
||||||
|
|
||||||
* [ ] Changes appear to address issue?
|
|
||||||
* [ ] Changes appear not to be breaking changes?
|
|
||||||
* [ ] Appropriate unit tests included?
|
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
|
||||||
* [ ] Commit messages meet standards?
|
|
||||||
* [ ] Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)
|
|
||||||
* [ ] Has associated issue been labelled `bug`? (only applicable if this PR is for a bug fix)
|
|
||||||
* [ ] List of Acceptance Tests Performed.
|
|
||||||
|
|
||||||
Write out a small list of tests performed with just enough detail for another developer on the team
|
|
||||||
to execute.
|
|
||||||
|
|
||||||
i.e. ```When Clicking on Add button, new `object` appears in dropdown.```
|
|
||||||
|
45
README.md
45
README.md
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
||||||
|
|
||||||
Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
> [!NOTE]
|
||||||
|
> Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
||||||
|
|
||||||
|
|
||||||
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
||||||
|
|
||||||
@ -14,19 +16,32 @@ Once you've created something amazing with Open MCT, showcase your work in our G
|
|||||||
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
||||||
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
||||||
|
|
||||||
1. Clone the source code
|
1. Clone the source code:
|
||||||
|
|
||||||
`git clone https://github.com/nasa/openmct.git`
|
```
|
||||||
|
git clone https://github.com/nasa/openmct.git
|
||||||
|
```
|
||||||
|
|
||||||
2. Install development dependencies. Note: Check the package.json engine for our tested and supported node versions.
|
2. (Optional) Install the correct node version using [nvm](https://github.com/nvm-sh/nvm):
|
||||||
|
|
||||||
`npm install`
|
```
|
||||||
|
nvm install
|
||||||
|
```
|
||||||
|
|
||||||
3. Run a local development server
|
3. Install development dependencies (Note: Check the `package.json` engine for our tested and supported node versions):
|
||||||
|
|
||||||
`npm start`
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
4. Run a local development server:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
||||||
|
|
||||||
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
||||||
|
|
||||||
@ -40,8 +55,12 @@ The clearest examples for developing Open MCT plugins are in the
|
|||||||
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
||||||
our documentation.
|
our documentation.
|
||||||
|
|
||||||
We want Open MCT to be as easy to use, install, run, and develop for as
|
> [!NOTE]
|
||||||
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
> We want Open MCT to be as easy to use, install, run, and develop for as
|
||||||
|
> possible, and your feedback will help us get there!
|
||||||
|
> Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose),
|
||||||
|
> [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions),
|
||||||
|
> or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
||||||
|
|
||||||
## Developing Applications With Open MCT
|
## Developing Applications With Open MCT
|
||||||
|
|
||||||
@ -51,6 +70,8 @@ For more on developing with Open MCT, see our documentation for a guide on [Deve
|
|||||||
|
|
||||||
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
||||||
|
|
||||||
|
The project uses `nvm` to ensure the node and npm version used, is coherent in all projects. Install nvm (non-windows), [here](https://github.com/nvm-sh/nvm) or the windows equivalent [here](https://github.com/coreybutler/nvm-windows)
|
||||||
|
|
||||||
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
@ -95,10 +116,10 @@ To run the performance tests:
|
|||||||
|
|
||||||
`npm run test:perf`
|
`npm run test:perf`
|
||||||
|
|
||||||
The test suite is configured to all tests localed in `e2e/tests/` ending in `*.e2e.spec.js`. For more about the e2e test suite, please see the [README](./e2e/README.md)
|
The test suite is configured to all tests located in `e2e/tests/` ending in `*.e2e.spec.js`. For more about the e2e test suite, please see the [README](./e2e/README.md)
|
||||||
|
|
||||||
### Security Tests
|
### Security Tests
|
||||||
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/). The list of CWE coverage items is avaiable in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml).
|
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/). The list of CWE coverage items is available in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml).
|
||||||
|
|
||||||
### Test Reporting and Code Coverage
|
### Test Reporting and Code Coverage
|
||||||
|
|
||||||
|
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)
|
14
codecov.yml
14
codecov.yml
@ -11,18 +11,18 @@ coverage:
|
|||||||
informational: true
|
informational: true
|
||||||
precision: 2
|
precision: 2
|
||||||
round: down
|
round: down
|
||||||
range: "66...100"
|
range: '66...100'
|
||||||
|
|
||||||
flags:
|
flags:
|
||||||
unit:
|
unit:
|
||||||
carryforward: true
|
carryforward: false
|
||||||
e2e-ci:
|
e2e-stable:
|
||||||
carryforward: true
|
carryforward: false
|
||||||
e2e-full:
|
e2e-full:
|
||||||
carryforward: true
|
carryforward: true
|
||||||
|
|
||||||
comment:
|
comment:
|
||||||
layout: "reach,diff,flags,files,footer"
|
layout: 'diff,flags,files,footer'
|
||||||
behavior: default
|
behavior: default
|
||||||
require_changes: false
|
require_changes: false
|
||||||
show_carryforward_flags: true
|
show_carryforward_flags: true
|
||||||
|
@ -53,7 +53,7 @@ requirements.
|
|||||||
|
|
||||||
Additionally, the following project-specific standards will be used:
|
Additionally, the following project-specific standards will be used:
|
||||||
|
|
||||||
* During development, a "-SNAPSHOT" suffix shall be appended to the
|
* During development, a "-next" suffix shall be appended to the
|
||||||
version number. The version number before the suffix shall reflect
|
version number. The version number before the suffix shall reflect
|
||||||
the next expected version number for release.
|
the next expected version number for release.
|
||||||
* Prior to a 1.0.0 release, the _minor_ version will be incremented
|
* Prior to a 1.0.0 release, the _minor_ version will be incremented
|
||||||
@ -93,7 +93,7 @@ numbers by the following process:
|
|||||||
|
|
||||||
1. Update version number in `package.json`
|
1. Update version number in `package.json`
|
||||||
1. Checkout branch created for the last sprint that has been successfully tested.
|
1. Checkout branch created for the last sprint that has been successfully tested.
|
||||||
2. Remove a `-SNAPSHOT` suffix from the version in `package.json`.
|
2. Remove a `-next` suffix from the version in `package.json`.
|
||||||
3. Verify that resulting version number meets semantic versioning
|
3. Verify that resulting version number meets semantic versioning
|
||||||
requirements relative to previous stable version. Increment the
|
requirements relative to previous stable version. Increment the
|
||||||
version number if necessary.
|
version number if necessary.
|
||||||
@ -138,7 +138,7 @@ numbers by the following process:
|
|||||||
1. Create a new branch off the `master` branch.
|
1. Create a new branch off the `master` branch.
|
||||||
2. Remove any suffix from the version number,
|
2. Remove any suffix from the version number,
|
||||||
or increment the _patch_ version if there is no suffix.
|
or increment the _patch_ version if there is no suffix.
|
||||||
3. Append a `-SNAPSHOT` suffix.
|
3. Append a `-next` suffix.
|
||||||
4. Commit changes to `package.json` on the `master` branch.
|
4. Commit changes to `package.json` on the `master` branch.
|
||||||
The commit message should reference the sprint being opened,
|
The commit message should reference the sprint being opened,
|
||||||
preferably by a URL reference to the associated Milestone in
|
preferably by a URL reference to the associated Milestone in
|
||||||
@ -150,6 +150,6 @@ numbers by the following process:
|
|||||||
Projects dependent on Open MCT being co-developed by the Open MCT
|
Projects dependent on Open MCT being co-developed by the Open MCT
|
||||||
team should follow a similar process, except that they should
|
team should follow a similar process, except that they should
|
||||||
additionally update their dependency on Open MCT to point to the
|
additionally update their dependency on Open MCT to point to the
|
||||||
latest archive when removing their `-SNAPSHOT` status, and
|
latest archive when removing their `-next` status, and
|
||||||
that they should be pointed back to the `master` branch after
|
that they should be pointed back to the `master` branch after
|
||||||
this has completed.
|
this has completed.
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"extends": ["plugin:playwright/playwright-test"],
|
extends: ['plugin:playwright/playwright-test'],
|
||||||
"rules": {
|
rules: {
|
||||||
"playwright/max-nested-describe": ["error", { "max": 1 }]
|
'playwright/max-nested-describe': ['error', { max: 1 }]
|
||||||
},
|
},
|
||||||
"overrides": [
|
overrides: [
|
||||||
{
|
{
|
||||||
"files": ["tests/visual/*.spec.js"],
|
files: ['tests/visual/*.spec.js'],
|
||||||
"rules": {
|
rules: {
|
||||||
"playwright/no-wait-for-timeout": "off"
|
'playwright/no-wait-for-timeout': 'off'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
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,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
snapshot:
|
|
||||||
widths: [1024, 2000]
|
|
||||||
min-height: 1440 # px
|
|
||||||
discovery:
|
|
||||||
concurrency: 2 # https://github.com/percy/cli/discussions/1067
|
|
207
e2e/README.md
207
e2e/README.md
@ -72,19 +72,30 @@ Visual Testing is an essential part of our e2e strategy as it ensures that the a
|
|||||||
For a better understanding of the visual issues which affect Open MCT, please see our bug tracker with the `label:visual` filter applied [here](https://github.com/nasa/openmct/issues?q=label%3Abug%3Avisual+)
|
For a better understanding of the visual issues which affect Open MCT, please see our bug tracker with the `label:visual` filter applied [here](https://github.com/nasa/openmct/issues?q=label%3Abug%3Avisual+)
|
||||||
To read about how to write a good visual test, please see [How to write a great Visual Test](#how-to-write-a-great-visual-test).
|
To read about how to write a good visual test, please see [How to write a great Visual Test](#how-to-write-a-great-visual-test).
|
||||||
|
|
||||||
`npm run test:e2e:visual` will run all of the visual tests against a local instance of Open MCT. If no `PERCY_TOKEN` API key is found in the terminal or command line environment variables, no visual comparisons will be made.
|
`npm run test:e2e:visual` commands will run all of the visual tests against a local instance of Open MCT. If no `PERCY_TOKEN` API key is found in the terminal or command line environment variables, no visual comparisons will be made.
|
||||||
|
|
||||||
|
- `npm run test:e2e:visual:ci` will run against every commit and PR.
|
||||||
|
- `npm run test:e2e:visual:full` will run every night with additional comparisons made for Larger Displays and with the `snow` theme.
|
||||||
#### Percy.io
|
#### Percy.io
|
||||||
|
|
||||||
To make this possible, we're leveraging a 3rd party service, [Percy](https://percy.io/). This service maintains a copy of all changes, users, scm-metadata, and baselines to verify that the application looks and feels the same _unless approved by a Open MCT developer_. To request a Percy API token, please reach out to the Open MCT Dev team on GitHub. For more information, please see the official [Percy documentation](https://docs.percy.io/docs/visual-testing-basics)
|
To make this possible, we're leveraging a 3rd party service, [Percy](https://percy.io/). This service maintains a copy of all changes, users, scm-metadata, and baselines to verify that the application looks and feels the same _unless approved by a Open MCT developer_. To request a Percy API token, please reach out to the Open MCT Dev team on GitHub. For more information, please see the official [Percy documentation](https://docs.percy.io/docs/visual-testing-basics).
|
||||||
|
|
||||||
### (Advanced) Snapshot Testing
|
At present, we are using percy with two configuration files: `./e2e/.percy.nightly.yml` and `./e2e/.percy.ci.yml`. This is mainly to reduce the number of snapshots.
|
||||||
|
|
||||||
Snapshot testing is very similar to visual testing but allows us to be more precise in detecting change without relying on a 3rd party service. Unfortuantely, this precision requires advanced test setup and teardown and so we're using this pattern as a last resort.
|
### Advanced: Snapshot Testing (Not Recommended)
|
||||||
|
|
||||||
To give an example, if a _single_ visual test assertion for an Overlay plot is run through multiple DOM rendering engines at various viewports to see how the Plot looks. If that same test were run as a snapshot test, it could only be executed against a single browser, on a single platform (ubuntu docker container).
|
While snapshot testing offers a precise way to detect changes in your application without relying on third-party services like Percy.io, we've found that it doesn't offer any advantages over visual testing in our use-cases. Therefore, snapshot testing is **not recommended** for further implementation.
|
||||||
|
|
||||||
|
#### CI vs Manual Checks
|
||||||
|
Snapshot tests can be reliably executed in Continuous Integration (CI) environments but lack the manual oversight provided by visual testing platforms like Percy.io. This means they may miss issues that a human reviewer could catch during manual checks.
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
A single visual test assertion in Percy.io can be executed across 10 different browser and resolution combinations without additional setup, providing comprehensive testing with minimal configuration. In contrast, a snapshot test is restricted to a single OS and browser resolution, requiring more effort to achieve the same level of coverage.
|
||||||
|
|
||||||
|
|
||||||
|
#### Further Reading
|
||||||
|
For those interested in the mechanics of snapshot testing with Playwright, you can refer to the [Playwright Snapshots Documentation](https://playwright.dev/docs/test-snapshots). However, keep in mind that we do not recommend using this approach.
|
||||||
|
|
||||||
Read more about [Playwright Snapshots](https://playwright.dev/docs/test-snapshots)
|
|
||||||
|
|
||||||
#### Open MCT's implementation
|
#### Open MCT's implementation
|
||||||
|
|
||||||
@ -133,22 +144,24 @@ These tests are expected to become blocking and gating with assertions as we ext
|
|||||||
|
|
||||||
## Test Architecture and CI
|
## Test Architecture and CI
|
||||||
|
|
||||||
### Architecture (TODO)
|
### Architecture
|
||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
|
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
|
||||||
|
|
||||||
- `./helper` - contains helper functions or scripts which are leveraged directly within the testsuites. i.e. non-default plugin scripts injected into DOM
|
|File Path|Description|
|
||||||
- `./test-data` - contains test data which is leveraged or generated in the functional, performance, or visual test suites. i.e. localStorage data
|
|:-:|-|
|
||||||
- `./tests/functional` - the bulk of the tests are contained within this folder to verify the functionality of open mct
|
|`./helper` | Contains helper functions or scripts which are leveraged directly within the test suites (e.g.: non-default plugin scripts injected into the DOM)|
|
||||||
- `./tests/functional/example/` - tests which specifically verify the example plugins
|
|`./test-data` | Contains test data which is leveraged or generated in the functional, performance, or visual test suites (e.g.: localStorage data).|
|
||||||
- `./tests/functional/plugins/` - tests which loosely test each plugin. This folder is the most likely to change. Note: some @snapshot tests are still contained within this structure
|
|`./tests/functional` | The bulk of the tests are contained within this folder to verify the functionality of Open MCT.|
|
||||||
- `./tests/framework/` - tests which verify that our testframework functionality and assumptions will continue to work based on further refactoring or playwright version changes
|
|`./tests/functional/example/` | Tests which specifically verify the example plugins (e.g.: Sine Wave Generator).|
|
||||||
- `./tests/performance/` - performance tests
|
|`./tests/functional/plugins/` | Tests which loosely test each plugin. This folder is the most likely to change. Note: some `@snapshot` tests are still contained within this structure.|
|
||||||
- `./tests/visual/` - Visual tests
|
|`./tests/framework/` | Tests which verify that our testing framework's functionality and assumptions will continue to work based on further refactoring or Playwright version changes (e.g.: verifying custom fixtures and appActions).|
|
||||||
- `./appActions.js` - Contains common fixtures which can be leveraged by testcase authors to quickly move through the application when writing new tests.
|
|`./tests/performance/` | Performance tests.|
|
||||||
- `./baseFixture.js` - Contains base fixtures which only extend default `@playwright/test` functionality. The goal is to remove these fixtures as native Playwright APIs improve.
|
|`./tests/visual/` | Visual tests.|
|
||||||
|
|`./appActions.js` | Contains common methods which can be leveraged by test case authors to quickly move through the application when writing new tests.|
|
||||||
|
|`./baseFixture.js` | Contains base fixtures which only extend default `@playwright/test` functionality. The expectation is that these fixtures will be removed as the native Playwright API improves|
|
||||||
|
|
||||||
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
|
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
|
||||||
|
|
||||||
@ -158,10 +171,12 @@ Where possible, we try to run Open MCT without modification or configuration cha
|
|||||||
|
|
||||||
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
|
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
|
||||||
|
|
||||||
- `./playwright-ci.config.js` - Used when running in CI or to debug CI issues locally
|
|Config File|Description|
|
||||||
- `./playwright-local.config.js` - Used when running locally
|
|:-:|-|
|
||||||
- `./playwright-performance.config.js` - Used when running performance tests in CI or locally
|
|`./playwright-ci.config.js` | Used when running in CI or to debug CI issues locally|
|
||||||
- `./playwright-visual.config.js` - Used to run the visual tests in CI or locally
|
|`./playwright-local.config.js` | Used when running locally|
|
||||||
|
|`./playwright-performance.config.js` | Used when running performance tests in CI or locally|
|
||||||
|
|`./playwright-visual.config.js` | Used to run the visual tests in CI or locally|
|
||||||
|
|
||||||
#### Test Tags
|
#### Test Tags
|
||||||
|
|
||||||
@ -169,13 +184,16 @@ Test tags are a great way of organizing tests outside of a file structure. To le
|
|||||||
|
|
||||||
Current list of test tags:
|
Current list of test tags:
|
||||||
|
|
||||||
- `@ipad` - Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no Create button).
|
|Test Tag|Description|
|
||||||
- `@gds` - Denotes a GDS Test Case used in the VIPER Mission.
|
|:-:|-|
|
||||||
- `@addInit` - Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of `npm start`.
|
|`@ipad` | Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no create button).|
|
||||||
- `@localStorage` - Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).
|
|`@gds` | Denotes a GDS Test Case used in the VIPER Mission.|
|
||||||
- `@snapshot` - Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.
|
|`@addInit` | Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of `npm start`.|
|
||||||
- `@unstable` - A new test or test which is known to be flaky.
|
|`@localStorage` | Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).|
|
||||||
- `@2p` - Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.
|
|`@snapshot` | Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.|
|
||||||
|
|`@unstable` | A new test or test which is known to be flaky.|
|
||||||
|
|`@2p` | Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.|
|
||||||
|
|`@generatedata` | Indicates that a test is used to generate testdata or test the generated test data. Usually to be associated with localstorage, but this may grow over time.|
|
||||||
|
|
||||||
### Continuous Integration
|
### Continuous Integration
|
||||||
|
|
||||||
@ -194,24 +212,27 @@ CircleCI
|
|||||||
- Stable e2e tests against ubuntu and chrome
|
- Stable e2e tests against ubuntu and chrome
|
||||||
- Performance tests against ubuntu and chrome
|
- Performance tests against ubuntu and chrome
|
||||||
- e2e tests are linted
|
- e2e tests are linted
|
||||||
|
- Visual tests are run in a single resolution on the default `espresso` theme
|
||||||
|
|
||||||
#### 2. Per-Merge Testing
|
#### 2. Per-Merge Testing
|
||||||
|
|
||||||
Github Actions / Workflow
|
Github Actions / Workflow
|
||||||
|
|
||||||
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
|
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
|
||||||
- Visual Tests. Triggered with Github Label Event 'pr:visual'
|
- CouchDB Tests. Triggered on PR Create and again with Github Label Event 'pr:e2e:couchdb'
|
||||||
|
|
||||||
#### 3. Scheduled / Batch Testing
|
#### 3. Scheduled / Batch Testing
|
||||||
|
|
||||||
Nightly Testing in Circle CI
|
Nightly Testing in Circle CI
|
||||||
|
|
||||||
- Full e2e suite against ubuntu and chrome
|
- Full e2e suite against ubuntu and chrome, firefox, and an MMOC resolution profile
|
||||||
- Performance tests against ubuntu and chrome
|
- Performance tests against ubuntu and chrome
|
||||||
|
- CouchDB suite
|
||||||
|
- Visual Tests are run in the full profile
|
||||||
|
|
||||||
Github Actions / Workflow
|
Github Actions / Workflow
|
||||||
|
|
||||||
- Visual Test baseline generation.
|
- None at the moment
|
||||||
|
|
||||||
#### Parallelism and Fast Feedback
|
#### Parallelism and Fast Feedback
|
||||||
|
|
||||||
@ -231,7 +252,8 @@ At the same time, we don't want to waste CI resources on parallel runs, so we've
|
|||||||
|
|
||||||
In order to maintain fast and reliable feedback, tests go through a promotion process. All new test cases or test suites must be labeled with the `@unstable` annotation. The Open MCT dev team runs these unstable tests in our private repos to ensure they work downstream and are reliable.
|
In order to maintain fast and reliable feedback, tests go through a promotion process. All new test cases or test suites must be labeled with the `@unstable` annotation. The Open MCT dev team runs these unstable tests in our private repos to ensure they work downstream and are reliable.
|
||||||
|
|
||||||
To run the stable tests, use the ```npm run test:e2e:stable``` command. To run the new and flaky tests, use the ```npm run test:e2e:unstable``` command.
|
- To run the stable tests, use the `npm run test:e2e:stable` command.
|
||||||
|
- To run the new and flaky tests, use the `npm run test:e2e:unstable` command.
|
||||||
|
|
||||||
A testcase and testsuite are to be unmarked as @unstable when:
|
A testcase and testsuite are to be unmarked as @unstable when:
|
||||||
|
|
||||||
@ -242,7 +264,7 @@ A testcase and testsuite are to be unmarked as @unstable when:
|
|||||||
|
|
||||||
#### **What's supported:**
|
#### **What's supported:**
|
||||||
|
|
||||||
We are leveraging the `browserslist` project to declare our supported list of browsers.
|
We are leveraging the `browserslist` project to declare our supported list of browsers. We support macOS, Windows, and ubuntu 20+.
|
||||||
|
|
||||||
#### **Where it's tested:**
|
#### **Where it's tested:**
|
||||||
|
|
||||||
@ -256,11 +278,17 @@ We also have the need to execute our e2e tests across this published list of bro
|
|||||||
- A stable version of Chromium from the official chromium channels. This is always at least 1 version ahead of desktop chrome.
|
- A stable version of Chromium from the official chromium channels. This is always at least 1 version ahead of desktop chrome.
|
||||||
- `playwright-chrome`
|
- `playwright-chrome`
|
||||||
- The stable channel of Chrome from the official chrome channels. This is always 2 versions behind chromium.
|
- The stable channel of Chrome from the official chrome channels. This is always 2 versions behind chromium.
|
||||||
|
- `playwright-firefox`
|
||||||
|
- Firefox Latest Stable. Modified slightly by the playwright team to support a CDP Shim.
|
||||||
|
|
||||||
|
In terms of operating system testing, we're only limited by what the CI providers are able to support. The bulk of our testing is performed on the official playwright container which is based on ubuntu. Github Actions allows us to use `windows-latest` and `mac-latest` and is run as needed.
|
||||||
|
|
||||||
#### **Mobile**
|
#### **Mobile**
|
||||||
|
|
||||||
We have the Mission-need to support iPad. To run our iPad suite, please see our `playwright-*.config.js` with the 'iPad' project.
|
We have the Mission-need to support iPad. To run our iPad suite, please see our `playwright-*.config.js` with the 'iPad' project.
|
||||||
|
|
||||||
|
In general, our test suite is not designed to run against mobile devices as the mobile experience is a focused version of the application. Core functionality is missing (chiefly the 'Create' button) and so this will likely turn into a separate suite.
|
||||||
|
|
||||||
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
||||||
|
|
||||||
Conditionally skipping tests based on browser (**RECOMMENDED**):
|
Conditionally skipping tests based on browser (**RECOMMENDED**):
|
||||||
@ -287,18 +315,44 @@ Skipping based on browser version (Rarely used): <https://github.com/microsoft/p
|
|||||||
|
|
||||||
## Test Design, Best Practices, and Tips & Tricks
|
## Test Design, Best Practices, and Tips & Tricks
|
||||||
|
|
||||||
### Test Design (TODO)
|
### Test Design
|
||||||
|
|
||||||
- How to make tests robust to function in other contexts (VISTA, VIPER, etc.)
|
#### Test as the User
|
||||||
- Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`
|
|
||||||
- How to make tests faster and more resilient
|
|
||||||
- When possible, navigate directly by URL
|
|
||||||
- Leverage `await page.goto('./', { waitUntil: 'networkidle' });`
|
|
||||||
- Avoid repeated setup to test to test a single assertion. Write longer tests with multiple soft assertions.
|
|
||||||
|
|
||||||
### How to write a great test (WIP)
|
In general, strive to test only through the UI as a user would. As stated in the [Playwright Best Practices](https://playwright.dev/docs/best-practices#test-user-visible-behavior):
|
||||||
|
|
||||||
|
> "Automated tests should verify that the application code works for the end users, and avoid relying on implementation details such as things which users will not typically use, see, or even know about such as the name of a function, whether something is an array, or the CSS class of some element. The end user will see or interact with what is rendered on the page, so your test should typically only see/interact with the same rendered output."
|
||||||
|
|
||||||
|
By adhering to this principle, we can create tests that are both robust and reflective of actual user experiences.
|
||||||
|
|
||||||
|
#### How to make tests robust to function in other contexts (VISTA, COUCHDB, YAMCS, VIPER, etc.)
|
||||||
|
1. Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`. This ensures that your tests will create unique instances of objects for your test to interact with.
|
||||||
|
1. Do not assert on the order or structure of objects available unless you created them yourself. These tests may be used against a persistent datastore like couchdb with many objects in the tree.
|
||||||
|
1. Do not search for your created objects. Open MCT does not performance uniqueness checks so it's possible that your tests will break when run twice.
|
||||||
|
1. Avoid creating locator aliases. This likely means that you're compensating for a bad locator. Improve the application instead.
|
||||||
|
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });` instead of `{ waitUntil: 'networkidle' }`. Tests run against deployments with websockets often have issues with the networkidle detection.
|
||||||
|
|
||||||
|
#### How to make tests faster and more resilient
|
||||||
|
1. Avoid app interaction when possible. The best way of doing this is to navigate directly by URL:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// You can capture the CreatedObjectInfo returned from this appAction:
|
||||||
|
const clock = await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
||||||
|
|
||||||
|
// ...and use its `url` property to navigate directly to it later in the test:
|
||||||
|
await page.goto(clock.url);
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });`
|
||||||
|
- Initial navigation should _almost_ always use the `{ waitUntil: 'domcontentloaded' }` option.
|
||||||
|
1. Avoid repeated setup to test a single assertion. Write longer tests with multiple soft assertions.
|
||||||
|
This ensures that your changes will be picked up with large refactors.
|
||||||
|
|
||||||
|
### How to write a great test
|
||||||
|
|
||||||
|
- Avoid using css locators to find elements to the page. Use modern web accessible locators like `getByRole`
|
||||||
- Use our [App Actions](./appActions.js) for performing common actions whenever applicable.
|
- Use our [App Actions](./appActions.js) for performing common actions whenever applicable.
|
||||||
|
- Use `waitForPlotsToRender()` before asserting against anything that is dependent upon plot series data being loaded and drawn.
|
||||||
- If you create an object outside of using the `createDomainObjectWithDefaults` App Action, make sure to fill in the 'Notes' section of your object with `page.testNotes`:
|
- If you create an object outside of using the `createDomainObjectWithDefaults` App Action, make sure to fill in the 'Notes' section of your object with `page.testNotes`:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -309,7 +363,39 @@ Skipping based on browser version (Rarely used): <https://github.com/microsoft/p
|
|||||||
await notesInput.fill(testNotes);
|
await notesInput.fill(testNotes);
|
||||||
```
|
```
|
||||||
|
|
||||||
#### How to write a great visual test (TODO)
|
#### How to Write a Great Visual Test
|
||||||
|
|
||||||
|
1. **Look for the Unknown Unknowns**: Avoid asserting on specific differences in the visual diff. Visual tests are most effective for identifying unknown unknowns.
|
||||||
|
|
||||||
|
2. **Get the App into Interesting States**: Prioritize getting Open MCT into unusual layouts or behaviors before capturing a visual snapshot. For instance, you could open a dropdown menu.
|
||||||
|
|
||||||
|
3. **Expect the Unexpected**: Use functional expect statements only to verify assumptions about the state between steps. A great visual test doesn't fail during the test itself, but rather when changes are reviewed in Percy.io.
|
||||||
|
|
||||||
|
4. **Control Variability**: Account for variations inherent in working with time-based telemetry and clocks.
|
||||||
|
- Utilize `percyCSS` to ignore time-based elements. For more details, consult our [percyCSS file](./.percy.ci.yml).
|
||||||
|
- Use Open MCT's fixed-time mode unless explicitly testing realtime clock
|
||||||
|
- Employ the `createExampleTelemetryObject` appAction to source telemetry and specify a `name` to avoid autogenerated names.
|
||||||
|
|
||||||
|
5. **Hide the Tree and Inspector**: Generally, your test will not require comparisons involving the tree and inspector. These aspects are covered in component-specific tests (explained below). To exclude them from the comparison by default, navigate to the root of the main view with the tree and inspector hidden:
|
||||||
|
- `await page.goto('./#/browse/mine?hideTree=true&hideInspector=true')`
|
||||||
|
|
||||||
|
6. **Component-Specific Tests**: If you wish to focus on a particular component, use the `/visual/component/` folder and limit the scope of the comparison to that component. For instance:
|
||||||
|
```js
|
||||||
|
await percySnapshot(page, `Tree Pane w/ single level expanded (theme: ${theme})`, {
|
||||||
|
scope: treePane
|
||||||
|
});
|
||||||
|
```
|
||||||
|
- Note: The `scope` variable can be any valid CSS selector.
|
||||||
|
|
||||||
|
7. **Write many `percySnapshot` commands in a single test**: In line with our approach to longer functional tests, we recommend that many test percySnapshots are taken in a single test. For instance:
|
||||||
|
```js
|
||||||
|
//<Some interesting state>
|
||||||
|
await percySnapshot(page, `Before object expanded (theme: ${theme})`);
|
||||||
|
//<Click on object>
|
||||||
|
await percySnapshot(page, `object expanded (theme: ${theme})`);
|
||||||
|
//Select from object
|
||||||
|
await percySnapshot(page, `object selected (theme: ${theme})`)
|
||||||
|
```
|
||||||
|
|
||||||
#### How to write a great network test
|
#### How to write a great network test
|
||||||
|
|
||||||
@ -326,12 +412,35 @@ For now, our best practices exist as self-tested, living documentation in our [e
|
|||||||
|
|
||||||
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
|
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
|
||||||
|
|
||||||
### Tips & Tricks (TODO)
|
### Tips & Tricks
|
||||||
|
|
||||||
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
|
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
|
||||||
|
|
||||||
|
- (Advanced) Overriding the Browser's Clock
|
||||||
|
It is possible to override the browser's clock in order to control time-based elements. Since this can cause unwanted behavior (i.e. Tree not rendering), only use this sparingly. To do this, use the `overrideClock` fixture as such:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
|
|
||||||
|
test.describe('foo test suite', () => {
|
||||||
|
|
||||||
|
// All subsequent tests in this suite will override the clock
|
||||||
|
test.use({
|
||||||
|
clockOptions: {
|
||||||
|
now: 1732413600000, // A timestamp given as milliseconds since the epoch
|
||||||
|
shouldAdvanceTime: true // Should the clock tick?
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('bar test', async ({ page }) => {
|
||||||
|
// ...
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
More info and options for `overrideClock` can be found in [baseFixtures.js](baseFixtures.js)
|
||||||
|
|
||||||
- Working with multiple pages
|
- Working with multiple pages
|
||||||
There are instances where multiple browser pages will need to be opened to verify multi-page or multi-tab application behavior.
|
There are instances where multiple browser pages will needed to verify multi-page or multi-tab application behavior. Make sure to use the `@2p` annotation as well as name each page appropriately: i.e. `page1` and `page2` or `tab1` and `tab2` depending on the intended use case. Generally pages should be used unless testing `sharedWorker` code, specifically.
|
||||||
|
|
||||||
### Reporting
|
### Reporting
|
||||||
|
|
||||||
@ -345,12 +454,16 @@ We leverage the following official Playwright reporters:
|
|||||||
- Tracefile
|
- Tracefile
|
||||||
- Screenshots
|
- Screenshots
|
||||||
|
|
||||||
When running the tests locally with the `npm run test:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
|
When running the tests locally with the `npm run test:e2e:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
|
||||||
|
|
||||||
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
|
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
|
||||||
|
|
||||||
### e2e Code Coverage
|
### e2e Code Coverage
|
||||||
|
|
||||||
|
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:
|
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```
|
```npm run cov:e2e:report```
|
||||||
@ -361,10 +474,6 @@ At this point, the nyc linecov report can be published to [codecov.io](https://a
|
|||||||
or
|
or
|
||||||
```npm run cov:e2e:full:publish``` for the full suite running against all available platforms.
|
```npm run cov:e2e:full:publish``` for the full suite running against all available platforms.
|
||||||
|
|
||||||
Codecov.io will combine each of the above commands with [Codecov.io Flags](https://docs.codecov.com/docs/flags). Effectively, this allows us to combine multiple reports which are run at various stages of our CI Pipeline or run as part of a parallel process.
|
|
||||||
|
|
||||||
This e2e coverage is combined with our unit test report to give a comprehensive (if flawed) view of line coverage.
|
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
### About e2e testing
|
### About e2e testing
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
* @property {string} type the type of domain object to create (e.g.: "Sine Wave Generator").
|
* @property {string} type the type of domain object to create (e.g.: "Sine Wave Generator").
|
||||||
* @property {string} [name] the desired name of the created domain object.
|
* @property {string} [name] the desired name of the created domain object.
|
||||||
* @property {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the Identifier or uuid of the parent object.
|
* @property {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the Identifier or uuid of the parent object.
|
||||||
|
* @property {Object<string, string>} [customParameters] any additional parameters to be passed to the domain object's form. E.g. '[aria-label="Data Rate (hz)"]': {'0.1'}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,6 +56,7 @@
|
|||||||
|
|
||||||
const Buffer = require('buffer').Buffer;
|
const Buffer = require('buffer').Buffer;
|
||||||
const genUuid = require('uuid').v4;
|
const genUuid = require('uuid').v4;
|
||||||
|
const { expect } = require('@playwright/test');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
||||||
@ -64,60 +66,69 @@ const genUuid = require('uuid').v4;
|
|||||||
* @param {CreateObjectOptions} options
|
* @param {CreateObjectOptions} options
|
||||||
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||||
*/
|
*/
|
||||||
async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine' }) {
|
async function createDomainObjectWithDefaults(
|
||||||
if (!name) {
|
page,
|
||||||
name = `${type}:${genUuid()}`;
|
{ type, name, parent = 'mine', customParameters = {} }
|
||||||
}
|
) {
|
||||||
|
if (!name) {
|
||||||
|
name = `${type}:${genUuid()}`;
|
||||||
|
}
|
||||||
|
|
||||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
// Navigate to the parent object. This is necessary to create the object
|
// Navigate to the parent object. This is necessary to create the object
|
||||||
// in the correct location, such as a folder, layout, or plot.
|
// in the correct location, such as a folder, layout, or plot.
|
||||||
await page.goto(`${parentUrl}?hideTree=true`);
|
await page.goto(`${parentUrl}`);
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
//Click the Create button
|
//Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
// Click the object specified by 'type'
|
||||||
await page.click(`li[role='menuitem']:text("${type}")`);
|
await page.click(`li[role='menuitem']:text("${type}")`);
|
||||||
|
|
||||||
// Modify the name input field of the domain object to accept 'name'
|
// Modify the name input field of the domain object to accept 'name'
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
await nameInput.fill("");
|
await nameInput.fill('');
|
||||||
await nameInput.fill(name);
|
await nameInput.fill(name);
|
||||||
|
|
||||||
if (page.testNotes) {
|
if (page.testNotes) {
|
||||||
// Fill the "Notes" section with information about the
|
// Fill the "Notes" section with information about the
|
||||||
// currently running test and its project.
|
// currently running test and its project.
|
||||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
await notesInput.fill(page.testNotes);
|
await notesInput.fill(page.testNotes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
// If there are any further parameters, fill them in
|
||||||
await Promise.all([
|
for (const [key, value] of Object.entries(customParameters)) {
|
||||||
page.waitForLoadState(),
|
const input = page.locator(`form[name="mctForm"] ${key}`);
|
||||||
page.click('[aria-label="Save"]'),
|
await input.fill('');
|
||||||
// Wait for Save Banner to appear
|
await input.fill(value);
|
||||||
page.waitForSelector('.c-message-banner__message')
|
}
|
||||||
]);
|
|
||||||
|
|
||||||
// Wait until the URL is updated
|
// Click OK button and wait for Navigate event
|
||||||
await page.waitForURL(`**/${parent}/*`);
|
await Promise.all([
|
||||||
const uuid = await getFocusedObjectUuid(page);
|
page.waitForLoadState(),
|
||||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
page.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
if (await _isInEditMode(page, uuid)) {
|
// Wait until the URL is updated
|
||||||
// Save (exit edit mode)
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
await page.locator('button[title="Save"]').click();
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
await page.locator('li[title="Save and Finish Editing"]').click();
|
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
if (await _isInEditMode(page, uuid)) {
|
||||||
name,
|
// Save (exit edit mode)
|
||||||
uuid,
|
await page.locator('button[title="Save"]').click();
|
||||||
url: objectUrl
|
await page.locator('li[title="Save and Finish Editing"]').click();
|
||||||
};
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
uuid,
|
||||||
|
url: objectUrl
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,30 +137,31 @@ async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine
|
|||||||
* @param {CreateNotificationOptions} createNotificationOptions
|
* @param {CreateNotificationOptions} createNotificationOptions
|
||||||
*/
|
*/
|
||||||
async function createNotification(page, createNotificationOptions) {
|
async function createNotification(page, createNotificationOptions) {
|
||||||
await page.evaluate((_createNotificationOptions) => {
|
await page.evaluate((_createNotificationOptions) => {
|
||||||
const { message, severity, options } = _createNotificationOptions;
|
const { message, severity, options } = _createNotificationOptions;
|
||||||
const notificationApi = window.openmct.notifications;
|
const notificationApi = window.openmct.notifications;
|
||||||
if (severity === 'info') {
|
if (severity === 'info') {
|
||||||
notificationApi.info(message, options);
|
notificationApi.info(message, options);
|
||||||
} else if (severity === 'alert') {
|
} else if (severity === 'alert') {
|
||||||
notificationApi.alert(message, options);
|
notificationApi.alert(message, options);
|
||||||
} else {
|
} else {
|
||||||
notificationApi.error(message, options);
|
notificationApi.error(message, options);
|
||||||
}
|
}
|
||||||
}, createNotificationOptions);
|
}, createNotificationOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Expand an item in the tree by a given object name.
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
async function expandTreePaneItemByName(page, name) {
|
async function expandTreePaneItemByName(page, name) {
|
||||||
const treePane = page.getByRole('tree', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: 'Main Tree'
|
name: 'Main Tree'
|
||||||
});
|
});
|
||||||
const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
|
const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
|
||||||
const expandTriangle = treeItem.locator('.c-disclosure-triangle');
|
const expandTriangle = treeItem.locator('.c-disclosure-triangle');
|
||||||
await expandTriangle.click();
|
await expandTriangle.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,67 +171,123 @@ async function expandTreePaneItemByName(page, name) {
|
|||||||
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
|
||||||
*/
|
*/
|
||||||
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
name = `Plan:${genUuid()}`;
|
name = `Plan:${genUuid()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
// Navigate to the parent object. This is necessary to create the object
|
// Navigate to the parent object. This is necessary to create the object
|
||||||
// in the correct location, such as a folder, layout, or plot.
|
// in the correct location, such as a folder, layout, or plot.
|
||||||
await page.goto(`${parentUrl}?hideTree=true`);
|
await page.goto(`${parentUrl}`);
|
||||||
|
|
||||||
// Click the Create button
|
// Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
// Click 'Plan' menu option
|
// Click 'Plan' menu option
|
||||||
await page.click(`li:text("Plan")`);
|
await page.click(`li:text("Plan")`);
|
||||||
|
|
||||||
// Modify the name input field of the domain object to accept 'name'
|
// Modify the name input field of the domain object to accept 'name'
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
const nameInput = page.getByLabel('Title', { exact: true });
|
||||||
await nameInput.fill("");
|
await nameInput.fill('');
|
||||||
await nameInput.fill(name);
|
await nameInput.fill(name);
|
||||||
|
|
||||||
// Upload buffer from memory
|
// Upload buffer from memory
|
||||||
await page.locator('input#fileElem').setInputFiles({
|
await page.locator('input#fileElem').setInputFiles({
|
||||||
name: 'plan.txt',
|
name: 'plan.txt',
|
||||||
mimeType: 'text/plain',
|
mimeType: 'text/plain',
|
||||||
buffer: Buffer.from(JSON.stringify(json))
|
buffer: Buffer.from(JSON.stringify(json))
|
||||||
});
|
});
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
// Click OK button and wait for Navigate event
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.waitForLoadState(),
|
page.waitForLoadState(),
|
||||||
page.click('[aria-label="Save"]'),
|
page.click('[aria-label="Save"]'),
|
||||||
// Wait for Save Banner to appear
|
// Wait for Save Banner to appear
|
||||||
page.waitForSelector('.c-message-banner__message')
|
page.waitForSelector('.c-message-banner__message')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Wait until the URL is updated
|
// Wait until the URL is updated
|
||||||
await page.waitForURL(`**/${parent}/*`);
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
const uuid = await getFocusedObjectUuid(page);
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
const objectUrl = await getHashUrlToDomainObject(page, uuid);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uuid,
|
uuid,
|
||||||
name,
|
name,
|
||||||
url: objectUrl
|
url: objectUrl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the given `domainObject`'s context menu from the object tree.
|
* Create a standardized Telemetry Object (Sine Wave Generator) for use in visual tests
|
||||||
* Expands the path to the object and scrolls to it if necessary.
|
* and tests against plotting telemetry (e.g. logPlot tests).
|
||||||
*
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the uuid or identifier of the parent object. Defaults to 'mine'
|
||||||
* @param {string} url the url to the object
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the telemetry object.
|
||||||
*/
|
*/
|
||||||
|
async function createExampleTelemetryObject(page, parent = 'mine') {
|
||||||
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
|
await page.goto(`${parentUrl}`);
|
||||||
|
|
||||||
|
await page.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) {
|
async function openObjectTreeContextMenu(page, url) {
|
||||||
await page.goto(url);
|
await page.goto(url);
|
||||||
await page.click('button[title="Show selected item in tree"]');
|
await page.click('button[title="Show selected item in tree"]');
|
||||||
await page.locator('.is-navigated-object').click({
|
await page.locator('.is-navigated-object').click({
|
||||||
button: 'right'
|
button: 'right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,23 +295,25 @@ async function openObjectTreeContextMenu(page, url) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
|
* @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
|
||||||
*/
|
*/
|
||||||
async function expandEntireTree(page, treeName = "Main Tree") {
|
async function expandEntireTree(page, treeName = 'Main Tree') {
|
||||||
const treeLocator = page.getByRole('tree', {
|
const treeLocator = page.getByRole('tree', {
|
||||||
name: treeName
|
name: treeName
|
||||||
});
|
});
|
||||||
const collapsedTreeItems = treeLocator.getByRole('treeitem', {
|
const collapsedTreeItems = treeLocator
|
||||||
expanded: false
|
.getByRole('treeitem', {
|
||||||
}).locator('span.c-disclosure-triangle.is-enabled');
|
expanded: false
|
||||||
|
})
|
||||||
|
.locator('span.c-disclosure-triangle.is-enabled');
|
||||||
|
|
||||||
while (await collapsedTreeItems.count() > 0) {
|
while ((await collapsedTreeItems.count()) > 0) {
|
||||||
await collapsedTreeItems.nth(0).click();
|
await collapsedTreeItems.nth(0).click();
|
||||||
|
|
||||||
// FIXME: Replace hard wait with something event-driven.
|
// FIXME: Replace hard wait with something event-driven.
|
||||||
// Without the wait, this fails periodically due to a race condition
|
// Without the wait, this fails periodically due to a race condition
|
||||||
// with Vue rendering (loop exits prematurely).
|
// with Vue rendering (loop exits prematurely).
|
||||||
// eslint-disable-next-line playwright/no-wait-for-timeout
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
||||||
await page.waitForTimeout(200);
|
await page.waitForTimeout(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,12 +323,12 @@ async function expandEntireTree(page, treeName = "Main Tree") {
|
|||||||
* @returns {Promise<string>} the uuid of the focused object
|
* @returns {Promise<string>} the uuid of the focused object
|
||||||
*/
|
*/
|
||||||
async function getFocusedObjectUuid(page) {
|
async function getFocusedObjectUuid(page) {
|
||||||
const UUIDv4Regexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi;
|
const UUIDv4Regexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi;
|
||||||
const focusedObjectUuid = await page.evaluate((regexp) => {
|
const focusedObjectUuid = await page.evaluate((regexp) => {
|
||||||
return window.location.href.split('?')[0].match(regexp).at(-1);
|
return window.location.href.split('?')[0].match(regexp).at(-1);
|
||||||
}, UUIDv4Regexp);
|
}, UUIDv4Regexp);
|
||||||
|
|
||||||
return focusedObjectUuid;
|
return focusedObjectUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -268,36 +338,41 @@ async function getFocusedObjectUuid(page) {
|
|||||||
* URLs returned will be of the form `'./browse/#/mine/<uuid0>/<uuid1>/...'`
|
* URLs returned will be of the form `'./browse/#/mine/<uuid0>/<uuid1>/...'`
|
||||||
*
|
*
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {string} uuid the uuid of the object to get the url for
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} identifier the uuid or identifier of the object to get the url for
|
||||||
* @returns {Promise<string>} the url of the object
|
* @returns {Promise<string>} the url of the object
|
||||||
*/
|
*/
|
||||||
async function getHashUrlToDomainObject(page, uuid) {
|
async function getHashUrlToDomainObject(page, identifier) {
|
||||||
const hashUrl = await page.evaluate(async (objectUuid) => {
|
await page.waitForLoadState('load');
|
||||||
const path = await window.openmct.objects.getOriginalPath(objectUuid);
|
const hashUrl = await page.evaluate(async (objectIdentifier) => {
|
||||||
let url = './#/browse/' + [...path].reverse()
|
const path = await window.openmct.objects.getOriginalPath(objectIdentifier);
|
||||||
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
let url =
|
||||||
.join('/');
|
'./#/browse/' +
|
||||||
|
[...path]
|
||||||
|
.reverse()
|
||||||
|
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
||||||
|
.join('/');
|
||||||
|
|
||||||
// Drop the vestigial '/ROOT' if it exists
|
// Drop the vestigial '/ROOT' if it exists
|
||||||
if (url.includes('/ROOT')) {
|
if (url.includes('/ROOT')) {
|
||||||
url = url.split('/ROOT').join('');
|
url = url.split('/ROOT').join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}, uuid);
|
}, identifier);
|
||||||
|
|
||||||
return hashUrl;
|
return hashUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilizes the OpenMCT API to detect if the UI is in Edit mode.
|
* Utilizes the OpenMCT API to detect if the UI is in Edit mode.
|
||||||
* @private
|
* @private
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} identifier
|
||||||
* @return {Promise<boolean>} true if the Open MCT is in Edit Mode
|
* @return {Promise<boolean>} true if the Open MCT is in Edit Mode
|
||||||
*/
|
*/
|
||||||
async function _isInEditMode(page, identifier) {
|
async function _isInEditMode(page, identifier) {
|
||||||
// eslint-disable-next-line no-return-await
|
// eslint-disable-next-line no-return-await
|
||||||
return await page.evaluate(() => window.openmct.editor.isEditing());
|
return await page.evaluate(() => window.openmct.editor.isEditing());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -306,15 +381,15 @@ async function _isInEditMode(page, identifier) {
|
|||||||
* @param {boolean} [isFixedTimespan=true] true for fixed timespan mode, false for realtime mode; default is true
|
* @param {boolean} [isFixedTimespan=true] true for fixed timespan mode, false for realtime mode; default is true
|
||||||
*/
|
*/
|
||||||
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
||||||
// Click 'mode' button
|
// Click 'mode' button
|
||||||
await page.locator('.c-mode-button').click();
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await page.getByRole('button', { name: 'Time Conductor Mode Menu' }).click();
|
||||||
// Switch time conductor mode
|
// Switch time conductor mode
|
||||||
if (isFixedTimespan) {
|
if (isFixedTimespan) {
|
||||||
await page.locator('data-testid=conductor-modeOption-fixed').click();
|
await page.getByRole('menuitem', { name: /Fixed Timespan/ }).click();
|
||||||
} else {
|
} else {
|
||||||
await page.locator('data-testid=conductor-modeOption-realtime').click();
|
await page.getByRole('menuitem', { name: /Real-Time/ }).click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -322,7 +397,7 @@ async function setTimeConductorMode(page, isFixedTimespan = true) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function setFixedTimeMode(page) {
|
async function setFixedTimeMode(page) {
|
||||||
await setTimeConductorMode(page, true);
|
await setTimeConductorMode(page, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -330,14 +405,17 @@ async function setFixedTimeMode(page) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function setRealTimeMode(page) {
|
async function setRealTimeMode(page) {
|
||||||
await setTimeConductorMode(page, false);
|
await setTimeConductorMode(page, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} OffsetValues
|
* @typedef {Object} OffsetValues
|
||||||
* @property {string | undefined} hours
|
* @property {string | undefined} startHours
|
||||||
* @property {string | undefined} mins
|
* @property {string | undefined} startMins
|
||||||
* @property {string | undefined} secs
|
* @property {string | undefined} startSecs
|
||||||
|
* @property {string | undefined} endHours
|
||||||
|
* @property {string | undefined} endMins
|
||||||
|
* @property {string | undefined} endSecs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -346,23 +424,36 @@ async function setRealTimeMode(page) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
* @param {import('@playwright/test').Locator} offsetButton
|
* @param {import('@playwright/test').Locator} offsetButton
|
||||||
*/
|
*/
|
||||||
async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
async function setTimeConductorOffset(
|
||||||
await offsetButton.click();
|
page,
|
||||||
|
{ startHours, startMins, startSecs, endHours, endMins, endSecs }
|
||||||
|
) {
|
||||||
|
if (startHours) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'Start offset hours' }).fill(startHours);
|
||||||
|
}
|
||||||
|
|
||||||
if (hours) {
|
if (startMins) {
|
||||||
await page.fill('.pr-time-controls__hrs', hours);
|
await page.getByRole('spinbutton', { name: 'Start offset minutes' }).fill(startMins);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mins) {
|
if (startSecs) {
|
||||||
await page.fill('.pr-time-controls__mins', mins);
|
await page.getByRole('spinbutton', { name: 'Start offset seconds' }).fill(startSecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secs) {
|
if (endHours) {
|
||||||
await page.fill('.pr-time-controls__secs', secs);
|
await page.getByRole('spinbutton', { name: 'End offset hours' }).fill(endHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click the check button
|
if (endMins) {
|
||||||
await page.locator('.pr-time__buttons .icon-check').click();
|
await page.getByRole('spinbutton', { name: 'End offset minutes' }).fill(endMins);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endSecs) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'End offset seconds' }).fill(endSecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Click the check button
|
||||||
|
await page.locator('.pr-time-input--buttons .icon-check').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -371,8 +462,9 @@ async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
*/
|
*/
|
||||||
async function setStartOffset(page, offset) {
|
async function setStartOffset(page, offset) {
|
||||||
const startOffsetButton = page.locator('data-testid=conductor-start-offset-button');
|
// Click 'mode' button
|
||||||
await setTimeConductorOffset(page, offset, startOffsetButton);
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -381,42 +473,194 @@ async function setStartOffset(page, offset) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
*/
|
*/
|
||||||
async function setEndOffset(page, offset) {
|
async function setEndOffset(page, offset) {
|
||||||
const endOffsetButton = page.locator('data-testid=conductor-end-offset-button');
|
// Click 'mode' button
|
||||||
await setTimeConductorOffset(page, offset, endOffsetButton);
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selects an inspector tab based on the provided tab name
|
* Set the time conductor bounds in fixed time mode
|
||||||
*
|
*
|
||||||
|
* NOTE: Unless explicitly testing the Time Conductor itself, it is advised to instead
|
||||||
|
* navigate directly to the object with the desired time bounds using `navigateToObjectWithFixedTimeBounds()`.
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {String} name the name of the tab
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
*/
|
*/
|
||||||
async function selectInspectorTab(page, name) {
|
async function setTimeConductorBounds(page, startDate, endDate) {
|
||||||
const inspectorTabs = page.getByRole('tablist');
|
// Bring up the time conductor popup
|
||||||
const inspectorTab = inspectorTabs.getByTitle(name);
|
expect(await page.locator('.l-shell__time-conductor.c-compact-tc').count()).toBe(1);
|
||||||
const inspectorTabClass = await inspectorTab.getAttribute('class');
|
await page.click('.l-shell__time-conductor.c-compact-tc');
|
||||||
const isSelectedInspectorTab = inspectorTabClass.includes('is-current');
|
|
||||||
|
|
||||||
// do not click a tab that is already selected or it will timeout your test
|
await setTimeBounds(page, startDate, endDate);
|
||||||
// do to a { pointer-events: none; } on selected tabs
|
|
||||||
if (!isSelectedInspectorTab) {
|
await page.keyboard.press('Enter');
|
||||||
await inspectorTab.click();
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Set the independent time conductor bounds in fixed time mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
|
async function setIndependentTimeConductorBounds(page, startDate, endDate) {
|
||||||
|
// Activate Independent Time Conductor in Fixed Time Mode
|
||||||
|
await page.getByRole('switch').click();
|
||||||
|
|
||||||
|
// Bring up the time conductor popup
|
||||||
|
await page.click('.c-conductor-holder--compact .c-compact-tc');
|
||||||
|
await expect(page.locator('.itc-popout')).toBeInViewport();
|
||||||
|
|
||||||
|
await setTimeBounds(page, startDate, endDate);
|
||||||
|
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the bounds of the visible conductor in fixed time mode
|
||||||
|
* @private
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
|
async function setTimeBounds(page, startDate, endDate) {
|
||||||
|
if (startDate) {
|
||||||
|
// Fill start time
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Start date' })
|
||||||
|
.fill(startDate.toString().substring(0, 10));
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Start time' })
|
||||||
|
.fill(startDate.toString().substring(11, 19));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endDate) {
|
||||||
|
// Fill end time
|
||||||
|
await page.getByRole('textbox', { name: 'End date' }).fill(endDate.toString().substring(0, 10));
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'End time' })
|
||||||
|
.fill(endDate.toString().substring(11, 19));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits and asserts that all plot series data on the page
|
||||||
|
* is loaded and drawn.
|
||||||
|
*
|
||||||
|
* In lieu of a better way to detect when a plot is done rendering,
|
||||||
|
* we [attach a class to the '.gl-plot' element](https://github.com/nasa/openmct/blob/5924d7ea95a0c2d4141c602a3c7d0665cb91095f/src/plugins/plot/MctPlot.vue#L27)
|
||||||
|
* once all pending series data has been loaded. The following appAction retrieves
|
||||||
|
* all plots on the page and waits up to the default timeout for the class to be
|
||||||
|
* attached to each plot.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function waitForPlotsToRender(page) {
|
||||||
|
const plotLocator = page.locator('.gl-plot');
|
||||||
|
for (const plot of await plotLocator.all()) {
|
||||||
|
await expect(plot).toHaveClass(/js-series-data-loaded/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PlotPixel
|
||||||
|
* @property {number} r The value of the red channel (0-255)
|
||||||
|
* @property {number} g The value of the green channel (0-255)
|
||||||
|
* @property {number} b The value of the blue channel (0-255)
|
||||||
|
* @property {number} a The value of the alpha channel (0-255)
|
||||||
|
* @property {string} strValue The rgba string value of the pixel
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for all plots to render and then retrieve and return an array
|
||||||
|
* of canvas plot pixel data (RGBA values).
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} canvasSelector The selector for the canvas element
|
||||||
|
* @return {Promise<PlotPixel[]>}
|
||||||
|
*/
|
||||||
|
async function getCanvasPixels(page, canvasSelector) {
|
||||||
|
const getTelemValuePromise = new Promise((resolve) =>
|
||||||
|
page.exposeFunction('getCanvasValue', resolve)
|
||||||
|
);
|
||||||
|
const canvasHandle = await page.evaluateHandle(
|
||||||
|
(canvas) => document.querySelector(canvas),
|
||||||
|
canvasSelector
|
||||||
|
);
|
||||||
|
const canvasContextHandle = await page.evaluateHandle(
|
||||||
|
(canvas) => canvas.getContext('2d'),
|
||||||
|
canvasHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
await page.evaluate(
|
||||||
|
([canvas, ctx]) => {
|
||||||
|
// The document canvas is where the plot points and lines are drawn.
|
||||||
|
// The only way to access the canvas is using document (using page.evaluate)
|
||||||
|
/** @type {ImageData} */
|
||||||
|
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
|
||||||
|
/** @type {number[]} */
|
||||||
|
const imageDataValues = Object.values(data);
|
||||||
|
/** @type {PlotPixel[]} */
|
||||||
|
const plotPixels = [];
|
||||||
|
// Each pixel consists of four values within the ImageData.data array. The for loop iterates by multiples of four.
|
||||||
|
// The values associated with each pixel are R (red), G (green), B (blue), and A (alpha), in that order.
|
||||||
|
for (let i = 0; i < imageDataValues.length; ) {
|
||||||
|
if (imageDataValues[i] > 0) {
|
||||||
|
plotPixels.push({
|
||||||
|
r: imageDataValues[i],
|
||||||
|
g: imageDataValues[i + 1],
|
||||||
|
b: imageDataValues[i + 2],
|
||||||
|
a: imageDataValues[i + 3],
|
||||||
|
strValue: `rgb(${imageDataValues[i]}, ${imageDataValues[i + 1]}, ${
|
||||||
|
imageDataValues[i + 2]
|
||||||
|
}, ${imageDataValues[i + 3]})`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i = i + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.getCanvasValue(plotPixels);
|
||||||
|
},
|
||||||
|
[canvasHandle, canvasContextHandle]
|
||||||
|
);
|
||||||
|
|
||||||
|
return getTelemValuePromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} myItemsFolderName
|
||||||
|
* @param {string} url
|
||||||
|
* @param {string} newName
|
||||||
|
*/
|
||||||
|
async function renameObjectFromContextMenu(page, url, newName) {
|
||||||
|
await openObjectTreeContextMenu(page, url);
|
||||||
|
await page.click('li:text("Edit Properties")');
|
||||||
|
const nameInput = page.getByLabel('Title', { exact: true });
|
||||||
|
await nameInput.fill('');
|
||||||
|
await nameInput.fill(newName);
|
||||||
|
await page.click('[aria-label="Save"]');
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createDomainObjectWithDefaults,
|
createDomainObjectWithDefaults,
|
||||||
createNotification,
|
createExampleTelemetryObject,
|
||||||
expandTreePaneItemByName,
|
createNotification,
|
||||||
expandEntireTree,
|
createPlanFromJSON,
|
||||||
createPlanFromJSON,
|
expandEntireTree,
|
||||||
openObjectTreeContextMenu,
|
expandTreePaneItemByName,
|
||||||
getHashUrlToDomainObject,
|
getCanvasPixels,
|
||||||
getFocusedObjectUuid,
|
getHashUrlToDomainObject,
|
||||||
setFixedTimeMode,
|
getFocusedObjectUuid,
|
||||||
setRealTimeMode,
|
navigateToObjectWithFixedTimeBounds,
|
||||||
setStartOffset,
|
openObjectTreeContextMenu,
|
||||||
setEndOffset,
|
setFixedTimeMode,
|
||||||
selectInspectorTab
|
setRealTimeMode,
|
||||||
|
setStartOffset,
|
||||||
|
setEndOffset,
|
||||||
|
setTimeConductorBounds,
|
||||||
|
setIndependentTimeConductorBounds,
|
||||||
|
waitForPlotsToRender,
|
||||||
|
renameObjectFromContextMenu
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const base = require('@playwright/test');
|
const base = require('@playwright/test');
|
||||||
const { expect } = base;
|
const { expect, request } = base;
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { v4: uuid } = require('uuid');
|
const { v4: uuid } = require('uuid');
|
||||||
@ -43,9 +43,9 @@ const sinon = require('sinon');
|
|||||||
* @returns {String} formatted string with message type, text, url, and line and column numbers
|
* @returns {String} formatted string with message type, text, url, and line and column numbers
|
||||||
*/
|
*/
|
||||||
function _consoleMessageToString(msg) {
|
function _consoleMessageToString(msg) {
|
||||||
const { url, lineNumber, columnNumber } = msg.location();
|
const { url, lineNumber, columnNumber } = msg.location();
|
||||||
|
|
||||||
return `[${msg.type()}] ${msg.text()} at (${url} ${lineNumber}:${columnNumber})`;
|
return `[${msg.type()}] ${msg.text()} at (${url} ${lineNumber}:${columnNumber})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,12 +56,9 @@ function _consoleMessageToString(msg) {
|
|||||||
* @return {Promise<Animation[]>}
|
* @return {Promise<Animation[]>}
|
||||||
*/
|
*/
|
||||||
function waitForAnimations(locator) {
|
function waitForAnimations(locator) {
|
||||||
return locator
|
return locator.evaluate((element) =>
|
||||||
.evaluate((element) =>
|
Promise.all(element.getAnimations({ subtree: true }).map((animation) => animation.finished))
|
||||||
Promise.all(
|
);
|
||||||
element
|
|
||||||
.getAnimations({ subtree: true })
|
|
||||||
.map((animation) => animation.finished)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,103 +69,138 @@ function waitForAnimations(locator) {
|
|||||||
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
||||||
|
|
||||||
exports.test = base.test.extend({
|
exports.test = base.test.extend({
|
||||||
/**
|
/**
|
||||||
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
|
* This allows the test to manipulate the browser clock. This is useful for Visual and Snapshot tests which need
|
||||||
* the Time Indicator Clock to be in a specific state.
|
* the Time Indicator Clock to be in a specific state.
|
||||||
* Usage:
|
*
|
||||||
* ```
|
* Warning: Has many limitations and secondary side effects in Open MCT.
|
||||||
* test.use({
|
* 1. The tree component does not render.
|
||||||
* clockOptions: {
|
* 2. page.WaitForNavigation does not trigger.
|
||||||
* now: 0,
|
*
|
||||||
* shouldAdvanceTime: true
|
* Usage:
|
||||||
* ```
|
* ```js
|
||||||
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
* test.use({
|
||||||
*
|
* clockOptions: {
|
||||||
* Default: `undefined`
|
* now: MISSION_TIME,
|
||||||
*
|
* shouldAdvanceTime: true
|
||||||
* @see {@link https://github.com/microsoft/playwright/issues/6347 Github RFE}
|
* ```
|
||||||
* @see {@link https://github.com/sinonjs/fake-timers/#var-clock--faketimersinstallconfig SinonJS FakeTimers Config}
|
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
||||||
*/
|
*
|
||||||
clockOptions: [undefined, { option: true }],
|
* Default: `undefined`
|
||||||
overrideClock: [async ({ context, clockOptions }, use) => {
|
*
|
||||||
if (clockOptions !== undefined) {
|
* @see {@link https://github.com/microsoft/playwright/issues/6347 Github RFE}
|
||||||
await context.addInitScript({
|
* @see {@link https://github.com/sinonjs/fake-timers/#var-clock--faketimersinstallconfig SinonJS FakeTimers Config}
|
||||||
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js')
|
* @type {import('@types/sinonjs__fake-timers').FakeTimerInstallOpts}
|
||||||
});
|
*/
|
||||||
await context.addInitScript((options) => {
|
clockOptions: [undefined, { option: true }],
|
||||||
window.__clock = sinon.useFakeTimers(options);
|
overrideClock: [
|
||||||
}, clockOptions);
|
async ({ context, clockOptions }, use) => {
|
||||||
}
|
if (clockOptions !== undefined) {
|
||||||
|
await context.addInitScript({
|
||||||
await use(context);
|
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js')
|
||||||
}, {
|
|
||||||
auto: true,
|
|
||||||
scope: 'test'
|
|
||||||
}],
|
|
||||||
/**
|
|
||||||
* Extends the base context class to add codecoverage shim.
|
|
||||||
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
|
||||||
*/
|
|
||||||
context: async ({ context }, use) => {
|
|
||||||
await context.addInitScript(() =>
|
|
||||||
window.addEventListener('beforeunload', () =>
|
|
||||||
(window).collectIstanbulCoverage(JSON.stringify((window).__coverage__))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
|
|
||||||
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
|
|
||||||
if (coverageJSON) {
|
|
||||||
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${uuid()}.json`), coverageJSON);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
await context.addInitScript((options) => {
|
||||||
|
window.__clock = sinon.useFakeTimers(options);
|
||||||
|
}, clockOptions);
|
||||||
|
}
|
||||||
|
|
||||||
await use(context);
|
await use(context);
|
||||||
for (const page of context.pages()) {
|
|
||||||
await page.evaluate(() => (window).collectIstanbulCoverage(JSON.stringify((window).__coverage__)));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/**
|
{
|
||||||
* If true, will assert against any console.error calls that occur during the test. Assertions occur
|
auto: true,
|
||||||
* during test teardown (after the test has completed).
|
scope: 'test'
|
||||||
*
|
|
||||||
* Default: `true`
|
|
||||||
*/
|
|
||||||
failOnConsoleError: [true, { option: true }],
|
|
||||||
/**
|
|
||||||
* Extends the base page class to enable console log error detection.
|
|
||||||
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
|
||||||
*/
|
|
||||||
page: async ({ page, failOnConsoleError }, use) => {
|
|
||||||
// Capture any console errors during test execution
|
|
||||||
const messages = [];
|
|
||||||
page.on('console', (msg) => messages.push(msg));
|
|
||||||
|
|
||||||
await use(page);
|
|
||||||
|
|
||||||
// Assert against console errors during teardown
|
|
||||||
if (failOnConsoleError) {
|
|
||||||
messages.forEach(
|
|
||||||
msg => expect.soft(msg.type(), `Console error detected: ${_consoleMessageToString(msg)}`).not.toEqual('error')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Extends the base browser class to enable CDP connection definition in playwright.config.js. Once
|
|
||||||
* that RFE is implemented, this function can be removed.
|
|
||||||
* @see {@link https://github.com/microsoft/playwright/issues/8379 Github RFE}
|
|
||||||
*/
|
|
||||||
browser: async ({ playwright, browser }, use, workerInfo) => {
|
|
||||||
// Use browserless if configured
|
|
||||||
if (workerInfo.project.name.match(/browserless/)) {
|
|
||||||
const vBrowser = await playwright.chromium.connectOverCDP({
|
|
||||||
endpointURL: 'ws://localhost:3003'
|
|
||||||
});
|
|
||||||
await use(vBrowser);
|
|
||||||
} else {
|
|
||||||
// Use Local Browser for testing.
|
|
||||||
await use(browser);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
/**
|
||||||
|
* Extends the base context class to add codecoverage shim.
|
||||||
|
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
||||||
|
*/
|
||||||
|
context: async ({ context }, use) => {
|
||||||
|
await context.addInitScript(() =>
|
||||||
|
window.addEventListener('beforeunload', () =>
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
|
||||||
|
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
|
||||||
|
if (coverageJSON) {
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(istanbulCLIOutput, `playwright_coverage_${uuid()}.json`),
|
||||||
|
coverageJSON
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await use(context);
|
||||||
|
for (const page of context.pages()) {
|
||||||
|
await page.evaluate(() =>
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* If true, will assert against any console.error calls that occur during the test. Assertions occur
|
||||||
|
* during test teardown (after the test has completed).
|
||||||
|
*
|
||||||
|
* Default: `true`
|
||||||
|
*/
|
||||||
|
failOnConsoleError: [true, { option: true }],
|
||||||
|
/**
|
||||||
|
* Extends the base page class to enable console log error detection.
|
||||||
|
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
||||||
|
*/
|
||||||
|
page: async ({ page, failOnConsoleError, clockOptions }, use) => {
|
||||||
|
// If overriding the clock, we must also override the Date.now()
|
||||||
|
// function in the generatorWorker context. This is necessary
|
||||||
|
// to ensure that example telemetry data is generated for the new clock time.
|
||||||
|
if (clockOptions?.now !== undefined) {
|
||||||
|
page.on(
|
||||||
|
'worker',
|
||||||
|
(worker) => {
|
||||||
|
if (worker.url().includes('generatorWorker')) {
|
||||||
|
worker.evaluate((time) => {
|
||||||
|
self.Date.now = () => time;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
clockOptions.now
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Capture any console errors during test execution
|
||||||
|
const messages = [];
|
||||||
|
page.on('console', (msg) => messages.push(msg));
|
||||||
|
|
||||||
|
await use(page);
|
||||||
|
|
||||||
|
// Assert against console errors during teardown
|
||||||
|
if (failOnConsoleError) {
|
||||||
|
messages.forEach((msg) =>
|
||||||
|
expect
|
||||||
|
.soft(msg.type(), `Console error detected: ${_consoleMessageToString(msg)}`)
|
||||||
|
.not.toEqual('error')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Extends the base browser class to enable CDP connection definition in playwright.config.js. Once
|
||||||
|
* that RFE is implemented, this function can be removed.
|
||||||
|
* @see {@link https://github.com/microsoft/playwright/issues/8379 Github RFE}
|
||||||
|
*/
|
||||||
|
browser: async ({ playwright, browser }, use, workerInfo) => {
|
||||||
|
// Use browserless if configured
|
||||||
|
if (workerInfo.project.name.match(/browserless/)) {
|
||||||
|
const vBrowser = await playwright.chromium.connectOverCDP({
|
||||||
|
endpointURL: 'ws://localhost:3003'
|
||||||
|
});
|
||||||
|
await use(vBrowser);
|
||||||
|
} else {
|
||||||
|
// Use Local Browser for testing.
|
||||||
|
await use(browser);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.expect = expect;
|
exports.expect = expect;
|
||||||
|
exports.request = request;
|
||||||
exports.waitForAnimations = waitForAnimations;
|
exports.waitForAnimations = waitForAnimations;
|
||||||
|
18
e2e/constants.js
Normal file
18
e2e/constants.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* eslint-disable prettier/prettier */
|
||||||
|
/**
|
||||||
|
* Constants which may be used across all e2e tests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time Constants
|
||||||
|
* - Used for overriding the browser clock in tests.
|
||||||
|
*/
|
||||||
|
export const MISSION_TIME = 1732413600000; // Saturday, November 23, 2024 6:00:00 PM GMT-08:00 (Thanksgiving Dinner Time)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL Constants
|
||||||
|
* - This is the URL that the browser will be directed to when running visual tests. This URL
|
||||||
|
* - hides the tree and inspector to prevent visual noise
|
||||||
|
* - sets the time bounds to a fixed range
|
||||||
|
*/
|
||||||
|
export const VISUAL_URL = './#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
|
@ -23,6 +23,6 @@
|
|||||||
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
openmct.install(openmct.plugins.example.ExampleFaultSource());
|
||||||
});
|
});
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
const staticFaults = true;
|
const staticFaults = true;
|
||||||
|
|
||||||
openmct.install(openmct.plugins.example.ExampleFaultSource(staticFaults));
|
openmct.install(openmct.plugins.example.ExampleFaultSource(staticFaults));
|
||||||
});
|
});
|
||||||
|
@ -22,6 +22,6 @@
|
|||||||
|
|
||||||
// This should be used to install the Example User
|
// This should be used to install the Example User
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.example.ExampleUser());
|
openmct.install(openmct.plugins.example.ExampleUser());
|
||||||
});
|
});
|
||||||
|
@ -23,6 +23,6 @@
|
|||||||
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
// This should be used to install the Example Fault Provider, this will also install the FaultManagementPlugin (neither of which are installed by default).
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.FaultManagement());
|
openmct.install(openmct.plugins.FaultManagement());
|
||||||
});
|
});
|
||||||
|
@ -1,76 +1,71 @@
|
|||||||
class DomainObjectViewProvider {
|
class DomainObjectViewProvider {
|
||||||
constructor(openmct) {
|
constructor(openmct) {
|
||||||
this.key = 'doViewProvider';
|
this.key = 'doViewProvider';
|
||||||
this.name = 'Domain Object View Provider';
|
this.name = 'Domain Object View Provider';
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
}
|
}
|
||||||
|
|
||||||
canView(domainObject) {
|
canView(domainObject) {
|
||||||
return domainObject.type === 'imageFileInput'
|
return domainObject.type === 'imageFileInput' || domainObject.type === 'jsonFileInput';
|
||||||
|| domainObject.type === 'jsonFileInput';
|
}
|
||||||
}
|
|
||||||
|
|
||||||
view(domainObject, objectPath) {
|
view(domainObject, objectPath) {
|
||||||
let content;
|
let content;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: function (element) {
|
show: function (element) {
|
||||||
const body = domainObject.selectFile.body;
|
const body = domainObject.selectFile.body;
|
||||||
const type = typeof body;
|
const type = typeof body;
|
||||||
|
|
||||||
content = document.createElement('div');
|
content = document.createElement('div');
|
||||||
content.id = 'file-input-type';
|
content.id = 'file-input-type';
|
||||||
content.textContent = JSON.stringify(type);
|
content.textContent = JSON.stringify(type);
|
||||||
element.appendChild(content);
|
element.appendChild(content);
|
||||||
},
|
},
|
||||||
destroy: function (element) {
|
destroy: function (element) {
|
||||||
element.removeChild(content);
|
element.removeChild(content);
|
||||||
content = undefined;
|
content = undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
|
|
||||||
openmct.types.addType('jsonFileInput', {
|
openmct.types.addType('jsonFileInput', {
|
||||||
key: 'jsonFileInput',
|
key: 'jsonFileInput',
|
||||||
name: "JSON File Input Object",
|
name: 'JSON File Input Object',
|
||||||
creatable: true,
|
creatable: true,
|
||||||
form: [
|
form: [
|
||||||
{
|
{
|
||||||
name: 'Upload File',
|
name: 'Upload File',
|
||||||
key: 'selectFile',
|
key: 'selectFile',
|
||||||
control: 'file-input',
|
control: 'file-input',
|
||||||
required: true,
|
required: true,
|
||||||
text: 'Select File...',
|
text: 'Select File...',
|
||||||
type: 'application/json',
|
type: 'application/json',
|
||||||
property: [
|
property: ['selectFile']
|
||||||
"selectFile"
|
}
|
||||||
]
|
]
|
||||||
}
|
});
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
openmct.types.addType('imageFileInput', {
|
openmct.types.addType('imageFileInput', {
|
||||||
key: 'imageFileInput',
|
key: 'imageFileInput',
|
||||||
name: "Image File Input Object",
|
name: 'Image File Input Object',
|
||||||
creatable: true,
|
creatable: true,
|
||||||
form: [
|
form: [
|
||||||
{
|
{
|
||||||
name: 'Upload File',
|
name: 'Upload File',
|
||||||
key: 'selectFile',
|
key: 'selectFile',
|
||||||
control: 'file-input',
|
control: 'file-input',
|
||||||
required: true,
|
required: true,
|
||||||
text: 'Select File...',
|
text: 'Select File...',
|
||||||
type: 'image/*',
|
type: 'image/*',
|
||||||
property: [
|
property: ['selectFile']
|
||||||
"selectFile"
|
}
|
||||||
]
|
]
|
||||||
}
|
});
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
|
openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
|
||||||
});
|
});
|
||||||
|
@ -27,6 +27,6 @@ const NOTEBOOK_NAME = 'Notebook';
|
|||||||
const URL_WHITELIST = ['google.com'];
|
const URL_WHITELIST = ['google.com'];
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
|
openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
|
||||||
});
|
});
|
||||||
|
@ -22,6 +22,6 @@
|
|||||||
|
|
||||||
// This should be used to install the Operator Status
|
// This should be used to install the Operator Status
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.OperatorStatus());
|
openmct.install(openmct.plugins.OperatorStatus());
|
||||||
});
|
});
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
// await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.RestrictedNotebook('CUSTOM_NAME'));
|
openmct.install(openmct.plugins.RestrictedNotebook('CUSTOM_NAME'));
|
||||||
});
|
});
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
(function () {
|
(function () {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const PERSISTENCE_KEY = 'persistence-tests';
|
const PERSISTENCE_KEY = 'persistence-tests';
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
|
|
||||||
openmct.objects.addRoot({
|
openmct.objects.addRoot({
|
||||||
namespace: PERSISTENCE_KEY,
|
namespace: PERSISTENCE_KEY,
|
||||||
key: PERSISTENCE_KEY
|
key: PERSISTENCE_KEY
|
||||||
});
|
|
||||||
|
|
||||||
openmct.objects.addProvider(PERSISTENCE_KEY, {
|
|
||||||
get(identifier) {
|
|
||||||
if (identifier.key !== PERSISTENCE_KEY) {
|
|
||||||
return undefined;
|
|
||||||
} else {
|
|
||||||
return Promise.resolve({
|
|
||||||
identifier,
|
|
||||||
type: 'folder',
|
|
||||||
name: 'Persistence Testing',
|
|
||||||
location: 'ROOT',
|
|
||||||
composition: []
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}());
|
|
||||||
|
openmct.objects.addProvider(PERSISTENCE_KEY, {
|
||||||
|
get(identifier) {
|
||||||
|
if (identifier.key !== PERSISTENCE_KEY) {
|
||||||
|
return undefined;
|
||||||
|
} else {
|
||||||
|
return Promise.resolve({
|
||||||
|
identifier,
|
||||||
|
type: 'folder',
|
||||||
|
name: 'Persistence Testing',
|
||||||
|
location: 'ROOT',
|
||||||
|
composition: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
@ -19,259 +19,275 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultManagementWithExample(page) {
|
async function navigateToFaultManagementWithExample(page) {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultManagementWithStaticExample(page) {
|
async function navigateToFaultManagementWithStaticExample(page) {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js') });
|
path: path.join(__dirname, './', 'addInitExampleFaultProviderStatic.js')
|
||||||
|
});
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultManagementWithoutExample(page) {
|
async function navigateToFaultManagementWithoutExample(page) {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function navigateToFaultItemInTree(page) {
|
async function navigateToFaultItemInTree(page) {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
// Click text=Fault Management
|
const faultManagementTreeItem = page
|
||||||
await page.click('text=Fault Management'); // this verifies the plugin has been added
|
.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
})
|
||||||
|
.getByRole('treeitem', {
|
||||||
|
name: 'Fault Management'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Navigate to "Fault Management" from the tree
|
||||||
|
await faultManagementTreeItem.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function acknowledgeFault(page, rowNumber) {
|
async function acknowledgeFault(page, rowNumber) {
|
||||||
await openFaultRowMenu(page, rowNumber);
|
await openFaultRowMenu(page, rowNumber);
|
||||||
await page.locator('.c-menu >> text="Acknowledge"').click();
|
await page.locator('.c-menu >> text="Acknowledge"').click();
|
||||||
// Click [aria-label="Save"]
|
// Click [aria-label="Save"]
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function shelveMultipleFaults(page, ...nums) {
|
async function shelveMultipleFaults(page, ...nums) {
|
||||||
const selectRows = nums.map((num) => {
|
const selectRows = nums.map((num) => {
|
||||||
return selectFaultItem(page, num);
|
return selectFaultItem(page, num);
|
||||||
});
|
});
|
||||||
await Promise.all(selectRows);
|
await Promise.all(selectRows);
|
||||||
|
|
||||||
await page.locator('button:has-text("Shelve")').click();
|
await page.locator('button:has-text("Shelve")').click();
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function acknowledgeMultipleFaults(page, ...nums) {
|
async function acknowledgeMultipleFaults(page, ...nums) {
|
||||||
const selectRows = nums.map((num) => {
|
const selectRows = nums.map((num) => {
|
||||||
return selectFaultItem(page, num);
|
return selectFaultItem(page, num);
|
||||||
});
|
});
|
||||||
await Promise.all(selectRows);
|
await Promise.all(selectRows);
|
||||||
|
|
||||||
await page.locator('button:has-text("Acknowledge")').click();
|
await page.locator('button:has-text("Acknowledge")').click();
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function shelveFault(page, rowNumber) {
|
async function shelveFault(page, rowNumber) {
|
||||||
await openFaultRowMenu(page, rowNumber);
|
await openFaultRowMenu(page, rowNumber);
|
||||||
await page.locator('.c-menu >> text="Shelve"').click();
|
await page.locator('.c-menu >> text="Shelve"').click();
|
||||||
// Click [aria-label="Save"]
|
// Click [aria-label="Save"]
|
||||||
await page.locator('[aria-label="Save"]').click();
|
await page.locator('[aria-label="Save"]').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function changeViewTo(page, view) {
|
async function changeViewTo(page, view) {
|
||||||
await page.locator('.c-fault-mgmt__search-row select').first().selectOption(view);
|
await page.locator('.c-fault-mgmt__search-row select').first().selectOption(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function sortFaultsBy(page, sort) {
|
async function sortFaultsBy(page, sort) {
|
||||||
await page.locator('.c-fault-mgmt__list-header-sortButton select').selectOption(sort);
|
await page.locator('.c-fault-mgmt__list-header-sortButton select').selectOption(sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function enterSearchTerm(page, term) {
|
async function enterSearchTerm(page, term) {
|
||||||
await page.locator('.c-fault-mgmt-search [aria-label="Search Input"]').fill(term);
|
await page.locator('.c-fault-mgmt-search [aria-label="Search Input"]').fill(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function clearSearch(page) {
|
async function clearSearch(page) {
|
||||||
await enterSearchTerm(page, '');
|
await enterSearchTerm(page, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function selectFaultItem(page, rowNumber) {
|
async function selectFaultItem(page, rowNumber) {
|
||||||
// eslint-disable-next-line playwright/no-force-option
|
await page.locator(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`).check();
|
||||||
await page.check(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`, { force: true }); // this will not work without force true, saw this may be a pw bug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getHighestSeverity(page) {
|
async function getHighestSeverity(page) {
|
||||||
const criticalCount = await page.locator('[title=CRITICAL]').count();
|
const criticalCount = await page.locator('[title=CRITICAL]').count();
|
||||||
const warningCount = await page.locator('[title=WARNING]').count();
|
const warningCount = await page.locator('[title=WARNING]').count();
|
||||||
|
|
||||||
if (criticalCount > 0) {
|
if (criticalCount > 0) {
|
||||||
return 'CRITICAL';
|
return 'CRITICAL';
|
||||||
} else if (warningCount > 0) {
|
} else if (warningCount > 0) {
|
||||||
return 'WARNING';
|
return 'WARNING';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'WATCH';
|
return 'WATCH';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getLowestSeverity(page) {
|
async function getLowestSeverity(page) {
|
||||||
const warningCount = await page.locator('[title=WARNING]').count();
|
const warningCount = await page.locator('[title=WARNING]').count();
|
||||||
const watchCount = await page.locator('[title=WATCH]').count();
|
const watchCount = await page.locator('[title=WATCH]').count();
|
||||||
|
|
||||||
if (watchCount > 0) {
|
if (watchCount > 0) {
|
||||||
return 'WATCH';
|
return 'WATCH';
|
||||||
} else if (warningCount > 0) {
|
} else if (warningCount > 0) {
|
||||||
return 'WARNING';
|
return 'WARNING';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'CRITICAL';
|
return 'CRITICAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultResultCount(page) {
|
async function getFaultResultCount(page) {
|
||||||
const count = await page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').count();
|
const count = await page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').count();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
function getFault(page, rowNumber) {
|
function getFault(page, rowNumber) {
|
||||||
const fault = page.locator(`.c-faults-list-view-item-body > .c-fault-mgmt__list >> nth=${rowNumber - 1}`);
|
const fault = page.locator(
|
||||||
|
`.c-faults-list-view-item-body > .c-fault-mgmt__list >> nth=${rowNumber - 1}`
|
||||||
|
);
|
||||||
|
|
||||||
return fault;
|
return fault;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
function getFaultByName(page, name) {
|
function getFaultByName(page, name) {
|
||||||
const fault = page.locator(`.c-fault-mgmt__list-faultname:has-text("${name}")`);
|
const fault = page.locator(`.c-fault-mgmt__list-faultname:has-text("${name}")`);
|
||||||
|
|
||||||
return fault;
|
return fault;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultName(page, rowNumber) {
|
async function getFaultName(page, rowNumber) {
|
||||||
const faultName = await page.locator(`.c-fault-mgmt__list-faultname >> nth=${rowNumber - 1}`).textContent();
|
const faultName = await page
|
||||||
|
.locator(`.c-fault-mgmt__list-faultname >> nth=${rowNumber - 1}`)
|
||||||
|
.textContent();
|
||||||
|
|
||||||
return faultName;
|
return faultName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultSeverity(page, rowNumber) {
|
async function getFaultSeverity(page, rowNumber) {
|
||||||
const faultSeverity = await page.locator(`.c-faults-list-view-item-body .c-fault-mgmt__list-severity >> nth=${rowNumber - 1}`).getAttribute('title');
|
const faultSeverity = await page
|
||||||
|
.locator(`.c-faults-list-view-item-body .c-fault-mgmt__list-severity >> nth=${rowNumber - 1}`)
|
||||||
|
.getAttribute('title');
|
||||||
|
|
||||||
return faultSeverity;
|
return faultSeverity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultNamespace(page, rowNumber) {
|
async function getFaultNamespace(page, rowNumber) {
|
||||||
const faultNamespace = await page.locator(`.c-fault-mgmt__list-path >> nth=${rowNumber - 1}`).textContent();
|
const faultNamespace = await page
|
||||||
|
.locator(`.c-fault-mgmt__list-path >> nth=${rowNumber - 1}`)
|
||||||
|
.textContent();
|
||||||
|
|
||||||
return faultNamespace;
|
return faultNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function getFaultTriggerTime(page, rowNumber) {
|
async function getFaultTriggerTime(page, rowNumber) {
|
||||||
const faultTriggerTime = await page.locator(`.c-fault-mgmt__list-trigTime >> nth=${rowNumber - 1} >> .c-fault-mgmt-item__value`).textContent();
|
const faultTriggerTime = await page
|
||||||
|
.locator(`.c-fault-mgmt__list-trigTime >> nth=${rowNumber - 1} >> .c-fault-mgmt-item__value`)
|
||||||
|
.textContent();
|
||||||
|
|
||||||
return faultTriggerTime.toString().trim();
|
return faultTriggerTime.toString().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function openFaultRowMenu(page, rowNumber) {
|
async function openFaultRowMenu(page, rowNumber) {
|
||||||
// select
|
// select
|
||||||
await page.locator(`.c-fault-mgmt-item > .c-fault-mgmt__list-action-button >> nth=${rowNumber - 1}`).click();
|
await page
|
||||||
|
.locator(`.c-fault-mgmt-item > .c-fault-mgmt__list-action-button >> nth=${rowNumber - 1}`)
|
||||||
|
.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
module.exports = {
|
||||||
navigateToFaultManagementWithExample,
|
navigateToFaultManagementWithExample,
|
||||||
navigateToFaultManagementWithStaticExample,
|
navigateToFaultManagementWithStaticExample,
|
||||||
navigateToFaultManagementWithoutExample,
|
navigateToFaultManagementWithoutExample,
|
||||||
navigateToFaultItemInTree,
|
navigateToFaultItemInTree,
|
||||||
acknowledgeFault,
|
acknowledgeFault,
|
||||||
shelveMultipleFaults,
|
shelveMultipleFaults,
|
||||||
acknowledgeMultipleFaults,
|
acknowledgeMultipleFaults,
|
||||||
shelveFault,
|
shelveFault,
|
||||||
changeViewTo,
|
changeViewTo,
|
||||||
sortFaultsBy,
|
sortFaultsBy,
|
||||||
enterSearchTerm,
|
enterSearchTerm,
|
||||||
clearSearch,
|
clearSearch,
|
||||||
selectFaultItem,
|
selectFaultItem,
|
||||||
getHighestSeverity,
|
getHighestSeverity,
|
||||||
getLowestSeverity,
|
getLowestSeverity,
|
||||||
getFaultResultCount,
|
getFaultResultCount,
|
||||||
getFault,
|
getFault,
|
||||||
getFaultByName,
|
getFaultByName,
|
||||||
getFaultName,
|
getFaultName,
|
||||||
getFaultSeverity,
|
getFaultSeverity,
|
||||||
getFaultNamespace,
|
getFaultNamespace,
|
||||||
getFaultTriggerTime,
|
getFaultTriggerTime,
|
||||||
openFaultRowMenu
|
openFaultRowMenu
|
||||||
};
|
};
|
||||||
|
@ -23,34 +23,36 @@
|
|||||||
const { createDomainObjectWithDefaults } = require('../appActions');
|
const { createDomainObjectWithDefaults } = require('../appActions');
|
||||||
|
|
||||||
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
||||||
|
const CUSTOM_NAME = 'CUSTOM_NAME';
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function enterTextEntry(page, text) {
|
async function enterTextEntry(page, text) {
|
||||||
// Click .c-notebook__drag-area
|
// Click the 'Add Notebook Entry' area
|
||||||
await page.locator(NOTEBOOK_DROP_AREA).click();
|
await page.locator(NOTEBOOK_DROP_AREA).click();
|
||||||
|
|
||||||
// enter text
|
// enter text
|
||||||
await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').fill(text);
|
await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').fill(text);
|
||||||
await commitEntry(page);
|
await commitEntry(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function dragAndDropEmbed(page, notebookObject) {
|
async function dragAndDropEmbed(page, notebookObject) {
|
||||||
// Create example telemetry object
|
// Create example telemetry object
|
||||||
const swg = await createDomainObjectWithDefaults(page, {
|
const swg = await createDomainObjectWithDefaults(page, {
|
||||||
type: "Sine Wave Generator"
|
type: 'Sine Wave Generator'
|
||||||
});
|
});
|
||||||
// Navigate to notebook
|
// Navigate to notebook
|
||||||
await page.goto(notebookObject.url);
|
await page.goto(notebookObject.url);
|
||||||
// Expand the tree to reveal the notebook
|
// Expand the tree to reveal the notebook
|
||||||
await page.click('button[title="Show selected item in tree"]');
|
await page.click('button[title="Show selected item in tree"]');
|
||||||
// Drag and drop the SWG into the notebook
|
// Drag and drop the SWG into the notebook
|
||||||
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
||||||
await commitEntry(page);
|
await commitEntry(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,11 +60,90 @@ async function dragAndDropEmbed(page, notebookObject) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function commitEntry(page) {
|
async function commitEntry(page) {
|
||||||
await page.locator('.c-ne__save-button > button').click();
|
//Click the Commit Entry button
|
||||||
|
await page.locator('.c-ne__save-button > button').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function startAndAddRestrictedNotebookObject(page) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
await page.addInitScript({ path: path.join(__dirname, 'addInitRestrictedNotebook.js') });
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
return createDomainObjectWithDefaults(page, {
|
||||||
|
type: CUSTOM_NAME,
|
||||||
|
name: 'Restricted Test Notebook'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function lockPage(page) {
|
||||||
|
const commitButton = page.locator('button:has-text("Commit Entries")');
|
||||||
|
await commitButton.click();
|
||||||
|
|
||||||
|
//Wait until Lock Banner is visible
|
||||||
|
await page.locator('text=Lock Page').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object and adds an entry.
|
||||||
|
* @param {import('@playwright/test').Page} - page to load
|
||||||
|
* @param {number} [iterations = 1] - the number of entries to create
|
||||||
|
*/
|
||||||
|
async function createNotebookAndEntry(page, iterations = 1) {
|
||||||
|
const notebook = createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
await enterTextEntry(page, `Entry ${iteration}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object, adds an entry, and adds a tag.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {number} [iterations = 1] - the number of entries (and tags) to create
|
||||||
|
*/
|
||||||
|
async function createNotebookEntryAndTags(page, iterations = 1) {
|
||||||
|
const notebook = await createNotebookAndEntry(page, iterations);
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.locator(`[aria-label="Notebook Entry"] >> nth = ${iteration}`).click();
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Driving" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
||||||
|
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Science" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
module.exports = {
|
||||||
enterTextEntry,
|
enterTextEntry,
|
||||||
dragAndDropEmbed
|
dragAndDropEmbed,
|
||||||
|
startAndAddRestrictedNotebookObject,
|
||||||
|
lockPage,
|
||||||
|
createNotebookEntryAndTags,
|
||||||
|
createNotebookAndEntry
|
||||||
};
|
};
|
||||||
|
@ -32,46 +32,53 @@ import { expect } from '../pluginFixtures';
|
|||||||
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||||
*/
|
*/
|
||||||
export async function assertPlanActivities(page, plan, objectUrl) {
|
export async function assertPlanActivities(page, plan, objectUrl) {
|
||||||
const groups = Object.keys(plan);
|
const groups = Object.keys(plan);
|
||||||
for (const group of groups) {
|
for (const group of groups) {
|
||||||
for (let i = 0; i < plan[group].length; i++) {
|
for (let i = 0; i < plan[group].length; i++) {
|
||||||
// Set the startBound to the start time of the first activity in the group
|
// Set the startBound to the start time of the first activity in the group
|
||||||
const startBound = plan[group][0].start;
|
const startBound = plan[group][0].start;
|
||||||
// Set the endBound to the end time of the current activity
|
// Set the endBound to the end time of the current activity
|
||||||
let endBound = plan[group][i].end;
|
let endBound = plan[group][i].end;
|
||||||
if (endBound === startBound) {
|
if (endBound === startBound) {
|
||||||
// Prevent oddities with setting start and end bound equal
|
// Prevent oddities with setting start and end bound equal
|
||||||
// via URL params
|
// via URL params
|
||||||
endBound += 1;
|
endBound += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch to fixed time mode with all plan events within the bounds
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
await page.goto(`${objectUrl}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`);
|
await page.goto(
|
||||||
|
`${objectUrl}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
|
||||||
// Assert that the number of activities in the plan view matches the number of
|
// Assert that the number of activities in the plan view matches the number of
|
||||||
// activities in the plan data within the specified time bounds
|
// activities in the plan data within the specified time bounds
|
||||||
const eventCount = await page.locator('.activity-bounds').count();
|
const eventCount = await page.locator('.activity-bounds').count();
|
||||||
expect(eventCount).toEqual(Object.values(plan)
|
expect(eventCount).toEqual(
|
||||||
.flat()
|
Object.values(plan)
|
||||||
.filter(event =>
|
.flat()
|
||||||
activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)).length);
|
.filter((event) =>
|
||||||
}
|
activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)
|
||||||
|
).length
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the activities time bounds overlap, false otherwise.
|
* Returns true if the activities time bounds overlap, false otherwise.
|
||||||
* @param {number} start1 the start time of the first activity
|
* @param {number} start1 the start time of the first activity
|
||||||
* @param {number} end1 the end time of the first activity
|
* @param {number} end1 the end time of the first activity
|
||||||
* @param {number} start2 the start time of the second activity
|
* @param {number} start2 the start time of the second activity
|
||||||
* @param {number} end2 the end time of the second activity
|
* @param {number} end2 the end time of the second activity
|
||||||
* @returns {boolean} true if the activities overlap, false otherwise
|
* @returns {boolean} true if the activities overlap, false otherwise
|
||||||
*/
|
*/
|
||||||
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
||||||
return (start1 >= start2 && start1 <= end2)
|
return (
|
||||||
|| (end1 >= start2 && end1 <= end2)
|
(start1 >= start2 && start1 <= end2) ||
|
||||||
|| (start2 >= start1 && start2 <= end1)
|
(end1 >= start2 && end1 <= end2) ||
|
||||||
|| (end2 >= start1 && end2 <= end1);
|
(start2 >= start1 && start2 <= end1) ||
|
||||||
|
(end2 >= start1 && end2 <= end1)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,11 +89,24 @@ function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
|||||||
* @param {string} planObjectUrl
|
* @param {string} planObjectUrl
|
||||||
*/
|
*/
|
||||||
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
||||||
const activities = Object.values(planJson).flat();
|
const activities = Object.values(planJson).flat();
|
||||||
// Get the earliest start value
|
// Get the earliest start value
|
||||||
const start = Math.min(...activities.map(activity => activity.start));
|
const start = Math.min(...activities.map((activity) => activity.start));
|
||||||
// Get the latest end value
|
// Get the latest end value
|
||||||
const end = Math.max(...activities.map(activity => activity.end));
|
const end = Math.max(...activities.map((activity) => activity.end));
|
||||||
// Set the start and end bounds to the earliest start and latest end
|
// Set the start and end bounds to the earliest start and latest end
|
||||||
await page.goto(`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`);
|
await page.goto(
|
||||||
|
`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the Open MCT API to set the status of a plan to 'draft'.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {import('../../appActions').CreatedObjectInfo} plan
|
||||||
|
*/
|
||||||
|
export async function setDraftStatusForPlan(page, plan) {
|
||||||
|
await page.evaluate(async (planObject) => {
|
||||||
|
await window.openmct.status.set(planObject.uuid, 'draft');
|
||||||
|
}, plan);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,6 @@
|
|||||||
// await page.addInitScript({ path: path.join(__dirname, 'useSnowTheme.js') });
|
// await page.addInitScript({ path: path.join(__dirname, 'useSnowTheme.js') });
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const openmct = window.openmct;
|
const openmct = window.openmct;
|
||||||
openmct.install(openmct.plugins.Snow());
|
openmct.install(openmct.plugins.Snow());
|
||||||
});
|
});
|
||||||
|
@ -9,73 +9,76 @@ const NUM_WORKERS = 2;
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with maxFailures = 5, this should ensure that flake is managed without failing the full suite
|
retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
|
||||||
testDir: 'tests',
|
testDir: 'tests',
|
||||||
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
||||||
timeout: 60 * 1000,
|
timeout: 60 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start:coverage',
|
command: 'npm run start:coverage',
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: false
|
reuseExistingServer: false
|
||||||
|
},
|
||||||
|
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
||||||
|
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
{
|
||||||
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
name: 'MMOC',
|
||||||
use: {
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
baseURL: 'http://localhost:8080/',
|
grepInvert: /@snapshot/,
|
||||||
headless: true,
|
use: {
|
||||||
ignoreHTTPSErrors: true,
|
browserName: 'chromium',
|
||||||
screenshot: 'only-on-failure',
|
viewport: {
|
||||||
trace: 'on-first-retry',
|
width: 2560,
|
||||||
video: 'off'
|
height: 1440
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'MMOC',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
viewport: {
|
|
||||||
width: 2560,
|
|
||||||
height: 1440
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'firefox',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'firefox'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chrome-beta', //Only Chrome Beta is available on ubuntu -- not chrome canary
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
channel: 'chrome-beta'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'firefox'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome-beta', //Only Chrome Beta is available on ubuntu -- not chrome canary
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
channel: 'chrome-beta'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'never',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
],
|
],
|
||||||
reporter: [
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
['list'],
|
['@deploysentinel/playwright']
|
||||||
['html', {
|
]
|
||||||
open: 'never',
|
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
|
||||||
}],
|
|
||||||
['junit', { outputFile: '../test-results/results.xml' }],
|
|
||||||
['github']
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -7,98 +7,101 @@ const { devices } = require('@playwright/test');
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 0,
|
retries: 0,
|
||||||
testDir: 'tests',
|
testDir: 'tests',
|
||||||
testIgnore: '**/*.perf.spec.js',
|
testIgnore: '**/*.perf.spec.js',
|
||||||
timeout: 30 * 1000,
|
timeout: 30 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start:coverage',
|
command: 'npm run start:coverage',
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: true
|
reuseExistingServer: true
|
||||||
|
},
|
||||||
|
workers: 1,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: false,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'retain-on-failure',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
workers: 1,
|
{
|
||||||
use: {
|
name: 'MMOC',
|
||||||
browserName: "chromium",
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
baseURL: 'http://localhost:8080/',
|
grepInvert: /@snapshot/,
|
||||||
headless: false,
|
use: {
|
||||||
ignoreHTTPSErrors: true,
|
browserName: 'chromium',
|
||||||
screenshot: 'only-on-failure',
|
viewport: {
|
||||||
trace: 'retain-on-failure',
|
width: 2560,
|
||||||
video: 'off'
|
height: 1440
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'MMOC',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
viewport: {
|
|
||||||
width: 2560,
|
|
||||||
height: 1440
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'safari',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grep: /@ipad/, // only run ipad tests due to this bug https://github.com/microsoft/playwright/issues/8340
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'webkit'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'firefox',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'firefox'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'canary',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
channel: 'chrome-canary' //Note this is not available in ubuntu/CircleCI
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chrome-beta',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
channel: 'chrome-beta'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ipad',
|
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grep: /@ipad/,
|
|
||||||
grepInvert: /@snapshot/,
|
|
||||||
use: {
|
|
||||||
browserName: 'webkit',
|
|
||||||
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
reporter: [
|
},
|
||||||
['list'],
|
{
|
||||||
['html', {
|
name: 'safari',
|
||||||
open: 'on-failure',
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
grep: /@ipad/, // only run ipad tests due to this bug https://github.com/microsoft/playwright/issues/8340
|
||||||
}]
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'webkit'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firefox',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'firefox'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'canary',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
channel: 'chrome-canary' //Note this is not available in ubuntu/CircleCI
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome-beta',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
channel: 'chrome-beta'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ipad',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
|
grep: /@ipad/,
|
||||||
|
grepInvert: /@snapshot/,
|
||||||
|
use: {
|
||||||
|
browserName: 'webkit',
|
||||||
|
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'on-failure',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -6,38 +6,38 @@ const CI = process.env.CI === 'true';
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
|
retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
testDir: 'tests/performance/',
|
testDir: 'tests/performance/',
|
||||||
timeout: 60 * 1000,
|
timeout: 60 * 1000,
|
||||||
workers: 1, //Only run in serial with 1 worker
|
workers: 1, //Only run in serial with 1 worker
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start', //coverage not generated
|
command: 'npm run start', //coverage not generated
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: !CI
|
reuseExistingServer: !CI
|
||||||
},
|
},
|
||||||
use: {
|
use: {
|
||||||
browserName: "chromium",
|
browserName: 'chromium',
|
||||||
baseURL: 'http://localhost:8080/',
|
baseURL: 'http://localhost:8080/',
|
||||||
headless: CI, //Only if running locally
|
headless: CI, //Only if running locally
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
screenshot: 'off',
|
screenshot: 'off',
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
video: 'off'
|
video: 'off'
|
||||||
},
|
},
|
||||||
projects: [
|
projects: [
|
||||||
{
|
{
|
||||||
name: 'chrome',
|
name: 'chrome',
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium'
|
browserName: 'chromium'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
reporter: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['junit', { outputFile: '../test-results/results.xml' }],
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
['json', { outputFile: '../test-results/results.json' }]
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -4,48 +4,51 @@
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
||||||
testDir: 'tests/visual',
|
testDir: 'tests/visual',
|
||||||
testMatch: '**/*.visual.spec.js', // only run visual tests
|
testMatch: '**/*.visual.spec.js', // only run visual tests
|
||||||
timeout: 60 * 1000,
|
timeout: 60 * 1000,
|
||||||
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start:coverage',
|
command: 'npm run start:coverage',
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: !process.env.CI
|
reuseExistingServer: !process.env.CI
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
use: {
|
{
|
||||||
baseURL: 'http://localhost:8080/',
|
name: 'chrome-snow-theme', //Runs the same visual tests but with snow-theme enabled
|
||||||
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
use: {
|
||||||
ignoreHTTPSErrors: true,
|
browserName: 'chromium',
|
||||||
screenshot: 'only-on-failure',
|
theme: 'snow'
|
||||||
trace: 'on-first-retry',
|
}
|
||||||
video: 'off'
|
}
|
||||||
},
|
],
|
||||||
projects: [
|
reporter: [
|
||||||
{
|
['list'],
|
||||||
name: 'chrome',
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
use: {
|
[
|
||||||
browserName: 'chromium'
|
'html',
|
||||||
}
|
{
|
||||||
},
|
open: 'on-failure',
|
||||||
{
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
name: 'chrome-snow-theme', //Runs the same visual tests but with snow-theme enabled
|
}
|
||||||
use: {
|
|
||||||
browserName: 'chromium',
|
|
||||||
theme: 'snow'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
reporter: [
|
|
||||||
['list'],
|
|
||||||
['junit', { outputFile: '../test-results/results.xml' }],
|
|
||||||
['html', {
|
|
||||||
open: 'on-failure',
|
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
|
||||||
}]
|
|
||||||
]
|
]
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* and appActions. These fixtures should be generalized across all plugins.
|
* and appActions. These fixtures should be generalized across all plugins.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('./baseFixtures');
|
const { test, expect, request } = require('./baseFixtures');
|
||||||
// const { createDomainObjectWithDefaults } = require('./appActions');
|
// const { createDomainObjectWithDefaults } = require('./appActions');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
@ -45,8 +45,6 @@ const path = require('path');
|
|||||||
// const createdObjects = new Map();
|
// const createdObjects = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* **NOTE: This feature is a work-in-progress and should not currently be used.**
|
|
||||||
*
|
|
||||||
* This action will create a domain object for the test to reference and return the uuid. If an object
|
* This action will create a domain object for the test to reference and return the uuid. If an object
|
||||||
* of a given name already exists, it will return the uuid of that object to the test instead of creating
|
* of a given name already exists, it will return the uuid of that object to the test instead of creating
|
||||||
* a new file. The intent is to move object creation out of test suites which are not explicitly worried
|
* a new file. The intent is to move object creation out of test suites which are not explicitly worried
|
||||||
@ -65,10 +63,7 @@ const path = require('path');
|
|||||||
|
|
||||||
// await createDomainObjectWithDefaults(page, type, name);
|
// await createDomainObjectWithDefaults(page, type, name);
|
||||||
|
|
||||||
// // Once object is created, get the uuid from the url
|
// const uuid = getHashUrlToDomainObject(page);
|
||||||
// const uuid = await page.evaluate(() => {
|
|
||||||
// return window.location.href.match(/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/)[0];
|
|
||||||
// });
|
|
||||||
|
|
||||||
// createdObjects.set(objectName, uuid);
|
// createdObjects.set(objectName, uuid);
|
||||||
|
|
||||||
@ -120,33 +115,46 @@ const theme = 'espresso';
|
|||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
const myItemsFolderName = "My Items";
|
const myItemsFolderName = 'My Items';
|
||||||
|
|
||||||
exports.test = test.extend({
|
exports.test = test.extend({
|
||||||
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
|
// This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
|
||||||
theme: [theme, { option: true }],
|
theme: [theme, { option: true }],
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
page: async ({ page, theme }, use, testInfo) => {
|
page: async ({ page, theme }, use, testInfo) => {
|
||||||
// eslint-disable-next-line playwright/no-conditional-in-test
|
// eslint-disable-next-line playwright/no-conditional-in-test
|
||||||
if (theme === 'snow') {
|
if (theme === 'snow') {
|
||||||
//inject snow theme
|
//inject snow theme
|
||||||
await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') });
|
await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') });
|
||||||
}
|
|
||||||
|
|
||||||
// Attach info about the currently running test and its project.
|
|
||||||
// This will be used by appActions to fill in the created
|
|
||||||
// domain object's notes.
|
|
||||||
page.testNotes = [
|
|
||||||
`${testInfo.titlePath.join('\n')}`,
|
|
||||||
`${testInfo.project.name}`
|
|
||||||
].join('\n');
|
|
||||||
|
|
||||||
await use(page);
|
|
||||||
},
|
|
||||||
myItemsFolderName: [myItemsFolderName, { option: true }],
|
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
openmctConfig: async ({ myItemsFolderName }, use) => {
|
|
||||||
await use({ myItemsFolderName });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach info about the currently running test and its project.
|
||||||
|
// This will be used by appActions to fill in the created
|
||||||
|
// domain object's notes.
|
||||||
|
page.testNotes = [`${testInfo.titlePath.join('\n')}`, `${testInfo.project.name}`].join('\n');
|
||||||
|
|
||||||
|
await use(page);
|
||||||
|
},
|
||||||
|
myItemsFolderName: [myItemsFolderName, { option: true }],
|
||||||
|
// eslint-disable-next-line no-shadow
|
||||||
|
openmctConfig: async ({ myItemsFolderName }, use) => {
|
||||||
|
await use({ myItemsFolderName });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.expect = expect;
|
exports.expect = expect;
|
||||||
|
exports.request = request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a readable stream and returns a string.
|
||||||
|
* @param {ReadableStream} readable - the readable stream
|
||||||
|
* @return {Promise<String>} the stringified stream
|
||||||
|
*/
|
||||||
|
exports.streamToString = async function (readable) {
|
||||||
|
let result = '';
|
||||||
|
for await (const chunk of readable) {
|
||||||
|
result += chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
@ -274,10 +274,7 @@
|
|||||||
"id": "ac0d7eb1-b485-458f-bd2a-a63aa87a3a8a"
|
"id": "ac0d7eb1-b485-458f-bd2a-a63aa87a3a8a"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"layoutGrid": [
|
"layoutGrid": [10, 10],
|
||||||
10,
|
|
||||||
10
|
|
||||||
],
|
|
||||||
"objectStyles": {
|
"objectStyles": {
|
||||||
"ed63cc29-80e2-4e2b-a472-3d6d4adbf310": {
|
"ed63cc29-80e2-4e2b-a472-3d6d4adbf310": {
|
||||||
"staticStyle": {
|
"staticStyle": {
|
||||||
@ -1455,9 +1452,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["120"],
|
||||||
"120"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1475,10 +1470,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["120", "-20"],
|
||||||
"120",
|
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1496,9 +1488,7 @@
|
|||||||
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "lessThan",
|
"operation": "lessThan",
|
||||||
"input": [
|
"input": ["-20"],
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1550,9 +1540,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["120"],
|
||||||
"120"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1570,10 +1558,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["120", "-20"],
|
||||||
"120",
|
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1591,9 +1576,7 @@
|
|||||||
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
"id": "6707be12-6a6e-4535-bb97-ab5c86f99934",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "lessThan",
|
"operation": "lessThan",
|
||||||
"input": [
|
"input": ["-20"],
|
||||||
"-20"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1645,9 +1628,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["150"],
|
||||||
"150"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1665,10 +1646,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["50", "-50"],
|
||||||
"50",
|
|
||||||
"-50"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1720,9 +1698,7 @@
|
|||||||
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
"id": "64e49fe7-5b36-43db-8347-4550b910de4c",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "greaterThan",
|
"operation": "greaterThan",
|
||||||
"input": [
|
"input": ["150"],
|
||||||
"150"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -1740,10 +1716,7 @@
|
|||||||
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
"id": "59f1c4bf-5d36-450c-9668-6546955fc066",
|
||||||
"telemetry": "any",
|
"telemetry": "any",
|
||||||
"operation": "between",
|
"operation": "between",
|
||||||
"input": [
|
"input": ["50", "-50"],
|
||||||
"50",
|
|
||||||
"-50"
|
|
||||||
],
|
|
||||||
"metadata": "sin"
|
"metadata": "sin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -2204,4 +2177,4 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rootId": "45b24009-dfed-4023-a30b-d31f5e3a2d87"
|
"rootId": "45b24009-dfed-4023-a30b-d31f5e3a2d87"
|
||||||
}
|
}
|
||||||
|
@ -1 +1,90 @@
|
|||||||
{"openmct":{"b3cee102-86dd-4c0a-8eec-4d5d276f8691":{"identifier":{"key":"b3cee102-86dd-4c0a-8eec-4d5d276f8691","namespace":""},"name":"Performance Display Layout","type":"layout","composition":[{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""}],"configuration":{"items":[{"width":32,"height":18,"x":12,"y":9,"identifier":{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""},"hasFrame":true,"fontSize":"default","font":"default","type":"subobject-view","id":"23ca351d-a67d-46aa-a762-290eb742d2f1"}],"layoutGrid":[10,10]},"modified":1654299875432,"location":"mine","persisted":1654299878751},"9666e7b4-be0c-47a5-94b8-99accad7155e":{"identifier":{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""},"name":"Performance Example Imagery","type":"example.imagery","configuration":{"imageLocation":"","imageLoadDelayInMilliSeconds":20000,"imageSamples":[],"layers":[{"source":"dist/imagery/example-imagery-layer-16x9.png","name":"16:9","visible":false},{"source":"dist/imagery/example-imagery-layer-safe.png","name":"Safe","visible":false},{"source":"dist/imagery/example-imagery-layer-scale.png","name":"Scale","visible":false}]},"telemetry":{"values":[{"name":"Name","key":"name"},{"name":"Time","key":"utc","format":"utc","hints":{"domain":2}},{"name":"Local Time","key":"local","format":"local-format","hints":{"domain":1}},{"name":"Image","key":"url","format":"image","hints":{"image":1},"layers":[{"source":"dist/imagery/example-imagery-layer-16x9.png","name":"16:9"},{"source":"dist/imagery/example-imagery-layer-safe.png","name":"Safe"},{"source":"dist/imagery/example-imagery-layer-scale.png","name":"Scale"}]},{"name":"Image Download Name","key":"imageDownloadName","format":"imageDownloadName","hints":{"imageDownloadName":1}}]},"modified":1654299840077,"location":"b3cee102-86dd-4c0a-8eec-4d5d276f8691","persisted":1654299840078}},"rootId":"b3cee102-86dd-4c0a-8eec-4d5d276f8691"}
|
{
|
||||||
|
"openmct": {
|
||||||
|
"b3cee102-86dd-4c0a-8eec-4d5d276f8691": {
|
||||||
|
"identifier": { "key": "b3cee102-86dd-4c0a-8eec-4d5d276f8691", "namespace": "" },
|
||||||
|
"name": "Performance Display Layout",
|
||||||
|
"type": "layout",
|
||||||
|
"composition": [{ "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" }],
|
||||||
|
"configuration": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"width": 32,
|
||||||
|
"height": 18,
|
||||||
|
"x": 12,
|
||||||
|
"y": 9,
|
||||||
|
"identifier": { "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" },
|
||||||
|
"hasFrame": true,
|
||||||
|
"fontSize": "default",
|
||||||
|
"font": "default",
|
||||||
|
"type": "subobject-view",
|
||||||
|
"id": "23ca351d-a67d-46aa-a762-290eb742d2f1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"layoutGrid": [10, 10]
|
||||||
|
},
|
||||||
|
"modified": 1654299875432,
|
||||||
|
"location": "mine",
|
||||||
|
"persisted": 1654299878751
|
||||||
|
},
|
||||||
|
"9666e7b4-be0c-47a5-94b8-99accad7155e": {
|
||||||
|
"identifier": { "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" },
|
||||||
|
"name": "Performance Example Imagery",
|
||||||
|
"type": "example.imagery",
|
||||||
|
"configuration": {
|
||||||
|
"imageLocation": "",
|
||||||
|
"imageLoadDelayInMilliSeconds": 20000,
|
||||||
|
"imageSamples": [],
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-16x9.png",
|
||||||
|
"name": "16:9",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-safe.png",
|
||||||
|
"name": "Safe",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-scale.png",
|
||||||
|
"name": "Scale",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"telemetry": {
|
||||||
|
"values": [
|
||||||
|
{ "name": "Name", "key": "name" },
|
||||||
|
{ "name": "Time", "key": "utc", "format": "utc", "hints": { "domain": 2 } },
|
||||||
|
{
|
||||||
|
"name": "Local Time",
|
||||||
|
"key": "local",
|
||||||
|
"format": "local-format",
|
||||||
|
"hints": { "domain": 1 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Image",
|
||||||
|
"key": "url",
|
||||||
|
"format": "image",
|
||||||
|
"hints": { "image": 1 },
|
||||||
|
"layers": [
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-16x9.png", "name": "16:9" },
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-safe.png", "name": "Safe" },
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-scale.png", "name": "Scale" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Image Download Name",
|
||||||
|
"key": "imageDownloadName",
|
||||||
|
"format": "imageDownloadName",
|
||||||
|
"hints": { "imageDownloadName": 1 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"modified": 1654299840077,
|
||||||
|
"location": "b3cee102-86dd-4c0a-8eec-4d5d276f8691",
|
||||||
|
"persisted": 1654299840078
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rootId": "b3cee102-86dd-4c0a-8eec-4d5d276f8691"
|
||||||
|
}
|
||||||
|
@ -1 +1,96 @@
|
|||||||
{"openmct":{"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d":{"identifier":{"key":"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d","namespace":""},"name":"Performance Notebook","type":"notebook","configuration":{"defaultSort":"oldest","entries":{"3e31c412-33ba-4757-8ade-e9821f6ba321":{"8c8f6035-631c-45af-8c24-786c60295335":[{"id":"entry-1652815305457","createdOn":1652815305457,"createdBy":"","text":"Existing Entry 1","embeds":[]},{"id":"entry-1652815313465","createdOn":1652815313465,"createdBy":"","text":"Existing Entry 2","embeds":[]},{"id":"entry-1652815399955","createdOn":1652815399955,"createdBy":"","text":"Existing Entry 3","embeds":[]}]}},"imageMigrationVer":"v1","pageTitle":"Page","sections":[{"id":"3e31c412-33ba-4757-8ade-e9821f6ba321","isDefault":false,"isSelected":false,"name":"Section1","pages":[{"id":"8c8f6035-631c-45af-8c24-786c60295335","isDefault":false,"isSelected":false,"name":"Page1","pageTitle":"Page"},{"id":"36555942-c9aa-439c-bbdb-0aaf50db50f5","isDefault":false,"isSelected":false,"name":"Page2","pageTitle":"Page"}],"sectionTitle":"Section"},{"id":"dab0bd1d-2c5a-405c-987f-107123d6189a","isDefault":false,"isSelected":true,"name":"Section2","pages":[{"id":"f625a86a-cb99-4898-8082-80543c8de534","isDefault":false,"isSelected":false,"name":"Page1","pageTitle":"Page"},{"id":"e77ef810-f785-42a7-942e-07e999b79c59","isDefault":false,"isSelected":true,"name":"Page2","pageTitle":"Page"}],"sectionTitle":"Section"}],"sectionTitle":"Section","type":"General","showTime":"0"},"modified":1652815915219,"location":"mine","persisted":1652815915222}},"rootId":"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d"}
|
{
|
||||||
|
"openmct": {
|
||||||
|
"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d": {
|
||||||
|
"identifier": { "key": "6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d", "namespace": "" },
|
||||||
|
"name": "Performance Notebook",
|
||||||
|
"type": "notebook",
|
||||||
|
"configuration": {
|
||||||
|
"defaultSort": "oldest",
|
||||||
|
"entries": {
|
||||||
|
"3e31c412-33ba-4757-8ade-e9821f6ba321": {
|
||||||
|
"8c8f6035-631c-45af-8c24-786c60295335": [
|
||||||
|
{
|
||||||
|
"id": "entry-1652815305457",
|
||||||
|
"createdOn": 1652815305457,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 1",
|
||||||
|
"embeds": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "entry-1652815313465",
|
||||||
|
"createdOn": 1652815313465,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 2",
|
||||||
|
"embeds": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "entry-1652815399955",
|
||||||
|
"createdOn": 1652815399955,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 3",
|
||||||
|
"embeds": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imageMigrationVer": "v1",
|
||||||
|
"pageTitle": "Page",
|
||||||
|
"sections": [
|
||||||
|
{
|
||||||
|
"id": "3e31c412-33ba-4757-8ade-e9821f6ba321",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Section1",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"id": "8c8f6035-631c-45af-8c24-786c60295335",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page1",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "36555942-c9aa-439c-bbdb-0aaf50db50f5",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page2",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dab0bd1d-2c5a-405c-987f-107123d6189a",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": true,
|
||||||
|
"name": "Section2",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"id": "f625a86a-cb99-4898-8082-80543c8de534",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page1",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e77ef810-f785-42a7-942e-07e999b79c59",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": true,
|
||||||
|
"name": "Page2",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section",
|
||||||
|
"type": "General",
|
||||||
|
"showTime": "0"
|
||||||
|
},
|
||||||
|
"modified": 1652815915219,
|
||||||
|
"location": "mine",
|
||||||
|
"persisted": 1652815915222
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rootId": "6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d"
|
||||||
|
}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"cookies": [],
|
|
||||||
"origins": [
|
|
||||||
{
|
|
||||||
"origin": "http://localhost:8080",
|
|
||||||
"localStorage": [
|
|
||||||
{
|
|
||||||
"name": "tcHistory",
|
|
||||||
"value": "{\"utc\":[{\"start\":1658617611983,\"end\":1658619411983}]}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mct",
|
|
||||||
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"persisted\":1658619412848,\"modified\":1658619412848},\"7fa5749b-8969-494c-9d85-c272516d333c\":{\"identifier\":{\"key\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"namespace\":\"\"},\"name\":\"Unnamed Overlay Plot\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"}}]},\"modified\":1658619413566,\"location\":\"mine\",\"persisted\":1658619413567},\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\":{\"name\":\"Unnamed Sine Wave Generator\",\"type\":\"generator\",\"identifier\":{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":\"5000\"},\"modified\":1658619413552,\"location\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"persisted\":1658619413552}}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mct-tree-expanded",
|
|
||||||
"value": "[\"/browse/mine\"]"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -1077,4 +1077,4 @@
|
|||||||
"textColor": "#ffffff"
|
"textColor": "#ffffff"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
{
|
{
|
||||||
"Group 1": [
|
"Group 1": [
|
||||||
{
|
{
|
||||||
"name": "Past event 1",
|
"name": "Past event 1",
|
||||||
"start": 1660320408000,
|
"start": 1660320408000,
|
||||||
"end": 1660343797000,
|
"end": 1660343797000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 2",
|
"name": "Past event 2",
|
||||||
"start": 1660406808000,
|
"start": 1660406808000,
|
||||||
"end": 1660429160000,
|
"end": 1660429160000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 3",
|
"name": "Past event 3",
|
||||||
"start": 1660493208000,
|
"start": 1660493208000,
|
||||||
"end": 1660503981000,
|
"end": 1660503981000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 4",
|
"name": "Past event 4",
|
||||||
"start": 1660579608000,
|
"start": 1660579608000,
|
||||||
"end": 1660624108000,
|
"end": 1660624108000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 5",
|
"name": "Past event 5",
|
||||||
"start": 1660666008000,
|
"start": 1660666008000,
|
||||||
"end": 1660681529000,
|
"end": 1660681529000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
{
|
{
|
||||||
"Group 1": [
|
"Group 1": [
|
||||||
{
|
{
|
||||||
"name": "Group 1 event 1",
|
"name": "Group 1 event 1",
|
||||||
"start": 1650320408000,
|
"start": 1650320408000,
|
||||||
"end": 1660343797000,
|
"end": 1660343797000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "orange",
|
"color": "orange",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Group 1 event 2",
|
"name": "Group 1 event 2",
|
||||||
"start": 1660005808000,
|
"start": 1660005808000,
|
||||||
"end": 1660429160000,
|
"end": 1660429160000,
|
||||||
"type": "Group 1",
|
"type": "Group 1",
|
||||||
"color": "yellow",
|
"color": "yellow",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"Group 2": [
|
"Group 2": [
|
||||||
{
|
{
|
||||||
"name": "Group 2 event 1",
|
"name": "Group 2 event 1",
|
||||||
"start": 1660320408000,
|
"start": 1660320408000,
|
||||||
"end": 1660420408000,
|
"end": 1660420408000,
|
||||||
"type": "Group 2",
|
"type": "Group 2",
|
||||||
"color": "green",
|
"color": "green",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Group 2 event 2",
|
"name": "Group 2 event 2",
|
||||||
"start": 1660406808000,
|
"start": 1660406808000,
|
||||||
"end": 1690429160000,
|
"end": 1690429160000,
|
||||||
"type": "Group 2",
|
"type": "Group 2",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"textColor": "white"
|
"textColor": "white"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
22
e2e/test-data/overlay_plot_storage.json
Normal file
22
e2e/test-data/overlay_plot_storage.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},\"20e7d5fe-9cf8-4099-8957-9453a8954c67\":{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960},\"2db521a9-996d-4d04-a171-93f4c5c220af\":{\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-recent-objects",
|
||||||
|
"value": "[{\"objectPath\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/2db521a9-996d-4d04-a171-93f4c5c220af\",\"domainObject\":{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602540,\"location\":\"mine\",\"created\":1732413602540,\"persisted\":1732413602540}},{\"objectPath\":[{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"domainObject\":{\"identifier\":{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603960,\"location\":\"mine\",\"created\":1732413601820,\"persisted\":1732413603960}},{\"objectPath\":[{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine\",\"domainObject\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"20e7d5fe-9cf8-4099-8957-9453a8954c67\",\"namespace\":\"\"},{\"key\":\"2db521a9-996d-4d04-a171-93f4c5c220af\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602540,\"created\":1732413600760,\"persisted\":1732413602540}}]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413601340,\"created\":1732413600580,\"persisted\":1732413601340},\"98161570-a735-4a50-9c75-11b346ad3789\":{\"identifier\":{\"key\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"namespace\":\"\"},\"name\":\"Overlay Plot with 5s Delay\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with 5s Delay\\nchrome\",\"modified\":1732413602660,\"location\":\"mine\",\"created\":1732413601340,\"persisted\":1732413602660},\"477e60bb-4cba-4603-b4c9-2281ccf7e054\":{\"identifier\":{\"key\":\"477e60bb-4cba-4603-b4c9-2281ccf7e054\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":5000,\"infinityValues\":false,\"staleness\":false},\"modified\":1732413602520,\"location\":\"98161570-a735-4a50-9c75-11b346ad3789\",\"created\":1732413602040,\"persisted\":1732413602520}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
@ -21,145 +21,149 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../pluginFixtures.js');
|
const { test, expect } = require('../../pluginFixtures.js');
|
||||||
const { createDomainObjectWithDefaults, createNotification, expandEntireTree } = require('../../appActions.js');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createNotification,
|
||||||
|
expandEntireTree
|
||||||
|
} = require('../../appActions.js');
|
||||||
|
|
||||||
test.describe('AppActions', () => {
|
test.describe('AppActions', () => {
|
||||||
test('createDomainObjectsWithDefaults', async ({ page }) => {
|
test('createDomainObjectsWithDefaults', async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
const e2eFolder = await createDomainObjectWithDefaults(page, {
|
const e2eFolder = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Folder',
|
type: 'Folder',
|
||||||
name: 'e2e folder'
|
name: 'e2e folder'
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('Create multiple flat objects in a row', async () => {
|
|
||||||
const timer1 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Timer',
|
|
||||||
name: 'Timer Foo',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
const timer2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Timer',
|
|
||||||
name: 'Timer Bar',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
const timer3 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Timer',
|
|
||||||
name: 'Timer Baz',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto(timer1.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
|
|
||||||
await page.goto(timer2.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
|
|
||||||
await page.goto(timer3.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer3.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('Create multiple nested objects in a row', async () => {
|
|
||||||
const folder1 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
name: 'Folder Foo',
|
|
||||||
parent: e2eFolder.uuid
|
|
||||||
});
|
|
||||||
const folder2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
name: 'Folder Bar',
|
|
||||||
parent: folder1.uuid
|
|
||||||
});
|
|
||||||
const folder3 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
name: 'Folder Baz',
|
|
||||||
parent: folder2.uuid
|
|
||||||
});
|
|
||||||
await page.goto(folder1.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
|
|
||||||
await page.goto(folder2.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
|
|
||||||
await page.goto(folder3.url);
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder3.name);
|
|
||||||
|
|
||||||
expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
|
|
||||||
expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
|
|
||||||
expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test("createNotification", async ({ page }) => {
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await test.step('Create multiple flat objects in a row', async () => {
|
||||||
await createNotification(page, {
|
const timer1 = await createDomainObjectWithDefaults(page, {
|
||||||
message: 'Test info notification',
|
type: 'Timer',
|
||||||
severity: 'info'
|
name: 'Timer Foo',
|
||||||
});
|
parent: e2eFolder.uuid
|
||||||
await expect(page.locator('.c-message-banner__message')).toHaveText('Test info notification');
|
});
|
||||||
await expect(page.locator('.c-message-banner')).toHaveClass(/info/);
|
const timer2 = await createDomainObjectWithDefaults(page, {
|
||||||
await page.locator('[aria-label="Dismiss"]').click();
|
type: 'Timer',
|
||||||
await createNotification(page, {
|
name: 'Timer Bar',
|
||||||
message: 'Test alert notification',
|
parent: e2eFolder.uuid
|
||||||
severity: 'alert'
|
});
|
||||||
});
|
const timer3 = await createDomainObjectWithDefaults(page, {
|
||||||
await expect(page.locator('.c-message-banner__message')).toHaveText('Test alert notification');
|
type: 'Timer',
|
||||||
await expect(page.locator('.c-message-banner')).toHaveClass(/alert/);
|
name: 'Timer Baz',
|
||||||
await page.locator('[aria-label="Dismiss"]').click();
|
parent: e2eFolder.uuid
|
||||||
await createNotification(page, {
|
});
|
||||||
message: 'Test error notification',
|
|
||||||
severity: 'error'
|
await page.goto(timer1.url);
|
||||||
});
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
|
||||||
await expect(page.locator('.c-message-banner__message')).toHaveText('Test error notification');
|
await page.goto(timer2.url);
|
||||||
await expect(page.locator('.c-message-banner')).toHaveClass(/error/);
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
|
||||||
await page.locator('[aria-label="Dismiss"]').click();
|
await page.goto(timer3.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer3.name);
|
||||||
});
|
});
|
||||||
test('expandEntireTree', async ({ page }) => {
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
const rootFolder = await createDomainObjectWithDefaults(page, {
|
await test.step('Create multiple nested objects in a row', async () => {
|
||||||
type: 'Folder'
|
const folder1 = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Folder',
|
||||||
const folder1 = await createDomainObjectWithDefaults(page, {
|
name: 'Folder Foo',
|
||||||
type: 'Folder',
|
parent: e2eFolder.uuid
|
||||||
parent: rootFolder.uuid
|
});
|
||||||
});
|
const folder2 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
name: 'Folder Bar',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
const folder3 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
name: 'Folder Baz',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
await page.goto(folder1.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
|
||||||
|
await page.goto(folder2.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
|
||||||
|
await page.goto(folder3.url);
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder3.name);
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
|
||||||
type: 'Clock',
|
expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
|
||||||
parent: folder1.uuid
|
expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
|
||||||
});
|
|
||||||
const folder2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
parent: folder1.uuid
|
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
parent: folder1.uuid
|
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
parent: folder2.uuid
|
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Folder',
|
|
||||||
parent: folder2.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto('./#/browse/mine');
|
|
||||||
await expandEntireTree(page);
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: "Main Tree"
|
|
||||||
});
|
|
||||||
const treePaneCollapsedItems = treePane.getByRole('treeitem', { expanded: false });
|
|
||||||
expect(await treePaneCollapsedItems.count()).toBe(0);
|
|
||||||
|
|
||||||
await page.goto('./#/browse/mine');
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
|
||||||
await page.click(`li[role='menuitem']:text("Clock")`);
|
|
||||||
await expandEntireTree(page, "Create Modal Tree");
|
|
||||||
const locatorTree = page.getByRole("tree", {
|
|
||||||
name: "Create Modal Tree"
|
|
||||||
});
|
|
||||||
const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
|
|
||||||
expect(await locatorTreeCollapsedItems.count()).toBe(0);
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
test('createNotification', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test info notification',
|
||||||
|
severity: 'info'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test info notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/info/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test alert notification',
|
||||||
|
severity: 'alert'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test alert notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/alert/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test error notification',
|
||||||
|
severity: 'error'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test error notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/error/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
});
|
||||||
|
test('expandEntireTree', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const rootFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
const folder1 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: rootFolder.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Clock',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
const folder2 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
await expandEntireTree(page);
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const treePaneCollapsedItems = treePane.getByRole('treeitem', { expanded: false });
|
||||||
|
expect(await treePaneCollapsedItems.count()).toBe(0);
|
||||||
|
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click the object specified by 'type'
|
||||||
|
await page.click(`li[role='menuitem']:text("Clock")`);
|
||||||
|
await expandEntireTree(page, 'Create Modal Tree');
|
||||||
|
const locatorTree = page.getByRole('tree', {
|
||||||
|
name: 'Create Modal Tree'
|
||||||
|
});
|
||||||
|
const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
|
||||||
|
expect(await locatorTreeCollapsedItems.count()).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,27 +29,26 @@ relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions ma
|
|||||||
const { test } = require('../../baseFixtures.js');
|
const { test } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
test.describe('baseFixtures tests', () => {
|
test.describe('baseFixtures tests', () => {
|
||||||
test('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
//Skip this test for now https://github.com/nasa/openmct/issues/6785
|
||||||
test.fail();
|
test.fixme('Verify that tests fail if console.error is thrown', async ({ page }) => {
|
||||||
//Go to baseURL
|
test.fail();
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
//Verify that ../fixtures.js detects console log errors
|
//Verify that ../fixtures.js detects console log errors
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.evaluate(() => console.error('This should result in a failure')),
|
page.evaluate(() => console.error('This should result in a failure')),
|
||||||
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
||||||
]);
|
]);
|
||||||
|
});
|
||||||
|
test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
});
|
//Verify that ../fixtures.js detects console log errors
|
||||||
test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
|
await Promise.all([
|
||||||
//Go to baseURL
|
page.evaluate(() => console.warn('This should result in a pass')),
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
||||||
|
]);
|
||||||
//Verify that ../fixtures.js detects console log errors
|
});
|
||||||
await Promise.all([
|
|
||||||
page.evaluate(() => console.warn('This should result in a pass')),
|
|
||||||
page.waitForEvent('console') // always wait for the event to happen while triggering it!
|
|
||||||
]);
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -21,28 +21,28 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test suite template is to be used when creating new test suites. It will be kept up to date with the latest improvements
|
* This test suite template is to be used when creating new test suites. It will be kept up to date with the latest improvements
|
||||||
* made by the Open MCT team. It will also follow our best pratices as those evolve. Please use this structure as a _reference_ and clear
|
* made by the Open MCT team. It will also follow our best pratices as those evolve. Please use this structure as a _reference_ and clear
|
||||||
* or update any references when creating a new test suite!
|
* or update any references when creating a new test suite!
|
||||||
*
|
*
|
||||||
* To illustrate current best practices, we've included a mocked up test suite for Renaming a Timer domain object.
|
* To illustrate current best practices, we've included a mocked up test suite for Renaming a Timer domain object.
|
||||||
*
|
*
|
||||||
* Demonstrated:
|
* Demonstrated:
|
||||||
* - Using appActions to leverage existing functions
|
* - Using appActions to leverage existing functions
|
||||||
* - Structure
|
* - Structure
|
||||||
* - @unstable annotation
|
* - @unstable annotation
|
||||||
* - await, expect, test, describe syntax
|
* - await, expect, test, describe syntax
|
||||||
* - Writing a custom function for a test suite
|
* - Writing a custom function for a test suite
|
||||||
* - Test stub for unfinished test coverage (test.fixme)
|
* - Test stub for unfinished test coverage (test.fixme)
|
||||||
*
|
*
|
||||||
* The structure should follow
|
* The structure should follow
|
||||||
* 1. imports
|
* 1. imports
|
||||||
* 2. test.describe()
|
* 2. test.describe()
|
||||||
* 3. -> test1
|
* 3. -> test1
|
||||||
* -> test2
|
* -> test2
|
||||||
* -> test3(stub)
|
* -> test3(stub)
|
||||||
* 4. Any custom functions
|
* 4. Any custom functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Structure: Some standard Imports. Please update the required pathing.
|
// Structure: Some standard Imports. Please update the required pathing.
|
||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
@ -58,63 +58,92 @@ const { createDomainObjectWithDefaults } = require('../../appActions');
|
|||||||
* as a part of our test promotion pipeline.
|
* as a part of our test promotion pipeline.
|
||||||
*/
|
*/
|
||||||
test.describe('Renaming Timer Object', () => {
|
test.describe('Renaming Timer Object', () => {
|
||||||
// Top-level declaration of the Timer object created in beforeEach().
|
// Top-level declaration of the Timer object created in beforeEach().
|
||||||
// We can then use this throughout the entire test suite.
|
// We can then use this throughout the entire test suite.
|
||||||
let timer;
|
let timer;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
|
// We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
|
||||||
// This example will create a Timer object with default properties, under the root folder:
|
// This example will create a Timer object with default properties, under the root folder:
|
||||||
timer = await createDomainObjectWithDefaults(page, { type: 'Timer' });
|
timer = await createDomainObjectWithDefaults(page, { type: 'Timer' });
|
||||||
|
|
||||||
// Assert the object to be created and check its name in the title
|
// Assert the object to be created and check its name in the title
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(timer.name);
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(timer.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure to use testcase names which are descriptive and easy to understand.
|
||||||
|
* A good testcase name concisely describes the test's goal(s) and should give
|
||||||
|
* some hint as to what went wrong if the test fails.
|
||||||
|
*/
|
||||||
|
test('An existing Timer object can be renamed via the 3dot actions menu', async ({ page }) => {
|
||||||
|
const newObjectName = 'Renamed Timer';
|
||||||
|
|
||||||
|
// We've created an example of a shared function which pases the page and newObjectName values
|
||||||
|
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
||||||
|
|
||||||
|
// Assert that the name has changed in the browser bar to the value we assigned above
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('An existing Timer object can be renamed twice', async ({ page }) => {
|
||||||
|
const newObjectName = 'Renamed Timer';
|
||||||
|
const newObjectName2 = 'Re-Renamed Timer';
|
||||||
|
|
||||||
|
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
||||||
|
|
||||||
|
// Assert that the name has changed in the browser bar to the value we assigned above
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
||||||
|
|
||||||
|
// Rename the Timer object again
|
||||||
|
await renameTimerFrom3DotMenu(page, timer.url, newObjectName2);
|
||||||
|
|
||||||
|
// Assert that the name has changed in the browser bar to the second value
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName2);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you run out of time to write new tests, please stub in the missing tests
|
||||||
|
* in-place with a test.fixme and BDD-style test steps.
|
||||||
|
* Someone will carry the baton!
|
||||||
|
*/
|
||||||
|
test.fixme('Can Rename Timer Object from Tree', async ({ page }) => {
|
||||||
|
//Create a new object
|
||||||
|
//Copy this object
|
||||||
|
//Delete first object
|
||||||
|
//Expect copied object to persist
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The next most important concept in our testing is working with telemetry objects. Telemetry is at the core of Open MCT
|
||||||
|
* and we have developed a great pattern for working with it.
|
||||||
|
*/
|
||||||
|
test.describe('Advanced: Working with telemetry objects', () => {
|
||||||
|
let displayLayout;
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create a Display Layout with a meaningful name
|
||||||
|
displayLayout = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Display Layout with Embedded SWG'
|
||||||
});
|
});
|
||||||
|
// Create Telemetry object within the parent object created above
|
||||||
/**
|
await createDomainObjectWithDefaults(page, {
|
||||||
* Make sure to use testcase names which are descriptive and easy to understand.
|
type: 'Sine Wave Generator',
|
||||||
* A good testcase name concisely describes the test's goal(s) and should give
|
name: 'Telemetry',
|
||||||
* some hint as to what went wrong if the test fails.
|
parent: displayLayout.uuid //reference the display layout in the creation process
|
||||||
*/
|
|
||||||
test('An existing Timer object can be renamed via the 3dot actions menu', async ({ page }) => {
|
|
||||||
const newObjectName = "Renamed Timer";
|
|
||||||
|
|
||||||
// We've created an example of a shared function which pases the page and newObjectName values
|
|
||||||
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
|
||||||
|
|
||||||
// Assert that the name has changed in the browser bar to the value we assigned above
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('An existing Timer object can be renamed twice', async ({ page }) => {
|
|
||||||
const newObjectName = "Renamed Timer";
|
|
||||||
const newObjectName2 = "Re-Renamed Timer";
|
|
||||||
|
|
||||||
await renameTimerFrom3DotMenu(page, timer.url, newObjectName);
|
|
||||||
|
|
||||||
// Assert that the name has changed in the browser bar to the value we assigned above
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
|
||||||
|
|
||||||
// Rename the Timer object again
|
|
||||||
await renameTimerFrom3DotMenu(page, timer.url, newObjectName2);
|
|
||||||
|
|
||||||
// Assert that the name has changed in the browser bar to the second value
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName2);
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If you run out of time to write new tests, please stub in the missing tests
|
|
||||||
* in-place with a test.fixme and BDD-style test steps.
|
|
||||||
* Someone will carry the baton!
|
|
||||||
*/
|
|
||||||
test.fixme('Can Rename Timer Object from Tree', async ({ page }) => {
|
|
||||||
//Create a new object
|
|
||||||
//Copy this object
|
|
||||||
//Delete first object
|
|
||||||
//Expect copied object to persist
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
test('Can directly navigate to a Display Layout with embedded telemetry', async ({ page }) => {
|
||||||
|
//Now you can directly navigate to the displayLayout created in the beforeEach with the embedded telemetry
|
||||||
|
await page.goto(displayLayout.url);
|
||||||
|
//Expect the created Telemetry Object to be visible when directly navigating to the displayLayout
|
||||||
|
await expect(page.getByTitle('Sine')).toBeVisible();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,18 +160,18 @@ test.describe('Renaming Timer Object', () => {
|
|||||||
* @param {string} newNameForTimer New name for object
|
* @param {string} newNameForTimer New name for object
|
||||||
*/
|
*/
|
||||||
async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
|
async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
|
||||||
// Navigate to the timer object
|
// Navigate to the timer object
|
||||||
await page.goto(timerUrl);
|
await page.goto(timerUrl);
|
||||||
|
|
||||||
// Click on 3 Dot Menu
|
// Click on 3 Dot Menu
|
||||||
await page.locator('button[title="More options"]').click();
|
await page.locator('button[title="More options"]').click();
|
||||||
|
|
||||||
// Click text=Edit Properties...
|
// Click text=Edit Properties...
|
||||||
await page.locator('text=Edit Properties...').click();
|
await page.locator('text=Edit Properties...').click();
|
||||||
|
|
||||||
// Rename the timer object
|
// Rename the timer object
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
|
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
|
||||||
|
|
||||||
// Click Ok button to Save
|
// Click Ok button to Save
|
||||||
await page.locator('button:has-text("OK")').click();
|
await page.locator('button:has-text("OK")').click();
|
||||||
}
|
}
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
@ -1,64 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
|
||||||
* Administration. All rights reserved.
|
|
||||||
*
|
|
||||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* Open MCT includes source code licensed under additional open source
|
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
||||||
* this source code distribution or the Licensing information page available
|
|
||||||
* at runtime from the About dialog for additional information.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
This test suite is dedicated to generating LocalStorage via Session Storage to be used
|
|
||||||
in some visual test suites like controlledClock.visual.spec.js. This suite should run to completion
|
|
||||||
and generate an artifact named ./e2e/test-data/VisualTestData_storage.json . This will run
|
|
||||||
on every Commit to ensure that this object still loads into tests correctly and will retain the
|
|
||||||
.e2e.spec.js suffix.
|
|
||||||
|
|
||||||
TODO: Provide additional validation of object properties as it grows.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
const { createDomainObjectWithDefaults } = require('../../appActions.js');
|
|
||||||
const { test, expect } = require('../../pluginFixtures.js');
|
|
||||||
|
|
||||||
test('Generate Visual Test Data @localStorage', async ({ page, context }) => {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
const overlayPlot = await createDomainObjectWithDefaults(page, { type: 'Overlay Plot' });
|
|
||||||
|
|
||||||
// click create button
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
|
||||||
|
|
||||||
// add sine wave generator with defaults
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
|
|
||||||
|
|
||||||
//Add a 5000 ms Delay
|
|
||||||
await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000');
|
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('button:has-text("OK")').click(),
|
|
||||||
//Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// focus the overlay plot
|
|
||||||
await page.goto(overlayPlot.url);
|
|
||||||
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlot.name);
|
|
||||||
//Save localStorage for future test execution
|
|
||||||
await context.storageState({ path: './e2e/test-data/VisualTestData_storage.json' });
|
|
||||||
});
|
|
@ -29,18 +29,16 @@ const { test } = require('../../pluginFixtures.js');
|
|||||||
|
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
test.describe.skip('pluginFixtures tests', () => {
|
test.describe.skip('pluginFixtures tests', () => {
|
||||||
// test.use({ domainObjectName: 'Timer' });
|
// test.use({ domainObjectName: 'Timer' });
|
||||||
// let timerUUID;
|
// let timerUUID;
|
||||||
|
// test('Creates a timer object @framework @unstable', ({ domainObject }) => {
|
||||||
// test('Creates a timer object @framework @unstable', ({ domainObject }) => {
|
// const { uuid } = domainObject;
|
||||||
// const { uuid } = domainObject;
|
// const uuidRegexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/;
|
||||||
// const uuidRegexp = /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/;
|
// expect(uuid).toMatch(uuidRegexp);
|
||||||
// expect(uuid).toMatch(uuidRegexp);
|
// timerUUID = uuid;
|
||||||
// timerUUID = uuid;
|
// });
|
||||||
// });
|
// test('Provides same uuid for subsequent uses of the same object @framework', ({ domainObject }) => {
|
||||||
|
// const { uuid } = domainObject;
|
||||||
// test('Provides same uuid for subsequent uses of the same object @framework', ({ domainObject }) => {
|
// expect(uuid).toEqual(timerUUID);
|
||||||
// const { uuid } = domainObject;
|
// });
|
||||||
// expect(uuid).toEqual(timerUUID);
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
@ -27,37 +27,39 @@ This test suite is dedicated to tests which verify branding related components.
|
|||||||
const { test, expect } = require('../../baseFixtures.js');
|
const { test, expect } = require('../../baseFixtures.js');
|
||||||
|
|
||||||
test.describe('Branding tests', () => {
|
test.describe('Branding tests', () => {
|
||||||
test('About Modal launches with basic branding properties', async ({ page }) => {
|
test('About Modal launches with basic branding properties', async ({ page }) => {
|
||||||
// Go to baseURL
|
// Go to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Click About button
|
// Click About button
|
||||||
await page.click('.l-shell__app-logo');
|
await page.click('.l-shell__app-logo');
|
||||||
|
|
||||||
// Verify that the NASA Logo Appears
|
// Verify that the NASA Logo Appears
|
||||||
await expect(page.locator('.c-about__image')).toBeVisible();
|
await expect(page.locator('.c-about__image')).toBeVisible();
|
||||||
|
|
||||||
// Modify the Build information in 'about' Modal
|
// Modify the Build information in 'about' Modal
|
||||||
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info').first();
|
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info').first();
|
||||||
await expect(versionInformationLocator).toBeEnabled();
|
await expect(versionInformationLocator).toBeEnabled();
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Version: \d/);
|
await expect.soft(versionInformationLocator).toContainText(/Version: \d/);
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Build Date: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun))/);
|
await expect
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Revision: \b[0-9a-f]{5,40}\b/);
|
.soft(versionInformationLocator)
|
||||||
await expect.soft(versionInformationLocator).toContainText(/Branch: ./);
|
.toContainText(/Build Date: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun))/);
|
||||||
});
|
await expect.soft(versionInformationLocator).toContainText(/Revision: \b[0-9a-f]{5,40}\b/);
|
||||||
test('Verify Links in About Modal @2p', async ({ page }) => {
|
await expect.soft(versionInformationLocator).toContainText(/Branch: ./);
|
||||||
// Go to baseURL
|
});
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
test('Verify Links in About Modal @2p', async ({ page }) => {
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Click About button
|
// Click About button
|
||||||
await page.click('.l-shell__app-logo');
|
await page.click('.l-shell__app-logo');
|
||||||
|
|
||||||
// Verify that clicking on the third party licenses information opens up another tab on licenses url
|
// Verify that clicking on the third party licenses information opens up another tab on licenses url
|
||||||
const [page2] = await Promise.all([
|
const [page2] = await Promise.all([
|
||||||
page.waitForEvent('popup'),
|
page.waitForEvent('popup'),
|
||||||
page.locator('text=click here for third party licensing information').click()
|
page.locator('text=click here for third party licensing information').click()
|
||||||
]);
|
]);
|
||||||
await page2.waitForLoadState('networkidle'); //Avoids timing issues with juggler/firefox
|
await page2.waitForLoadState('networkidle'); //Avoids timing issues with juggler/firefox
|
||||||
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
expect(page2.waitForURL('**/licenses**')).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,91 +21,98 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test suite is meant to be executed against a couchdb container. More doc to come
|
* This test suite is meant to be executed against a couchdb container. More doc to come
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
|
|
||||||
test.describe("CouchDB Status Indicator with mocked responses @couchdb", () => {
|
test.describe('CouchDB Status Indicator with mocked responses @couchdb', () => {
|
||||||
test.use({ failOnConsoleError: false });
|
test.use({ failOnConsoleError: false });
|
||||||
//TODO BeforeAll Verify CouchDB Connectivity with APIContext
|
//TODO BeforeAll Verify CouchDB Connectivity with APIContext
|
||||||
test('Shows green if connected', async ({ page }) => {
|
test('Shows green if connected', async ({ page }) => {
|
||||||
await page.route('**/openmct/mine', route => {
|
await page.route('**/openmct/mine', (route) => {
|
||||||
route.fulfill({
|
route.fulfill({
|
||||||
status: 200,
|
status: 200,
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
body: JSON.stringify({})
|
body: JSON.stringify({})
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
|
||||||
await expect(page.locator('div:has-text("CouchDB is connected")').nth(3)).toBeVisible();
|
|
||||||
});
|
});
|
||||||
test('Shows red if not connected', async ({ page }) => {
|
|
||||||
await page.route('**/openmct/**', route => {
|
|
||||||
route.fulfill({
|
|
||||||
status: 503,
|
|
||||||
contentType: 'application/json',
|
|
||||||
body: JSON.stringify({})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
await expect(page.locator('div:has-text("CouchDB is offline")').nth(3)).toBeVisible();
|
waitUntil: 'networkidle'
|
||||||
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB is connected")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Shows red if not connected', async ({ page }) => {
|
||||||
|
await page.route('**/openmct/**', (route) => {
|
||||||
|
route.fulfill({
|
||||||
|
status: 503,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify({})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test('Shows unknown if it receives an unexpected response code', async ({ page }) => {
|
|
||||||
await page.route('**/openmct/mine', route => {
|
|
||||||
route.fulfill({
|
|
||||||
status: 418,
|
|
||||||
contentType: 'application/json',
|
|
||||||
body: JSON.stringify({})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', { waitUntil: 'networkidle' });
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
await expect(page.locator('div:has-text("CouchDB connectivity unknown")').nth(3)).toBeVisible();
|
waitUntil: 'networkidle'
|
||||||
});
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB is offline")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Shows unknown if it receives an unexpected response code', async ({ page }) => {
|
||||||
|
await page.route('**/openmct/mine', (route) => {
|
||||||
|
route.fulfill({
|
||||||
|
status: 418,
|
||||||
|
contentType: 'application/json',
|
||||||
|
body: JSON.stringify({})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./#/browse/mine?hideTree=true&hideInspector=true', {
|
||||||
|
waitUntil: 'networkidle'
|
||||||
|
});
|
||||||
|
await expect(page.locator('div:has-text("CouchDB connectivity unknown")').nth(3)).toBeVisible();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe("CouchDB initialization with mocked responses @couchdb", () => {
|
test.describe('CouchDB initialization with mocked responses @couchdb', () => {
|
||||||
test.use({ failOnConsoleError: false });
|
test.use({ failOnConsoleError: false });
|
||||||
test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
|
test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
|
||||||
const mockedMissingObjectResponsefromCouchDB = {
|
const mockedMissingObjectResponseFromCouchDB = {
|
||||||
status: 404,
|
status: 404,
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
body: JSON.stringify({})
|
body: JSON.stringify({})
|
||||||
};
|
};
|
||||||
|
|
||||||
// Override the first request to GET openmct/mine to return a 404.
|
// Override the first request to GET openmct/mine to return a 404.
|
||||||
// This simulates the case of starting Open MCT with a fresh database
|
// This simulates the case of starting Open MCT with a fresh database
|
||||||
// and no "My Items" folder created yet.
|
// and no "My Items" folder created yet.
|
||||||
await page.route('**/mine', route => {
|
await page.route(
|
||||||
route.fulfill(mockedMissingObjectResponsefromCouchDB);
|
'**/mine',
|
||||||
}, { times: 1 });
|
(route) => {
|
||||||
|
route.fulfill(mockedMissingObjectResponseFromCouchDB);
|
||||||
|
},
|
||||||
|
{ times: 1 }
|
||||||
|
);
|
||||||
|
|
||||||
// Set up promise to verify that a PUT request to create "My Items"
|
// Set up promise to verify that a PUT request to create "My Items"
|
||||||
// folder was made.
|
// folder was made.
|
||||||
const putMineFolderRequest = page.waitForRequest(req =>
|
const putMineFolderRequest = page.waitForRequest(
|
||||||
req.url().endsWith('/mine')
|
(req) => req.url().endsWith('/mine') && req.method() === 'PUT'
|
||||||
&& req.method() === 'PUT');
|
);
|
||||||
|
|
||||||
// Set up promise to verify that a GET request to retrieve "My Items"
|
// Set up promise to verify that a GET request to retrieve "My Items"
|
||||||
// folder was made.
|
// folder was made.
|
||||||
const getMineFolderRequest = page.waitForRequest(req =>
|
const getMineFolderRequest = page.waitForRequest(
|
||||||
req.url().endsWith('/mine')
|
(req) => req.url().endsWith('/mine') && req.method() === 'GET'
|
||||||
&& req.method() === 'GET');
|
);
|
||||||
|
|
||||||
// Go to baseURL.
|
// Go to baseURL.
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Wait for both requests to resolve.
|
// Wait for both requests to resolve.
|
||||||
await Promise.all([
|
await Promise.all([putMineFolderRequest, getMineFolderRequest]);
|
||||||
putMineFolderRequest,
|
});
|
||||||
getMineFolderRequest
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -28,32 +28,31 @@ const { test, expect } = require('../../../pluginFixtures');
|
|||||||
const { createDomainObjectWithDefaults } = require('../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../appActions');
|
||||||
|
|
||||||
test.describe('Example Event Generator CRUD Operations', () => {
|
test.describe('Example Event Generator CRUD Operations', () => {
|
||||||
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
|
test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
//Create a name for the object
|
//Create a name for the object
|
||||||
const newObjectName = 'Test Event Generator';
|
const newObjectName = 'Test Event Generator';
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Event Message Generator',
|
type: 'Event Message Generator',
|
||||||
name: newObjectName
|
name: newObjectName
|
||||||
});
|
|
||||||
|
|
||||||
//Assertions against newly created object which define standard behavior
|
|
||||||
await expect(page.waitForURL(/.*&view=table/)).toBeTruthy();
|
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Assertions against newly created object which define standard behavior
|
||||||
|
await expect(page.waitForURL(/.*&view=table/)).toBeTruthy();
|
||||||
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(newObjectName);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Example Event Generator Telemetry Event Verficiation', () => {
|
test.describe('Example Event Generator Telemetry Event Verification', () => {
|
||||||
|
test.fixme('telemetry is coming in for test event', async ({ page }) => {
|
||||||
test.fixme('telemetry is coming in for test event', async ({ page }) => {
|
|
||||||
// Go to object created in step one
|
// Go to object created in step one
|
||||||
// Verify the telemetry table is filled with > 1 row
|
// Verify the telemetry table is filled with > 1 row
|
||||||
});
|
});
|
||||||
test.fixme('telemetry is sorted by time ascending', async ({ page }) => {
|
test.fixme('telemetry is sorted by time ascending', async ({ page }) => {
|
||||||
// Go to object created in step one
|
// Go to object created in step one
|
||||||
// Verify the telemetry table has a class with "is-sorting asc"
|
// Verify the telemetry table has a class with "is-sorting asc"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -27,93 +27,113 @@ This test suite is dedicated to tests which verify the basic operations surround
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('Sine Wave Generator', () => {
|
test.describe('Sine Wave Generator', () => {
|
||||||
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({ page, browserName }) => {
|
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
page,
|
||||||
test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
|
browserName
|
||||||
|
}) => {
|
||||||
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
|
test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
|
||||||
|
|
||||||
//Go to baseURL
|
//Go to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
//Click the Create button
|
//Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
// Click Sine Wave Generator
|
// Click Sine Wave Generator
|
||||||
await page.click('text=Sine Wave Generator');
|
await page.click('text=Sine Wave Generator');
|
||||||
|
|
||||||
// Verify that the each required field has required indicator
|
// Verify that the each required field has required indicator
|
||||||
// Title
|
// Title
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
||||||
|
|
||||||
// Verify that the Notes row does not have a required indicator
|
// Verify that the Notes row does not have a required indicator
|
||||||
await expect(page.locator('.c-form__section div:nth-child(3) .form-row .c-form-row__state-indicator')).not.toContain('.req');
|
await expect(
|
||||||
await page.locator('textarea[type="text"]').fill('Optional Note Text');
|
page.locator('.c-form__section div:nth-child(3) .form-row .c-form-row__state-indicator')
|
||||||
|
).not.toContain('.req');
|
||||||
|
await page.locator('textarea[type="text"]').fill('Optional Note Text');
|
||||||
|
|
||||||
// Period
|
// Period
|
||||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Amplitude
|
// Amplitude
|
||||||
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Offset
|
// Offset
|
||||||
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Data Rate
|
// Data Rate
|
||||||
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Phase
|
// Phase
|
||||||
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Randomness
|
// Randomness
|
||||||
await expect(page.locator('div:nth-child(9) .c-form-row__state-indicator')).toHaveClass(/req/);
|
await expect(page.locator('div:nth-child(9) .c-form-row__state-indicator')).toHaveClass(/req/);
|
||||||
|
|
||||||
// Verify that by removing value from required text field shows invalid indicator
|
// Verify that by removing value from required text field shows invalid indicator
|
||||||
await page.locator('text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]').fill('');
|
await page
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
.locator(
|
||||||
|
'text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]'
|
||||||
|
)
|
||||||
|
.fill('');
|
||||||
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
||||||
|
|
||||||
// Verify that by adding value to empty required text field changes invalid to valid indicator
|
// Verify that by adding value to empty required text field changes invalid to valid indicator
|
||||||
await page.locator('text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]').fill('New Sine Wave Generator');
|
await page
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
.locator(
|
||||||
|
'text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]'
|
||||||
|
)
|
||||||
|
.fill('New Sine Wave Generator');
|
||||||
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
||||||
|
|
||||||
// Verify that by removing value from required number field shows invalid indicator
|
// Verify that by removing value from required number field shows invalid indicator
|
||||||
await page.locator('.field.control.l-input-sm input').first().fill('');
|
await page.locator('.field.control.l-input-sm input').first().fill('');
|
||||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/invalid/);
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(
|
||||||
|
/invalid/
|
||||||
|
);
|
||||||
|
|
||||||
// Verify that by adding value to empty required number field changes invalid to valid indicator
|
// Verify that by adding value to empty required number field changes invalid to valid indicator
|
||||||
await page.locator('.field.control.l-input-sm input').first().fill('3');
|
await page.locator('.field.control.l-input-sm input').first().fill('3');
|
||||||
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/valid/);
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(
|
||||||
|
/valid/
|
||||||
|
);
|
||||||
|
|
||||||
// Verify that can change value of number field by up/down arrows keys
|
// Verify that can change value of number field by up/down arrows keys
|
||||||
// Click .field.control.l-input-sm input >> nth=0
|
// Click .field.control.l-input-sm input >> nth=0
|
||||||
await page.locator('.field.control.l-input-sm input').first().click();
|
await page.locator('.field.control.l-input-sm input').first().click();
|
||||||
// Press ArrowUp 3 times to change value from 3 to 6
|
// Press ArrowUp 3 times to change value from 3 to 6
|
||||||
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
||||||
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
||||||
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
||||||
|
|
||||||
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
||||||
await expect(value).toBe('6');
|
await expect(value).toBe('6');
|
||||||
|
|
||||||
//Click text=OK
|
//Click text=OK
|
||||||
await Promise.all([
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('button:has-text("OK")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Verify that the Sine Wave Generator is displayed and correct
|
// Verify that the Sine Wave Generator is displayed and correct
|
||||||
// Verify object properties
|
// Verify object properties
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText('New Sine Wave Generator');
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(
|
||||||
|
'New Sine Wave Generator'
|
||||||
|
);
|
||||||
|
|
||||||
// Verify canvas rendered and can be interacted with
|
// Verify canvas rendered and can be interacted with
|
||||||
await page.locator('canvas').nth(1).click({
|
await page
|
||||||
position: {
|
.locator('canvas')
|
||||||
x: 341,
|
.nth(1)
|
||||||
y: 28
|
.click({
|
||||||
}
|
position: {
|
||||||
});
|
x: 341,
|
||||||
|
y: 28
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Verify that where we click on canvas shows the number we clicked on
|
// Verify that where we click on canvas shows the number we clicked on
|
||||||
// Note that any number will do, we just care that a number exists
|
// Note that any number will do, we just care that a number exists
|
||||||
await expect(page.locator('.value-to-display-nearestValue')).toContainText(/[+-]?([0-9]*[.])?[0-9]+/);
|
await expect(page.locator('.value-to-display-nearestValue')).toContainText(
|
||||||
|
/[+-]?([0-9]*[.])?[0-9]+/
|
||||||
});
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify form functionality in isolation
|
This test suite is dedicated to tests which verify form functionality in isolation
|
||||||
*/
|
*/
|
||||||
@ -34,246 +34,269 @@ const jsonFilePath = 'e2e/test-data/ExampleLayouts.json';
|
|||||||
const imageFilePath = 'e2e/test-data/rick.jpg';
|
const imageFilePath = 'e2e/test-data/rick.jpg';
|
||||||
|
|
||||||
test.describe('Form Validation Behavior', () => {
|
test.describe('Form Validation Behavior', () => {
|
||||||
test('Required Field indicators appear if title is empty and can be corrected', async ({ page }) => {
|
test('Required Field indicators appear if title is empty and can be corrected', async ({
|
||||||
//Go to baseURL
|
page
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
}) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
await page.click(':nth-match(:text("Folder"), 2)');
|
await page.getByRole('menuitem', { name: ' Folder' }).click();
|
||||||
|
|
||||||
// Fill in empty string into title and trigger validation with 'Tab'
|
// Fill in empty string into title and trigger validation with 'Tab'
|
||||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
await page.click('text=Properties Title Notes >> input[type="text"]');
|
||||||
await page.fill('text=Properties Title Notes >> input[type="text"]', '');
|
await page.fill('text=Properties Title Notes >> input[type="text"]', '');
|
||||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
||||||
|
|
||||||
//Required Field Form Validation
|
//Required Field Form Validation
|
||||||
await expect(page.locator('button:has-text("OK")')).toBeDisabled();
|
await expect(page.locator('button:has-text("OK")')).toBeDisabled();
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
||||||
|
|
||||||
//Correct Form Validation for missing title and trigger validation with 'Tab'
|
//Correct Form Validation for missing title and trigger validation with 'Tab'
|
||||||
await page.click('text=Properties Title Notes >> input[type="text"]');
|
await page.click('text=Properties Title Notes >> input[type="text"]');
|
||||||
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
await page.fill('text=Properties Title Notes >> input[type="text"]', TEST_FOLDER);
|
||||||
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
|
||||||
|
|
||||||
//Required Field Form Validation is corrected
|
//Required Field Form Validation is corrected
|
||||||
await expect(page.locator('button:has-text("OK")')).toBeEnabled();
|
await expect(page.locator('button:has-text("OK")')).toBeEnabled();
|
||||||
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
|
||||||
|
|
||||||
//Finish Creating Domain Object
|
//Finish Creating Domain Object
|
||||||
await Promise.all([
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('button:has-text("OK")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Verify that the Domain Object has been created with the corrected title property
|
//Verify that the Domain Object has been created with the corrected title property
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(TEST_FOLDER);
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(TEST_FOLDER);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Form File Input Behavior', () => {
|
test.describe('Form File Input Behavior', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addInitFileInputObject.js') });
|
path: path.join(__dirname, '../../helper', 'addInitFileInputObject.js')
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('Can select a JSON file type', async ({ page }) => {
|
test('Can select a JSON file type', async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.getByRole('button', { name: ' Create ' }).click();
|
await page.getByRole('button', { name: ' Create ' }).click();
|
||||||
await page.getByRole('menuitem', { name: 'JSON File Input Object' }).click();
|
await page.getByRole('menuitem', { name: 'JSON File Input Object' }).click();
|
||||||
|
|
||||||
await page.setInputFiles('#fileElem', jsonFilePath);
|
await page.setInputFiles('#fileElem', jsonFilePath);
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Save' }).click();
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
const type = await page.locator('#file-input-type').textContent();
|
const type = await page.locator('#file-input-type').textContent();
|
||||||
await expect(type).toBe(`"string"`);
|
await expect(type).toBe(`"string"`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can select an image file type', async ({ page }) => {
|
test('Can select an image file type', async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.getByRole('button', { name: ' Create ' }).click();
|
await page.getByRole('button', { name: ' Create ' }).click();
|
||||||
await page.getByRole('menuitem', { name: 'Image File Input Object' }).click();
|
await page.getByRole('menuitem', { name: 'Image File Input Object' }).click();
|
||||||
|
|
||||||
await page.setInputFiles('#fileElem', imageFilePath);
|
await page.setInputFiles('#fileElem', imageFilePath);
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Save' }).click();
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
const type = await page.locator('#file-input-type').textContent();
|
const type = await page.locator('#file-input-type').textContent();
|
||||||
await expect(type).toBe(`"object"`);
|
await expect(type).toBe(`"object"`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Persistence operations @addInit', () => {
|
test.describe('Persistence operations @addInit', () => {
|
||||||
// add non persistable root item
|
// add non persistable root item
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') });
|
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js')
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('Persistability should be respected in the create form location field', async ({ page }) => {
|
test('Persistability should be respected in the create form location field', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/4323'
|
description: 'https://github.com/nasa/openmct/issues/4323'
|
||||||
});
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
await page.click('text=Condition Set');
|
|
||||||
|
|
||||||
await page.locator('form[name="mctForm"] >> text=Persistence Testing').click();
|
|
||||||
|
|
||||||
const okButton = page.locator('button:has-text("OK")');
|
|
||||||
await expect(okButton).toBeDisabled();
|
|
||||||
});
|
});
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
await page.click('text=Condition Set');
|
||||||
|
|
||||||
|
await page.locator('form[name="mctForm"] >> text=Persistence Testing').click();
|
||||||
|
|
||||||
|
const okButton = page.locator('button:has-text("OK")');
|
||||||
|
await expect(okButton).toBeDisabled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Persistence operations @couchdb', () => {
|
test.describe('Persistence operations @couchdb', () => {
|
||||||
test.use({ failOnConsoleError: false });
|
test.use({ failOnConsoleError: false });
|
||||||
test('Editing object properties should generate a single persistence operation', async ({ page }) => {
|
test('Editing object properties should generate a single persistence operation', async ({
|
||||||
test.info().annotations.push({
|
page
|
||||||
type: 'issue',
|
}) => {
|
||||||
description: 'https://github.com/nasa/openmct/issues/5616'
|
test.info().annotations.push({
|
||||||
});
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5616'
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create a new 'Clock' object with default settings
|
|
||||||
const clock = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Clock'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Count all persistence operations (PUT requests) for this specific object
|
|
||||||
let putRequestCount = 0;
|
|
||||||
page.on('request', req => {
|
|
||||||
if (req.method() === 'PUT' && req.url().endsWith(clock.uuid)) {
|
|
||||||
putRequestCount += 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Open the edit form for the clock object
|
|
||||||
await page.click('button[title="More options"]');
|
|
||||||
await page.click('li[title="Edit properties of this object."]');
|
|
||||||
|
|
||||||
// Modify the display format from default 12hr -> 24hr and click 'Save'
|
|
||||||
await page.locator('select[aria-label="12 or 24 hour clock"]').selectOption({ value: 'clock24' });
|
|
||||||
await page.click('button[aria-label="Save"]');
|
|
||||||
|
|
||||||
await expect.poll(() => putRequestCount, {
|
|
||||||
message: 'Verify a single PUT request was made to persist the object',
|
|
||||||
timeout: 1000
|
|
||||||
}).toEqual(1);
|
|
||||||
});
|
});
|
||||||
test('Can create an object after a conflict error @couchdb @2p', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5982'
|
|
||||||
});
|
|
||||||
|
|
||||||
const page2 = await page.context().newPage();
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Both pages: Go to baseURL
|
// Create a new 'Clock' object with default settings
|
||||||
await Promise.all([
|
const clock = await createDomainObjectWithDefaults(page, {
|
||||||
page.goto('./', { waitUntil: 'networkidle' }),
|
type: 'Clock'
|
||||||
page2.goto('./', { waitUntil: 'networkidle' })
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Both pages: Click the Create button
|
|
||||||
await Promise.all([
|
|
||||||
page.click('button:has-text("Create")'),
|
|
||||||
page2.click('button:has-text("Create")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Both pages: Click "Clock" in the Create menu
|
|
||||||
await Promise.all([
|
|
||||||
page.click(`li[role='menuitem']:text("Clock")`),
|
|
||||||
page2.click(`li[role='menuitem']:text("Clock")`)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Generate unique names for both objects
|
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
|
||||||
const nameInput2 = page2.locator('form[name="mctForm"] .first input[type="text"]');
|
|
||||||
|
|
||||||
// Both pages: Fill in the 'Name' form field.
|
|
||||||
await Promise.all([
|
|
||||||
nameInput.fill(""),
|
|
||||||
nameInput.fill(`Clock:${genUuid()}`),
|
|
||||||
nameInput2.fill(""),
|
|
||||||
nameInput2.fill(`Clock:${genUuid()}`)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Both pages: Fill the "Notes" section with information about the
|
|
||||||
// currently running test and its project.
|
|
||||||
const testNotes = page.testNotes;
|
|
||||||
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
|
||||||
const notesInput2 = page2.locator('form[name="mctForm"] #notes-textarea');
|
|
||||||
await Promise.all([
|
|
||||||
notesInput.fill(testNotes),
|
|
||||||
notesInput2.fill(testNotes)
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Page 2: Click "OK" to create the domain object and wait for navigation.
|
|
||||||
// This will update the composition of the parent folder, setting the
|
|
||||||
// conditions for a conflict error from the first page.
|
|
||||||
await Promise.all([
|
|
||||||
page2.waitForLoadState(),
|
|
||||||
page2.click('[aria-label="Save"]'),
|
|
||||||
// Wait for Save Banner to appear
|
|
||||||
page2.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Close Page 2, we're done with it.
|
|
||||||
await page2.close();
|
|
||||||
|
|
||||||
// Page 1: Click "OK" to create the domain object and wait for navigation.
|
|
||||||
// This will trigger a conflict error upon attempting to update
|
|
||||||
// the composition of the parent folder.
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForLoadState(),
|
|
||||||
page.click('[aria-label="Save"]'),
|
|
||||||
// Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Page 1: Verify that the conflict has occurred and an error notification is displayed.
|
|
||||||
await expect(page.locator('.c-message-banner__message', {
|
|
||||||
hasText: "Conflict detected while saving mine"
|
|
||||||
})).toBeVisible();
|
|
||||||
|
|
||||||
// Page 1: Start logging console errors from this point on
|
|
||||||
let errors = [];
|
|
||||||
page.on('console', (msg) => {
|
|
||||||
if (msg.type() === 'error') {
|
|
||||||
errors.push(msg.text());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Page 1: Try to create a clock with the page that received the conflict.
|
|
||||||
const clockAfterConflict = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Clock'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Page 1: Wait for save progress dialog to appear/disappear
|
|
||||||
await page.locator('.c-message-banner__message', {
|
|
||||||
hasText: 'Do not navigate away from this page or close this browser tab while this message is displayed.',
|
|
||||||
state: 'visible'
|
|
||||||
}).waitFor({ state: 'hidden' });
|
|
||||||
|
|
||||||
// Page 1: Navigate to 'My Items' and verify that the second clock was created
|
|
||||||
await page.goto('./#/browse/mine');
|
|
||||||
await expect(page.locator(`.c-grid-item__name[title="${clockAfterConflict.name}"]`)).toBeVisible();
|
|
||||||
|
|
||||||
// Verify no console errors occurred
|
|
||||||
expect(errors).toHaveLength(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Count all persistence operations (PUT requests) for this specific object
|
||||||
|
let putRequestCount = 0;
|
||||||
|
page.on('request', (req) => {
|
||||||
|
if (req.method() === 'PUT' && req.url().endsWith(clock.uuid)) {
|
||||||
|
putRequestCount += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Open the edit form for the clock object
|
||||||
|
await page.click('button[title="More options"]');
|
||||||
|
await page.click('li[title="Edit properties of this object."]');
|
||||||
|
|
||||||
|
// Modify the display format from default 12hr -> 24hr and click 'Save'
|
||||||
|
await page
|
||||||
|
.locator('select[aria-label="12 or 24 hour clock"]')
|
||||||
|
.selectOption({ value: 'clock24' });
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
await expect
|
||||||
|
.poll(() => putRequestCount, {
|
||||||
|
message: 'Verify a single PUT request was made to persist the object',
|
||||||
|
timeout: 1000
|
||||||
|
})
|
||||||
|
.toEqual(1);
|
||||||
|
});
|
||||||
|
test('Can create an object after a conflict error @couchdb @2p', async ({
|
||||||
|
page,
|
||||||
|
openmctConfig
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5982'
|
||||||
|
});
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
// Instantiate a second page/tab
|
||||||
|
const page2 = await page.context().newPage();
|
||||||
|
|
||||||
|
// Both pages: Go to baseURL
|
||||||
|
await Promise.all([
|
||||||
|
page.goto('./', { waitUntil: 'networkidle' }),
|
||||||
|
page2.goto('./', { waitUntil: 'networkidle' })
|
||||||
|
]);
|
||||||
|
|
||||||
|
//Slow down the test a bit
|
||||||
|
await expect(
|
||||||
|
page.getByRole('button', { name: `Expand ${myItemsFolderName} folder` })
|
||||||
|
).toBeVisible();
|
||||||
|
await expect(
|
||||||
|
page2.getByRole('button', { name: `Expand ${myItemsFolderName} folder` })
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Both pages: Click the Create button
|
||||||
|
await Promise.all([
|
||||||
|
page.click('button:has-text("Create")'),
|
||||||
|
page2.click('button:has-text("Create")')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Both pages: Click "Clock" in the Create menu
|
||||||
|
await Promise.all([
|
||||||
|
page.click(`li[role='menuitem']:text("Clock")`),
|
||||||
|
page2.click(`li[role='menuitem']:text("Clock")`)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Generate unique names for both objects
|
||||||
|
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
|
const nameInput2 = page2.locator('form[name="mctForm"] .first input[type="text"]');
|
||||||
|
|
||||||
|
// Both pages: Fill in the 'Name' form field.
|
||||||
|
await Promise.all([
|
||||||
|
nameInput.fill(''),
|
||||||
|
nameInput.fill(`Clock:${genUuid()}`),
|
||||||
|
nameInput2.fill(''),
|
||||||
|
nameInput2.fill(`Clock:${genUuid()}`)
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Both pages: Fill the "Notes" section with information about the
|
||||||
|
// currently running test and its project.
|
||||||
|
const testNotes = page.testNotes;
|
||||||
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
const notesInput2 = page2.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
await Promise.all([notesInput.fill(testNotes), notesInput2.fill(testNotes)]);
|
||||||
|
|
||||||
|
// Page 2: Click "OK" to create the domain object and wait for navigation.
|
||||||
|
// This will update the composition of the parent folder, setting the
|
||||||
|
// conditions for a conflict error from the first page.
|
||||||
|
await Promise.all([
|
||||||
|
page2.waitForLoadState(),
|
||||||
|
page2.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page2.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Close Page 2, we're done with it.
|
||||||
|
await page2.close();
|
||||||
|
|
||||||
|
// Page 1: Click "OK" to create the domain object and wait for navigation.
|
||||||
|
// This will trigger a conflict error upon attempting to update
|
||||||
|
// the composition of the parent folder.
|
||||||
|
await Promise.all([
|
||||||
|
page.waitForLoadState(),
|
||||||
|
page.click('[aria-label="Save"]'),
|
||||||
|
// Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Page 1: Verify that the conflict has occurred and an error notification is displayed.
|
||||||
|
await expect(
|
||||||
|
page.locator('.c-message-banner__message', {
|
||||||
|
hasText: 'Conflict detected while saving mine'
|
||||||
|
})
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Page 1: Start logging console errors from this point on
|
||||||
|
let errors = [];
|
||||||
|
page.on('console', (msg) => {
|
||||||
|
if (msg.type() === 'error') {
|
||||||
|
errors.push(msg.text());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Page 1: Try to create a clock with the page that received the conflict.
|
||||||
|
const clockAfterConflict = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Clock'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Page 1: Wait for save progress dialog to appear/disappear
|
||||||
|
await page
|
||||||
|
.locator('.c-message-banner__message', {
|
||||||
|
hasText:
|
||||||
|
'Do not navigate away from this page or close this browser tab while this message is displayed.',
|
||||||
|
state: 'visible'
|
||||||
|
})
|
||||||
|
.waitFor({ state: 'hidden' });
|
||||||
|
|
||||||
|
// Page 1: Navigate to 'My Items' and verify that the second clock was created
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
await expect(
|
||||||
|
page.locator(`.c-grid-item__name[title="${clockAfterConflict.name}"]`)
|
||||||
|
).toBeVisible();
|
||||||
|
|
||||||
|
// Verify no console errors occurred
|
||||||
|
expect(errors).toHaveLength(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Form Correctness by Object Type', () => {
|
test.describe('Form Correctness by Object Type', () => {
|
||||||
test.fixme('Verify correct behavior of number object (SWG)', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object (SWG)', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Timer', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Timer', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Plan View', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Plan View', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Clock', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Clock', async ({ page }) => {});
|
||||||
test.fixme('Verify correct behavior of number object Hyperlink', async ({page}) => {});
|
test.fixme('Verify correct behavior of number object Hyperlink', async ({ page }) => {});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify persistability checks
|
This test suite is dedicated to tests which verify persistability checks
|
||||||
*/
|
*/
|
||||||
@ -29,22 +29,31 @@ const { test, expect } = require('../../baseFixtures.js');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
test.describe('Persistence operations @addInit', () => {
|
test.describe('Persistence operations @addInit', () => {
|
||||||
// add non persistable root item
|
// add non persistable root item
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addNoneditableObject.js') });
|
path: path.join(__dirname, '../../helper', 'addNoneditableObject.js')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Non-persistable objects should not show persistence related actions', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await page.locator('text=Persistence Testing').first().click({
|
||||||
|
button: 'right'
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Non-persistable objects should not show persistence related actions', async ({ page }) => {
|
const menuOptions = page.locator('.c-menu li');
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
await page.locator('text=Persistence Testing').first().click({
|
await expect.soft(menuOptions).toContainText(['Open In New Tab', 'View', 'Create Link']);
|
||||||
button: 'right'
|
await expect(menuOptions).not.toContainText([
|
||||||
});
|
'Move',
|
||||||
|
'Duplicate',
|
||||||
const menuOptions = page.locator('.c-menu li');
|
'Remove',
|
||||||
|
'Add New Folder',
|
||||||
await expect.soft(menuOptions).toContainText(['Open In New Tab', 'View', 'Create Link']);
|
'Edit Properties...',
|
||||||
await expect(menuOptions).not.toContainText(['Move', 'Duplicate', 'Remove', 'Add New Folder', 'Edit Properties...', 'Export as JSON', 'Import from JSON']);
|
'Export as JSON',
|
||||||
});
|
'Import from JSON'
|
||||||
|
]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,276 +1,303 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance with the License.
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
* Open MCT includes source code licensed under additional open source
|
* Open MCT includes source code licensed under additional open source
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
|
This test suite is dedicated to tests which verify the basic operations surrounding moving & linking objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||||
|
|
||||||
test.describe('Move & link item tests', () => {
|
test.describe('Move & link item tests', () => {
|
||||||
test('Create a basic object and verify that it can be moved to another folder', async ({ page, openmctConfig }) => {
|
test('Create a basic object and verify that it can be moved to another folder', async ({
|
||||||
const { myItemsFolderName } = openmctConfig;
|
page,
|
||||||
|
openmctConfig
|
||||||
// Go to Open MCT
|
}) => {
|
||||||
await page.goto('./');
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
|
||||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
// Go to Open MCT
|
||||||
type: 'Folder',
|
await page.goto('./');
|
||||||
name: 'Parent Folder'
|
|
||||||
});
|
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
type: 'Folder',
|
||||||
type: 'Folder',
|
name: 'Parent Folder'
|
||||||
name: 'Child Folder',
|
});
|
||||||
parent: parentFolder.uuid
|
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Folder',
|
||||||
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
name: 'Child Folder',
|
||||||
type: 'Folder',
|
parent: parentFolder.uuid
|
||||||
name: 'Grandchild Folder',
|
});
|
||||||
parent: childFolder.uuid
|
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Folder',
|
||||||
|
name: 'Grandchild Folder',
|
||||||
// Attempt to move parent to its own grandparent
|
parent: childFolder.uuid
|
||||||
await page.locator('button[title="Show selected item in tree"]').click();
|
});
|
||||||
|
|
||||||
const treePane = page.getByRole('tree', {
|
// Attempt to move parent to its own grandparent
|
||||||
name: 'Main Tree'
|
await page.locator('button[title="Show selected item in tree"]').click();
|
||||||
});
|
|
||||||
await treePane.getByRole('treeitem', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: 'Parent Folder'
|
name: 'Main Tree'
|
||||||
}).click({
|
});
|
||||||
button: 'right'
|
await treePane
|
||||||
});
|
.getByRole('treeitem', {
|
||||||
|
name: 'Parent Folder'
|
||||||
await page.getByRole('menuitem', {
|
})
|
||||||
name: /Move/
|
.click({
|
||||||
}).click();
|
button: 'right'
|
||||||
|
});
|
||||||
const createModalTree = page.getByRole('tree', {
|
|
||||||
name: "Create Modal Tree"
|
await page
|
||||||
});
|
.getByRole('menuitem', {
|
||||||
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
name: /Move/
|
||||||
name: myItemsFolderName
|
})
|
||||||
});
|
.click();
|
||||||
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
|
||||||
await myItemsLocatorTreeItem.click();
|
const createModalTree = page.getByRole('tree', {
|
||||||
|
name: 'Create Modal Tree'
|
||||||
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
});
|
||||||
name: parentFolder.name
|
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
});
|
name: myItemsFolderName
|
||||||
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
});
|
||||||
await parentFolderLocatorTreeItem.click();
|
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await myItemsLocatorTreeItem.click();
|
||||||
|
|
||||||
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
name: new RegExp(childFolder.name)
|
name: parentFolder.name
|
||||||
});
|
});
|
||||||
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await childFolderLocatorTreeItem.click();
|
await parentFolderLocatorTreeItem.click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
|
||||||
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
name: grandchildFolder.name
|
name: new RegExp(childFolder.name)
|
||||||
});
|
});
|
||||||
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await grandchildFolderLocatorTreeItem.click();
|
await childFolderLocatorTreeItem.click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
|
||||||
await parentFolderLocatorTreeItem.click();
|
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
name: grandchildFolder.name
|
||||||
await page.locator('[aria-label="Cancel"]').click();
|
});
|
||||||
|
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
// Move Child Folder from Parent Folder to My Items
|
await grandchildFolderLocatorTreeItem.click();
|
||||||
await treePane.getByRole('treeitem', {
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
name: new RegExp(childFolder.name)
|
|
||||||
}).click({
|
await parentFolderLocatorTreeItem.click();
|
||||||
button: 'right'
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
});
|
await page.locator('[aria-label="Cancel"]').click();
|
||||||
await page.getByRole('menuitem', {
|
|
||||||
name: /Move/
|
// Move Child Folder from Parent Folder to My Items
|
||||||
}).click();
|
await treePane
|
||||||
await myItemsLocatorTreeItem.click();
|
.getByRole('treeitem', {
|
||||||
|
name: new RegExp(childFolder.name)
|
||||||
await page.locator('[aria-label="Save"]').click();
|
})
|
||||||
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
.click({
|
||||||
name: myItemsFolderName
|
button: 'right'
|
||||||
});
|
});
|
||||||
|
await page
|
||||||
// Expect that Child Folder is in My Items, the root folder
|
.getByRole('menuitem', {
|
||||||
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
name: /Move/
|
||||||
});
|
})
|
||||||
test('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({ page, openmctConfig }) => {
|
.click();
|
||||||
const { myItemsFolderName } = openmctConfig;
|
await myItemsLocatorTreeItem.click();
|
||||||
|
|
||||||
// Go to Open MCT
|
await page.locator('[aria-label="Save"]').click();
|
||||||
await page.goto('./');
|
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: myItemsFolderName
|
||||||
// Create Telemetry Table
|
});
|
||||||
let telemetryTable = 'Test Telemetry Table';
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
// Expect that Child Folder is in My Items, the root folder
|
||||||
await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
|
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
});
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
|
test('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({
|
||||||
|
page,
|
||||||
await page.locator('button:has-text("OK")').click();
|
openmctConfig
|
||||||
|
}) => {
|
||||||
// Finish editing and save Telemetry Table
|
const { myItemsFolderName } = openmctConfig;
|
||||||
await page.locator('.c-button--menu.c-button--major.icon-save').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
// Go to Open MCT
|
||||||
|
await page.goto('./');
|
||||||
// Create New Folder Basic Domain Object
|
|
||||||
let folder = 'Test Folder';
|
// Create Telemetry Table
|
||||||
await page.locator('button:has-text("Create")').click();
|
let telemetryTable = 'Test Telemetry Table';
|
||||||
await page.locator('li[role="menuitem"]:has-text("Folder")').click();
|
await page.locator('button:has-text("Create")').click();
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
|
||||||
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
|
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||||
|
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
|
||||||
// See if it's possible to put the folder in the Telemetry object during creation (Soft Assert)
|
|
||||||
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
await page.locator('button:has-text("OK")').click();
|
||||||
let okButton = page.locator('button.c-button.c-button--major:has-text("OK")');
|
|
||||||
let okButtonStateDisabled = await okButton.isDisabled();
|
// Finish editing and save Telemetry Table
|
||||||
expect.soft(okButtonStateDisabled).toBeTruthy();
|
await page.locator('.c-button--menu.c-button--major.icon-save').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
// Continue test regardless of assertion and create it in My Items
|
|
||||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
// Create New Folder Basic Domain Object
|
||||||
await page.locator('button:has-text("OK")').click();
|
let folder = 'Test Folder';
|
||||||
|
await page.locator('button:has-text("Create")').click();
|
||||||
// Open My Items
|
await page.locator('li[role="menuitem"]:has-text("Folder")').click();
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
await page.locator('text=Properties Title Notes >> input[type="text"]').click();
|
||||||
|
await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
|
||||||
// Select Folder Object and select Move from context menu
|
|
||||||
await Promise.all([
|
// See if it's possible to put the folder in the Telemetry object during creation (Soft Assert)
|
||||||
page.waitForNavigation(),
|
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
||||||
page.locator(`a:has-text("${folder}")`).click()
|
let okButton = page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||||
]);
|
let okButtonStateDisabled = await okButton.isDisabled();
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-tree__item__label .c-tree__item__type-icon').click({
|
expect.soft(okButtonStateDisabled).toBeTruthy();
|
||||||
button: 'right'
|
|
||||||
});
|
// Continue test regardless of assertion and create it in My Items
|
||||||
await page.locator('li.icon-move').click();
|
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
// See if it's possible to put the folder in the Telemetry object after creation
|
|
||||||
await page.locator(`text=Location Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
// Open My Items
|
||||||
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||||
let okButton2 = page.locator('button.c-button.c-button--major:has-text("OK")');
|
|
||||||
let okButtonStateDisabled2 = await okButton2.isDisabled();
|
// Select Folder Object and select Move from context menu
|
||||||
expect(okButtonStateDisabled2).toBeTruthy();
|
await Promise.all([page.waitForNavigation(), page.locator(`a:has-text("${folder}")`).click()]);
|
||||||
});
|
await page
|
||||||
|
.locator('.c-tree__item.is-navigated-object .c-tree__item__label .c-tree__item__type-icon')
|
||||||
test('Create a basic object and verify that it can be linked to another folder', async ({ page, openmctConfig }) => {
|
.click({
|
||||||
const { myItemsFolderName } = openmctConfig;
|
button: 'right'
|
||||||
|
});
|
||||||
// Go to Open MCT
|
await page.locator('li.icon-move').click();
|
||||||
await page.goto('./');
|
|
||||||
|
// See if it's possible to put the folder in the Telemetry object after creation
|
||||||
const parentFolder = await createDomainObjectWithDefaults(page, {
|
await page.locator(`text=Location Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
||||||
type: 'Folder',
|
await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
|
||||||
name: 'Parent Folder'
|
let okButton2 = page.locator('button.c-button.c-button--major:has-text("OK")');
|
||||||
});
|
let okButtonStateDisabled2 = await okButton2.isDisabled();
|
||||||
const childFolder = await createDomainObjectWithDefaults(page, {
|
expect(okButtonStateDisabled2).toBeTruthy();
|
||||||
type: 'Folder',
|
});
|
||||||
name: 'Child Folder',
|
|
||||||
parent: parentFolder.uuid
|
test('Create a basic object and verify that it can be linked to another folder', async ({
|
||||||
});
|
page,
|
||||||
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
openmctConfig
|
||||||
type: 'Folder',
|
}) => {
|
||||||
name: 'Grandchild Folder',
|
const { myItemsFolderName } = openmctConfig;
|
||||||
parent: childFolder.uuid
|
|
||||||
});
|
// Go to Open MCT
|
||||||
|
await page.goto('./');
|
||||||
// Attempt to move parent to its own grandparent
|
|
||||||
await page.locator('button[title="Show selected item in tree"]').click();
|
const parentFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
const treePane = page.getByRole('tree', {
|
name: 'Parent Folder'
|
||||||
name: 'Main Tree'
|
});
|
||||||
});
|
const childFolder = await createDomainObjectWithDefaults(page, {
|
||||||
await treePane.getByRole('treeitem', {
|
type: 'Folder',
|
||||||
name: 'Parent Folder'
|
name: 'Child Folder',
|
||||||
}).click({
|
parent: parentFolder.uuid
|
||||||
button: 'right'
|
});
|
||||||
});
|
const grandchildFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
await page.getByRole('menuitem', {
|
name: 'Grandchild Folder',
|
||||||
name: /Move/
|
parent: childFolder.uuid
|
||||||
}).click();
|
});
|
||||||
|
|
||||||
const createModalTree = page.getByRole('tree', {
|
// Attempt to move parent to its own grandparent
|
||||||
name: "Create Modal Tree"
|
await page.locator('button[title="Show selected item in tree"]').click();
|
||||||
});
|
|
||||||
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: myItemsFolderName
|
name: 'Main Tree'
|
||||||
});
|
});
|
||||||
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await treePane
|
||||||
await myItemsLocatorTreeItem.click();
|
.getByRole('treeitem', {
|
||||||
|
name: 'Parent Folder'
|
||||||
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
})
|
||||||
name: parentFolder.name
|
.click({
|
||||||
});
|
button: 'right'
|
||||||
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
});
|
||||||
await parentFolderLocatorTreeItem.click();
|
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
await page
|
||||||
|
.getByRole('menuitem', {
|
||||||
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
name: /Move/
|
||||||
name: new RegExp(childFolder.name)
|
})
|
||||||
});
|
.click();
|
||||||
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
|
||||||
await childFolderLocatorTreeItem.click();
|
const createModalTree = page.getByRole('tree', {
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
name: 'Create Modal Tree'
|
||||||
|
});
|
||||||
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
name: grandchildFolder.name
|
name: myItemsFolderName
|
||||||
});
|
});
|
||||||
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await grandchildFolderLocatorTreeItem.click();
|
await myItemsLocatorTreeItem.click();
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
|
||||||
|
const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
await parentFolderLocatorTreeItem.click();
|
name: parentFolder.name
|
||||||
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
});
|
||||||
await page.locator('[aria-label="Cancel"]').click();
|
await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
|
await parentFolderLocatorTreeItem.click();
|
||||||
// Move Child Folder from Parent Folder to My Items
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
await treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(childFolder.name)
|
const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
}).click({
|
name: new RegExp(childFolder.name)
|
||||||
button: 'right'
|
});
|
||||||
});
|
await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
await page.getByRole('menuitem', {
|
await childFolderLocatorTreeItem.click();
|
||||||
name: /Link/
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
}).click();
|
|
||||||
await myItemsLocatorTreeItem.click();
|
const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
|
||||||
|
name: grandchildFolder.name
|
||||||
await page.locator('[aria-label="Save"]').click();
|
});
|
||||||
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
|
||||||
name: myItemsFolderName
|
await grandchildFolderLocatorTreeItem.click();
|
||||||
});
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
|
|
||||||
// Expect that Child Folder is in My Items, the root folder
|
await parentFolderLocatorTreeItem.click();
|
||||||
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
|
||||||
});
|
await page.locator('[aria-label="Cancel"]').click();
|
||||||
});
|
|
||||||
|
// Move Child Folder from Parent Folder to My Items
|
||||||
test.fixme('Cannot move a previously created domain object to non-peristable object in Move Modal', async ({ page }) => {
|
await treePane
|
||||||
//Create a domain object
|
.getByRole('treeitem', {
|
||||||
//Save Domain object
|
name: new RegExp(childFolder.name)
|
||||||
//Move Object and verify that cannot select non-persistable object
|
})
|
||||||
//Move Object to My Items
|
.click({
|
||||||
//Verify successful move
|
button: 'right'
|
||||||
});
|
});
|
||||||
|
await page
|
||||||
|
.getByRole('menuitem', {
|
||||||
|
name: /Link/
|
||||||
|
})
|
||||||
|
.click();
|
||||||
|
await myItemsLocatorTreeItem.click();
|
||||||
|
|
||||||
|
await page.locator('[aria-label="Save"]').click();
|
||||||
|
const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: myItemsFolderName
|
||||||
|
});
|
||||||
|
|
||||||
|
// Expect that Child Folder is in My Items, the root folder
|
||||||
|
expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.fixme(
|
||||||
|
'Cannot move a previously created domain object to non-persistable object in Move Modal',
|
||||||
|
async ({ page }) => {
|
||||||
|
//Create a domain object
|
||||||
|
//Save Domain object
|
||||||
|
//Move Object and verify that cannot select non-persistable object
|
||||||
|
//Move Object to My Items
|
||||||
|
//Verify successful move
|
||||||
|
}
|
||||||
|
);
|
||||||
|
@ -28,85 +28,91 @@ const { createDomainObjectWithDefaults, createNotification } = require('../../ap
|
|||||||
const { test, expect } = require('../../pluginFixtures');
|
const { test, expect } = require('../../pluginFixtures');
|
||||||
|
|
||||||
test.describe('Notifications List', () => {
|
test.describe('Notifications List', () => {
|
||||||
test('Notifications can be dismissed individually', async ({ page }) => {
|
test.fixme('Notifications can be dismissed individually', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/6122'
|
description: 'https://github.com/nasa/openmct/issues/6820'
|
||||||
});
|
|
||||||
|
|
||||||
// Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create an error notification with the message "Error message"
|
|
||||||
await createNotification(page, {
|
|
||||||
severity: 'error',
|
|
||||||
message: 'Error message'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create an alert notification with the message "Alert message"
|
|
||||||
await createNotification(page, {
|
|
||||||
severity: 'alert',
|
|
||||||
message: 'Alert message'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify that there is a button with aria-label "Review 2 Notifications"
|
|
||||||
expect(await page.locator('button[aria-label="Review 2 Notifications"]').count()).toBe(1);
|
|
||||||
|
|
||||||
// Click on button with aria-label "Review 2 Notifications"
|
|
||||||
await page.click('button[aria-label="Review 2 Notifications"]');
|
|
||||||
|
|
||||||
// Click on button with aria-label="Dismiss notification of Error message"
|
|
||||||
await page.click('button[aria-label="Dismiss notification of Error message"]');
|
|
||||||
|
|
||||||
// Verify there is no a notification (listitem) with the text "Error message" since it was dismissed
|
|
||||||
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).not.toContain('Error message');
|
|
||||||
|
|
||||||
// Verify there is still a notification (listitem) with the text "Alert message"
|
|
||||||
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).toContain('Alert message');
|
|
||||||
|
|
||||||
// Click on button with aria-label="Dismiss notification of Alert message"
|
|
||||||
await page.click('button[aria-label="Dismiss notification of Alert message"]');
|
|
||||||
|
|
||||||
// Verify that there is no dialog since the notification overlay was closed automatically after all notifications were dismissed
|
|
||||||
expect(await page.locator('div[role="dialog"]').count()).toBe(0);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create an error notification with the message "Error message"
|
||||||
|
await createNotification(page, {
|
||||||
|
severity: 'error',
|
||||||
|
message: 'Error message'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create an alert notification with the message "Alert message"
|
||||||
|
await createNotification(page, {
|
||||||
|
severity: 'alert',
|
||||||
|
message: 'Alert message'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Verify that there is a button with aria-label "Review 2 Notifications"
|
||||||
|
expect(await page.locator('button[aria-label="Review 2 Notifications"]').count()).toBe(1);
|
||||||
|
|
||||||
|
// Click on button with aria-label "Review 2 Notifications"
|
||||||
|
await page.click('button[aria-label="Review 2 Notifications"]');
|
||||||
|
|
||||||
|
// Click on button with aria-label="Dismiss notification of Error message"
|
||||||
|
await page.click('button[aria-label="Dismiss notification of Error message"]');
|
||||||
|
|
||||||
|
// Verify there is no a notification (listitem) with the text "Error message" since it was dismissed
|
||||||
|
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).not.toContain(
|
||||||
|
'Error message'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Verify there is still a notification (listitem) with the text "Alert message"
|
||||||
|
expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).toContain(
|
||||||
|
'Alert message'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Click on button with aria-label="Dismiss notification of Alert message"
|
||||||
|
await page.click('button[aria-label="Dismiss notification of Alert message"]');
|
||||||
|
|
||||||
|
// Verify that there is no dialog since the notification overlay was closed automatically after all notifications were dismissed
|
||||||
|
expect(await page.locator('div[role="dialog"]').count()).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Notification Overlay', () => {
|
test.describe('Notification Overlay', () => {
|
||||||
test('Closing notification list after notification banner disappeared does not cause it to open automatically', async ({ page }) => {
|
test('Closing notification list after notification banner disappeared does not cause it to open automatically', async ({
|
||||||
test.info().annotations.push({
|
page
|
||||||
type: 'issue',
|
}) => {
|
||||||
description: 'https://github.com/nasa/openmct/issues/6130'
|
test.info().annotations.push({
|
||||||
});
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6130'
|
||||||
// Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create a new Display Layout object
|
|
||||||
await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
|
|
||||||
|
|
||||||
// Click on the button "Review 1 Notification"
|
|
||||||
await page.click('button[aria-label="Review 1 Notification"]');
|
|
||||||
|
|
||||||
// Verify that Notification List is open
|
|
||||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
|
||||||
|
|
||||||
// Wait until there is no Notification Banner
|
|
||||||
await page.waitForSelector('div[role="alert"]', { state: 'detached'});
|
|
||||||
|
|
||||||
// Click on the "Close" button of the Notification List
|
|
||||||
await page.click('button[aria-label="Close"]');
|
|
||||||
|
|
||||||
// On the Display Layout object, click on the "Edit" button
|
|
||||||
await page.click('button[title="Edit"]');
|
|
||||||
|
|
||||||
// Click on the "Save" button
|
|
||||||
await page.click('button[title="Save"]');
|
|
||||||
|
|
||||||
// Click on the "Save and Finish Editing" option
|
|
||||||
await page.click('li[title="Save and Finish Editing"]');
|
|
||||||
|
|
||||||
// Verify that Notification List is NOT open
|
|
||||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create a new Display Layout object
|
||||||
|
await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
|
||||||
|
|
||||||
|
// Click on the button "Review 1 Notification"
|
||||||
|
await page.click('button[aria-label="Review 1 Notification"]');
|
||||||
|
|
||||||
|
// Verify that Notification List is open
|
||||||
|
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
||||||
|
|
||||||
|
// Wait until there is no Notification Banner
|
||||||
|
await page.waitForSelector('div[role="alert"]', { state: 'detached' });
|
||||||
|
|
||||||
|
// Click on the "Close" button of the Notification List
|
||||||
|
await page.click('button[aria-label="Close"]');
|
||||||
|
|
||||||
|
// On the Display Layout object, click on the "Edit" button
|
||||||
|
await page.click('button[title="Edit"]');
|
||||||
|
|
||||||
|
// Click on the "Save" button
|
||||||
|
await page.click('button[title="Save"]');
|
||||||
|
|
||||||
|
// Click on the "Save and Finish Editing" option
|
||||||
|
await page.click('li[title="Save and Finish Editing"]');
|
||||||
|
|
||||||
|
// Verify that Notification List is NOT open
|
||||||
|
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -20,66 +20,104 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
const { test, expect } = require('../../../pluginFixtures');
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
const { createPlanFromJSON, createDomainObjectWithDefaults, selectInspectorTab } = require('../../../appActions');
|
const { createPlanFromJSON, createDomainObjectWithDefaults } = require('../../../appActions');
|
||||||
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
||||||
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json');
|
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json');
|
||||||
const { assertPlanActivities, setBoundsToSpanAllActivities } = require('../../../helper/planningUtils');
|
const {
|
||||||
|
assertPlanActivities,
|
||||||
|
setBoundsToSpanAllActivities
|
||||||
|
} = require('../../../helper/planningUtils');
|
||||||
const { getPreciseDuration } = require('../../../../src/utils/duration');
|
const { getPreciseDuration } = require('../../../../src/utils/duration');
|
||||||
|
|
||||||
test.describe("Gantt Chart", () => {
|
test.describe('Gantt Chart', () => {
|
||||||
let ganttChart;
|
let ganttChart;
|
||||||
test.beforeEach(async ({ page }) => {
|
let plan;
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
test.beforeEach(async ({ page }) => {
|
||||||
ganttChart = await createDomainObjectWithDefaults(page, {
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
type: 'Gantt Chart'
|
ganttChart = await createDomainObjectWithDefaults(page, {
|
||||||
});
|
type: 'Gantt Chart'
|
||||||
await createPlanFromJSON(page, {
|
});
|
||||||
json: testPlan1,
|
plan = await createPlanFromJSON(page, {
|
||||||
parent: ganttChart.uuid
|
json: testPlan1,
|
||||||
});
|
parent: ganttChart.uuid
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Displays all plan events', async ({ page }) => {
|
||||||
|
await page.goto(ganttChart.url);
|
||||||
|
|
||||||
|
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
||||||
|
});
|
||||||
|
test('Replaces a plan with a new plan', async ({ page }) => {
|
||||||
|
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
||||||
|
await createPlanFromJSON(page, {
|
||||||
|
json: testPlan2,
|
||||||
|
parent: ganttChart.uuid
|
||||||
|
});
|
||||||
|
const replaceModal = page
|
||||||
|
.getByRole('dialog')
|
||||||
|
.filter({ hasText: 'This action will replace the current Plan. Do you want to continue?' });
|
||||||
|
await expect(replaceModal).toBeVisible();
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
|
||||||
|
await assertPlanActivities(page, testPlan2, ganttChart.url);
|
||||||
|
});
|
||||||
|
test('Can select a single activity and display its details in the inspector', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.slow();
|
||||||
|
await page.goto(ganttChart.url);
|
||||||
|
|
||||||
|
await setBoundsToSpanAllActivities(page, testPlan1, ganttChart.url);
|
||||||
|
|
||||||
|
const activities = Object.values(testPlan1).flat();
|
||||||
|
const activity = activities[0];
|
||||||
|
await page
|
||||||
|
.locator('g')
|
||||||
|
.filter({ hasText: new RegExp(activity.name) })
|
||||||
|
.click();
|
||||||
|
await page.getByRole('tab', { name: 'Activity' }).click();
|
||||||
|
|
||||||
|
const startDateTime = await page
|
||||||
|
.locator(
|
||||||
|
'.c-inspect-properties__label:has-text("Start DateTime")+.c-inspect-properties__value'
|
||||||
|
)
|
||||||
|
.innerText();
|
||||||
|
const endDateTime = await page
|
||||||
|
.locator('.c-inspect-properties__label:has-text("End DateTime")+.c-inspect-properties__value')
|
||||||
|
.innerText();
|
||||||
|
const duration = await page
|
||||||
|
.locator('.c-inspect-properties__label:has-text("duration")+.c-inspect-properties__value')
|
||||||
|
.innerText();
|
||||||
|
|
||||||
|
const expectedStartDate = new Date(activity.start).toISOString();
|
||||||
|
const actualStartDate = new Date(startDateTime).toISOString();
|
||||||
|
const expectedEndDate = new Date(activity.end).toISOString();
|
||||||
|
const actualEndDate = new Date(endDateTime).toISOString();
|
||||||
|
const expectedDuration = getPreciseDuration(activity.end - activity.start);
|
||||||
|
const actualDuration = duration;
|
||||||
|
|
||||||
|
expect(expectedStartDate).toEqual(actualStartDate);
|
||||||
|
expect(expectedEndDate).toEqual(actualEndDate);
|
||||||
|
expect(expectedDuration).toEqual(actualDuration);
|
||||||
|
});
|
||||||
|
test("Displays a Plan's draft status", async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6641'
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Displays all plan events", async ({ page }) => {
|
// Mark the Plan's status as draft in the OpenMCT API
|
||||||
await page.goto(ganttChart.url);
|
await page.evaluate(async (planObject) => {
|
||||||
|
await window.openmct.status.set(planObject.uuid, 'draft');
|
||||||
|
}, plan);
|
||||||
|
|
||||||
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
// Navigate to the Gantt Chart
|
||||||
});
|
await page.goto(ganttChart.url);
|
||||||
test("Replaces a plan with a new plan", async ({ page }) => {
|
|
||||||
await assertPlanActivities(page, testPlan1, ganttChart.url);
|
|
||||||
await createPlanFromJSON(page, {
|
|
||||||
json: testPlan2,
|
|
||||||
parent: ganttChart.uuid
|
|
||||||
});
|
|
||||||
const replaceModal = page.getByRole('dialog').filter({ hasText: "This action will replace the current Plan. Do you want to continue?" });
|
|
||||||
await expect(replaceModal).toBeVisible();
|
|
||||||
await page.getByRole('button', { name: 'OK' }).click();
|
|
||||||
|
|
||||||
await assertPlanActivities(page, testPlan2, ganttChart.url);
|
// Assert that the Plan's status is displayed as draft
|
||||||
});
|
expect(await page.locator('.u-contents.c-swimlane.is-status--draft').count()).toBe(
|
||||||
test("Can select a single activity and display its details in the inspector", async ({ page }) => {
|
Object.keys(testPlan1).length
|
||||||
test.slow();
|
);
|
||||||
await page.goto(ganttChart.url);
|
});
|
||||||
|
|
||||||
await setBoundsToSpanAllActivities(page, testPlan1, ganttChart.url);
|
|
||||||
|
|
||||||
const activities = Object.values(testPlan1).flat();
|
|
||||||
const activity = activities[0];
|
|
||||||
await page.locator('g').filter({ hasText: new RegExp(activity.name) }).click();
|
|
||||||
await selectInspectorTab(page, 'Activity');
|
|
||||||
|
|
||||||
const startDateTime = await page.locator('.c-inspect-properties__label:has-text("Start DateTime")+.c-inspect-properties__value').innerText();
|
|
||||||
const endDateTime = await page.locator('.c-inspect-properties__label:has-text("End DateTime")+.c-inspect-properties__value').innerText();
|
|
||||||
const duration = await page.locator('.c-inspect-properties__label:has-text("duration")+.c-inspect-properties__value').innerText();
|
|
||||||
|
|
||||||
const expectedStartDate = new Date(activity.start).toISOString();
|
|
||||||
const actualStartDate = new Date(startDateTime).toISOString();
|
|
||||||
const expectedEndDate = new Date(activity.end).toISOString();
|
|
||||||
const actualEndDate = new Date(endDateTime).toISOString();
|
|
||||||
const expectedDuration = getPreciseDuration(activity.end - activity.start);
|
|
||||||
const actualDuration = duration;
|
|
||||||
|
|
||||||
expect(expectedStartDate).toEqual(actualStartDate);
|
|
||||||
expect(expectedEndDate).toEqual(actualEndDate);
|
|
||||||
expect(expectedDuration).toEqual(actualDuration);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -24,16 +24,16 @@ const { createPlanFromJSON } = require('../../../appActions');
|
|||||||
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
|
||||||
const { assertPlanActivities } = require('../../../helper/planningUtils');
|
const { assertPlanActivities } = require('../../../helper/planningUtils');
|
||||||
|
|
||||||
test.describe("Plan", () => {
|
test.describe('Plan', () => {
|
||||||
let plan;
|
let plan;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
plan = await createPlanFromJSON(page, {
|
plan = await createPlanFromJSON(page, {
|
||||||
json: testPlan1
|
json: testPlan1
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("Displays all plan events", async ({ page }) => {
|
test('Displays all plan events', async ({ page }) => {
|
||||||
await assertPlanActivities(page, testPlan1, plan.url);
|
await assertPlanActivities(page, testPlan1, plan.url);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
124
e2e/tests/functional/planning/timelist.e2e.spec.js
Normal file
124
e2e/tests/functional/planning/timelist.e2e.spec.js
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
|
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../../appActions');
|
||||||
|
|
||||||
|
const testPlan = {
|
||||||
|
TEST_GROUP: [
|
||||||
|
{
|
||||||
|
name: 'Past event 1',
|
||||||
|
start: 1660320408000,
|
||||||
|
end: 1660343797000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 2',
|
||||||
|
start: 1660406808000,
|
||||||
|
end: 1660429160000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 3',
|
||||||
|
start: 1660493208000,
|
||||||
|
end: 1660503981000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 4',
|
||||||
|
start: 1660579608000,
|
||||||
|
end: 1660624108000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Past event 5',
|
||||||
|
start: 1660666008000,
|
||||||
|
end: 1660681529000,
|
||||||
|
type: 'TEST-GROUP',
|
||||||
|
color: 'orange',
|
||||||
|
textColor: 'white'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
test.describe('Time List', () => {
|
||||||
|
test('Create a Time List, add a single Plan to it and verify all the activities are displayed with no milliseconds', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
// Goto baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const timelist = await test.step('Create a Time List', async () => {
|
||||||
|
const createdTimeList = await createDomainObjectWithDefaults(page, { type: 'Time List' });
|
||||||
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
|
expect(objectName).toBe(createdTimeList.name);
|
||||||
|
|
||||||
|
return createdTimeList;
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Create a Plan and add it to the timelist', async () => {
|
||||||
|
const createdPlan = await createPlanFromJSON(page, {
|
||||||
|
name: 'Test Plan',
|
||||||
|
json: testPlan
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(timelist.url);
|
||||||
|
// Expand the tree to show the plan
|
||||||
|
await page.click("button[title='Show selected item in tree']");
|
||||||
|
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
|
||||||
|
await page.click("button[title='Save']");
|
||||||
|
await page.click("li[title='Save and Finish Editing']");
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
||||||
|
|
||||||
|
await page.goto(timelist.url);
|
||||||
|
|
||||||
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
|
await page.goto(
|
||||||
|
`${timelist.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=timelist.view`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Verify all events are displayed
|
||||||
|
const eventCount = await page.locator('.js-list-item').count();
|
||||||
|
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Does not show milliseconds in times', async () => {
|
||||||
|
// Get the first activity
|
||||||
|
const row = page.locator('.js-list-item').first();
|
||||||
|
// Verify that none fo the times have milliseconds displayed.
|
||||||
|
// Example: 2024-11-17T16:00:00Z is correct and 2024-11-17T16:00:00.000Z is wrong
|
||||||
|
|
||||||
|
await expect(row.locator('.--start')).not.toContainText('.');
|
||||||
|
await expect(row.locator('.--end')).not.toContainText('.');
|
||||||
|
await expect(row.locator('.--duration')).not.toContainText('.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -21,161 +21,153 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../../pluginFixtures');
|
const { test, expect } = require('../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createPlanFromJSON,
|
||||||
|
setIndependentTimeConductorBounds
|
||||||
|
} = require('../../../appActions');
|
||||||
|
|
||||||
const testPlan = {
|
const testPlan = {
|
||||||
"TEST_GROUP": [
|
TEST_GROUP: [
|
||||||
{
|
{
|
||||||
"name": "Past event 1",
|
name: 'Past event 1',
|
||||||
"start": 1660320408000,
|
start: 1660320408000,
|
||||||
"end": 1660343797000,
|
end: 1660343797000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 2",
|
name: 'Past event 2',
|
||||||
"start": 1660406808000,
|
start: 1660406808000,
|
||||||
"end": 1660429160000,
|
end: 1660429160000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 3",
|
name: 'Past event 3',
|
||||||
"start": 1660493208000,
|
start: 1660493208000,
|
||||||
"end": 1660503981000,
|
end: 1660503981000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 4",
|
name: 'Past event 4',
|
||||||
"start": 1660579608000,
|
start: 1660579608000,
|
||||||
"end": 1660624108000,
|
end: 1660624108000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Past event 5",
|
name: 'Past event 5',
|
||||||
"start": 1660666008000,
|
start: 1660666008000,
|
||||||
"end": 1660681529000,
|
end: 1660681529000,
|
||||||
"type": "TEST-GROUP",
|
type: 'TEST-GROUP',
|
||||||
"color": "orange",
|
color: 'orange',
|
||||||
"textColor": "white"
|
textColor: 'white'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
test.describe("Time Strip", () => {
|
test.describe('Time Strip', () => {
|
||||||
test("Create two Time Strips, add a single Plan to both, and verify they can have separate Indepdenent Time Contexts @unstable", async ({ page }) => {
|
test('Create two Time Strips, add a single Plan to both, and verify they can have separate Independent Time Contexts @unstable', async ({
|
||||||
test.info().annotations.push({
|
page
|
||||||
type: 'issue',
|
}) => {
|
||||||
description: 'https://github.com/nasa/openmct/issues/5627'
|
test.info().annotations.push({
|
||||||
});
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5627'
|
||||||
// Constant locators
|
|
||||||
const independentTimeConductorInputs = page.locator('.l-shell__main-independent-time-conductor .c-input--datetime');
|
|
||||||
const activityBounds = page.locator('.activity-bounds');
|
|
||||||
|
|
||||||
// Goto baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
const timestrip = await test.step("Create a Time Strip", async () => {
|
|
||||||
const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
|
|
||||||
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
|
||||||
expect(objectName).toBe(createdTimeStrip.name);
|
|
||||||
|
|
||||||
return createdTimeStrip;
|
|
||||||
});
|
|
||||||
|
|
||||||
const plan = await test.step("Create a Plan and add it to the timestrip", async () => {
|
|
||||||
const createdPlan = await createPlanFromJSON(page, {
|
|
||||||
name: 'Test Plan',
|
|
||||||
json: testPlan
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto(timestrip.url);
|
|
||||||
// Expand the tree to show the plan
|
|
||||||
await page.click("button[title='Show selected item in tree']");
|
|
||||||
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
|
|
||||||
await page.click("button[title='Save']");
|
|
||||||
await page.click("li[title='Save and Finish Editing']");
|
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
|
||||||
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
|
||||||
|
|
||||||
// Switch to fixed time mode with all plan events within the bounds
|
|
||||||
await page.goto(`${timestrip.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=time-strip.view`);
|
|
||||||
|
|
||||||
// Verify all events are displayed
|
|
||||||
const eventCount = await page.locator('.activity-bounds').count();
|
|
||||||
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
|
||||||
|
|
||||||
return createdPlan;
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step("TimeStrip can use the Independent Time Conductor", async () => {
|
|
||||||
// Activate Independent Time Conductor in Fixed Time Mode
|
|
||||||
await page.click('.c-toggle-switch__slider');
|
|
||||||
expect(await activityBounds.count()).toEqual(0);
|
|
||||||
|
|
||||||
// Set the independent time bounds so that only one event is shown
|
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
|
||||||
const endBound = testPlan.TEST_GROUP[0].end;
|
|
||||||
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
|
||||||
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
|
||||||
|
|
||||||
await independentTimeConductorInputs.nth(0).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(0).fill(startBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill(endBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
expect(await activityBounds.count()).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step("Can have multiple TimeStrips with the same plan linked and different Independent Time Contexts", async () => {
|
|
||||||
// Create another Time Strip and verify that it has been created
|
|
||||||
const createdTimeStrip = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Time Strip',
|
|
||||||
name: "Another Time Strip"
|
|
||||||
});
|
|
||||||
|
|
||||||
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
|
||||||
expect(objectName).toBe(createdTimeStrip.name);
|
|
||||||
|
|
||||||
// Drag the existing Plan onto the newly created Time Strip, and save.
|
|
||||||
await page.dragAndDrop(`role=treeitem[name=/${plan.name}/]`, '.c-object-view');
|
|
||||||
await page.click("button[title='Save']");
|
|
||||||
await page.click("li[title='Save and Finish Editing']");
|
|
||||||
|
|
||||||
// Activate Independent Time Conductor in Fixed Time Mode
|
|
||||||
await page.click('.c-toggle-switch__slider');
|
|
||||||
|
|
||||||
// All events should be displayed at this point because the
|
|
||||||
// initial independent context bounds will match the global bounds
|
|
||||||
expect(await activityBounds.count()).toEqual(5);
|
|
||||||
|
|
||||||
// Set the independent time bounds so that two events are shown
|
|
||||||
const startBound = testPlan.TEST_GROUP[0].start;
|
|
||||||
const endBound = testPlan.TEST_GROUP[1].end;
|
|
||||||
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
|
||||||
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
|
||||||
|
|
||||||
await independentTimeConductorInputs.nth(0).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(0).fill(startBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill('');
|
|
||||||
await independentTimeConductorInputs.nth(1).fill(endBoundString);
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
|
|
||||||
// Verify that two events are displayed
|
|
||||||
expect(await activityBounds.count()).toEqual(2);
|
|
||||||
|
|
||||||
// Switch to the previous Time Strip and verify that only one event is displayed
|
|
||||||
await page.goto(timestrip.url);
|
|
||||||
expect(await activityBounds.count()).toEqual(1);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Constant locators
|
||||||
|
const activityBounds = page.locator('.activity-bounds');
|
||||||
|
|
||||||
|
// Goto baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const timestrip = await test.step('Create a Time Strip', async () => {
|
||||||
|
const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
|
||||||
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
|
expect(objectName).toBe(createdTimeStrip.name);
|
||||||
|
|
||||||
|
return createdTimeStrip;
|
||||||
|
});
|
||||||
|
|
||||||
|
const plan = await test.step('Create a Plan and add it to the timestrip', async () => {
|
||||||
|
const createdPlan = await createPlanFromJSON(page, {
|
||||||
|
name: 'Test Plan',
|
||||||
|
json: testPlan
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(timestrip.url);
|
||||||
|
// Expand the tree to show the plan
|
||||||
|
await page.click("button[title='Show selected item in tree']");
|
||||||
|
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
|
||||||
|
await page.click("button[title='Save']");
|
||||||
|
await page.click("li[title='Save and Finish Editing']");
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
|
||||||
|
|
||||||
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
|
await page.goto(
|
||||||
|
`${timestrip.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=time-strip.view`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Verify all events are displayed
|
||||||
|
const eventCount = await page.locator('.activity-bounds').count();
|
||||||
|
expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
|
||||||
|
|
||||||
|
return createdPlan;
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('TimeStrip can use the Independent Time Conductor', async () => {
|
||||||
|
expect(await activityBounds.count()).toEqual(5);
|
||||||
|
|
||||||
|
// Set the independent time bounds so that only one event is shown
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[0].end;
|
||||||
|
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
||||||
|
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
||||||
|
|
||||||
|
await setIndependentTimeConductorBounds(page, startBoundString, endBoundString);
|
||||||
|
expect(await activityBounds.count()).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('Can have multiple TimeStrips with the same plan linked and different Independent Time Contexts', async () => {
|
||||||
|
// Create another Time Strip and verify that it has been created
|
||||||
|
const createdTimeStrip = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Time Strip',
|
||||||
|
name: 'Another Time Strip'
|
||||||
|
});
|
||||||
|
|
||||||
|
const objectName = await page.locator('.l-browse-bar__object-name').innerText();
|
||||||
|
expect(objectName).toBe(createdTimeStrip.name);
|
||||||
|
|
||||||
|
// Drag the existing Plan onto the newly created Time Strip, and save.
|
||||||
|
await page.dragAndDrop(`role=treeitem[name=/${plan.name}/]`, '.c-object-view');
|
||||||
|
await page.click("button[title='Save']");
|
||||||
|
await page.click("li[title='Save and Finish Editing']");
|
||||||
|
|
||||||
|
// All events should be displayed at this point because the
|
||||||
|
// initial independent context bounds will match the global bounds
|
||||||
|
expect(await activityBounds.count()).toEqual(5);
|
||||||
|
|
||||||
|
// Set the independent time bounds so that two events are shown
|
||||||
|
const startBound = testPlan.TEST_GROUP[0].start;
|
||||||
|
const endBound = testPlan.TEST_GROUP[1].end;
|
||||||
|
const startBoundString = new Date(startBound).toISOString().replace('T', ' ');
|
||||||
|
const endBoundString = new Date(endBound).toISOString().replace('T', ' ');
|
||||||
|
|
||||||
|
await setIndependentTimeConductorBounds(page, startBoundString, endBoundString);
|
||||||
|
|
||||||
|
// Verify that two events are displayed
|
||||||
|
expect(await activityBounds.count()).toEqual(2);
|
||||||
|
|
||||||
|
// Switch to the previous Time Strip and verify that only one event is displayed
|
||||||
|
await page.goto(timestrip.url);
|
||||||
|
expect(await activityBounds.count()).toEqual(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -27,40 +27,40 @@ This test suite is dedicated to tests which verify the basic operations surround
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('Clock Generator CRUD Operations', () => {
|
test.describe('Clock Generator CRUD Operations', () => {
|
||||||
|
test('Timezone dropdown will collapse when clicked outside or on dropdown icon again', async ({
|
||||||
test('Timezone dropdown will collapse when clicked outside or on dropdown icon again', async ({ page }) => {
|
page
|
||||||
test.info().annotations.push({
|
}) => {
|
||||||
type: 'issue',
|
test.info().annotations.push({
|
||||||
description: 'https://github.com/nasa/openmct/issues/4878'
|
type: 'issue',
|
||||||
});
|
description: 'https://github.com/nasa/openmct/issues/4878'
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click Clock
|
|
||||||
await page.click('text=Clock');
|
|
||||||
|
|
||||||
// Click .icon-arrow-down
|
|
||||||
await page.locator('.icon-arrow-down').click();
|
|
||||||
//verify if the autocomplete dropdown is visible
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeVisible();
|
|
||||||
// Click .icon-arrow-down
|
|
||||||
await page.locator('.icon-arrow-down').click();
|
|
||||||
|
|
||||||
// Verify clicking on the autocomplete arrow collapses the dropdown
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeHidden();
|
|
||||||
|
|
||||||
// Click timezone input to open dropdown
|
|
||||||
await page.locator('.c-input--autocomplete__input').click();
|
|
||||||
//verify if the autocomplete dropdown is visible
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeVisible();
|
|
||||||
|
|
||||||
// Verify clicking outside the autocomplete dropdown collapses it
|
|
||||||
await page.locator('text=Timezone').click();
|
|
||||||
// Verify clicking on the autocomplete arrow collapses the dropdown
|
|
||||||
await expect(page.locator(".c-input--autocomplete__options")).toBeHidden();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click Clock
|
||||||
|
await page.getByRole('menuitem').first().click();
|
||||||
|
|
||||||
|
// Click .icon-arrow-down
|
||||||
|
await page.locator('.icon-arrow-down').click();
|
||||||
|
//verify if the autocomplete dropdown is visible
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeVisible();
|
||||||
|
// Click .icon-arrow-down
|
||||||
|
await page.locator('.icon-arrow-down').click();
|
||||||
|
|
||||||
|
// Verify clicking on the autocomplete arrow collapses the dropdown
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeHidden();
|
||||||
|
|
||||||
|
// Click timezone input to open dropdown
|
||||||
|
await page.locator('.c-input--autocomplete__input').click();
|
||||||
|
//verify if the autocomplete dropdown is visible
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeVisible();
|
||||||
|
|
||||||
|
// Verify clicking outside the autocomplete dropdown collapses it
|
||||||
|
await page.locator('text=Timezone').click();
|
||||||
|
// Verify clicking on the autocomplete arrow collapses the dropdown
|
||||||
|
await expect(page.locator('.c-input--autocomplete__options')).toBeHidden();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -25,17 +25,17 @@
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('Remote Clock', () => {
|
test.describe('Remote Clock', () => {
|
||||||
// eslint-disable-next-line require-await
|
// eslint-disable-next-line require-await
|
||||||
test.fixme('blocks historical requests until first tick is received', async ({ page }) => {
|
test.fixme('blocks historical requests until first tick is received', async ({ page }) => {
|
||||||
test.info().annotations.push({
|
test.info().annotations.push({
|
||||||
type: 'issue',
|
type: 'issue',
|
||||||
description: 'https://github.com/nasa/openmct/issues/5221'
|
description: 'https://github.com/nasa/openmct/issues/5221'
|
||||||
});
|
|
||||||
// addInitScript to with remote clock
|
|
||||||
// Switch time conductor mode to 'remote clock'
|
|
||||||
// Navigate to telemetry
|
|
||||||
// Verify that the plot renders historical data within the correct bounds
|
|
||||||
// Refresh the page
|
|
||||||
// Verify again that the plot renders historical data within the correct bounds
|
|
||||||
});
|
});
|
||||||
|
// addInitScript to with remote clock
|
||||||
|
// Switch time conductor mode to 'remote clock'
|
||||||
|
// Navigate to telemetry
|
||||||
|
// Verify that the plot renders historical data within the correct bounds
|
||||||
|
// Refresh the page
|
||||||
|
// Verify again that the plot renders historical data within the correct bounds
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -22,304 +22,349 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
|
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
|
||||||
suite is sharing state between tests which is considered an anti-pattern. Implimenting in this way to
|
suite is sharing state between tests which is considered an anti-pattern. Implementing in this way to
|
||||||
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
|
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures.js');
|
const { test, expect } = require('../../../../pluginFixtures.js');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
createExampleTelemetryObject
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
|
||||||
let conditionSetUrl;
|
let conditionSetUrl;
|
||||||
let getConditionSetIdentifierFromUrl;
|
let getConditionSetIdentifierFromUrl;
|
||||||
|
|
||||||
test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
|
test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
|
||||||
test.beforeAll(async ({ browser}) => {
|
test.beforeAll(async ({ browser }) => {
|
||||||
//TODO: This needs to be refactored
|
//TODO: This needs to be refactored
|
||||||
const context = await browser.newContext();
|
const context = await browser.newContext();
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
await page.click('button:has-text("Create")');
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Condition Set")').click();
|
await page.locator('li[role="menuitem"]:has-text("Condition Set")').click();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
||||||
page.waitForNavigation(),
|
|
||||||
page.click('button:has-text("OK")')
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Save localStorage for future test execution
|
//Save localStorage for future test execution
|
||||||
await context.storageState({ path: './e2e/test-data/recycled_local_storage.json' });
|
await context.storageState({ path: './e2e/test-data/recycled_local_storage.json' });
|
||||||
|
|
||||||
//Set object identifier from url
|
//Set object identifier from url
|
||||||
conditionSetUrl = page.url();
|
conditionSetUrl = page.url();
|
||||||
|
|
||||||
getConditionSetIdentifierFromUrl = conditionSetUrl.split('/').pop().split('?')[0];
|
getConditionSetIdentifierFromUrl = conditionSetUrl.split('/').pop().split('?')[0];
|
||||||
console.debug(`getConditionSetIdentifierFromUrl: ${getConditionSetIdentifierFromUrl}`);
|
console.debug(`getConditionSetIdentifierFromUrl: ${getConditionSetIdentifierFromUrl}`);
|
||||||
await page.close();
|
await page.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Load localStorage for subsequent tests
|
//Load localStorage for subsequent tests
|
||||||
test.use({ storageState: './e2e/test-data/recycled_local_storage.json' });
|
test.use({ storageState: './e2e/test-data/recycled_local_storage.json' });
|
||||||
|
|
||||||
//Begin suite of tests again localStorage
|
//Begin suite of tests again localStorage
|
||||||
test('Condition set object properties persist in main view and inspector @localStorage', async ({ page }) => {
|
test('Condition set object properties persist in main view and inspector @localStorage', async ({
|
||||||
//Navigate to baseURL with injected localStorage
|
page
|
||||||
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
}) => {
|
||||||
|
//Navigate to baseURL with injected localStorage
|
||||||
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
await expect
|
||||||
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
|
.toContainText('Unnamed Condition Set');
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in Inspector
|
//Assertions on loaded Condition Set in Inspector
|
||||||
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
||||||
|
|
||||||
//Reload Page
|
//Reload Page
|
||||||
await Promise.all([
|
await Promise.all([page.reload(), page.waitForLoadState('networkidle')]);
|
||||||
page.reload(),
|
|
||||||
page.waitForLoadState('networkidle')
|
|
||||||
]);
|
|
||||||
|
|
||||||
//Re-verify after reload
|
//Re-verify after reload
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
await expect
|
||||||
//Assertions on loaded Condition Set in Inspector
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
.toContainText('Unnamed Condition Set');
|
||||||
|
//Assertions on loaded Condition Set in Inspector
|
||||||
|
expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('condition set object can be modified on @localStorage', async ({ page, openmctConfig }) => {
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
|
||||||
});
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
||||||
test('condition set object can be modified on @localStorage', async ({ page, openmctConfig }) => {
|
|
||||||
const { myItemsFolderName } = openmctConfig;
|
|
||||||
|
|
||||||
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
||||||
|
await expect
|
||||||
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
|
.toContainText('Unnamed Condition Set');
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
//Update the Condition Set properties
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
// Click Edit Button
|
||||||
|
await page.locator('text=Conditions View Snapshot >> button').nth(3).click();
|
||||||
|
|
||||||
//Update the Condition Set properties
|
//Edit Condition Set Name from main view
|
||||||
// Click Edit Button
|
await page
|
||||||
await page.locator('text=Conditions View Snapshot >> button').nth(3).click();
|
.locator('.l-browse-bar__object-name')
|
||||||
|
.filter({ hasText: 'Unnamed Condition Set' })
|
||||||
|
.first()
|
||||||
|
.fill('Renamed Condition Set');
|
||||||
|
await page
|
||||||
|
.locator('.l-browse-bar__object-name')
|
||||||
|
.filter({ hasText: 'Renamed Condition Set' })
|
||||||
|
.first()
|
||||||
|
.press('Enter');
|
||||||
|
// Click Save Button
|
||||||
|
await page
|
||||||
|
.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button')
|
||||||
|
.nth(1)
|
||||||
|
.click();
|
||||||
|
// Click Save and Finish Editing Option
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
//Edit Condition Set Name from main view
|
//Verify Main section reflects updated Name Property
|
||||||
await page.locator('.l-browse-bar__object-name').filter({ hasText: 'Unnamed Condition Set' }).first().fill('Renamed Condition Set');
|
await expect
|
||||||
await page.locator('.l-browse-bar__object-name').filter({ hasText: 'Renamed Condition Set' }).first().press('Enter');
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
// Click Save Button
|
.toContainText('Renamed Condition Set');
|
||||||
await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1).click();
|
|
||||||
// Click Save and Finish Editing Option
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
//Verify Main section reflects updated Name Property
|
// Verify Inspector properties
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Renamed Condition Set');
|
// Verify Inspector has updated Name property
|
||||||
|
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
||||||
|
// Verify Inspector Details has updated Name property
|
||||||
|
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
||||||
|
|
||||||
// Verify Inspector properties
|
// Verify Tree reflects updated Name property
|
||||||
// Verify Inspector has updated Name property
|
// Expand Tree
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
||||||
// Verify Inspector Details has updated Name property
|
// Verify Condition Set Object is renamed in Tree
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
// Verify Search Tree reflects renamed Name property
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
||||||
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
|
||||||
// Verify Tree reflects updated Name proprety
|
//Reload Page
|
||||||
// Expand Tree
|
await Promise.all([page.reload(), page.waitForLoadState('networkidle')]);
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
|
||||||
// Verify Condition Set Object is renamed in Tree
|
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
||||||
// Verify Search Tree reflects renamed Name property
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
||||||
|
|
||||||
//Reload Page
|
//Verify Main section reflects updated Name Property
|
||||||
await Promise.all([
|
await expect
|
||||||
page.reload(),
|
.soft(page.locator('.l-browse-bar__object-name'))
|
||||||
page.waitForLoadState('networkidle')
|
.toContainText('Renamed Condition Set');
|
||||||
]);
|
|
||||||
|
|
||||||
//Verify Main section reflects updated Name Property
|
// Verify Inspector properties
|
||||||
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Renamed Condition Set');
|
// Verify Inspector has updated Name property
|
||||||
|
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
||||||
|
// Verify Inspector Details has updated Name property
|
||||||
|
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
||||||
|
|
||||||
// Verify Inspector properties
|
// Verify Tree reflects updated Name property
|
||||||
// Verify Inspector has updated Name property
|
// Expand Tree
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
||||||
// Verify Inspector Details has updated Name property
|
// Verify Condition Set Object is renamed in Tree
|
||||||
expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
// Verify Search Tree reflects renamed Name property
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
||||||
|
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
||||||
|
});
|
||||||
|
test('condition set object can be deleted by Search Tree Actions menu on @localStorage', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
//Navigate to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Verify Tree reflects updated Name proprety
|
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
||||||
// Expand Tree
|
await expect(
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span >> nth=3`).click();
|
page.locator('a:has-text("Unnamed Condition Set Condition Set") >> nth=0')
|
||||||
// Verify Condition Set Object is renamed in Tree
|
).toBeVisible();
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
||||||
// Verify Search Tree reflects renamed Name property
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Renamed');
|
|
||||||
expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
||||||
});
|
|
||||||
test('condition set object can be deleted by Search Tree Actions menu on @localStorage', async ({ page }) => {
|
|
||||||
//Navigate to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
//Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
|
const numberOfConditionSetsToStart = await page
|
||||||
await expect(page.locator('a:has-text("Unnamed Condition Set Condition Set") >> nth=0')).toBeVisible();
|
.locator('a:has-text("Unnamed Condition Set Condition Set")')
|
||||||
|
.count();
|
||||||
|
|
||||||
const numberOfConditionSetsToStart = await page.locator('a:has-text("Unnamed Condition Set Condition Set")').count();
|
// Search for Unnamed Condition Set
|
||||||
|
await page
|
||||||
|
.locator('[aria-label="OpenMCT Search"] input[type="search"]')
|
||||||
|
.fill('Unnamed Condition Set');
|
||||||
|
// Click Search Result
|
||||||
|
await page
|
||||||
|
.locator('[aria-label="OpenMCT Search"] >> text=Unnamed Condition Set')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
// Click hamburger button
|
||||||
|
await page.locator('[title="More options"]').click();
|
||||||
|
|
||||||
// Search for Unnamed Condition Set
|
// Click 'Remove' and press OK
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Unnamed Condition Set');
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
// Click Search Result
|
await page.locator('button:has-text("OK")').click();
|
||||||
await page.locator('[aria-label="OpenMCT Search"] >> text=Unnamed Condition Set').first().click();
|
|
||||||
// Click hamburger button
|
|
||||||
await page.locator('[title="More options"]').click();
|
|
||||||
|
|
||||||
// Click 'Remove' and press OK
|
//Expect Unnamed Condition Set to be removed in Main View
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
const numberOfConditionSetsAtEnd = await page
|
||||||
await page.locator('button:has-text("OK")').click();
|
.locator('a:has-text("Unnamed Condition Set Condition Set")')
|
||||||
|
.count();
|
||||||
|
|
||||||
//Expect Unnamed Condition Set to be removed in Main View
|
expect(numberOfConditionSetsAtEnd).toEqual(numberOfConditionSetsToStart - 1);
|
||||||
const numberOfConditionSetsAtEnd = await page.locator('a:has-text("Unnamed Condition Set Condition Set")').count();
|
|
||||||
|
|
||||||
expect(numberOfConditionSetsAtEnd).toEqual(numberOfConditionSetsToStart - 1);
|
//Feature?
|
||||||
|
//Domain Object is still available by direct URL after delete
|
||||||
//Feature?
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
||||||
//Domain Object is still available by direct URL after delete
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
||||||
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
});
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Basic Condition Set Use', () => {
|
test.describe('Basic Condition Set Use', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
let conditionSet;
|
||||||
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Open a browser, navigate to the main page, and wait until all network events to resolve
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
// Create a new condition set
|
||||||
|
conditionSet = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Condition Set',
|
||||||
|
name: 'Test Condition Set'
|
||||||
});
|
});
|
||||||
test('Can add a condition', async ({ page }) => {
|
});
|
||||||
// Create a new condition set
|
test('Creating a condition defaults the condition name to "Unnamed Condition"', async ({
|
||||||
await createDomainObjectWithDefaults(page, {
|
page
|
||||||
type: 'Condition Set',
|
}) => {
|
||||||
name: "Test Condition Set"
|
await page.goto(conditionSet.url);
|
||||||
});
|
|
||||||
// Change the object to edit mode
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Click Add Condition button
|
// Change the object to edit mode
|
||||||
await page.locator('#addCondition').click();
|
await page.locator('[title="Edit"]').click();
|
||||||
// Check that the new Unnamed Condition section appears
|
|
||||||
const numOfUnnamedConditions = await page.locator('text=Unnamed Condition').count();
|
// Click Add Condition button
|
||||||
expect(numOfUnnamedConditions).toEqual(1);
|
await page.locator('#addCondition').click();
|
||||||
|
// Check that the new Unnamed Condition section appears
|
||||||
|
const numOfUnnamedConditions = await page
|
||||||
|
.locator('.c-condition__name', { hasText: 'Unnamed Condition' })
|
||||||
|
.count();
|
||||||
|
expect(numOfUnnamedConditions).toEqual(1);
|
||||||
|
});
|
||||||
|
test('ConditionSet should display appropriate view options', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5924'
|
||||||
});
|
});
|
||||||
test('ConditionSet should display appropriate view options', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5924'
|
|
||||||
});
|
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator',
|
type: 'Sine Wave Generator',
|
||||||
name: "Alpha Sine Wave Generator"
|
name: 'Alpha Sine Wave Generator'
|
||||||
});
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Sine Wave Generator',
|
|
||||||
name: "Beta Sine Wave Generator"
|
|
||||||
});
|
|
||||||
const conditionSet1 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Condition Set',
|
|
||||||
name: "Test Condition Set"
|
|
||||||
});
|
|
||||||
|
|
||||||
// Change the object to edit mode
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.goto(conditionSet1.url);
|
|
||||||
page.click('button[title="Show selected item in tree"]');
|
|
||||||
// Add the Alpha & Beta Sine Wave Generator to the Condition Set and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const alphaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Alpha Sine Wave Generator"});
|
|
||||||
const betaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Beta Sine Wave Generator"});
|
|
||||||
const conditionCollection = page.locator('#conditionCollection');
|
|
||||||
|
|
||||||
await alphaGeneratorTreeItem.dragTo(conditionCollection);
|
|
||||||
await betaGeneratorTreeItem.dragTo(conditionCollection);
|
|
||||||
|
|
||||||
const saveButtonLocator = page.locator('button[title="Save"]');
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
|
||||||
await page.click('button[title="Change the current view"]');
|
|
||||||
|
|
||||||
await expect(page.getByRole('menuitem', { name: /Lad Table/ })).toBeHidden();
|
|
||||||
await expect(page.getByRole('menuitem', { name: /Conditions View/ })).toBeVisible();
|
|
||||||
await expect(page.getByRole('menuitem', { name: /Plot/ })).toBeVisible();
|
|
||||||
await expect(page.getByRole('menuitem', { name: /Telemetry Table/ })).toBeVisible();
|
|
||||||
});
|
});
|
||||||
test('ConditionSet should output blank instead of the default value', async ({ page }) => {
|
await createDomainObjectWithDefaults(page, {
|
||||||
//Navigate to baseURL
|
type: 'Sine Wave Generator',
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
name: 'Beta Sine Wave Generator'
|
||||||
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
|
||||||
await page.click(`li[role='menuitem']:text("Sine Wave Generator")`);
|
|
||||||
await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000');
|
|
||||||
const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
|
|
||||||
await nameInput.fill("Delayed Sine Wave Generator");
|
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForLoadState(),
|
|
||||||
page.click('[aria-label="Save"]'),
|
|
||||||
// Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Create a new condition set
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Condition Set',
|
|
||||||
name: "Test Blank Output of Condition Set"
|
|
||||||
});
|
|
||||||
// Change the object to edit mode
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Click Add Condition button twice
|
|
||||||
await page.locator('#addCondition').click();
|
|
||||||
await page.locator('#addCondition').click();
|
|
||||||
await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition');
|
|
||||||
await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition');
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
|
||||||
// Add the Sine Wave Generator to the Condition Set and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Delayed Sine Wave Generator"});
|
|
||||||
const conditionCollection = await page.locator('#conditionCollection');
|
|
||||||
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(conditionCollection);
|
|
||||||
|
|
||||||
const firstCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=0');
|
|
||||||
firstCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' });
|
|
||||||
|
|
||||||
const secondCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=1');
|
|
||||||
secondCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' });
|
|
||||||
|
|
||||||
const firstCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=0');
|
|
||||||
firstCriterionMetadata.selectOption({ label: 'Sine' });
|
|
||||||
|
|
||||||
const secondCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=1');
|
|
||||||
secondCriterionMetadata.selectOption({ label: 'Sine' });
|
|
||||||
|
|
||||||
const firstCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=0');
|
|
||||||
firstCriterionComparison.selectOption({ label: 'is greater than or equal to' });
|
|
||||||
|
|
||||||
const secondCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=1');
|
|
||||||
secondCriterionComparison.selectOption({ label: 'is less than' });
|
|
||||||
|
|
||||||
const firstCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=0');
|
|
||||||
await firstCriterionInput.fill("0");
|
|
||||||
|
|
||||||
const secondCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=1');
|
|
||||||
await secondCriterionInput.fill("0");
|
|
||||||
|
|
||||||
const saveButtonLocator = page.locator('button[title="Save"]');
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
|
||||||
|
|
||||||
const outputValue = await page.locator('[aria-label="Current Output Value"]');
|
|
||||||
await expect(outputValue).toHaveText('---');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await page.goto(conditionSet.url);
|
||||||
|
|
||||||
|
// Change the object to edit mode
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
page.click('button[title="Show selected item in tree"]');
|
||||||
|
// Add the Alpha & Beta Sine Wave Generator to the Condition Set and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const alphaGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: 'Alpha Sine Wave Generator'
|
||||||
|
});
|
||||||
|
const betaGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: 'Beta Sine Wave Generator'
|
||||||
|
});
|
||||||
|
const conditionCollection = page.locator('#conditionCollection');
|
||||||
|
|
||||||
|
await alphaGeneratorTreeItem.dragTo(conditionCollection);
|
||||||
|
await betaGeneratorTreeItem.dragTo(conditionCollection);
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
await page.click('button[title="Change the current view"]');
|
||||||
|
|
||||||
|
await expect(page.getByRole('menuitem', { name: /Lad Table/ })).toBeHidden();
|
||||||
|
await expect(page.getByRole('menuitem', { name: /Conditions View/ })).toBeVisible();
|
||||||
|
await expect(page.getByRole('menuitem', { name: /Plot/ })).toBeVisible();
|
||||||
|
await expect(page.getByRole('menuitem', { name: /Telemetry Table/ })).toBeVisible();
|
||||||
|
});
|
||||||
|
test('ConditionSet has correct outputs when telemetry is and is not available', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const exampleTelemetry = await createExampleTelemetryObject(page);
|
||||||
|
|
||||||
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
await page.goto(conditionSet.url);
|
||||||
|
// Change the object to edit mode
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Create two conditions
|
||||||
|
await page.locator('#addCondition').click();
|
||||||
|
await page.locator('#addCondition').click();
|
||||||
|
await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition');
|
||||||
|
await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition');
|
||||||
|
|
||||||
|
// Add Telemetry to ConditionSet
|
||||||
|
const sineWaveGeneratorTreeItem = page
|
||||||
|
.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
})
|
||||||
|
.getByRole('treeitem', {
|
||||||
|
name: exampleTelemetry.name
|
||||||
|
});
|
||||||
|
const conditionCollection = page.locator('#conditionCollection');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(conditionCollection);
|
||||||
|
|
||||||
|
// Modify First Criterion
|
||||||
|
const firstCriterionTelemetry = page.locator(
|
||||||
|
'[aria-label="Criterion Telemetry Selection"] >> nth=0'
|
||||||
|
);
|
||||||
|
firstCriterionTelemetry.selectOption({ label: exampleTelemetry.name });
|
||||||
|
const firstCriterionMetadata = page.locator(
|
||||||
|
'[aria-label="Criterion Metadata Selection"] >> nth=0'
|
||||||
|
);
|
||||||
|
firstCriterionMetadata.selectOption({ label: 'Sine' });
|
||||||
|
const firstCriterionComparison = page.locator(
|
||||||
|
'[aria-label="Criterion Comparison Selection"] >> nth=0'
|
||||||
|
);
|
||||||
|
firstCriterionComparison.selectOption({ label: 'is greater than or equal to' });
|
||||||
|
const firstCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=0');
|
||||||
|
await firstCriterionInput.fill('0');
|
||||||
|
|
||||||
|
// Modify First Criterion
|
||||||
|
const secondCriterionTelemetry = page.locator(
|
||||||
|
'[aria-label="Criterion Telemetry Selection"] >> nth=1'
|
||||||
|
);
|
||||||
|
secondCriterionTelemetry.selectOption({ label: exampleTelemetry.name });
|
||||||
|
|
||||||
|
const secondCriterionMetadata = page.locator(
|
||||||
|
'[aria-label="Criterion Metadata Selection"] >> nth=1'
|
||||||
|
);
|
||||||
|
secondCriterionMetadata.selectOption({ label: 'Sine' });
|
||||||
|
|
||||||
|
const secondCriterionComparison = page.locator(
|
||||||
|
'[aria-label="Criterion Comparison Selection"] >> nth=1'
|
||||||
|
);
|
||||||
|
secondCriterionComparison.selectOption({ label: 'is less than' });
|
||||||
|
|
||||||
|
const secondCriterionInput = page.locator('[aria-label="Criterion Input"] >> nth=1');
|
||||||
|
await secondCriterionInput.fill('0');
|
||||||
|
|
||||||
|
// Save ConditionSet
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Validate that the condition set is evaluating and outputting
|
||||||
|
// the correct value when the underlying telemetry subscription is active.
|
||||||
|
let outputValue = page.locator('[aria-label="Current Output Value"]');
|
||||||
|
await expect(outputValue).toHaveText('false');
|
||||||
|
|
||||||
|
await page.goto(exampleTelemetry.url);
|
||||||
|
|
||||||
|
// Edit SWG to add 8 second loading delay to simulate the case
|
||||||
|
// where telemetry is not available.
|
||||||
|
await page.getByTitle('More options').click();
|
||||||
|
await page.getByRole('menuitem', { name: 'Edit Properties...' }).click();
|
||||||
|
await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000');
|
||||||
|
await page.getByLabel('Save').click();
|
||||||
|
|
||||||
|
// Expect that the output value is blank or '---' if the
|
||||||
|
// underlying telemetry subscription is not active.
|
||||||
|
await page.goto(conditionSet.url);
|
||||||
|
await expect(outputValue).toHaveText('---');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,173 +21,317 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults, setStartOffset, setFixedTimeMode, setRealTimeMode } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
setStartOffset,
|
||||||
|
setFixedTimeMode,
|
||||||
|
setRealTimeMode,
|
||||||
|
setIndependentTimeConductorBounds
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
|
||||||
test.describe('Display Layout', () => {
|
test.describe('Display Layout', () => {
|
||||||
/** @type {import('../../../../appActions').CreatedObjectInfo} */
|
/** @type {import('../../../../appActions').CreatedObjectInfo} */
|
||||||
let sineWaveObject;
|
let sineWaveObject;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
await setRealTimeMode(page);
|
await setRealTimeMode(page);
|
||||||
|
|
||||||
// Create Sine Wave Generator
|
// Create Sine Wave Generator
|
||||||
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator'
|
type: 'Sine Wave Generator'
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in real time', async ({ page }) => {
|
});
|
||||||
// Create a Display Layout
|
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in real time', async ({
|
||||||
await createDomainObjectWithDefaults(page, {
|
page
|
||||||
type: 'Display Layout',
|
}) => {
|
||||||
name: "Test Display Layout"
|
// Create a Display Layout
|
||||||
});
|
await createDomainObjectWithDefaults(page, {
|
||||||
// Edit Display Layout
|
type: 'Display Layout',
|
||||||
await page.locator('[title="Edit"]').click();
|
name: 'Test Display Layout'
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
// Subscribe to the Sine Wave Generator data
|
|
||||||
// On getting data, check if the value found in the Display Layout is the most recent value
|
|
||||||
// from the Sine Wave Generator
|
|
||||||
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
|
||||||
const formattedTelemetryValue = getTelemValuePromise;
|
|
||||||
const displayLayoutValuePromise = await page.waitForSelector(`text="${formattedTelemetryValue}"`);
|
|
||||||
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
|
||||||
const trimmedDisplayValue = displayLayoutValue.trim();
|
|
||||||
|
|
||||||
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
|
||||||
});
|
});
|
||||||
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in fixed time', async ({ page }) => {
|
// Edit Display Layout
|
||||||
// Create a Display Layout
|
await page.locator('[title="Edit"]').click();
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
name: "Test Display Layout"
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Expand the 'My Items' folder in the left tree
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
const treePane = page.getByRole('tree', {
|
const treePane = page.getByRole('tree', {
|
||||||
name: 'Main Tree'
|
name: 'Main Tree'
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
// Subscribe to the Sine Wave Generator data
|
|
||||||
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
|
||||||
// Set an offset of 1 minute and then change the time mode to fixed to set a 1 minute historical window
|
|
||||||
await setStartOffset(page, { mins: '1' });
|
|
||||||
await setFixedTimeMode(page);
|
|
||||||
|
|
||||||
// On getting data, check if the value found in the Display Layout is the most recent value
|
|
||||||
// from the Sine Wave Generator
|
|
||||||
const formattedTelemetryValue = getTelemValuePromise;
|
|
||||||
const displayLayoutValuePromise = await page.waitForSelector(`text="${formattedTelemetryValue}"`);
|
|
||||||
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
|
||||||
const trimmedDisplayValue = displayLayoutValue.trim();
|
|
||||||
|
|
||||||
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
|
||||||
});
|
});
|
||||||
test('items in a display layout can be removed with object tree context menu when viewing the display layout', async ({ page }) => {
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
// Create a Display Layout
|
name: new RegExp(sineWaveObject.name)
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout',
|
|
||||||
name: "Test Display Layout"
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
|
||||||
|
|
||||||
// Expand the Display Layout so we can remove the sine wave generator
|
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
|
||||||
|
|
||||||
// Bring up context menu and remove
|
|
||||||
await sineWaveGeneratorTreeItem.nth(1).click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// delete
|
|
||||||
|
|
||||||
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
test('items in a display layout can be removed with object tree context menu when viewing another item', async ({ page }) => {
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
test.info().annotations.push({
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
type: 'issue',
|
await page.locator('button[title="Save"]').click();
|
||||||
description: 'https://github.com/nasa/openmct/issues/3117'
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
});
|
|
||||||
// Create a Display Layout
|
|
||||||
const displayLayout = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Display Layout'
|
|
||||||
});
|
|
||||||
// Edit Display Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Subscribe to the Sine Wave Generator data
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
// On getting data, check if the value found in the Display Layout is the most recent value
|
||||||
// Add the Sine Wave Generator to the Display Layout and save changes
|
// from the Sine Wave Generator
|
||||||
const treePane = page.getByRole('tree', {
|
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
||||||
name: 'Main Tree'
|
const formattedTelemetryValue = getTelemValuePromise;
|
||||||
});
|
const displayLayoutValuePromise = await page.waitForSelector(
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
`text="${formattedTelemetryValue}"`
|
||||||
name: new RegExp(sineWaveObject.name)
|
);
|
||||||
});
|
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
||||||
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
const trimmedDisplayValue = displayLayoutValue.trim();
|
||||||
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
||||||
|
});
|
||||||
// Expand the Display Layout so we can remove the sine wave generator
|
test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in fixed time', async ({
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
page
|
||||||
|
}) => {
|
||||||
// Go to the original Sine Wave Generator to navigate away from the Display Layout
|
// Create a Display Layout
|
||||||
await page.goto(sineWaveObject.url);
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
// Bring up context menu and remove
|
name: 'Test Display Layout'
|
||||||
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// navigate back to the display layout to confirm it has been removed
|
|
||||||
await page.goto(displayLayout.url);
|
|
||||||
|
|
||||||
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
// Subscribe to the Sine Wave Generator data
|
||||||
|
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
||||||
|
// Set an offset of 1 minute and then change the time mode to fixed to set a 1 minute historical window
|
||||||
|
await setStartOffset(page, { mins: '1' });
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
|
||||||
|
// On getting data, check if the value found in the Display Layout is the most recent value
|
||||||
|
// from the Sine Wave Generator
|
||||||
|
const formattedTelemetryValue = getTelemValuePromise;
|
||||||
|
const displayLayoutValuePromise = await page.waitForSelector(
|
||||||
|
`text="${formattedTelemetryValue}"`
|
||||||
|
);
|
||||||
|
const displayLayoutValue = await displayLayoutValuePromise.textContent();
|
||||||
|
const trimmedDisplayValue = displayLayoutValue.trim();
|
||||||
|
|
||||||
|
expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
|
||||||
|
});
|
||||||
|
test('items in a display layout can be removed with object tree context menu when viewing the display layout', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
// Create a Display Layout
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Test Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Display Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.nth(1).click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// delete
|
||||||
|
|
||||||
|
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
test('items in a display layout can be removed with object tree context menu when viewing another item', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/3117'
|
||||||
|
});
|
||||||
|
// Create a Display Layout
|
||||||
|
const displayLayout = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
const layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Display Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Go to the original Sine Wave Generator to navigate away from the Display Layout
|
||||||
|
await page.goto(sineWaveObject.url);
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// navigate back to the display layout to confirm it has been removed
|
||||||
|
await page.goto(displayLayout.url);
|
||||||
|
|
||||||
|
expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('independent time works with display layouts and its children', async ({ page }) => {
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
// Create Example Imagery
|
||||||
|
const exampleImageryObject = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Example Imagery'
|
||||||
|
});
|
||||||
|
// Create a Display Layout
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const exampleImageryTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(exampleImageryObject.name)
|
||||||
|
});
|
||||||
|
let layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
await exampleImageryTreeItem.dragTo(layoutGridHolder);
|
||||||
|
|
||||||
|
//adjust so that we can see the independent time conductor toggle
|
||||||
|
// Adjust object height
|
||||||
|
await page.locator('div[title="Resize object height"] > input').click();
|
||||||
|
await page.locator('div[title="Resize object height"] > input').fill('70');
|
||||||
|
|
||||||
|
// Adjust object width
|
||||||
|
await page.locator('div[title="Resize object width"] > input').click();
|
||||||
|
await page.locator('div[title="Resize object width"] > input').fill('70');
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
const startDate = '2021-12-30 01:01:00.000Z';
|
||||||
|
const endDate = '2021-12-30 01:11:00.000Z';
|
||||||
|
await setIndependentTimeConductorBounds(page, startDate, endDate);
|
||||||
|
|
||||||
|
// check image date
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible();
|
||||||
|
|
||||||
|
// flip it off
|
||||||
|
await page.getByRole('switch').click();
|
||||||
|
// timestamp shouldn't be in the past anymore
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('When multiple plots are contained in a layout, we only ask for annotations once @couchdb', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
// Create another Sine Wave Generator
|
||||||
|
const anotherSineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Sine Wave Generator'
|
||||||
|
});
|
||||||
|
// Create a Display Layout
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Test Display Layout'
|
||||||
|
});
|
||||||
|
// Edit Display Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Display Layout and save changes
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
|
||||||
|
let layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
// eslint-disable-next-line playwright/no-force-option
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder, { force: true });
|
||||||
|
|
||||||
|
await page.getByText('View type').click();
|
||||||
|
await page.getByText('Overlay Plot').click();
|
||||||
|
|
||||||
|
const anotherSineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(anotherSineWaveObject.name)
|
||||||
|
});
|
||||||
|
layoutGridHolder = page.locator('.l-layout__grid-holder');
|
||||||
|
// eslint-disable-next-line playwright/no-force-option
|
||||||
|
await anotherSineWaveGeneratorTreeItem.dragTo(layoutGridHolder, { force: true });
|
||||||
|
|
||||||
|
await page.getByText('View type').click();
|
||||||
|
await page.getByText('Overlay Plot').click();
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
// Time to inspect some network traffic
|
||||||
|
let networkRequests = [];
|
||||||
|
page.on('request', (request) => {
|
||||||
|
const searchRequest = request.url().endsWith('_find');
|
||||||
|
const fetchRequest = request.resourceType() === 'fetch';
|
||||||
|
if (searchRequest && fetchRequest) {
|
||||||
|
networkRequests.push(request);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// wait for annotations requests to be batched and requested
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
// Network requests for the composite telemetry with multiple items should be:
|
||||||
|
// 1. a single batched request for annotations
|
||||||
|
expect(networkRequests.length).toBe(1);
|
||||||
|
|
||||||
|
await setRealTimeMode(page);
|
||||||
|
networkRequests = [];
|
||||||
|
|
||||||
|
await page.reload();
|
||||||
|
|
||||||
|
// wait for annotations to not load (if we have any, we've got a problem)
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// In real time mode, we don't fetch annotations at all
|
||||||
|
expect(networkRequests.length).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,18 +344,20 @@ test.describe('Display Layout', () => {
|
|||||||
* @returns {Promise<string>} the formatted sin telemetry value
|
* @returns {Promise<string>} the formatted sin telemetry value
|
||||||
*/
|
*/
|
||||||
async function subscribeToTelemetry(page, objectIdentifier) {
|
async function subscribeToTelemetry(page, objectIdentifier) {
|
||||||
const getTelemValuePromise = new Promise(resolve => page.exposeFunction('getTelemValue', resolve));
|
const getTelemValuePromise = new Promise((resolve) =>
|
||||||
|
page.exposeFunction('getTelemValue', resolve)
|
||||||
|
);
|
||||||
|
|
||||||
await page.evaluate(async (telemetryIdentifier) => {
|
await page.evaluate(async (telemetryIdentifier) => {
|
||||||
const telemetryObject = await window.openmct.objects.get(telemetryIdentifier);
|
const telemetryObject = await window.openmct.objects.get(telemetryIdentifier);
|
||||||
const metadata = window.openmct.telemetry.getMetadata(telemetryObject);
|
const metadata = window.openmct.telemetry.getMetadata(telemetryObject);
|
||||||
const formats = await window.openmct.telemetry.getFormatMap(metadata);
|
const formats = await window.openmct.telemetry.getFormatMap(metadata);
|
||||||
window.openmct.telemetry.subscribe(telemetryObject, (obj) => {
|
window.openmct.telemetry.subscribe(telemetryObject, (obj) => {
|
||||||
const sinVal = obj.sin;
|
const sinVal = obj.sin;
|
||||||
const formattedSinVal = formats.sin.format(sinVal);
|
const formattedSinVal = formats.sin.format(sinVal);
|
||||||
window.getTelemValue(formattedSinVal);
|
window.getTelemValue(formattedSinVal);
|
||||||
});
|
});
|
||||||
}, objectIdentifier);
|
}, objectIdentifier);
|
||||||
|
|
||||||
return getTelemValuePromise;
|
return getTelemValuePromise;
|
||||||
}
|
}
|
||||||
|
@ -24,214 +24,231 @@ const { test, expect } = require('../../../../pluginFixtures');
|
|||||||
const utils = require('../../../../helper/faultUtils');
|
const utils = require('../../../../helper/faultUtils');
|
||||||
|
|
||||||
test.describe('The Fault Management Plugin using example faults', () => {
|
test.describe('The Fault Management Plugin using example faults', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await utils.navigateToFaultManagementWithExample(page);
|
await utils.navigateToFaultManagementWithExample(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Shows a criticality icon for every fault @unstable', async ({ page }) => {
|
test('Shows a criticality icon for every fault @unstable', async ({ page }) => {
|
||||||
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
const criticalityIconCount = await page.locator('c-fault-mgmt__list-severity').count();
|
const criticalityIconCount = await page.locator('c-fault-mgmt__list-severity').count();
|
||||||
|
|
||||||
expect.soft(faultCount).toEqual(criticalityIconCount);
|
expect.soft(faultCount).toEqual(criticalityIconCount);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('When selecting a fault, it has an "is-selected" class and it\'s information shows in the inspector @unstable', async ({ page }) => {
|
test('When selecting a fault, it has an "is-selected" class and it\'s information shows in the inspector @unstable', async ({
|
||||||
await utils.selectFaultItem(page, 1);
|
page
|
||||||
|
}) => {
|
||||||
|
await utils.selectFaultItem(page, 1);
|
||||||
|
|
||||||
const selectedFaultName = await page.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname').textContent();
|
await page.getByRole('tab', { name: 'Fault Management Configuration' }).click();
|
||||||
const inspectorFaultNameCount = await page.locator(`.c-inspector__properties >> :text("${selectedFaultName}")`).count();
|
const selectedFaultName = await page
|
||||||
|
.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname')
|
||||||
|
.textContent();
|
||||||
|
const inspectorFaultNameCount = await page
|
||||||
|
.locator(`.c-inspector__properties >> :text("${selectedFaultName}")`)
|
||||||
|
.count();
|
||||||
|
|
||||||
await expect.soft(page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').first()).toHaveClass(/is-selected/);
|
await expect
|
||||||
expect.soft(inspectorFaultNameCount).toEqual(1);
|
.soft(page.locator('.c-faults-list-view-item-body > .c-fault-mgmt__list').first())
|
||||||
});
|
.toHaveClass(/is-selected/);
|
||||||
|
expect.soft(inspectorFaultNameCount).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
test('When selecting multiple faults, no specific fault information is shown in the inspector @unstable', async ({ page }) => {
|
test('When selecting multiple faults, no specific fault information is shown in the inspector @unstable', async ({
|
||||||
await utils.selectFaultItem(page, 1);
|
page
|
||||||
await utils.selectFaultItem(page, 2);
|
}) => {
|
||||||
|
await utils.selectFaultItem(page, 1);
|
||||||
|
await utils.selectFaultItem(page, 2);
|
||||||
|
|
||||||
const selectedRows = page.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname');
|
const selectedRows = page.locator(
|
||||||
expect.soft(await selectedRows.count()).toEqual(2);
|
'.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname'
|
||||||
|
);
|
||||||
|
expect.soft(await selectedRows.count()).toEqual(2);
|
||||||
|
|
||||||
const firstSelectedFaultName = await selectedRows.nth(0).textContent();
|
await page.getByRole('tab', { name: 'Fault Management Configuration' }).click();
|
||||||
const secondSelectedFaultName = await selectedRows.nth(1).textContent();
|
const firstSelectedFaultName = await selectedRows.nth(0).textContent();
|
||||||
const firstNameInInspectorCount = await page.locator(`.c-inspector__properties >> :text("${firstSelectedFaultName}")`).count();
|
const secondSelectedFaultName = await selectedRows.nth(1).textContent();
|
||||||
const secondNameInInspectorCount = await page.locator(`.c-inspector__properties >> :text("${secondSelectedFaultName}")`).count();
|
const firstNameInInspectorCount = await page
|
||||||
|
.locator(`.c-inspector__properties >> :text("${firstSelectedFaultName}")`)
|
||||||
|
.count();
|
||||||
|
const secondNameInInspectorCount = await page
|
||||||
|
.locator(`.c-inspector__properties >> :text("${secondSelectedFaultName}")`)
|
||||||
|
.count();
|
||||||
|
|
||||||
expect.soft(firstNameInInspectorCount).toEqual(0);
|
expect.soft(firstNameInInspectorCount).toEqual(0);
|
||||||
expect.soft(secondNameInInspectorCount).toEqual(0);
|
expect.soft(secondNameInInspectorCount).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to shelve a fault @unstable', async ({ page }) => {
|
test('Allows you to shelve a fault @unstable', async ({ page }) => {
|
||||||
const shelvedFaultName = await utils.getFaultName(page, 2);
|
const shelvedFaultName = await utils.getFaultName(page, 2);
|
||||||
const beforeShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
const beforeShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
||||||
|
|
||||||
expect.soft(await beforeShelvedFault.count()).toBe(1);
|
expect.soft(await beforeShelvedFault.count()).toBe(1);
|
||||||
|
|
||||||
await utils.shelveFault(page, 2);
|
await utils.shelveFault(page, 2);
|
||||||
|
|
||||||
// check it is removed from standard view
|
// check it is removed from standard view
|
||||||
const afterShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
const afterShelvedFault = utils.getFaultByName(page, shelvedFaultName);
|
||||||
expect.soft(await afterShelvedFault.count()).toBe(0);
|
expect.soft(await afterShelvedFault.count()).toBe(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'shelved');
|
await utils.changeViewTo(page, 'shelved');
|
||||||
|
|
||||||
const shelvedViewFault = utils.getFaultByName(page, shelvedFaultName);
|
const shelvedViewFault = utils.getFaultByName(page, shelvedFaultName);
|
||||||
|
|
||||||
expect.soft(await shelvedViewFault.count()).toBe(1);
|
expect.soft(await shelvedViewFault.count()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to acknowledge a fault @unstable', async ({ page }) => {
|
test('Allows you to acknowledge a fault @unstable', async ({ page }) => {
|
||||||
const acknowledgedFaultName = await utils.getFaultName(page, 3);
|
const acknowledgedFaultName = await utils.getFaultName(page, 3);
|
||||||
|
|
||||||
await utils.acknowledgeFault(page, 3);
|
await utils.acknowledgeFault(page, 3);
|
||||||
|
|
||||||
const fault = utils.getFault(page, 3);
|
const fault = utils.getFault(page, 3);
|
||||||
await expect.soft(fault).toHaveClass(/is-acknowledged/);
|
await expect.soft(fault).toHaveClass(/is-acknowledged/);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'acknowledged');
|
await utils.changeViewTo(page, 'acknowledged');
|
||||||
|
|
||||||
const acknowledgedViewFaultName = await utils.getFaultName(page, 1);
|
const acknowledgedViewFaultName = await utils.getFaultName(page, 1);
|
||||||
expect.soft(acknowledgedFaultName).toEqual(acknowledgedViewFaultName);
|
expect.soft(acknowledgedFaultName).toEqual(acknowledgedViewFaultName);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to shelve multiple faults @unstable', async ({ page }) => {
|
test('Allows you to shelve multiple faults @unstable', async ({ page }) => {
|
||||||
const shelvedFaultNameOne = await utils.getFaultName(page, 1);
|
const shelvedFaultNameOne = await utils.getFaultName(page, 1);
|
||||||
const shelvedFaultNameFour = await utils.getFaultName(page, 4);
|
const shelvedFaultNameFour = await utils.getFaultName(page, 4);
|
||||||
|
|
||||||
const beforeShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
const beforeShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
||||||
const beforeShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
const beforeShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
||||||
|
|
||||||
expect.soft(await beforeShelvedFaultOne.count()).toBe(1);
|
expect.soft(await beforeShelvedFaultOne.count()).toBe(1);
|
||||||
expect.soft(await beforeShelvedFaultFour.count()).toBe(1);
|
expect.soft(await beforeShelvedFaultFour.count()).toBe(1);
|
||||||
|
|
||||||
await utils.shelveMultipleFaults(page, 1, 4);
|
await utils.shelveMultipleFaults(page, 1, 4);
|
||||||
|
|
||||||
// check it is removed from standard view
|
// check it is removed from standard view
|
||||||
const afterShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
const afterShelvedFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
||||||
const afterShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
const afterShelvedFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
||||||
expect.soft(await afterShelvedFaultOne.count()).toBe(0);
|
expect.soft(await afterShelvedFaultOne.count()).toBe(0);
|
||||||
expect.soft(await afterShelvedFaultFour.count()).toBe(0);
|
expect.soft(await afterShelvedFaultFour.count()).toBe(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'shelved');
|
await utils.changeViewTo(page, 'shelved');
|
||||||
|
|
||||||
const shelvedViewFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
const shelvedViewFaultOne = utils.getFaultByName(page, shelvedFaultNameOne);
|
||||||
const shelvedViewFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
const shelvedViewFaultFour = utils.getFaultByName(page, shelvedFaultNameFour);
|
||||||
|
|
||||||
expect.soft(await shelvedViewFaultOne.count()).toBe(1);
|
expect.soft(await shelvedViewFaultOne.count()).toBe(1);
|
||||||
expect.soft(await shelvedViewFaultFour.count()).toBe(1);
|
expect.soft(await shelvedViewFaultFour.count()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to acknowledge multiple faults @unstable', async ({ page }) => {
|
test('Allows you to acknowledge multiple faults @unstable', async ({ page }) => {
|
||||||
const acknowledgedFaultNameTwo = await utils.getFaultName(page, 2);
|
const acknowledgedFaultNameTwo = await utils.getFaultName(page, 2);
|
||||||
const acknowledgedFaultNameFive = await utils.getFaultName(page, 5);
|
const acknowledgedFaultNameFive = await utils.getFaultName(page, 5);
|
||||||
|
|
||||||
await utils.acknowledgeMultipleFaults(page, 2, 5);
|
await utils.acknowledgeMultipleFaults(page, 2, 5);
|
||||||
|
|
||||||
const faultTwo = utils.getFault(page, 2);
|
const faultTwo = utils.getFault(page, 2);
|
||||||
const faultFive = utils.getFault(page, 5);
|
const faultFive = utils.getFault(page, 5);
|
||||||
|
|
||||||
// check they have been acknowledged
|
// check they have been acknowledged
|
||||||
await expect.soft(faultTwo).toHaveClass(/is-acknowledged/);
|
await expect.soft(faultTwo).toHaveClass(/is-acknowledged/);
|
||||||
await expect.soft(faultFive).toHaveClass(/is-acknowledged/);
|
await expect.soft(faultFive).toHaveClass(/is-acknowledged/);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'acknowledged');
|
await utils.changeViewTo(page, 'acknowledged');
|
||||||
|
|
||||||
const acknowledgedViewFaultTwo = utils.getFaultByName(page, acknowledgedFaultNameTwo);
|
const acknowledgedViewFaultTwo = utils.getFaultByName(page, acknowledgedFaultNameTwo);
|
||||||
const acknowledgedViewFaultFive = utils.getFaultByName(page, acknowledgedFaultNameFive);
|
const acknowledgedViewFaultFive = utils.getFaultByName(page, acknowledgedFaultNameFive);
|
||||||
|
|
||||||
expect.soft(await acknowledgedViewFaultTwo.count()).toBe(1);
|
expect.soft(await acknowledgedViewFaultTwo.count()).toBe(1);
|
||||||
expect.soft(await acknowledgedViewFaultFive.count()).toBe(1);
|
expect.soft(await acknowledgedViewFaultFive.count()).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to search faults @unstable', async ({ page }) => {
|
test('Allows you to search faults @unstable', async ({ page }) => {
|
||||||
const faultThreeNamespace = await utils.getFaultNamespace(page, 3);
|
const faultThreeNamespace = await utils.getFaultNamespace(page, 3);
|
||||||
const faultTwoName = await utils.getFaultName(page, 2);
|
const faultTwoName = await utils.getFaultName(page, 2);
|
||||||
const faultFiveTriggerTime = await utils.getFaultTriggerTime(page, 5);
|
const faultFiveTriggerTime = await utils.getFaultTriggerTime(page, 5);
|
||||||
|
|
||||||
// should be all faults (5)
|
// should be all faults (5)
|
||||||
let faultResultCount = await utils.getFaultResultCount(page);
|
let faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(5);
|
expect.soft(faultResultCount).toEqual(5);
|
||||||
|
|
||||||
// search namespace
|
// search namespace
|
||||||
await utils.enterSearchTerm(page, faultThreeNamespace);
|
await utils.enterSearchTerm(page, faultThreeNamespace);
|
||||||
|
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(1);
|
expect.soft(faultResultCount).toEqual(1);
|
||||||
expect.soft(await utils.getFaultNamespace(page, 1)).toEqual(faultThreeNamespace);
|
expect.soft(await utils.getFaultNamespace(page, 1)).toEqual(faultThreeNamespace);
|
||||||
|
|
||||||
// all faults
|
// all faults
|
||||||
await utils.clearSearch(page);
|
await utils.clearSearch(page);
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(5);
|
expect.soft(faultResultCount).toEqual(5);
|
||||||
|
|
||||||
// search name
|
// search name
|
||||||
await utils.enterSearchTerm(page, faultTwoName);
|
await utils.enterSearchTerm(page, faultTwoName);
|
||||||
|
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(1);
|
expect.soft(faultResultCount).toEqual(1);
|
||||||
expect.soft(await utils.getFaultName(page, 1)).toEqual(faultTwoName);
|
expect.soft(await utils.getFaultName(page, 1)).toEqual(faultTwoName);
|
||||||
|
|
||||||
// all faults
|
// all faults
|
||||||
await utils.clearSearch(page);
|
await utils.clearSearch(page);
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(5);
|
expect.soft(faultResultCount).toEqual(5);
|
||||||
|
|
||||||
// search triggerTime
|
// search triggerTime
|
||||||
await utils.enterSearchTerm(page, faultFiveTriggerTime);
|
await utils.enterSearchTerm(page, faultFiveTriggerTime);
|
||||||
|
|
||||||
faultResultCount = await utils.getFaultResultCount(page);
|
faultResultCount = await utils.getFaultResultCount(page);
|
||||||
expect.soft(faultResultCount).toEqual(1);
|
expect.soft(faultResultCount).toEqual(1);
|
||||||
expect.soft(await utils.getFaultTriggerTime(page, 1)).toEqual(faultFiveTriggerTime);
|
expect.soft(await utils.getFaultTriggerTime(page, 1)).toEqual(faultFiveTriggerTime);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Allows you to sort faults @unstable', async ({ page }) => {
|
test('Allows you to sort faults @unstable', async ({ page }) => {
|
||||||
const highestSeverity = await utils.getHighestSeverity(page);
|
const highestSeverity = await utils.getHighestSeverity(page);
|
||||||
const lowestSeverity = await utils.getLowestSeverity(page);
|
const lowestSeverity = await utils.getLowestSeverity(page);
|
||||||
const faultOneName = 'Example Fault 1';
|
const faultOneName = 'Example Fault 1';
|
||||||
const faultFiveName = 'Example Fault 5';
|
const faultFiveName = 'Example Fault 5';
|
||||||
let firstFaultName = await utils.getFaultName(page, 1);
|
let firstFaultName = await utils.getFaultName(page, 1);
|
||||||
|
|
||||||
expect.soft(firstFaultName).toEqual(faultOneName);
|
expect.soft(firstFaultName).toEqual(faultOneName);
|
||||||
|
|
||||||
await utils.sortFaultsBy(page, 'oldest-first');
|
await utils.sortFaultsBy(page, 'oldest-first');
|
||||||
|
|
||||||
firstFaultName = await utils.getFaultName(page, 1);
|
firstFaultName = await utils.getFaultName(page, 1);
|
||||||
expect.soft(firstFaultName).toEqual(faultFiveName);
|
expect.soft(firstFaultName).toEqual(faultFiveName);
|
||||||
|
|
||||||
await utils.sortFaultsBy(page, 'severity');
|
await utils.sortFaultsBy(page, 'severity');
|
||||||
|
|
||||||
const sortedHighestSeverity = await utils.getFaultSeverity(page, 1);
|
|
||||||
const sortedLowestSeverity = await utils.getFaultSeverity(page, 5);
|
|
||||||
expect.soft(sortedHighestSeverity).toEqual(highestSeverity);
|
|
||||||
expect.soft(sortedLowestSeverity).toEqual(lowestSeverity);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const sortedHighestSeverity = await utils.getFaultSeverity(page, 1);
|
||||||
|
const sortedLowestSeverity = await utils.getFaultSeverity(page, 5);
|
||||||
|
expect.soft(sortedHighestSeverity).toEqual(highestSeverity);
|
||||||
|
expect.soft(sortedLowestSeverity).toEqual(lowestSeverity);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('The Fault Management Plugin without using example faults', () => {
|
test.describe('The Fault Management Plugin without using example faults', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await utils.navigateToFaultManagementWithoutExample(page);
|
await utils.navigateToFaultManagementWithoutExample(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Shows no faults when no faults are provided @unstable', async ({ page }) => {
|
test('Shows no faults when no faults are provided @unstable', async ({ page }) => {
|
||||||
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
|
|
||||||
expect.soft(faultCount).toEqual(0);
|
expect.soft(faultCount).toEqual(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'acknowledged');
|
await utils.changeViewTo(page, 'acknowledged');
|
||||||
const acknowledgedCount = await page.locator('c-fault-mgmt__list').count();
|
const acknowledgedCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
expect.soft(acknowledgedCount).toEqual(0);
|
expect.soft(acknowledgedCount).toEqual(0);
|
||||||
|
|
||||||
await utils.changeViewTo(page, 'shelved');
|
await utils.changeViewTo(page, 'shelved');
|
||||||
const shelvedCount = await page.locator('c-fault-mgmt__list').count();
|
const shelvedCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
expect.soft(shelvedCount).toEqual(0);
|
expect.soft(shelvedCount).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Will return no faults when searching @unstable', async ({ page }) => {
|
test('Will return no faults when searching @unstable', async ({ page }) => {
|
||||||
await utils.enterSearchTerm(page, 'fault');
|
await utils.enterSearchTerm(page, 'fault');
|
||||||
|
|
||||||
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
const faultCount = await page.locator('c-fault-mgmt__list').count();
|
||||||
|
|
||||||
expect.soft(faultCount).toEqual(0);
|
expect.soft(faultCount).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,133 +21,239 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
setIndependentTimeConductorBounds
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
|
||||||
test.describe('Flexible Layout', () => {
|
test.describe('Flexible Layout', () => {
|
||||||
let sineWaveObject;
|
let sineWaveObject;
|
||||||
let clockObject;
|
let clockObject;
|
||||||
test.beforeEach(async ({ page }) => {
|
let treePane;
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
let sineWaveGeneratorTreeItem;
|
||||||
|
let clockTreeItem;
|
||||||
|
let flexibleLayout;
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Create Sine Wave Generator
|
// Create Sine Wave Generator
|
||||||
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator'
|
type: 'Sine Wave Generator'
|
||||||
});
|
|
||||||
|
|
||||||
// Create Clock Object
|
|
||||||
clockObject = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Clock'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test('panes have the appropriate draggable attribute while in Edit and Browse modes', async ({ page }) => {
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
const clockTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(clockObject.name)
|
|
||||||
});
|
|
||||||
// Create a Flexible Layout
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Flexible Layout'
|
|
||||||
});
|
|
||||||
// Edit Flexible Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Create Clock Object
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
clockObject = await createDomainObjectWithDefaults(page, {
|
||||||
// Add the Sine Wave Generator and Clock to the Flexible Layout
|
type: 'Clock'
|
||||||
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
|
||||||
await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
|
|
||||||
// Check that panes can be dragged while Flexible Layout is in Edit mode
|
|
||||||
let dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
|
|
||||||
await expect(dragWrapper).toHaveAttribute('draggable', 'true');
|
|
||||||
// Save Flexible Layout
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
// Check that panes are not draggable while Flexible Layout is in Browse mode
|
|
||||||
dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
|
|
||||||
await expect(dragWrapper).toHaveAttribute('draggable', 'false');
|
|
||||||
});
|
});
|
||||||
test('items in a flexible layout can be removed with object tree context menu when viewing the flexible layout', async ({ page }) => {
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
// Create a Display Layout
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Flexible Layout'
|
|
||||||
});
|
|
||||||
// Edit Flexible Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Create a Flexible Layout
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
flexibleLayout = await createDomainObjectWithDefaults(page, {
|
||||||
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
type: 'Flexible Layout'
|
||||||
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
|
||||||
|
|
||||||
// Expand the Flexible Layout so we can remove the sine wave generator
|
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
|
||||||
|
|
||||||
// Bring up context menu and remove
|
|
||||||
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// Verify that the item has been removed from the layout
|
|
||||||
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
test('items in a flexible layout can be removed with object tree context menu when viewing another item', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/3117'
|
|
||||||
});
|
|
||||||
const treePane = page.getByRole('tree', {
|
|
||||||
name: 'Main Tree'
|
|
||||||
});
|
|
||||||
const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
|
||||||
name: new RegExp(sineWaveObject.name)
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create a Flexible Layout
|
// Define the Sine Wave Generator and Clock tree items
|
||||||
const flexibleLayout = await createDomainObjectWithDefaults(page, {
|
treePane = page.getByRole('tree', {
|
||||||
type: 'Flexible Layout'
|
name: 'Main Tree'
|
||||||
});
|
|
||||||
// Edit Flexible Layout
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
|
||||||
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
|
||||||
|
|
||||||
// Expand the Flexible Layout so we can remove the sine wave generator
|
|
||||||
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
|
||||||
|
|
||||||
// Go to the original Sine Wave Generator to navigate away from the Flexible Layout
|
|
||||||
await page.goto(sineWaveObject.url);
|
|
||||||
|
|
||||||
// Bring up context menu and remove
|
|
||||||
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
|
||||||
await page.locator('button:has-text("OK")').click();
|
|
||||||
|
|
||||||
// navigate back to the display layout to confirm it has been removed
|
|
||||||
await page.goto(flexibleLayout.url);
|
|
||||||
|
|
||||||
// Verify that the item has been removed from the layout
|
|
||||||
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
|
||||||
});
|
});
|
||||||
|
sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(sineWaveObject.name)
|
||||||
|
});
|
||||||
|
clockTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(clockObject.name)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
test('panes have the appropriate draggable attribute while in Edit and Browse modes', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
||||||
|
// Add the Sine Wave Generator and Clock to the Flexible Layout
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
|
||||||
|
// Check that panes can be dragged while Flexible Layout is in Edit mode
|
||||||
|
let dragWrapper = page
|
||||||
|
.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper')
|
||||||
|
.first();
|
||||||
|
await expect(dragWrapper).toHaveAttribute('draggable', 'true');
|
||||||
|
// Save Flexible Layout
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
// Check that panes are not draggable while Flexible Layout is in Browse mode
|
||||||
|
dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
|
||||||
|
await expect(dragWrapper).toHaveAttribute('draggable', 'false');
|
||||||
|
});
|
||||||
|
test('changing toolbar settings in edit mode is immediately reflected and persists upon save', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6942'
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
||||||
|
// Add the Sine Wave Generator and Clock to the Flexible Layout
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
|
||||||
|
|
||||||
|
// Click on the first frame to select it
|
||||||
|
await page.locator('.c-fl-container__frame').first().click();
|
||||||
|
await expect(page.locator('.c-fl-container__frame > .c-frame').first()).toHaveAttribute(
|
||||||
|
's-selected',
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert the toolbar is visible
|
||||||
|
await expect(page.locator('.c-toolbar')).toBeInViewport();
|
||||||
|
|
||||||
|
// Assert the layout is in columns orientation
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
|
|
||||||
|
// Change the layout to rows orientation
|
||||||
|
await page.getByTitle('Columns layout').click();
|
||||||
|
|
||||||
|
// Assert the layout is in rows orientation
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toBeGreaterThan(0);
|
||||||
|
|
||||||
|
// Assert the frame of the first item is visible
|
||||||
|
await expect(page.locator('.c-so-view').first()).not.toHaveClass(/c-so-view--no-frame/);
|
||||||
|
|
||||||
|
// Hide the frame of the first item
|
||||||
|
await page.getByTitle('Frame visible').click();
|
||||||
|
|
||||||
|
// Assert the frame is hidden
|
||||||
|
await expect(page.locator('.c-so-view').first()).toHaveClass(/c-so-view--no-frame/);
|
||||||
|
|
||||||
|
// Assert there are 2 containers
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(2);
|
||||||
|
|
||||||
|
// Add a container
|
||||||
|
await page.getByTitle('Add Container').click();
|
||||||
|
|
||||||
|
// Assert there are 3 containers
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(3);
|
||||||
|
|
||||||
|
// Save Flexible Layout
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
|
|
||||||
|
// Nav away and back
|
||||||
|
await page.goto(sineWaveObject.url);
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
|
||||||
|
// Wait for the first frame to be visible so we know the layout has loaded
|
||||||
|
await expect(page.locator('.c-fl-container').nth(0)).toBeInViewport();
|
||||||
|
|
||||||
|
// Assert the settings have persisted
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(3);
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toBeGreaterThan(0);
|
||||||
|
await expect(page.locator('.c-so-view').first()).toHaveClass(/c-so-view--no-frame/);
|
||||||
|
});
|
||||||
|
test('items in a flexible layout can be removed with object tree context menu when viewing the flexible layout', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
|
||||||
|
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Flexible Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// Verify that the item has been removed from the layout
|
||||||
|
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
test('items in a flexible layout can be removed with object tree context menu when viewing another item', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/3117'
|
||||||
|
});
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
||||||
|
await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
|
||||||
|
|
||||||
|
// Expand the Flexible Layout so we can remove the sine wave generator
|
||||||
|
await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
|
||||||
|
|
||||||
|
// Go to the original Sine Wave Generator to navigate away from the Flexible Layout
|
||||||
|
await page.goto(sineWaveObject.url);
|
||||||
|
|
||||||
|
// Bring up context menu and remove
|
||||||
|
await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
|
||||||
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
|
||||||
|
// navigate back to the display layout to confirm it has been removed
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
|
||||||
|
// Verify that the item has been removed from the layout
|
||||||
|
expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('independent time works with flexible layouts and its children', async ({ page }) => {
|
||||||
|
// Create Example Imagery
|
||||||
|
const exampleImageryObject = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Example Imagery'
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(flexibleLayout.url);
|
||||||
|
// Edit Flexible Layout
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
const exampleImageryTreeItem = treePane.getByRole('treeitem', {
|
||||||
|
name: new RegExp(exampleImageryObject.name)
|
||||||
|
});
|
||||||
|
// Add the Sine Wave Generator to the Flexible Layout and save changes
|
||||||
|
await exampleImageryTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
|
||||||
|
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
// flip on independent time conductor
|
||||||
|
await setIndependentTimeConductorBounds(
|
||||||
|
page,
|
||||||
|
'2021-12-30 01:01:00.000Z',
|
||||||
|
'2021-12-30 01:11:00.000Z'
|
||||||
|
);
|
||||||
|
|
||||||
|
// check image date
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z').first()).toBeVisible();
|
||||||
|
|
||||||
|
// flip it off
|
||||||
|
await page.getByRole('switch').click();
|
||||||
|
// timestamp shouldn't be in the past anymore
|
||||||
|
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -21,104 +21,116 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test suite is dedicated to testing the Gauge component.
|
* This test suite is dedicated to testing the Gauge component.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
||||||
const uuid = require('uuid').v4;
|
const uuid = require('uuid').v4;
|
||||||
|
|
||||||
test.describe('Gauge', () => {
|
test.describe('Gauge', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// Open a browser, navigate to the main page, and wait until all networkevents to resolve
|
// Open a browser, navigate to the main page, and wait until all networkevents to resolve
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Can add and remove telemetry sources @unstable', async ({ page }) => {
|
||||||
|
// Create the gauge with defaults
|
||||||
|
const gauge = await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
||||||
|
const editButtonLocator = page.locator('button[title="Edit"]');
|
||||||
|
const saveButtonLocator = page.locator('button[title="Save"]');
|
||||||
|
|
||||||
|
// Create a sine wave generator within the gauge
|
||||||
|
const swg1 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Sine Wave Generator',
|
||||||
|
name: `swg-${uuid()}`,
|
||||||
|
parent: gauge.uuid
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can add and remove telemetry sources @unstable', async ({ page }) => {
|
// Navigate to the gauge and verify that
|
||||||
// Create the gauge with defaults
|
// the SWG appears in the elements pool
|
||||||
const gauge = await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
await page.goto(gauge.url);
|
||||||
const editButtonLocator = page.locator('button[title="Edit"]');
|
await editButtonLocator.click();
|
||||||
const saveButtonLocator = page.locator('button[title="Save"]');
|
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeVisible();
|
||||||
|
await saveButtonLocator.click();
|
||||||
|
await page.locator('li[title="Save and Finish Editing"]').click();
|
||||||
|
|
||||||
// Create a sine wave generator within the gauge
|
// Create another sine wave generator within the gauge
|
||||||
const swg1 = await createDomainObjectWithDefaults(page, {
|
const swg2 = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator',
|
type: 'Sine Wave Generator',
|
||||||
name: `swg-${uuid()}`,
|
name: `swg-${uuid()}`,
|
||||||
parent: gauge.uuid
|
parent: gauge.uuid
|
||||||
});
|
|
||||||
|
|
||||||
// Navigate to the gauge and verify that
|
|
||||||
// the SWG appears in the elements pool
|
|
||||||
await page.goto(gauge.url);
|
|
||||||
await editButtonLocator.click();
|
|
||||||
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeVisible();
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
await page.locator('li[title="Save and Finish Editing"]').click();
|
|
||||||
|
|
||||||
// Create another sine wave generator within the gauge
|
|
||||||
const swg2 = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Sine Wave Generator',
|
|
||||||
name: `swg-${uuid()}`,
|
|
||||||
parent: gauge.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify that the 'Replace telemetry source' modal appears and accept it
|
|
||||||
await expect.soft(page.locator('text=This action will replace the current telemetry source. Do you want to continue?')).toBeVisible();
|
|
||||||
await page.click('text=Ok');
|
|
||||||
|
|
||||||
// Navigate to the gauge and verify that the new SWG
|
|
||||||
// appears in the elements pool and the old one is gone
|
|
||||||
await page.goto(gauge.url);
|
|
||||||
await editButtonLocator.click();
|
|
||||||
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeHidden();
|
|
||||||
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg2.name}`)).toBeVisible();
|
|
||||||
await saveButtonLocator.click();
|
|
||||||
|
|
||||||
// Right click on the new SWG in the elements pool and delete it
|
|
||||||
await page.locator(`#inspector-elements-tree >> text=${swg2.name}`).click({
|
|
||||||
button: 'right'
|
|
||||||
});
|
|
||||||
await page.locator('li[title="Remove this object from its containing object."]').click();
|
|
||||||
|
|
||||||
// Verify that the 'Remove object' confirmation modal appears and accept it
|
|
||||||
await expect.soft(page.locator('text=Warning! This action will remove this object. Are you sure you want to continue?')).toBeVisible();
|
|
||||||
await page.click('text=Ok');
|
|
||||||
|
|
||||||
// Verify that the elements pool shows no elements
|
|
||||||
await expect(page.locator('text="No contained elements"')).toBeVisible();
|
|
||||||
});
|
});
|
||||||
test('Can create a non-default Gauge', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5356'
|
|
||||||
});
|
|
||||||
//Click the Create button
|
|
||||||
await page.click('button:has-text("Create")');
|
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
// Verify that the 'Replace telemetry source' modal appears and accept it
|
||||||
await page.click(`li[role='menuitem']:text("Gauge")`);
|
await expect
|
||||||
// FIXME: We need better selectors for these custom form controls
|
.soft(
|
||||||
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
page.locator(
|
||||||
await displayCurrentValueSwitch.setChecked(false);
|
'text=This action will replace the current telemetry source. Do you want to continue?'
|
||||||
await page.click('button[aria-label="Save"]');
|
)
|
||||||
|
)
|
||||||
|
.toBeVisible();
|
||||||
|
await page.click('text=Ok');
|
||||||
|
|
||||||
// TODO: Verify changes in the UI
|
// Navigate to the gauge and verify that the new SWG
|
||||||
|
// appears in the elements pool and the old one is gone
|
||||||
|
await page.goto(gauge.url);
|
||||||
|
await editButtonLocator.click();
|
||||||
|
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeHidden();
|
||||||
|
await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg2.name}`)).toBeVisible();
|
||||||
|
await saveButtonLocator.click();
|
||||||
|
|
||||||
|
// Right click on the new SWG in the elements pool and delete it
|
||||||
|
await page.locator(`#inspector-elements-tree >> text=${swg2.name}`).click({
|
||||||
|
button: 'right'
|
||||||
});
|
});
|
||||||
test('Can edit a single Gauge-specific property', async ({ page }) => {
|
await page.locator('li[title="Remove this object from its containing object."]').click();
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5985'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create the gauge with defaults
|
// Verify that the 'Remove object' confirmation modal appears and accept it
|
||||||
await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
await expect
|
||||||
await page.click('button[title="More options"]');
|
.soft(
|
||||||
await page.click('li[role="menuitem"]:has-text("Edit Properties")');
|
page.locator(
|
||||||
// FIXME: We need better selectors for these custom form controls
|
'text=Warning! This action will remove this object. Are you sure you want to continue?'
|
||||||
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
)
|
||||||
await displayCurrentValueSwitch.setChecked(false);
|
)
|
||||||
await page.click('button[aria-label="Save"]');
|
.toBeVisible();
|
||||||
|
await page.click('text=Ok');
|
||||||
|
|
||||||
// TODO: Verify changes in the UI
|
// Verify that the elements pool shows no elements
|
||||||
|
await expect(page.locator('text="No contained elements"')).toBeVisible();
|
||||||
|
});
|
||||||
|
test('Can create a non-default Gauge', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5356'
|
||||||
});
|
});
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
// Click the object specified by 'type'
|
||||||
|
await page.click(`li[role='menuitem']:text("Gauge")`);
|
||||||
|
// FIXME: We need better selectors for these custom form controls
|
||||||
|
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
||||||
|
await displayCurrentValueSwitch.setChecked(false);
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
// TODO: Verify changes in the UI
|
||||||
|
});
|
||||||
|
test('Can edit a single Gauge-specific property', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5985'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create the gauge with defaults
|
||||||
|
await createDomainObjectWithDefaults(page, { type: 'Gauge' });
|
||||||
|
await page.click('button[title="More options"]');
|
||||||
|
await page.click('li[role="menuitem"]:has-text("Edit Properties")');
|
||||||
|
// FIXME: We need better selectors for these custom form controls
|
||||||
|
const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
|
||||||
|
await displayCurrentValueSwitch.setChecked(false);
|
||||||
|
await page.click('button[aria-label="Save"]');
|
||||||
|
|
||||||
|
// TODO: Verify changes in the UI
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -29,22 +29,31 @@ This test suite is dedicated to tests which verify the basic operations surround
|
|||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('ExportAsJSON', () => {
|
test.describe('ExportAsJSON', () => {
|
||||||
test.fixme('Create a basic object and verify that it can be exported as JSON from Tree', async ({ page }) => {
|
test.fixme(
|
||||||
//Create domain object
|
'Create a basic object and verify that it can be exported as JSON from Tree',
|
||||||
//Save Domain Object
|
async ({ page }) => {
|
||||||
//Verify that the newly created domain object can be exported as JSON from the Tree
|
//Create domain object
|
||||||
});
|
//Save Domain Object
|
||||||
test.fixme('Create a basic object and verify that it can be exported as JSON from 3 dot menu', async ({ page }) => {
|
//Verify that the newly created domain object can be exported as JSON from the Tree
|
||||||
//Create domain object
|
}
|
||||||
//Save Domain Object
|
);
|
||||||
//Verify that the newly created domain object can be exported as JSON from the 3 dot menu
|
test.fixme(
|
||||||
});
|
'Create a basic object and verify that it can be exported as JSON from 3 dot menu',
|
||||||
test.fixme('Verify that a nested Object can be exported as JSON', async ({ page }) => {
|
async ({ page }) => {
|
||||||
// Create 2 objects with hierarchy
|
//Create domain object
|
||||||
// Export as JSON
|
//Save Domain Object
|
||||||
// Verify Hiearchy
|
//Verify that the newly created domain object can be exported as JSON from the 3 dot menu
|
||||||
});
|
}
|
||||||
test.fixme('Verify that the ExportAsJSON dropdown does not appear for the item X', async ({ page }) => {
|
);
|
||||||
// Other than non-persistible objects
|
test.fixme('Verify that a nested Object can be exported as JSON', async ({ page }) => {
|
||||||
});
|
// Create 2 objects with hierarchy
|
||||||
|
// Export as JSON
|
||||||
|
// Verify Hierarchy
|
||||||
|
});
|
||||||
|
test.fixme(
|
||||||
|
'Verify that the ExportAsJSON dropdown does not appear for the item X',
|
||||||
|
async ({ page }) => {
|
||||||
|
// Other than non-persistable objects
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
@ -1,48 +1,54 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
* "License"); you may not use this file except in compliance with the License.
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*
|
*
|
||||||
* Open MCT includes source code licensed under additional open source
|
* Open MCT includes source code licensed under additional open source
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify the basic operations surrounding importAsJSON.
|
This test suite is dedicated to tests which verify the basic operations surrounding importAsJSON.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// FIXME: Remove this eslint exception once tests are implemented
|
// FIXME: Remove this eslint exception once tests are implemented
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { test, expect } = require('../../../../baseFixtures');
|
const { test, expect } = require('../../../../baseFixtures');
|
||||||
|
|
||||||
test.describe('ExportAsJSON', () => {
|
test.describe('ExportAsJSON', () => {
|
||||||
test.fixme('Verify that domain object can be importAsJSON from Tree', async ({ page }) => {
|
test.fixme('Verify that domain object can be importAsJSON from Tree', async ({ page }) => {
|
||||||
//Verify that an testdata JSON file can be imported from Tree
|
//Verify that an testdata JSON file can be imported from Tree
|
||||||
//Verify correctness of imported domain object
|
//Verify correctness of imported domain object
|
||||||
});
|
});
|
||||||
test.fixme('Verify that domain object can be importAsJSON from 3 dot menu on folder', async ({ page }) => {
|
test.fixme(
|
||||||
//Verify that an testdata JSON file can be imported from 3 dot menu on folder domain object
|
'Verify that domain object can be importAsJSON from 3 dot menu on folder',
|
||||||
//Verify correctness of imported domain object
|
async ({ page }) => {
|
||||||
});
|
//Verify that an testdata JSON file can be imported from 3 dot menu on folder domain object
|
||||||
test.fixme('Verify that a nested Objects can be importAsJSON', async ({ page }) => {
|
//Verify correctness of imported domain object
|
||||||
// Testdata with hierarchy
|
}
|
||||||
// ImportAsJSON on Tree
|
);
|
||||||
// Verify Hierarchy
|
test.fixme('Verify that a nested Objects can be importAsJSON', async ({ page }) => {
|
||||||
});
|
// Testdata with hierarchy
|
||||||
test.fixme('Verify that the ImportAsJSON dropdown does not appear for the item X', async ({ page }) => {
|
// ImportAsJSON on Tree
|
||||||
// Other than non-persistible objects
|
// Verify Hierarchy
|
||||||
});
|
});
|
||||||
});
|
test.fixme(
|
||||||
|
'Verify that the ImportAsJSON dropdown does not appear for the item X',
|
||||||
|
async ({ page }) => {
|
||||||
|
// Other than non-persistable objects
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
@ -21,189 +21,200 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults, setStartOffset, setFixedTimeMode, setRealTimeMode, selectInspectorTab } = require('../../../../appActions');
|
const {
|
||||||
|
createDomainObjectWithDefaults,
|
||||||
|
setStartOffset,
|
||||||
|
setFixedTimeMode,
|
||||||
|
setRealTimeMode
|
||||||
|
} = require('../../../../appActions');
|
||||||
|
|
||||||
test.describe('Testing LAD table configuration', () => {
|
test.describe('Testing LAD table configuration', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Create LAD table
|
// Create LAD table
|
||||||
const ladTable = await createDomainObjectWithDefaults(page, {
|
const ladTable = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'LAD Table',
|
type: 'LAD Table',
|
||||||
name: "Test LAD Table"
|
name: 'Test LAD Table'
|
||||||
});
|
|
||||||
|
|
||||||
// Create Sine Wave Generator
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Sine Wave Generator',
|
|
||||||
name: "Test Sine Wave Generator",
|
|
||||||
parent: ladTable.uuid
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto(ladTable.url);
|
|
||||||
});
|
|
||||||
test('in edit mode, LAD Tables provide ability to hide columns', async ({ page }) => {
|
|
||||||
// Edit LAD table
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// // Expand the 'My Items' folder in the left tree
|
|
||||||
// await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// // Add the Sine Wave Generator to the LAD table and save changes
|
|
||||||
// await page.dragAndDrop('role=treeitem[name=/Test Sine Wave Generator/]', '.c-lad-table-wrapper');
|
|
||||||
// select configuration tab in inspector
|
|
||||||
await selectInspectorTab(page, 'LAD Table Configuration');
|
|
||||||
|
|
||||||
// make sure headers are visible initially
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
|
||||||
|
|
||||||
// hide timestamp column
|
|
||||||
await page.getByLabel('Timestamp').uncheck();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
|
||||||
|
|
||||||
// hide units & type column
|
|
||||||
await page.getByLabel('Units').uncheck();
|
|
||||||
await page.getByLabel('Type').uncheck();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
|
||||||
|
|
||||||
// save and reload and verify they columns are still hidden
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
await page.reload();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
|
||||||
|
|
||||||
// Edit LAD table
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
await selectInspectorTab(page, 'LAD Table Configuration');
|
|
||||||
|
|
||||||
// show timestamp column
|
|
||||||
await page.getByLabel('Timestamp').check();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
|
||||||
|
|
||||||
// save and reload and make sure only timestamp is still visible
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
await page.reload();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
|
||||||
|
|
||||||
// Edit LAD table
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
await selectInspectorTab(page, 'LAD Table Configuration');
|
|
||||||
|
|
||||||
// show units and type columns
|
|
||||||
await page.getByLabel('Units').check();
|
|
||||||
await page.getByLabel('Type').check();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
|
||||||
|
|
||||||
// save and reload and make sure all columns are still visible
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
await page.reload();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
|
||||||
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('LAD Tables don\'t allow selection of rows but does show context click menus', async ({ page }) => {
|
// Create Sine Wave Generator
|
||||||
const cell = await page.locator('.js-first-data');
|
await createDomainObjectWithDefaults(page, {
|
||||||
const userSelectable = await cell.evaluate((el) => {
|
type: 'Sine Wave Generator',
|
||||||
return window.getComputedStyle(el).getPropertyValue('user-select');
|
name: 'Test Sine Wave Generator',
|
||||||
});
|
parent: ladTable.uuid
|
||||||
|
|
||||||
expect(userSelectable).toBe('none');
|
|
||||||
// Right-click on the LAD table row
|
|
||||||
await cell.click({
|
|
||||||
button: 'right'
|
|
||||||
});
|
|
||||||
const menuOptions = page.locator('.c-menu ul');
|
|
||||||
await expect.soft(menuOptions).toContainText('View Full Datum');
|
|
||||||
await expect.soft(menuOptions).toContainText('View Historical Data');
|
|
||||||
await expect.soft(menuOptions).toContainText('Remove');
|
|
||||||
// await page.locator('li[title="Remove this object from its containing object."]').click();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await page.goto(ladTable.url);
|
||||||
|
});
|
||||||
|
test('in edit mode, LAD Tables provide ability to hide columns', async ({ page }) => {
|
||||||
|
// Edit LAD table
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// // Expand the 'My Items' folder in the left tree
|
||||||
|
// await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// // Add the Sine Wave Generator to the LAD table and save changes
|
||||||
|
// await page.dragAndDrop('role=treeitem[name=/Test Sine Wave Generator/]', '.c-lad-table-wrapper');
|
||||||
|
// select configuration tab in inspector
|
||||||
|
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
|
||||||
|
|
||||||
|
// make sure headers are visible initially
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
||||||
|
|
||||||
|
// hide timestamp column
|
||||||
|
await page.getByLabel('Timestamp').uncheck();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
||||||
|
|
||||||
|
// hide units & type column
|
||||||
|
await page.getByLabel('Units').uncheck();
|
||||||
|
await page.getByLabel('Type').uncheck();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
||||||
|
|
||||||
|
// save and reload and verify they columns are still hidden
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
await page.reload();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
||||||
|
|
||||||
|
// Edit LAD table
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
|
||||||
|
|
||||||
|
// show timestamp column
|
||||||
|
await page.getByLabel('Timestamp').check();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
||||||
|
|
||||||
|
// save and reload and make sure only timestamp is still visible
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
await page.reload();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
||||||
|
|
||||||
|
// Edit LAD table
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
await page.getByRole('tab', { name: 'LAD Table Configuration' }).click();
|
||||||
|
|
||||||
|
// show units and type columns
|
||||||
|
await page.getByLabel('Units').check();
|
||||||
|
await page.getByLabel('Type').check();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
||||||
|
|
||||||
|
// save and reload and make sure all columns are still visible
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
await page.reload();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
|
||||||
|
await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("LAD Tables don't allow selection of rows but does show context click menus", async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const cell = await page.locator('.js-first-data');
|
||||||
|
const userSelectable = await cell.evaluate((el) => {
|
||||||
|
return window.getComputedStyle(el).getPropertyValue('user-select');
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(userSelectable).toBe('none');
|
||||||
|
// Right-click on the LAD table row
|
||||||
|
await cell.click({
|
||||||
|
button: 'right'
|
||||||
|
});
|
||||||
|
const menuOptions = page.locator('.c-menu ul');
|
||||||
|
await expect.soft(menuOptions).toContainText('View Full Datum');
|
||||||
|
await expect.soft(menuOptions).toContainText('View Historical Data');
|
||||||
|
await expect.soft(menuOptions).toContainText('Remove');
|
||||||
|
// await page.locator('li[title="Remove this object from its containing object."]').click();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Testing LAD table @unstable', () => {
|
test.describe('Testing LAD table @unstable', () => {
|
||||||
let sineWaveObject;
|
let sineWaveObject;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
await setRealTimeMode(page);
|
await setRealTimeMode(page);
|
||||||
|
|
||||||
// Create Sine Wave Generator
|
// Create Sine Wave Generator
|
||||||
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
sineWaveObject = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator',
|
type: 'Sine Wave Generator',
|
||||||
name: "Test Sine Wave Generator"
|
name: 'Test Sine Wave Generator'
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test('telemetry value exactly matches latest telemetry value received in real time', async ({ page }) => {
|
});
|
||||||
// Create LAD table
|
test('telemetry value exactly matches latest telemetry value received in real time', async ({
|
||||||
await createDomainObjectWithDefaults(page, {
|
page
|
||||||
type: 'LAD Table',
|
}) => {
|
||||||
name: "Test LAD Table"
|
// Create LAD table
|
||||||
});
|
await createDomainObjectWithDefaults(page, {
|
||||||
// Edit LAD table
|
type: 'LAD Table',
|
||||||
await page.locator('[title="Edit"]').click();
|
name: 'Test LAD Table'
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
|
||||||
// Add the Sine Wave Generator to the LAD table and save changes
|
|
||||||
await page.dragAndDrop('text=Test Sine Wave Generator', '.c-lad-table-wrapper');
|
|
||||||
await page.locator('button[title="Save"]').click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
// Subscribe to the Sine Wave Generator data
|
|
||||||
// On getting data, check if the value found in the LAD table is the most recent value
|
|
||||||
// from the Sine Wave Generator
|
|
||||||
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
|
||||||
const subscribeTelemValue = await getTelemValuePromise;
|
|
||||||
const ladTableValuePromise = await page.waitForSelector(`text="${subscribeTelemValue}"`);
|
|
||||||
const ladTableValue = await ladTableValuePromise.textContent();
|
|
||||||
|
|
||||||
expect(ladTableValue).toBe(subscribeTelemValue);
|
|
||||||
});
|
});
|
||||||
test('telemetry value exactly matches latest telemetry value received in fixed time', async ({ page }) => {
|
// Edit LAD table
|
||||||
// Create LAD table
|
await page.locator('[title="Edit"]').click();
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'LAD Table',
|
|
||||||
name: "Test LAD Table"
|
|
||||||
});
|
|
||||||
// Edit LAD table
|
|
||||||
await page.locator('[title="Edit"]').click();
|
|
||||||
|
|
||||||
// Expand the 'My Items' folder in the left tree
|
// Expand the 'My Items' folder in the left tree
|
||||||
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
// Add the Sine Wave Generator to the LAD table and save changes
|
// Add the Sine Wave Generator to the LAD table and save changes
|
||||||
await page.dragAndDrop('text=Test Sine Wave Generator', '.c-lad-table-wrapper');
|
await page.dragAndDrop('text=Test Sine Wave Generator', '.c-lad-table-wrapper');
|
||||||
await page.locator('button[title="Save"]').click();
|
await page.locator('button[title="Save"]').click();
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
// Subscribe to the Sine Wave Generator data
|
// Subscribe to the Sine Wave Generator data
|
||||||
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
// On getting data, check if the value found in the LAD table is the most recent value
|
||||||
// Set an offset of 1 minute and then change the time mode to fixed to set a 1 minute historical window
|
// from the Sine Wave Generator
|
||||||
await setStartOffset(page, { mins: '1' });
|
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
||||||
await setFixedTimeMode(page);
|
const subscribeTelemValue = await getTelemValuePromise;
|
||||||
|
const ladTableValuePromise = await page.waitForSelector(`text="${subscribeTelemValue}"`);
|
||||||
|
const ladTableValue = await ladTableValuePromise.textContent();
|
||||||
|
|
||||||
// On getting data, check if the value found in the LAD table is the most recent value
|
expect(ladTableValue).toBe(subscribeTelemValue);
|
||||||
// from the Sine Wave Generator
|
});
|
||||||
const subscribeTelemValue = await getTelemValuePromise;
|
test('telemetry value exactly matches latest telemetry value received in fixed time', async ({
|
||||||
const ladTableValuePromise = await page.waitForSelector(`text="${subscribeTelemValue}"`);
|
page
|
||||||
const ladTableValue = await ladTableValuePromise.textContent();
|
}) => {
|
||||||
|
// Create LAD table
|
||||||
expect(ladTableValue).toBe(subscribeTelemValue);
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'LAD Table',
|
||||||
|
name: 'Test LAD Table'
|
||||||
});
|
});
|
||||||
|
// Edit LAD table
|
||||||
|
await page.locator('[title="Edit"]').click();
|
||||||
|
|
||||||
|
// Expand the 'My Items' folder in the left tree
|
||||||
|
await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
|
||||||
|
// Add the Sine Wave Generator to the LAD table and save changes
|
||||||
|
await page.dragAndDrop('text=Test Sine Wave Generator', '.c-lad-table-wrapper');
|
||||||
|
await page.locator('button[title="Save"]').click();
|
||||||
|
await page.locator('text=Save and Finish Editing').click();
|
||||||
|
|
||||||
|
// Subscribe to the Sine Wave Generator data
|
||||||
|
const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
|
||||||
|
// Set an offset of 1 minute and then change the time mode to fixed to set a 1 minute historical window
|
||||||
|
await setStartOffset(page, { mins: '1' });
|
||||||
|
await setFixedTimeMode(page);
|
||||||
|
|
||||||
|
// On getting data, check if the value found in the LAD table is the most recent value
|
||||||
|
// from the Sine Wave Generator
|
||||||
|
const subscribeTelemValue = await getTelemValuePromise;
|
||||||
|
const ladTableValuePromise = await page.waitForSelector(`text="${subscribeTelemValue}"`);
|
||||||
|
const ladTableValue = await ladTableValuePromise.textContent();
|
||||||
|
|
||||||
|
expect(ladTableValue).toBe(subscribeTelemValue);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -216,18 +227,20 @@ test.describe('Testing LAD table @unstable', () => {
|
|||||||
* @returns {Promise<string>} the formatted sin telemetry value
|
* @returns {Promise<string>} the formatted sin telemetry value
|
||||||
*/
|
*/
|
||||||
async function subscribeToTelemetry(page, objectIdentifier) {
|
async function subscribeToTelemetry(page, objectIdentifier) {
|
||||||
const getTelemValuePromise = new Promise(resolve => page.exposeFunction('getTelemValue', resolve));
|
const getTelemValuePromise = new Promise((resolve) =>
|
||||||
|
page.exposeFunction('getTelemValue', resolve)
|
||||||
|
);
|
||||||
|
|
||||||
await page.evaluate(async (telemetryIdentifier) => {
|
await page.evaluate(async (telemetryIdentifier) => {
|
||||||
const telemetryObject = await window.openmct.objects.get(telemetryIdentifier);
|
const telemetryObject = await window.openmct.objects.get(telemetryIdentifier);
|
||||||
const metadata = window.openmct.telemetry.getMetadata(telemetryObject);
|
const metadata = window.openmct.telemetry.getMetadata(telemetryObject);
|
||||||
const formats = await window.openmct.telemetry.getFormatMap(metadata);
|
const formats = await window.openmct.telemetry.getFormatMap(metadata);
|
||||||
window.openmct.telemetry.subscribe(telemetryObject, (obj) => {
|
window.openmct.telemetry.subscribe(telemetryObject, (obj) => {
|
||||||
const sinVal = obj.sin;
|
const sinVal = obj.sin;
|
||||||
const formattedSinVal = formats.sin.format(sinVal);
|
const formattedSinVal = formats.sin.format(sinVal);
|
||||||
window.getTelemValue(formattedSinVal);
|
window.getTelemValue(formattedSinVal);
|
||||||
});
|
});
|
||||||
}, objectIdentifier);
|
}, objectIdentifier);
|
||||||
|
|
||||||
return getTelemValuePromise;
|
return getTelemValuePromise;
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
|
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect, streamToString } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
||||||
const nbUtils = require('../../../../helper/notebookUtils');
|
const nbUtils = require('../../../../helper/notebookUtils');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@ -32,349 +32,454 @@ const path = require('path');
|
|||||||
const NOTEBOOK_NAME = 'Notebook';
|
const NOTEBOOK_NAME = 'Notebook';
|
||||||
|
|
||||||
test.describe('Notebook CRUD Operations', () => {
|
test.describe('Notebook CRUD Operations', () => {
|
||||||
test.fixme('Can create a Notebook Object', async ({ page }) => {
|
test.fixme('Can create a Notebook Object', async ({ page }) => {
|
||||||
//Create domain object
|
//Create domain object
|
||||||
//Newly created notebook should have one Section and one page, 'Unnamed Section'/'Unnamed Page'
|
//Newly created notebook should have one Section and one page, 'Unnamed Section'/'Unnamed Page'
|
||||||
});
|
});
|
||||||
test.fixme('Can update a Notebook Object', async ({ page }) => {});
|
test.fixme('Can update a Notebook Object', async ({ page }) => {});
|
||||||
test.fixme('Can view a perviously created Notebook Object', async ({ page }) => {});
|
test.fixme('Can view a perviously created Notebook Object', async ({ page }) => {});
|
||||||
test.fixme('Can Delete a Notebook Object', async ({ page }) => {
|
test.fixme('Can Delete a Notebook Object', async ({ page }) => {
|
||||||
// Other than non-persistible objects
|
// Other than non-persistable objects
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Default Notebook', () => {
|
test.describe('Default Notebook', () => {
|
||||||
// General Default Notebook statements
|
// General Default Notebook statements
|
||||||
// ## Useful commands:
|
// ## Useful commands:
|
||||||
// 1. - To check default notebook:
|
// 1. - To check default notebook:
|
||||||
// `JSON.parse(localStorage.getItem('notebook-storage'));`
|
// `JSON.parse(localStorage.getItem('notebook-storage'));`
|
||||||
// 1. - Clear default notebook:
|
// 1. - Clear default notebook:
|
||||||
// `localStorage.setItem('notebook-storage', null);`
|
// `localStorage.setItem('notebook-storage', null);`
|
||||||
test.fixme('A newly created Notebook is automatically set as the default notebook if no other notebooks exist', async ({ page }) => {
|
test.fixme(
|
||||||
//Create new notebook
|
'A newly created Notebook is automatically set as the default notebook if no other notebooks exist',
|
||||||
//Verify Default Notebook Characteristics
|
async ({ page }) => {
|
||||||
});
|
//Create new notebook
|
||||||
test.fixme('A newly created Notebook is automatically set as the default notebook if at least one other notebook exists', async ({ page }) => {
|
//Verify Default Notebook Characteristics
|
||||||
//Create new notebook A
|
}
|
||||||
//Create second notebook B
|
);
|
||||||
//Verify Non-Default Notebook A Characteristics
|
test.fixme(
|
||||||
//Verify Default Notebook B Characteristics
|
'A newly created Notebook is automatically set as the default notebook if at least one other notebook exists',
|
||||||
});
|
async ({ page }) => {
|
||||||
test.fixme('If a default notebook is deleted, the second most recent notebook becomes the default', async ({ page }) => {
|
//Create new notebook A
|
||||||
//Create new notebook A
|
//Create second notebook B
|
||||||
//Create second notebook B
|
//Verify Non-Default Notebook A Characteristics
|
||||||
//Delete Notebook B
|
//Verify Default Notebook B Characteristics
|
||||||
//Verify Default Notebook A Characteristics
|
}
|
||||||
});
|
);
|
||||||
|
test.fixme(
|
||||||
|
'If a default notebook is deleted, the second most recent notebook becomes the default',
|
||||||
|
async ({ page }) => {
|
||||||
|
//Create new notebook A
|
||||||
|
//Create second notebook B
|
||||||
|
//Delete Notebook B
|
||||||
|
//Verify Default Notebook A Characteristics
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Notebook section tests', () => {
|
test.describe('Notebook section tests', () => {
|
||||||
//The following test cases are associated with Notebook Sections
|
//The following test cases are associated with Notebook Sections
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
//Navigate to baseURL
|
//Navigate to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Create Notebook
|
// Create Notebook
|
||||||
await createDomainObjectWithDefaults(page, {
|
await createDomainObjectWithDefaults(page, {
|
||||||
type: NOTEBOOK_NAME
|
type: NOTEBOOK_NAME
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test('Default and new sections are automatically named Unnamed Section with Unnamed Page', async ({ page }) => {
|
});
|
||||||
// Check that the default section and page are created and the name matches the defaults
|
test('Default and new sections are automatically named Unnamed Section with Unnamed Page', async ({
|
||||||
const defaultSectionName = await page.locator('.c-notebook__sections .c-list__item__name').textContent();
|
page
|
||||||
expect(defaultSectionName).toBe('Unnamed Section');
|
}) => {
|
||||||
const defaultPageName = await page.locator('.c-notebook__pages .c-list__item__name').textContent();
|
const notebookSectionNames = page.locator('.c-notebook__sections .c-list__item__name');
|
||||||
expect(defaultPageName).toBe('Unnamed Page');
|
const notebookPageNames = page.locator('.c-notebook__pages .c-list__item__name');
|
||||||
|
await expect(notebookSectionNames).toBeHidden();
|
||||||
|
await expect(notebookPageNames).toBeHidden();
|
||||||
|
// Expand sidebar
|
||||||
|
await page.locator('.c-notebook__toggle-nav-button').click();
|
||||||
|
// Check that the default section and page are created and the name matches the defaults
|
||||||
|
const defaultSectionName = await notebookSectionNames.innerText();
|
||||||
|
await expect(notebookSectionNames).toBeVisible();
|
||||||
|
expect(defaultSectionName).toBe('Unnamed Section');
|
||||||
|
const defaultPageName = await notebookPageNames.innerText();
|
||||||
|
await expect(notebookPageNames).toBeVisible();
|
||||||
|
expect(defaultPageName).toBe('Unnamed Page');
|
||||||
|
|
||||||
// Expand sidebar and add a section
|
// Add a section
|
||||||
await page.locator('.c-notebook__toggle-nav-button').click();
|
await page.locator('.js-sidebar-sections .c-icon-button.icon-plus').click();
|
||||||
await page.locator('.js-sidebar-sections .c-icon-button.icon-plus').click();
|
|
||||||
|
|
||||||
// Check that new section and page within the new section match the defaults
|
// Check that new section and page within the new section match the defaults
|
||||||
const newSectionName = await page.locator('.c-notebook__sections .c-list__item__name').nth(1).textContent();
|
const newSectionName = await notebookSectionNames.nth(1).innerText();
|
||||||
expect(newSectionName).toBe('Unnamed Section');
|
await expect(notebookSectionNames.nth(1)).toBeVisible();
|
||||||
const newPageName = await page.locator('.c-notebook__pages .c-list__item__name').textContent();
|
expect(newSectionName).toBe('Unnamed Section');
|
||||||
expect(newPageName).toBe('Unnamed Page');
|
const newPageName = await notebookPageNames.innerText();
|
||||||
});
|
await expect(notebookPageNames).toBeVisible();
|
||||||
test.fixme('Section selection operations and associated behavior', async ({ page }) => {
|
expect(newPageName).toBe('Unnamed Page');
|
||||||
//Create new notebook A
|
});
|
||||||
//Add Sections until 6 total with no default section/page
|
test.fixme('Section selection operations and associated behavior', async ({ page }) => {
|
||||||
//Select 3rd section
|
//Create new notebook A
|
||||||
//Delete 4th section
|
//Add Sections until 6 total with no default section/page
|
||||||
//3rd section is still selected
|
//Select 3rd section
|
||||||
//Delete 3rd section
|
//Delete 4th section
|
||||||
//1st section is selected
|
//3rd section is still selected
|
||||||
//Set 3rd section as default
|
//Delete 3rd section
|
||||||
//Delete 2nd section
|
//1st section is selected
|
||||||
//3rd section is still default
|
//Set 3rd section as default
|
||||||
//Delete 3rd section
|
//Delete 2nd section
|
||||||
//1st is selected and there is no default notebook
|
//3rd section is still default
|
||||||
});
|
//Delete 3rd section
|
||||||
test.fixme('Section rename operations', async ({ page }) => {
|
//1st is selected and there is no default notebook
|
||||||
// Create a new notebook
|
});
|
||||||
// Add a section
|
test.fixme('Section rename operations', async ({ page }) => {
|
||||||
// Rename the section but do not confirm
|
// Create a new notebook
|
||||||
// Keyboard press 'Escape'
|
// Add a section
|
||||||
// Verify that the section name reverts to the default name
|
// Rename the section but do not confirm
|
||||||
// Rename the section but do not confirm
|
// Keyboard press 'Escape'
|
||||||
// Keyboard press 'Enter'
|
// Verify that the section name reverts to the default name
|
||||||
// Verify that the section name is updated
|
// Rename the section but do not confirm
|
||||||
// Rename the section to "" (empty string)
|
// Keyboard press 'Enter'
|
||||||
// Keyboard press 'Enter' to confirm
|
// Verify that the section name is updated
|
||||||
// Verify that the section name reverts to the default name
|
// Rename the section to "" (empty string)
|
||||||
// Rename the section to something long that overflows the text box
|
// Keyboard press 'Enter' to confirm
|
||||||
// Verify that the section name is not truncated while input is active
|
// Verify that the section name reverts to the default name
|
||||||
// Confirm the section name edit
|
// Rename the section to something long that overflows the text box
|
||||||
// Verify that the section name is truncated now that input is not active
|
// Verify that the section name is not truncated while input is active
|
||||||
});
|
// Confirm the section name edit
|
||||||
|
// Verify that the section name is truncated now that input is not active
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Notebook page tests', () => {
|
test.describe('Notebook page tests', () => {
|
||||||
//The following test cases are associated with Notebook Pages
|
//The following test cases are associated with Notebook Pages
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
//Navigate to baseURL
|
//Navigate to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Create Notebook
|
// Create Notebook
|
||||||
await createDomainObjectWithDefaults(page, {
|
await createDomainObjectWithDefaults(page, {
|
||||||
type: NOTEBOOK_NAME
|
type: NOTEBOOK_NAME
|
||||||
});
|
|
||||||
});
|
});
|
||||||
//Test will need to be implemented after a refactor in #5713
|
});
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
//Test will need to be implemented after a refactor in #5713
|
||||||
test.skip('Delete page popup is removed properly on clicking dropdown again', async ({ page }) => {
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
test.info().annotations.push({
|
test.skip('Delete page popup is removed properly on clicking dropdown again', async ({
|
||||||
type: 'issue',
|
page
|
||||||
description: 'https://github.com/nasa/openmct/issues/5713'
|
}) => {
|
||||||
});
|
test.info().annotations.push({
|
||||||
// Expand sidebar and add a second page
|
type: 'issue',
|
||||||
await page.locator('.c-notebook__toggle-nav-button').click();
|
description: 'https://github.com/nasa/openmct/issues/5713'
|
||||||
await page.locator('text=Page Add >> button').click();
|
});
|
||||||
|
// Expand sidebar and add a second page
|
||||||
|
await page.locator('.c-notebook__toggle-nav-button').click();
|
||||||
|
await page.locator('text=Page Add >> button').click();
|
||||||
|
|
||||||
// Click on the 2nd page dropdown button and expect the Delete Page option to appear
|
// Click on the 2nd page dropdown button and expect the Delete Page option to appear
|
||||||
await page.locator('button[title="Open context menu"]').nth(2).click();
|
await page.locator('button[title="Open context menu"]').nth(2).click();
|
||||||
await expect(page.locator('text=Delete Page')).toBeEnabled();
|
await expect(page.locator('text=Delete Page')).toBeEnabled();
|
||||||
// Clicking on the same page a second time causes the same Delete Page option to recreate
|
// Clicking on the same page a second time causes the same Delete Page option to recreate
|
||||||
await page.locator('button[title="Open context menu"]').nth(2).click();
|
await page.locator('button[title="Open context menu"]').nth(2).click();
|
||||||
await expect(page.locator('text=Delete Page')).toBeEnabled();
|
await expect(page.locator('text=Delete Page')).toBeEnabled();
|
||||||
// Clicking on the first page causes the first delete button to detach and recreate on the first page
|
// Clicking on the first page causes the first delete button to detach and recreate on the first page
|
||||||
await page.locator('button[title="Open context menu"]').nth(1).click();
|
await page.locator('button[title="Open context menu"]').nth(1).click();
|
||||||
const numOfDeletePagePopups = await page.locator('li[title="Delete Page"]').count();
|
const numOfDeletePagePopups = await page.locator('li[title="Delete Page"]').count();
|
||||||
expect(numOfDeletePagePopups).toBe(1);
|
expect(numOfDeletePagePopups).toBe(1);
|
||||||
});
|
});
|
||||||
test.fixme('Page selection operations and associated behavior', async ({ page }) => {
|
test.fixme('Page selection operations and associated behavior', async ({ page }) => {
|
||||||
//Create new notebook A
|
//Create new notebook A
|
||||||
//Delete existing Page
|
//Delete existing Page
|
||||||
//New 'Unnamed Page' automatically created
|
//New 'Unnamed Page' automatically created
|
||||||
//Create 6 total Pages without a default page
|
//Create 6 total Pages without a default page
|
||||||
//Select 3rd
|
//Select 3rd
|
||||||
//Delete 3rd
|
//Delete 3rd
|
||||||
//First is now selected
|
//First is now selected
|
||||||
//Set 3rd as default
|
//Set 3rd as default
|
||||||
//Select 2nd page
|
//Select 2nd page
|
||||||
//Delete 2nd page
|
//Delete 2nd page
|
||||||
//3rd (default) is now selected
|
//3rd (default) is now selected
|
||||||
//Set 3rd as default page
|
//Set 3rd as default page
|
||||||
//Select 3rd (default) page
|
//Select 3rd (default) page
|
||||||
//Delete 3rd page
|
//Delete 3rd page
|
||||||
//First is now selected and there is no default notebook
|
//First is now selected and there is no default notebook
|
||||||
});
|
});
|
||||||
test.fixme('Page rename operations', async ({ page }) => {
|
test.fixme('Page rename operations', async ({ page }) => {
|
||||||
// Create a new notebook
|
// Create a new notebook
|
||||||
// Add a page
|
// Add a page
|
||||||
// Rename the page but do not confirm
|
// Rename the page but do not confirm
|
||||||
// Keyboard press 'Escape'
|
// Keyboard press 'Escape'
|
||||||
// Verify that the page name reverts to the default name
|
// Verify that the page name reverts to the default name
|
||||||
// Rename the page but do not confirm
|
// Rename the page but do not confirm
|
||||||
// Keyboard press 'Enter'
|
// Keyboard press 'Enter'
|
||||||
// Verify that the page name is updated
|
// Verify that the page name is updated
|
||||||
// Rename the page to "" (empty string)
|
// Rename the page to "" (empty string)
|
||||||
// Keyboard press 'Enter' to confirm
|
// Keyboard press 'Enter' to confirm
|
||||||
// Verify that the page name reverts to the default name
|
// Verify that the page name reverts to the default name
|
||||||
// Rename the page to something long that overflows the text box
|
// Rename the page to something long that overflows the text box
|
||||||
// Verify that the page name is not truncated while input is active
|
// Verify that the page name is not truncated while input is active
|
||||||
// Confirm the page name edit
|
// Confirm the page name edit
|
||||||
// Verify that the page name is truncated now that input is not active
|
// Verify that the page name is truncated now that input is not active
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Notebook export tests', () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
//Navigate to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create Notebook
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: NOTEBOOK_NAME
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
test('can export notebook as text', async ({ page }) => {
|
||||||
|
await nbUtils.enterTextEntry(page, `Foo bar entry`);
|
||||||
|
// Click on 3 Dot Menu
|
||||||
|
await page.locator('button[title="More options"]').click();
|
||||||
|
const downloadPromise = page.waitForEvent('download');
|
||||||
|
|
||||||
|
await page.getByRole('menuitem', { name: /Export Notebook as Text/ }).click();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
const download = await downloadPromise;
|
||||||
|
const readStream = await download.createReadStream();
|
||||||
|
const exportedText = await streamToString(readStream);
|
||||||
|
expect(exportedText).toContain('Foo bar entry');
|
||||||
|
});
|
||||||
|
test.fixme('can export multiple notebook entries as text ', async ({ page }) => {});
|
||||||
|
test.fixme('can export all notebook entry metdata', async ({ page }) => {});
|
||||||
|
test.fixme('can export all notebook tags', async ({ page }) => {});
|
||||||
|
test.fixme('can export all notebook snapshots', async ({ page }) => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Notebook search tests', () => {
|
test.describe('Notebook search tests', () => {
|
||||||
test.fixme('Can search for a single result', async ({ page }) => {});
|
test.fixme('Can search for a single result', async ({ page }) => {});
|
||||||
test.fixme('Can search for many results', async ({ page }) => {});
|
test.fixme('Can search for many results', async ({ page }) => {});
|
||||||
test.fixme('Can search for new and recently modified entries', async ({ page }) => {});
|
test.fixme('Can search for new and recently modified entries', async ({ page }) => {});
|
||||||
test.fixme('Can search for section text', async ({ page }) => {});
|
test.fixme('Can search for section text', async ({ page }) => {});
|
||||||
test.fixme('Can search for page text', async ({ page }) => {});
|
test.fixme('Can search for page text', async ({ page }) => {});
|
||||||
test.fixme('Can search for entry text', async ({ page }) => {});
|
test.fixme('Can search for entry text', async ({ page }) => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Notebook entry tests', () => {
|
test.describe('Notebook entry tests', () => {
|
||||||
// Create Notebook with URL Whitelist
|
// Create Notebook with URL Whitelist
|
||||||
let notebookObject;
|
let notebookObject;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitNotebookWithUrls.js') });
|
await page.addInitScript({
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
path: path.join(__dirname, '../../../../helper/', 'addInitNotebookWithUrls.js')
|
||||||
|
|
||||||
notebookObject = await createDomainObjectWithDefaults(page, {
|
|
||||||
type: NOTEBOOK_NAME
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
test.fixme('When a new entry is created, it should be focused', async ({ page }) => {});
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
test('When an object is dropped into a notebook, a new entry is created and it should be focused @unstable', async ({ page }) => {
|
|
||||||
// Create Overlay Plot
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
|
||||||
type: 'Overlay Plot'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Navigate to the notebook object
|
notebookObject = await createDomainObjectWithDefaults(page, {
|
||||||
await page.goto(notebookObject.url);
|
type: NOTEBOOK_NAME
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
|
||||||
|
|
||||||
await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', '.c-notebook__drag-area');
|
|
||||||
|
|
||||||
const embed = page.locator('.c-ne__embed__link');
|
|
||||||
const embedName = await embed.textContent();
|
|
||||||
|
|
||||||
await expect(embed).toHaveClass(/icon-plot-overlay/);
|
|
||||||
expect(embedName).toBe('Dropped Overlay Plot');
|
|
||||||
});
|
});
|
||||||
test('When an object is dropped into a notebooks existing entry, it should be focused @unstable', async ({ page }) => {
|
});
|
||||||
// Create Overlay Plot
|
test('When a new entry is created, it should be focused and selected', async ({ page }) => {
|
||||||
await createDomainObjectWithDefaults(page, {
|
// Navigate to the notebook object
|
||||||
type: 'Overlay Plot'
|
await page.goto(notebookObject.url);
|
||||||
});
|
|
||||||
|
|
||||||
// Navigate to the notebook object
|
// Click .c-notebook__drag-area
|
||||||
await page.goto(notebookObject.url);
|
await page.locator('.c-notebook__drag-area').click();
|
||||||
|
await expect(page.locator('[aria-label="Notebook Entry Input"]')).toBeVisible();
|
||||||
// Reveal the notebook in the tree
|
await expect(page.locator('[aria-label="Notebook Entry"]')).toHaveClass(/is-selected/);
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
});
|
||||||
|
test('When an object is dropped into a notebook, a new entry is created and it should be focused @unstable', async ({
|
||||||
await nbUtils.enterTextEntry(page, 'Entry to drop into');
|
page
|
||||||
await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', 'text=Entry to drop into');
|
}) => {
|
||||||
|
// Create Overlay Plot
|
||||||
const existingEntry = page.locator('.c-ne__content', { has: page.locator('text="Entry to drop into"') });
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
const embed = existingEntry.locator('.c-ne__embed__link');
|
type: 'Overlay Plot'
|
||||||
const embedName = await embed.textContent();
|
|
||||||
|
|
||||||
await expect(embed).toHaveClass(/icon-plot-overlay/);
|
|
||||||
expect(embedName).toBe('Dropped Overlay Plot');
|
|
||||||
});
|
});
|
||||||
test.fixme('new entries persist through navigation events without save', async ({ page }) => {});
|
|
||||||
test.fixme('previous and new entries can be deleted', async ({ page }) => {});
|
|
||||||
test('when a valid link is entered into a notebook entry, it becomes clickable when viewing', async ({ page }) => {
|
|
||||||
const TEST_LINK = 'http://www.google.com';
|
|
||||||
|
|
||||||
// Navigate to the notebook object
|
// Navigate to the notebook object
|
||||||
await page.goto(notebookObject.url);
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
// Reveal the notebook in the tree
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);
|
await page
|
||||||
|
.getByRole('treeitem', { name: overlayPlot.name })
|
||||||
|
.dragTo(page.locator('.c-notebook__drag-area'));
|
||||||
|
|
||||||
const validLink = page.locator(`a[href="${TEST_LINK}"]`);
|
const embed = page.locator('.c-ne__embed__link');
|
||||||
|
const embedName = await embed.innerText();
|
||||||
|
|
||||||
// Start waiting for popup before clicking. Note no await.
|
await expect(embed).toHaveClass(/icon-plot-overlay/);
|
||||||
const popupPromise = page.waitForEvent('popup');
|
expect(embedName).toBe(overlayPlot.name);
|
||||||
|
});
|
||||||
await validLink.click();
|
test('When an object is dropped into a notebooks existing entry, it should be focused @unstable', async ({
|
||||||
const popup = await popupPromise;
|
page
|
||||||
|
}) => {
|
||||||
// Wait for the popup to load.
|
// Create Overlay Plot
|
||||||
await popup.waitForLoadState();
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
expect.soft(popup.url()).toContain('www.google.com');
|
type: 'Overlay Plot'
|
||||||
|
|
||||||
expect(await validLink.count()).toBe(1);
|
|
||||||
});
|
});
|
||||||
test('when an invalid link is entered into a notebook entry, it does not become clickable when viewing', async ({ page }) => {
|
|
||||||
const TEST_LINK = 'www.google.com';
|
|
||||||
|
|
||||||
// Navigate to the notebook object
|
// Navigate to the notebook object
|
||||||
await page.goto(notebookObject.url);
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
// Reveal the notebook in the tree
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);
|
await nbUtils.enterTextEntry(page, 'Entry to drop into');
|
||||||
|
await page
|
||||||
|
.getByRole('treeitem', { name: overlayPlot.name })
|
||||||
|
.dragTo(page.locator('text=Entry to drop into'));
|
||||||
|
|
||||||
const invalidLink = page.locator(`a[href="${TEST_LINK}"]`);
|
const existingEntry = page.locator('.c-ne__content', {
|
||||||
|
has: page.locator('text="Entry to drop into"')
|
||||||
expect(await invalidLink.count()).toBe(0);
|
|
||||||
});
|
});
|
||||||
test('when a link is entered, but it is not in the whitelisted urls, it does not become clickable when viewing', async ({ page }) => {
|
const embed = existingEntry.locator('.c-ne__embed__link');
|
||||||
const TEST_LINK = 'http://www.bing.com';
|
const embedName = await embed.innerText();
|
||||||
|
|
||||||
// Navigate to the notebook object
|
await expect(embed).toHaveClass(/icon-plot-overlay/);
|
||||||
await page.goto(notebookObject.url);
|
expect(embedName).toBe(overlayPlot.name);
|
||||||
|
});
|
||||||
|
test.fixme('new entries persist through navigation events without save', async ({ page }) => {});
|
||||||
|
test('previous and new entries can be deleted', async ({ page }) => {
|
||||||
|
// Navigate to the notebook object
|
||||||
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
await nbUtils.enterTextEntry(page, 'First Entry');
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
await page.hover('text="First Entry"');
|
||||||
|
await page.click('button[title="Delete this entry"]');
|
||||||
|
await page.getByRole('button', { name: 'Ok' }).filter({ hasText: 'Ok' }).click();
|
||||||
|
await expect(page.locator('text="First Entry"')).toBeHidden();
|
||||||
|
await nbUtils.enterTextEntry(page, 'Another First Entry');
|
||||||
|
await nbUtils.enterTextEntry(page, 'Second Entry');
|
||||||
|
await nbUtils.enterTextEntry(page, 'Third Entry');
|
||||||
|
await page.hover('[aria-label="Notebook Entry"] >> nth=2');
|
||||||
|
await page.click('button[title="Delete this entry"] >> nth=2');
|
||||||
|
await page.getByRole('button', { name: 'Ok' }).filter({ hasText: 'Ok' }).click();
|
||||||
|
await expect(page.locator('text="Third Entry"')).toBeHidden();
|
||||||
|
await expect(page.locator('text="Another First Entry"')).toBeVisible();
|
||||||
|
await expect(page.locator('text="Second Entry"')).toBeVisible();
|
||||||
|
});
|
||||||
|
test('when a valid link is entered into a notebook entry, it becomes clickable when viewing', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const TEST_LINK = 'http://www.google.com';
|
||||||
|
|
||||||
await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);
|
// Navigate to the notebook object
|
||||||
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
const invalidLink = page.locator(`a[href="${TEST_LINK}"]`);
|
// Reveal the notebook in the tree
|
||||||
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
expect(await invalidLink.count()).toBe(0);
|
await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);
|
||||||
});
|
|
||||||
test('when a valid link with a subdomain and a valid domain in the whitelisted urls is entered into a notebook entry, it becomes clickable when viewing', async ({ page }) => {
|
|
||||||
const INVALID_TEST_LINK = 'http://bing.google.com';
|
|
||||||
|
|
||||||
// Navigate to the notebook object
|
const validLink = page.locator(`a[href="${TEST_LINK}"]`);
|
||||||
await page.goto(notebookObject.url);
|
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
// Start waiting for popup before clicking. Note no await.
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
const popupPromise = page.waitForEvent('popup');
|
||||||
|
|
||||||
await nbUtils.enterTextEntry(page, `This should be a link: ${INVALID_TEST_LINK} is it?`);
|
await validLink.click();
|
||||||
|
const popup = await popupPromise;
|
||||||
|
|
||||||
const validLink = page.locator(`a[href="${INVALID_TEST_LINK}"]`);
|
// Wait for the popup to load.
|
||||||
|
await popup.waitForLoadState();
|
||||||
|
expect.soft(popup.url()).toContain('www.google.com');
|
||||||
|
|
||||||
expect(await validLink.count()).toBe(1);
|
expect(await validLink.count()).toBe(1);
|
||||||
});
|
});
|
||||||
test('when a valid secure link is entered into a notebook entry, it becomes clickable when viewing', async ({ page }) => {
|
test('when an invalid link is entered into a notebook entry, it does not become clickable when viewing', async ({
|
||||||
const TEST_LINK = 'https://www.google.com';
|
page
|
||||||
|
}) => {
|
||||||
|
const TEST_LINK = 'www.google.com';
|
||||||
|
|
||||||
// Navigate to the notebook object
|
// Navigate to the notebook object
|
||||||
await page.goto(notebookObject.url);
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
// Reveal the notebook in the tree
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);
|
await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);
|
||||||
|
|
||||||
const validLink = page.locator(`a[href="${TEST_LINK}"]`);
|
const invalidLink = page.locator(`a[href="${TEST_LINK}"]`);
|
||||||
|
|
||||||
// Start waiting for popup before clicking. Note no await.
|
expect(await invalidLink.count()).toBe(0);
|
||||||
const popupPromise = page.waitForEvent('popup');
|
});
|
||||||
|
test('when a link is entered, but it is not in the whitelisted urls, it does not become clickable when viewing', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const TEST_LINK = 'http://www.bing.com';
|
||||||
|
|
||||||
await validLink.click();
|
// Navigate to the notebook object
|
||||||
const popup = await popupPromise;
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
// Wait for the popup to load.
|
// Reveal the notebook in the tree
|
||||||
await popup.waitForLoadState();
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
expect.soft(popup.url()).toContain('www.google.com');
|
|
||||||
|
|
||||||
expect(await validLink.count()).toBe(1);
|
await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);
|
||||||
});
|
|
||||||
test('when a nefarious link is entered into a notebook entry, it is sanitized when viewing', async ({ page }) => {
|
|
||||||
const TEST_LINK = 'http://www.google.com?bad=';
|
|
||||||
const TEST_LINK_BAD = `http://www.google.com?bad=<script>alert('gimme your cookies')</script>`;
|
|
||||||
|
|
||||||
// Navigate to the notebook object
|
const invalidLink = page.locator(`a[href="${TEST_LINK}"]`);
|
||||||
await page.goto(notebookObject.url);
|
|
||||||
|
|
||||||
// Reveal the notebook in the tree
|
expect(await invalidLink.count()).toBe(0);
|
||||||
await page.getByTitle('Show selected item in tree').click();
|
});
|
||||||
|
test('when a valid link with a subdomain and a valid domain in the whitelisted urls is entered into a notebook entry, it becomes clickable when viewing', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const INVALID_TEST_LINK = 'http://bing.google.com';
|
||||||
|
|
||||||
await nbUtils.enterTextEntry(page, `This should be a link, BUT not a bad link: ${TEST_LINK_BAD} is it?`);
|
// Navigate to the notebook object
|
||||||
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
const sanitizedLink = page.locator(`a[href="${TEST_LINK}"]`);
|
// Reveal the notebook in the tree
|
||||||
const unsanitizedLink = page.locator(`a[href="${TEST_LINK_BAD}"]`);
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
expect.soft(await sanitizedLink.count()).toBe(1);
|
await nbUtils.enterTextEntry(page, `This should be a link: ${INVALID_TEST_LINK} is it?`);
|
||||||
expect(await unsanitizedLink.count()).toBe(0);
|
|
||||||
});
|
const validLink = page.locator(`a[href="${INVALID_TEST_LINK}"]`);
|
||||||
|
|
||||||
|
expect(await validLink.count()).toBe(1);
|
||||||
|
});
|
||||||
|
test('when a valid secure link is entered into a notebook entry, it becomes clickable when viewing', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const TEST_LINK = 'https://www.google.com';
|
||||||
|
|
||||||
|
// Navigate to the notebook object
|
||||||
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
|
// Reveal the notebook in the tree
|
||||||
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
|
await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);
|
||||||
|
|
||||||
|
const validLink = page.locator(`a[href="${TEST_LINK}"]`);
|
||||||
|
|
||||||
|
// Start waiting for popup before clicking. Note no await.
|
||||||
|
const popupPromise = page.waitForEvent('popup');
|
||||||
|
|
||||||
|
await validLink.click();
|
||||||
|
const popup = await popupPromise;
|
||||||
|
|
||||||
|
// Wait for the popup to load.
|
||||||
|
await popup.waitForLoadState();
|
||||||
|
expect.soft(popup.url()).toContain('www.google.com');
|
||||||
|
|
||||||
|
expect(await validLink.count()).toBe(1);
|
||||||
|
});
|
||||||
|
test('when a nefarious link is entered into a notebook entry, it is sanitized when viewing', async ({
|
||||||
|
page
|
||||||
|
}) => {
|
||||||
|
const TEST_LINK = 'http://www.google.com?bad=';
|
||||||
|
const TEST_LINK_BAD = `http://www.google.com?bad=<script>alert('gimme your cookies')</script>`;
|
||||||
|
|
||||||
|
// Navigate to the notebook object
|
||||||
|
await page.goto(notebookObject.url);
|
||||||
|
|
||||||
|
// Reveal the notebook in the tree
|
||||||
|
await page.getByTitle('Show selected item in tree').click();
|
||||||
|
|
||||||
|
await nbUtils.enterTextEntry(
|
||||||
|
page,
|
||||||
|
`This should be a link, BUT not a bad link: ${TEST_LINK_BAD} is it?`
|
||||||
|
);
|
||||||
|
|
||||||
|
const sanitizedLink = page.locator(`a[href="${TEST_LINK}"]`);
|
||||||
|
const unsanitizedLink = page.locator(`a[href="${TEST_LINK_BAD}"]`);
|
||||||
|
|
||||||
|
expect.soft(await sanitizedLink.count()).toBe(1);
|
||||||
|
expect(await unsanitizedLink.count()).toBe(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -24,111 +24,196 @@
|
|||||||
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
|
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const fs = require('fs').promises;
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
// const { expandTreePaneItemByName, createDomainObjectWithDefaults } = require('../../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
||||||
// const nbUtils = require('../../../../helper/notebookUtils');
|
|
||||||
|
const NOTEBOOK_NAME = 'Notebook';
|
||||||
|
|
||||||
test.describe('Snapshot Menu tests', () => {
|
test.describe('Snapshot Menu tests', () => {
|
||||||
test.fixme('When no default notebook is selected, Snapshot Menu dropdown should only have a single option', async ({ page }) => {
|
test.fixme(
|
||||||
// There should be no default notebook
|
'When no default notebook is selected, Snapshot Menu dropdown should only have a single option',
|
||||||
// Clear default notebook if exists using `localStorage.setItem('notebook-storage', null);`
|
async ({ page }) => {
|
||||||
// refresh page
|
// There should be no default notebook
|
||||||
// Click on 'Notebook Snaphot Menu'
|
// Clear default notebook if exists using `localStorage.setItem('notebook-storage', null);`
|
||||||
// 'save to Notebook Snapshots' should be only option there
|
// refresh page
|
||||||
});
|
// Click on 'Notebook Snapshot Menu'
|
||||||
test.fixme('When default notebook is updated selected, Snapshot Menu dropdown should list it as the newest option', async ({ page }) => {
|
// 'save to Notebook Snapshots' should be only option there
|
||||||
// Create 2a notebooks
|
}
|
||||||
// Set Notebook A as Default
|
);
|
||||||
// Open Snapshot Menu and note that Notebook A is listed
|
test.fixme(
|
||||||
// Close Snapshot Menu
|
'When default notebook is updated selected, Snapshot Menu dropdown should list it as the newest option',
|
||||||
// Set Default Notebook to Notebook B
|
async ({ page }) => {
|
||||||
// Open Snapshot Notebook and note that Notebook B is listed
|
// Create 2a notebooks
|
||||||
// Select Default Notebook Option and verify that Snapshot is added to Notebook B
|
// Set Notebook A as Default
|
||||||
});
|
// Open Snapshot Menu and note that Notebook A is listed
|
||||||
test.fixme('Can add Snapshots via Snapshot Menu and details are correct', async ({ page }) => {
|
// Close Snapshot Menu
|
||||||
//Note this should be a visual test, too
|
// Set Default Notebook to Notebook B
|
||||||
// Create Telemetry object
|
// Open Snapshot Notebook and note that Notebook B is listed
|
||||||
// Create A notebook with many pages and sections.
|
// Select Default Notebook Option and verify that Snapshot is added to Notebook B
|
||||||
// Set page and section defaults to be between first and last of many. i.e. 3 of 5
|
}
|
||||||
// Navigate to Telemetry object
|
);
|
||||||
// Select Default Notebook Option and verify that Snapshot is added to Notebook A
|
test.fixme('Can add Snapshots via Snapshot Menu and details are correct', async ({ page }) => {
|
||||||
// Verify Snapshot Details appear correctly
|
//Note this should be a visual test, too
|
||||||
});
|
// Create Telemetry object
|
||||||
test.fixme('Snapshots adjust time conductor', async ({ page }) => {
|
// Create A notebook with many pages and sections.
|
||||||
// Create Telemetry object
|
// Set page and section defaults to be between first and last of many. i.e. 3 of 5
|
||||||
// Set Telemetry object's timeconductor to Fixed time with Start and Endtimes are recorded
|
// Navigate to Telemetry object
|
||||||
// Embed Telemetry object into notebook
|
// Select Default Notebook Option and verify that Snapshot is added to Notebook A
|
||||||
// Set Time Conductor to Local clock
|
// Verify Snapshot Details appear correctly
|
||||||
// Click into embedded telemetry object and verify object appears with same fixed time from record
|
});
|
||||||
});
|
test.fixme('Snapshots adjust time conductor', async ({ page }) => {
|
||||||
|
// Create Telemetry object
|
||||||
|
// Set Telemetry object's timeconductor to Fixed time with Start and End times are recorded
|
||||||
|
// Embed Telemetry object into notebook
|
||||||
|
// Set Time Conductor to Local clock
|
||||||
|
// Click into embedded telemetry object and verify object appears with same fixed time from record
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Snapshot Container tests', () => {
|
test.describe('Snapshot Container tests', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
//Navigate to baseURL
|
//Navigate to baseURL
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
// Create Notebook
|
// Create Notebook
|
||||||
// const notebook = await createDomainObjectWithDefaults(page, {
|
// const notebook = await createDomainObjectWithDefaults(page, {
|
||||||
// type: 'Notebook',
|
// type: 'Notebook',
|
||||||
// name: "Test Notebook"
|
// name: "Test Notebook"
|
||||||
// });
|
// });
|
||||||
// // Create Overlay Plot
|
// // Create Overlay Plot
|
||||||
// const snapShotObject = await createDomainObjectWithDefaults(page, {
|
// const snapShotObject = await createDomainObjectWithDefaults(page, {
|
||||||
// type: 'Overlay Plot',
|
// type: 'Overlay Plot',
|
||||||
// name: "Dropped Overlay Plot"
|
// name: "Dropped Overlay Plot"
|
||||||
// });
|
// });
|
||||||
|
|
||||||
await page.getByRole('button', { name: ' Snapshot ' }).click();
|
await page.getByRole('button', { name: ' Snapshot ' }).click();
|
||||||
await page.getByRole('menuitem', { name: ' Save to Notebook Snapshots' }).click();
|
await page.getByRole('menuitem', { name: ' Save to Notebook Snapshots' }).click();
|
||||||
await page.getByRole('button', { name: 'Show' }).click();
|
await page.getByRole('button', { name: 'Show' }).click();
|
||||||
|
});
|
||||||
});
|
test.fixme('5 Snapshots can be added to a container', async ({ page }) => {});
|
||||||
test.fixme('5 Snapshots can be added to a container', async ({ page }) => {});
|
test.fixme(
|
||||||
test.fixme('5 Snapshots can be added to a container and Deleted with Delete All action', async ({ page }) => {});
|
'5 Snapshots can be added to a container and Deleted with Delete All action',
|
||||||
test.fixme('A snapshot can be Deleted from Container with 3 dot action menu', async ({ page }) => {});
|
async ({ page }) => {}
|
||||||
test.fixme('A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu', async ({ page }) => {
|
);
|
||||||
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
|
test.fixme(
|
||||||
await page.getByRole('menuitem', { name: ' View Snapshot' }).click();
|
'A snapshot can be Deleted from Container with 3 dot action menu',
|
||||||
await expect(page.locator('.c-overlay__outer')).toBeVisible();
|
async ({ page }) => {}
|
||||||
await page.getByTitle('Annotate').click();
|
);
|
||||||
await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
|
test.fixme(
|
||||||
await page.getByRole('button', { name: '' }).click();
|
'A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu',
|
||||||
// await expect(page.locator('#snap-annotation-canvas')).not.toBeVisible();
|
async ({ page }) => {
|
||||||
await page.getByRole('button', { name: 'Save' }).click();
|
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
|
||||||
await page.getByRole('button', { name: 'Done' }).click();
|
await page.getByRole('menuitem', { name: ' View Snapshot' }).click();
|
||||||
//await expect(await page.locator)
|
await expect(page.locator('.c-overlay__outer')).toBeVisible();
|
||||||
});
|
await page.getByTitle('Annotate').click();
|
||||||
test('A snapshot can be Quick Viewed from Container with 3 dot action menu', async ({ page }) => {
|
await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
|
||||||
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
|
await page.getByRole('button', { name: '' }).click();
|
||||||
await page.getByRole('menuitem', { name: 'Quick View' }).click();
|
// await expect(page.locator('#snap-annotation-canvas')).not.toBeVisible();
|
||||||
await expect(page.locator('.c-overlay__outer')).toBeVisible();
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
});
|
await page.getByRole('button', { name: 'Done' }).click();
|
||||||
test.fixme('A snapshot can be Navigated To from Container with 3 dot action menu', async ({ page }) => {});
|
//await expect(await page.locator)
|
||||||
test.fixme('A snapshot can be Navigated To Item in Time from Container with 3 dot action menu', async ({ page }) => {});
|
}
|
||||||
test.fixme('A snapshot Container can be open and closed', async ({ page }) => {});
|
);
|
||||||
test.fixme('Can add object to Snapshot container and pull into notebook and create a new entry', async ({ page }) => {
|
test('A snapshot can be Quick Viewed from Container with 3 dot action menu', async ({ page }) => {
|
||||||
//Create Notebook
|
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
|
||||||
//Create Telemetry Object
|
await page.getByRole('menuitem', { name: 'Quick View' }).click();
|
||||||
//From Telemetry Object, use 'save to Notebook Snapshots'
|
await expect(page.locator('.c-overlay__outer')).toBeVisible();
|
||||||
//Snapshots indicator should blink, click on it to view snapshots
|
});
|
||||||
//Navigate to Notebook
|
test.fixme(
|
||||||
//Drag and Drop onto droppable area for new entry
|
'A snapshot can be Navigated To from Container with 3 dot action menu',
|
||||||
//New Entry created with given snapshot added
|
async ({ page }) => {}
|
||||||
//Snapshot removed from container?
|
);
|
||||||
});
|
test.fixme(
|
||||||
test.fixme('Can add object to Snapshot container and pull into notebook and existing entry', async ({ page }) => {
|
'A snapshot can be Navigated To Item in Time from Container with 3 dot action menu',
|
||||||
//Create Notebook
|
async ({ page }) => {}
|
||||||
//Create Telemetry Object
|
);
|
||||||
//From Telemetry Object, use 'save to Notebook Snapshots'
|
test.fixme('A snapshot Container can be open and closed', async ({ page }) => {});
|
||||||
//Snapshots indicator should blink, click on it to view snapshots
|
test.fixme(
|
||||||
//Navigate to Notebook
|
'Can add object to Snapshot container and pull into notebook and create a new entry',
|
||||||
//Drag and Drop into exiting entry
|
async ({ page }) => {
|
||||||
//Existing Entry updated with given snapshot
|
//Create Notebook
|
||||||
//Snapshot removed from container?
|
//Create Telemetry Object
|
||||||
});
|
//From Telemetry Object, use 'save to Notebook Snapshots'
|
||||||
test.fixme('Verify Embedded options for PNG, JPG, and Annotate work correctly', async ({ page }) => {
|
//Snapshots indicator should blink, click on it to view snapshots
|
||||||
//Add snapshot to container
|
//Navigate to Notebook
|
||||||
//Verify PNG, JPG, and Annotate buttons work correctly
|
//Drag and Drop onto droppable area for new entry
|
||||||
});
|
//New Entry created with given snapshot added
|
||||||
|
//Snapshot removed from container?
|
||||||
|
}
|
||||||
|
);
|
||||||
|
test.fixme(
|
||||||
|
'Can add object to Snapshot container and pull into notebook and existing entry',
|
||||||
|
async ({ page }) => {
|
||||||
|
//Create Notebook
|
||||||
|
//Create Telemetry Object
|
||||||
|
//From Telemetry Object, use 'save to Notebook Snapshots'
|
||||||
|
//Snapshots indicator should blink, click on it to view snapshots
|
||||||
|
//Navigate to Notebook
|
||||||
|
//Drag and Drop into exiting entry
|
||||||
|
//Existing Entry updated with given snapshot
|
||||||
|
//Snapshot removed from container?
|
||||||
|
}
|
||||||
|
);
|
||||||
|
test.fixme(
|
||||||
|
'Verify Embedded options for PNG, JPG, and Annotate work correctly',
|
||||||
|
async ({ page }) => {
|
||||||
|
//Add snapshot to container
|
||||||
|
//Verify PNG, JPG, and Annotate buttons work correctly
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe('Snapshot image tests', () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
//Navigate to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
// Create Notebook
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: NOTEBOOK_NAME
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Can drop an image onto a notebook and create a new entry', async ({ page }) => {
|
||||||
|
const imageData = await fs.readFile('src/images/favicons/favicon-96x96.png');
|
||||||
|
const imageArray = new Uint8Array(imageData);
|
||||||
|
const fileData = Array.from(imageArray);
|
||||||
|
|
||||||
|
const dropTransfer = await page.evaluateHandle((data) => {
|
||||||
|
const dataTransfer = new DataTransfer();
|
||||||
|
const file = new File([new Uint8Array(data)], 'favicon-96x96.png', { type: 'image/png' });
|
||||||
|
dataTransfer.items.add(file);
|
||||||
|
return dataTransfer;
|
||||||
|
}, fileData);
|
||||||
|
|
||||||
|
await page.dispatchEvent('.c-notebook__drag-area', 'drop', { dataTransfer: dropTransfer });
|
||||||
|
|
||||||
|
// be sure that entry was created
|
||||||
|
await expect(page.getByText('favicon-96x96.png')).toBeVisible();
|
||||||
|
|
||||||
|
// click on image (need to click twice to focus)
|
||||||
|
await page.getByRole('img', { name: 'favicon-96x96.png thumbnail' }).click();
|
||||||
|
await page.getByRole('img', { name: 'favicon-96x96.png thumbnail' }).click();
|
||||||
|
|
||||||
|
// expect large image to be displayed
|
||||||
|
await expect(page.getByRole('dialog').getByText('favicon-96x96.png')).toBeVisible();
|
||||||
|
|
||||||
|
await page.getByLabel('Close').click();
|
||||||
|
|
||||||
|
// drop another image onto the entry
|
||||||
|
await page.dispatchEvent('.c-snapshots', 'drop', { dataTransfer: dropTransfer });
|
||||||
|
|
||||||
|
// expect two embedded images now
|
||||||
|
expect(await page.getByRole('img', { name: 'favicon-96x96.png thumbnail' }).count()).toBe(2);
|
||||||
|
|
||||||
|
await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
|
||||||
|
|
||||||
|
await page.getByRole('menuitem', { name: /Remove This Embed/ }).click();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Ok', exact: true }).click();
|
||||||
|
|
||||||
|
// expect one embedded image now as we deleted the other
|
||||||
|
expect(await page.getByRole('img', { name: 'favicon-96x96.png thumbnail' }).count()).toBe(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -26,252 +26,221 @@ This test suite is dedicated to tests which verify the basic operations surround
|
|||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
||||||
|
const nbUtils = require('../../../../helper/notebookUtils');
|
||||||
|
|
||||||
test.describe('Notebook Tests with CouchDB @couchdb', () => {
|
test.describe('Notebook Tests with CouchDB @couchdb', () => {
|
||||||
let testNotebook;
|
let testNotebook;
|
||||||
test.beforeEach(async ({ page }) => {
|
|
||||||
//Navigate to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// Create Notebook
|
test.beforeEach(async ({ page }) => {
|
||||||
testNotebook = await createDomainObjectWithDefaults(page, {
|
//Navigate to baseURL
|
||||||
type: 'Notebook',
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
name: "TestNotebook"
|
|
||||||
});
|
// Create Notebook
|
||||||
|
testNotebook = await createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
||||||
|
await page.goto(testNotebook.url, { waitUntil: 'networkidle' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Inspect Notebook Entry Network Requests', async ({ page }) => {
|
||||||
|
//Ensure we're on the annotations Tab in the inspector
|
||||||
|
await page.getByText('Annotations').click();
|
||||||
|
// Expand sidebar
|
||||||
|
await page.locator('.c-notebook__toggle-nav-button').click();
|
||||||
|
|
||||||
|
// Collect all request events to count and assert after notebook action
|
||||||
|
let notebookElementsRequests = [];
|
||||||
|
page.on('request', (request) => notebookElementsRequests.push(request));
|
||||||
|
|
||||||
|
//Clicking Add Page generates
|
||||||
|
let [notebookUrlRequest] = await Promise.all([
|
||||||
|
// Waits for the next request with the specified url
|
||||||
|
page.waitForRequest(`**/openmct/${testNotebook.uuid}`),
|
||||||
|
// Triggers the request
|
||||||
|
page.click('[aria-label="Add Page"]')
|
||||||
|
]);
|
||||||
|
// Ensures that there are no other network requests
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// Assert that only two requests are made
|
||||||
|
// Network Requests are:
|
||||||
|
// 1) The actual POST to create the page
|
||||||
|
expect(notebookElementsRequests.length).toBe(1);
|
||||||
|
|
||||||
|
// Assert on request object
|
||||||
|
expect(notebookUrlRequest.postDataJSON().metadata.name).toBe(testNotebook.name);
|
||||||
|
expect(notebookUrlRequest.postDataJSON().model.persisted).toBeGreaterThanOrEqual(
|
||||||
|
notebookUrlRequest.postDataJSON().model.modified
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add an entry
|
||||||
|
// Network Requests are:
|
||||||
|
// 1) The actual POST to create the entry
|
||||||
|
// 2) The shared worker event from 👆 POST request
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await nbUtils.enterTextEntry(page, 'First Entry');
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
expect(notebookElementsRequests.length).toBeLessThanOrEqual(2);
|
||||||
|
|
||||||
|
// Add some tags
|
||||||
|
// Network Requests are for each tag creation are:
|
||||||
|
// 1) Getting the original path of the parent object
|
||||||
|
// 2) Getting the original path of the grandparent object (recursive call)
|
||||||
|
// 3) Creating the annotation/tag object
|
||||||
|
// 4) The shared worker event from 👆 POST request
|
||||||
|
// 5) Mutate notebook domain object's annotationModified property
|
||||||
|
// 6) The shared worker event from 👆 POST request
|
||||||
|
// 7) Notebooks fetching new annotations due to annotationModified changed
|
||||||
|
// 8) The update of the notebook domain's object's modified property
|
||||||
|
// 9) The shared worker event from 👆 POST request
|
||||||
|
// 10) Entry is timestamped
|
||||||
|
// 11) The shared worker event from 👆 POST request
|
||||||
|
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await addTagAndAwaitNetwork(page, 'Driving');
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(11);
|
||||||
|
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await addTagAndAwaitNetwork(page, 'Drilling');
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(11);
|
||||||
|
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await addTagAndAwaitNetwork(page, 'Science');
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(11);
|
||||||
|
|
||||||
|
// Delete all the tags
|
||||||
|
// Network requests are:
|
||||||
|
// 1) Send POST to mutate _delete property to true on annotation with tag
|
||||||
|
// 2) The shared worker event from 👆 POST request
|
||||||
|
// 3) Timestamp update on entry
|
||||||
|
// 4) The shared worker event from 👆 POST request
|
||||||
|
// This happens for 3 tags so 12 requests
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await removeTagAndAwaitNetwork(page, 'Driving');
|
||||||
|
await removeTagAndAwaitNetwork(page, 'Drilling');
|
||||||
|
await removeTagAndAwaitNetwork(page, 'Science');
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(12);
|
||||||
|
|
||||||
|
// Add two more pages
|
||||||
|
await page.click('[aria-label="Add Page"]');
|
||||||
|
await page.click('[aria-label="Add Page"]');
|
||||||
|
|
||||||
|
// Add three entries
|
||||||
|
await nbUtils.enterTextEntry(page, 'First Entry');
|
||||||
|
await nbUtils.enterTextEntry(page, 'Second Entry');
|
||||||
|
await nbUtils.enterTextEntry(page, 'Third Entry');
|
||||||
|
|
||||||
|
// Add three tags
|
||||||
|
await addTagAndAwaitNetwork(page, 'Science');
|
||||||
|
await addTagAndAwaitNetwork(page, 'Drilling');
|
||||||
|
await addTagAndAwaitNetwork(page, 'Driving');
|
||||||
|
|
||||||
|
// Add a fourth entry
|
||||||
|
// Network requests are:
|
||||||
|
// 1) Send POST to add new entry
|
||||||
|
// 2) The shared worker event from 👆 POST request
|
||||||
|
// 3) Timestamp update on entry
|
||||||
|
// 4) The shared worker event from 👆 POST request
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await nbUtils.enterTextEntry(page, 'Fourth Entry');
|
||||||
|
page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
|
||||||
|
|
||||||
|
// Add a fifth entry
|
||||||
|
// Network requests are:
|
||||||
|
// 1) Send POST to add new entry
|
||||||
|
// 2) The shared worker event from 👆 POST request
|
||||||
|
// 3) Timestamp update on entry
|
||||||
|
// 4) The shared worker event from 👆 POST request
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await nbUtils.enterTextEntry(page, 'Fifth Entry');
|
||||||
|
page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
|
||||||
|
|
||||||
|
// Add a sixth entry
|
||||||
|
// 1) Send POST to add new entry
|
||||||
|
// 2) The shared worker event from 👆 POST request
|
||||||
|
// 3) Timestamp update on entry
|
||||||
|
// 4) The shared worker event from 👆 POST request
|
||||||
|
notebookElementsRequests = [];
|
||||||
|
await nbUtils.enterTextEntry(page, 'Sixth Entry');
|
||||||
|
page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Search tests', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/akhenry/openmct-yamcs/issues/69'
|
||||||
});
|
});
|
||||||
|
await page.getByText('Annotations').click();
|
||||||
|
await nbUtils.enterTextEntry(page, 'First Entry');
|
||||||
|
|
||||||
test('Inspect Notebook Entry Network Requests', async ({ page }) => {
|
// Add three tags
|
||||||
await page.getByText('Annotations').click();
|
await addTagAndAwaitNetwork(page, 'Science');
|
||||||
// Expand sidebar
|
await addTagAndAwaitNetwork(page, 'Drilling');
|
||||||
await page.locator('.c-notebook__toggle-nav-button').click();
|
await addTagAndAwaitNetwork(page, 'Driving');
|
||||||
|
|
||||||
// Collect all request events to count and assert after notebook action
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
let addingNotebookElementsRequests = [];
|
//Partial match for "Science" should only return Science
|
||||||
page.on('request', (request) => addingNotebookElementsRequests.push(request));
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]').first()).toContainText('Science');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]').first()).not.toContainText('Driving');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]').first()).not.toContainText(
|
||||||
|
'Drilling'
|
||||||
|
);
|
||||||
|
|
||||||
let [notebookUrlRequest, allDocsRequest] = await Promise.all([
|
//Searching for a tag which does not exist should return an empty result
|
||||||
// Waits for the next request with the specified url
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
page.waitForRequest(`**/openmct/${testNotebook.uuid}`),
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
|
||||||
page.waitForRequest('**/openmct/_all_docs?include_docs=true'),
|
await expect(page.locator('text=No results found')).toBeVisible();
|
||||||
// Triggers the request
|
});
|
||||||
page.click('[aria-label="Add Page"]'),
|
|
||||||
// Ensures that there are no other network requests
|
|
||||||
page.waitForLoadState('networkidle')
|
|
||||||
]);
|
|
||||||
// Assert that only two requests are made
|
|
||||||
// Network Requests are:
|
|
||||||
// 1) The actual POST to create the page
|
|
||||||
// 2) The shared worker event from 👆 request
|
|
||||||
expect(addingNotebookElementsRequests.length).toBe(2);
|
|
||||||
|
|
||||||
// Assert on request object
|
|
||||||
expect(notebookUrlRequest.postDataJSON().metadata.name).toBe('TestNotebook');
|
|
||||||
expect(notebookUrlRequest.postDataJSON().model.persisted).toBeGreaterThanOrEqual(notebookUrlRequest.postDataJSON().model.modified);
|
|
||||||
expect(allDocsRequest.postDataJSON().keys).toContain(testNotebook.uuid);
|
|
||||||
|
|
||||||
// Add an entry
|
|
||||||
// Network Requests are:
|
|
||||||
// 1) The actual POST to create the entry
|
|
||||||
// 2) The shared worker event from 👆 POST request
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').fill(`First Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').press('Enter');
|
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
expect(addingNotebookElementsRequests.length).toBeLessThanOrEqual(2);
|
|
||||||
|
|
||||||
// Add some tags
|
|
||||||
// Network Requests are for each tag creation are:
|
|
||||||
// 1) Getting the original path of the parent object
|
|
||||||
// 2) Getting the original path of the grandparent object (recursive call)
|
|
||||||
// 3) Creating the annotation/tag object
|
|
||||||
// 4) The shared worker event from 👆 POST request
|
|
||||||
// 5) Mutate notebook domain object's annotationModified property
|
|
||||||
// 6) The shared worker event from 👆 POST request
|
|
||||||
// 7) Notebooks fetching new annotations due to annotationModified changed
|
|
||||||
// 8) The update of the notebook domain's object's modified property
|
|
||||||
// 9) The shared worker event from 👆 POST request
|
|
||||||
// 10) Entry is timestamped
|
|
||||||
// 11) The shared worker event from 👆 POST request
|
|
||||||
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Driving")');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(11);
|
|
||||||
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Drilling').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Drilling")');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(11);
|
|
||||||
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Science")');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(11);
|
|
||||||
|
|
||||||
// Delete all the tags
|
|
||||||
// Network requests are:
|
|
||||||
// 1) Send POST to mutate _delete property to true on annotation with tag
|
|
||||||
// 2) The shared worker event from 👆 POST request
|
|
||||||
// 3) Timestamp update on entry
|
|
||||||
// 4) The shared worker event from 👆 POST request
|
|
||||||
// This happens for 3 tags so 12 requests
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
|
||||||
await page.locator('[aria-label="Remove tag Driving"]').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Driving")', {state: 'hidden'});
|
|
||||||
await page.hover('[aria-label="Tag"]:has-text("Drilling")');
|
|
||||||
await page.locator('[aria-label="Remove tag Drilling"]').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Drilling")', {state: 'hidden'});
|
|
||||||
page.hover('[aria-label="Tag"]:has-text("Science")');
|
|
||||||
await page.locator('[aria-label="Remove tag Science"]').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Science")', {state: 'hidden'});
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(12);
|
|
||||||
|
|
||||||
// Add two more pages
|
|
||||||
await page.click('[aria-label="Add Page"]');
|
|
||||||
await page.click('[aria-label="Add Page"]');
|
|
||||||
|
|
||||||
// Add three entries
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').fill(`First Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').press('Enter');
|
|
||||||
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').fill(`Second Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').press('Enter');
|
|
||||||
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=2').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=2').fill(`Third Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=2').press('Enter');
|
|
||||||
|
|
||||||
// Add three tags
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Science")');
|
|
||||||
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Drilling').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Drilling")');
|
|
||||||
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Driving")');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
// Add a fourth entry
|
|
||||||
// Network requests are:
|
|
||||||
// 1) Send POST to add new entry
|
|
||||||
// 2) The shared worker event from 👆 POST request
|
|
||||||
// 3) Timestamp update on entry
|
|
||||||
// 4) The shared worker event from 👆 POST request
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=3').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=3').fill(`Fourth Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=3').press('Enter');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(4);
|
|
||||||
|
|
||||||
// Add a fifth entry
|
|
||||||
// Network requests are:
|
|
||||||
// 1) Send POST to add new entry
|
|
||||||
// 2) The shared worker event from 👆 POST request
|
|
||||||
// 3) Timestamp update on entry
|
|
||||||
// 4) The shared worker event from 👆 POST request
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=4').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=4').fill(`Fifth Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=4').press('Enter');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(4);
|
|
||||||
|
|
||||||
// Add a sixth entry
|
|
||||||
// 1) Send POST to add new entry
|
|
||||||
// 2) The shared worker event from 👆 POST request
|
|
||||||
// 3) Timestamp update on entry
|
|
||||||
// 4) The shared worker event from 👆 POST request
|
|
||||||
addingNotebookElementsRequests = [];
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=5').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=5').fill(`Sixth Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=5').press('Enter');
|
|
||||||
page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(4);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Search tests', async ({ page }) => {
|
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/akhenry/openmct-yamcs/issues/69'
|
|
||||||
});
|
|
||||||
await page.getByText('Annotations').click();
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').click();
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').fill(`First Entry`);
|
|
||||||
await page.locator('[aria-label="Notebook Entry Input"]').press('Enter');
|
|
||||||
|
|
||||||
// Add three tags
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Science")');
|
|
||||||
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Drilling').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Drilling")');
|
|
||||||
|
|
||||||
await page.hover(`button:has-text("Add Tag")`);
|
|
||||||
await page.locator(`button:has-text("Add Tag")`).click();
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
|
||||||
await page.waitForSelector('[aria-label="Tag"]:has-text("Driving")');
|
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
|
|
||||||
await expect(page.locator('[aria-label="Search Result"]').first()).toContainText("Science");
|
|
||||||
await expect(page.locator('[aria-label="Search Result"]').first()).not.toContainText("Driving");
|
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
|
|
||||||
await expect(page.locator('text=No results found')).toBeVisible();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Try to reduce indeterminism of browser requests by only returning fetch requests.
|
// Try to reduce indeterminism of browser requests by only returning fetch requests.
|
||||||
// Filter out preflight CORS, fetching stylesheets, page icons, etc. that can occur during tests
|
// Filter out preflight CORS, fetching stylesheets, page icons, etc. that can occur during tests
|
||||||
function filterNonFetchRequests(requests) {
|
function filterNonFetchRequests(requests) {
|
||||||
return requests.filter(request => {
|
return requests.filter((request) => {
|
||||||
return (request.resourceType() === 'fetch');
|
return request.resourceType() === 'fetch';
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a tag to a notebook entry by providing a tagName.
|
||||||
|
* Reduces indeterminism by waiting until all necessary requests are completed.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} tagName
|
||||||
|
*/
|
||||||
|
async function addTagAndAwaitNetwork(page, tagName) {
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
await Promise.all([
|
||||||
|
// Waits for the next request with the specified url
|
||||||
|
page.waitForRequest('**/openmct/_all_docs?include_docs=true'),
|
||||||
|
// Triggers the request
|
||||||
|
page.locator(`[aria-label="Autocomplete Options"] >> text=${tagName}`).click(),
|
||||||
|
expect(page.locator(`[aria-label="Tag"]:has-text("${tagName}")`)).toBeVisible()
|
||||||
|
]);
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a tag to a notebook entry by providing a tagName.
|
||||||
|
* Reduces indeterminism by waiting until all necessary requests are completed.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} tagName
|
||||||
|
*/
|
||||||
|
async function removeTagAndAwaitNetwork(page, tagName) {
|
||||||
|
await page.hover(`[aria-label="Tag"]:has-text("${tagName}")`);
|
||||||
|
await Promise.all([
|
||||||
|
page.locator(`[aria-label="Remove tag ${tagName}"]`).click(),
|
||||||
|
//With this pattern, we're awaiting the response but asserting on the request payload.
|
||||||
|
page.waitForResponse(
|
||||||
|
(resp) => resp.request().postData().includes(`"_deleted":true`) && resp.status() === 201
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
await expect(page.locator(`[aria-label="Tag"]:has-text("${tagName}")`)).toBeHidden();
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
}
|
}
|
||||||
|
@ -20,173 +20,178 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect, streamToString } = require('../../../../pluginFixtures');
|
||||||
const { openObjectTreeContextMenu, createDomainObjectWithDefaults } = require('../../../../appActions');
|
const { openObjectTreeContextMenu } = require('../../../../appActions');
|
||||||
const path = require('path');
|
const {
|
||||||
const nbUtils = require('../../../../helper/notebookUtils');
|
lockPage,
|
||||||
|
dragAndDropEmbed,
|
||||||
|
enterTextEntry,
|
||||||
|
startAndAddRestrictedNotebookObject
|
||||||
|
} = require('../../../../helper/notebookUtils');
|
||||||
|
|
||||||
const TEST_TEXT = 'Testing text for entries.';
|
const TEST_TEXT = 'Testing text for entries.';
|
||||||
const TEST_TEXT_NAME = 'Test Page';
|
const TEST_TEXT_NAME = 'Test Page';
|
||||||
const CUSTOM_NAME = 'CUSTOM_NAME';
|
|
||||||
|
|
||||||
test.describe('Restricted Notebook', () => {
|
test.describe('Restricted Notebook', () => {
|
||||||
let notebook;
|
let notebook;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
notebook = await startAndAddRestrictedNotebookObject(page);
|
notebook = await startAndAddRestrictedNotebookObject(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can be renamed @addInit', async ({ page }) => {
|
test('Can be renamed @addInit', async ({ page }) => {
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(`${notebook.name}`);
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(`${notebook.name}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can be deleted if there are no locked pages @addInit', async ({ page }) => {
|
test('Can be deleted if there are no locked pages @addInit', async ({ page }) => {
|
||||||
await openObjectTreeContextMenu(page, notebook.url);
|
await openObjectTreeContextMenu(page, notebook.url);
|
||||||
|
|
||||||
const menuOptions = page.locator('.c-menu ul');
|
const menuOptions = page.locator('.c-menu ul');
|
||||||
await expect.soft(menuOptions).toContainText('Remove');
|
await expect.soft(menuOptions).toContainText('Remove');
|
||||||
|
|
||||||
const restrictedNotebookTreeObject = page.locator(`a:has-text("${notebook.name}")`);
|
const restrictedNotebookTreeObject = page.locator(`a:has-text("${notebook.name}")`);
|
||||||
|
|
||||||
// notebook tree object exists
|
// notebook tree object exists
|
||||||
expect.soft(await restrictedNotebookTreeObject.count()).toEqual(1);
|
expect.soft(await restrictedNotebookTreeObject.count()).toEqual(1);
|
||||||
|
|
||||||
// Click Remove Text
|
// Click Remove Text
|
||||||
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
await page.locator('li[role="menuitem"]:has-text("Remove")').click();
|
||||||
|
|
||||||
// Click 'OK' on confirmation window and wait for save banner to appear
|
// Click 'OK' on confirmation window and wait for save banner to appear
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.waitForNavigation(),
|
page.waitForNavigation(),
|
||||||
page.locator('button:has-text("OK")').click(),
|
page.locator('button:has-text("OK")').click(),
|
||||||
page.waitForSelector('.c-message-banner__message')
|
page.waitForSelector('.c-message-banner__message')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// has been deleted
|
// has been deleted
|
||||||
expect(await restrictedNotebookTreeObject.count()).toEqual(0);
|
expect(await restrictedNotebookTreeObject.count()).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can be locked if at least one page has one entry @addInit', async ({ page }) => {
|
test('Can be locked if at least one page has one entry @addInit', async ({ page }) => {
|
||||||
|
await enterTextEntry(page, TEST_TEXT);
|
||||||
await nbUtils.enterTextEntry(page, TEST_TEXT);
|
|
||||||
|
|
||||||
const commitButton = page.locator('button:has-text("Commit Entries")');
|
|
||||||
expect(await commitButton.count()).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const commitButton = page.locator('button:has-text("Commit Entries")');
|
||||||
|
expect(await commitButton.count()).toEqual(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Restricted Notebook with at least one entry and with the page locked @addInit', () => {
|
test.describe('Restricted Notebook with at least one entry and with the page locked @addInit', () => {
|
||||||
let notebook;
|
let notebook;
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
notebook = await startAndAddRestrictedNotebookObject(page);
|
notebook = await startAndAddRestrictedNotebookObject(page);
|
||||||
await nbUtils.enterTextEntry(page, TEST_TEXT);
|
await enterTextEntry(page, TEST_TEXT);
|
||||||
await lockPage(page);
|
await lockPage(page);
|
||||||
|
|
||||||
// open sidebar
|
// open sidebar
|
||||||
await page.locator('button.c-notebook__toggle-nav-button').click();
|
await page.locator('button.c-notebook__toggle-nav-button').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Locked page should now be in a locked state @addInit @unstable', async ({ page }, testInfo) => {
|
test('Locked page should now be in a locked state @addInit @unstable', async ({
|
||||||
// eslint-disable-next-line playwright/no-skipped-test
|
page
|
||||||
test.skip(testInfo.project === 'chrome-beta', "Test is unreliable on chrome-beta");
|
}, testInfo) => {
|
||||||
// main lock message on page
|
// eslint-disable-next-line playwright/no-skipped-test
|
||||||
const lockMessage = page.locator('text=This page has been committed and cannot be modified or removed');
|
test.skip(testInfo.project === 'chrome-beta', 'Test is unreliable on chrome-beta');
|
||||||
expect.soft(await lockMessage.count()).toEqual(1);
|
// main lock message on page
|
||||||
|
const lockMessage = page.locator(
|
||||||
|
'text=This page has been committed and cannot be modified or removed'
|
||||||
|
);
|
||||||
|
expect.soft(await lockMessage.count()).toEqual(1);
|
||||||
|
|
||||||
// lock icon on page in sidebar
|
// lock icon on page in sidebar
|
||||||
const pageLockIcon = page.locator('ul.c-notebook__pages li div.icon-lock');
|
const pageLockIcon = page.locator('ul.c-notebook__pages li div.icon-lock');
|
||||||
expect.soft(await pageLockIcon.count()).toEqual(1);
|
expect.soft(await pageLockIcon.count()).toEqual(1);
|
||||||
|
|
||||||
// no way to remove a restricted notebook with a locked page
|
// no way to remove a restricted notebook with a locked page
|
||||||
await openObjectTreeContextMenu(page, notebook.url);
|
await openObjectTreeContextMenu(page, notebook.url);
|
||||||
const menuOptions = page.locator('.c-menu ul');
|
const menuOptions = page.locator('.c-menu ul');
|
||||||
|
|
||||||
await expect(menuOptions).not.toContainText('Remove');
|
await expect(menuOptions).not.toContainText('Remove');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can still: add page, rename, add entry, delete unlocked pages @addInit', async ({ page }) => {
|
test('Can still: add page, rename, add entry, delete unlocked pages @addInit', async ({
|
||||||
// Click text=Page Add >> button
|
page
|
||||||
await Promise.all([
|
}) => {
|
||||||
page.waitForNavigation(),
|
// Add a new page to the section
|
||||||
page.locator('text=Page Add >> button').click()
|
await page.getByRole('button', { name: 'Add Page' }).click();
|
||||||
]);
|
// Focus the new page by clicking it
|
||||||
// Click text=Unnamed Page >> nth=1
|
await page.getByText('Unnamed Page').nth(1).click();
|
||||||
await page.locator('text=Unnamed Page').nth(1).click();
|
// Rename the new page
|
||||||
// Press a with modifiers
|
await page.getByText('Unnamed Page').nth(1).fill(TEST_TEXT_NAME);
|
||||||
await page.locator('text=Unnamed Page').nth(1).fill(TEST_TEXT_NAME);
|
|
||||||
|
|
||||||
// expect to be able to rename unlocked pages
|
// expect to be able to rename unlocked pages
|
||||||
const newPageElement = page.locator(`text=${TEST_TEXT_NAME}`);
|
const newPageElement = page.getByText(TEST_TEXT_NAME);
|
||||||
const newPageCount = await newPageElement.count();
|
const newPageCount = await newPageElement.count();
|
||||||
await newPageElement.press('Enter'); // exit contenteditable state
|
await newPageElement.press('Enter'); // exit contenteditable state
|
||||||
expect.soft(newPageCount).toEqual(1);
|
expect.soft(newPageCount).toEqual(1);
|
||||||
|
|
||||||
// enter test text
|
// enter test text
|
||||||
await nbUtils.enterTextEntry(page, TEST_TEXT);
|
await enterTextEntry(page, TEST_TEXT);
|
||||||
|
|
||||||
// expect new page to be lockable
|
// expect new page to be lockable
|
||||||
const commitButton = page.locator('BUTTON:HAS-TEXT("COMMIT ENTRIES")');
|
const commitButton = page.getByRole('button', { name: ' Commit Entries' });
|
||||||
expect.soft(await commitButton.count()).toEqual(1);
|
expect.soft(await commitButton.count()).toEqual(1);
|
||||||
|
|
||||||
// Click text=Unnamed PageTest Page >> button
|
// Click the context menu button for the new page
|
||||||
await page.locator('text=Unnamed PageTest Page >> button').click();
|
await page.getByTitle('Open context menu').click();
|
||||||
// Click text=Delete Page
|
// Delete the page
|
||||||
await page.locator('text=Delete Page').click();
|
await page.getByRole('menuitem', { name: 'Delete Page' }).click();
|
||||||
// Click text=Ok
|
// Click OK button
|
||||||
await Promise.all([
|
await page.getByRole('button', { name: 'Ok', exact: true }).click();
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('button:has-text("OK")').click()
|
|
||||||
]);
|
|
||||||
|
|
||||||
// deleted page, should no longer exist
|
// deleted page, should no longer exist
|
||||||
const deletedPageElement = page.locator(`text=${TEST_TEXT_NAME}`);
|
const deletedPageElement = page.getByText(TEST_TEXT_NAME);
|
||||||
expect(await deletedPageElement.count()).toEqual(0);
|
expect(await deletedPageElement.count()).toEqual(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Restricted Notebook with a page locked and with an embed @addInit', () => {
|
test.describe('Restricted Notebook with a page locked and with an embed @addInit', () => {
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
const notebook = await startAndAddRestrictedNotebookObject(page);
|
||||||
|
await dragAndDropEmbed(page, notebook);
|
||||||
|
});
|
||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
test('Allows embeds to be deleted if page unlocked @addInit', async ({ page }) => {
|
||||||
const notebook = await startAndAddRestrictedNotebookObject(page);
|
// Click embed popup menu
|
||||||
await nbUtils.dragAndDropEmbed(page, notebook);
|
await page.locator('.c-ne__embed__name .c-icon-button').click();
|
||||||
});
|
|
||||||
|
|
||||||
test('Allows embeds to be deleted if page unlocked @addInit', async ({ page }) => {
|
const embedMenu = page.locator('body >> .c-menu');
|
||||||
// Click .c-ne__embed__name .c-popup-menu-button
|
await expect(embedMenu).toContainText('Remove This Embed');
|
||||||
await page.locator('.c-ne__embed__name .c-icon-button').click(); // embed popup menu
|
});
|
||||||
|
|
||||||
const embedMenu = page.locator('body >> .c-menu');
|
test('Disallows embeds to be deleted if page locked @addInit', async ({ page }) => {
|
||||||
await expect(embedMenu).toContainText('Remove This Embed');
|
await lockPage(page);
|
||||||
});
|
// Click embed popup menu
|
||||||
|
await page.locator('.c-ne__embed__name .c-icon-button').click();
|
||||||
test('Disallows embeds to be deleted if page locked @addInit', async ({ page }) => {
|
|
||||||
await lockPage(page);
|
|
||||||
// Click .c-ne__embed__name .c-popup-menu-button
|
|
||||||
await page.locator('.c-ne__embed__name .c-icon-button').click(); // embed popup menu
|
|
||||||
|
|
||||||
const embedMenu = page.locator('body >> .c-menu');
|
|
||||||
await expect(embedMenu).not.toContainText('Remove This Embed');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const embedMenu = page.locator('body >> .c-menu');
|
||||||
|
await expect(embedMenu).not.toContainText('Remove This Embed');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
test.describe('can export restricted notebook as text', () => {
|
||||||
* @param {import('@playwright/test').Page} page
|
test.beforeEach(async ({ page }) => {
|
||||||
*/
|
await startAndAddRestrictedNotebookObject(page);
|
||||||
async function startAndAddRestrictedNotebookObject(page) {
|
});
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitRestrictedNotebook.js') });
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
return createDomainObjectWithDefaults(page, { type: CUSTOM_NAME });
|
test('basic functionality ', async ({ page }) => {
|
||||||
}
|
await enterTextEntry(page, `Foo bar entry`);
|
||||||
|
// Click on 3 Dot Menu
|
||||||
|
await page.locator('button[title="More options"]').click();
|
||||||
|
const downloadPromise = page.waitForEvent('download');
|
||||||
|
|
||||||
/**
|
await page.getByRole('menuitem', { name: /Export Notebook as Text/ }).click();
|
||||||
* @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.getByRole('button', { name: 'Save' }).click();
|
||||||
await page.locator('text=Lock Page').click();
|
|
||||||
}
|
//Verify exported text as a stream of text instead of a file read from the filesystem
|
||||||
|
const download = await downloadPromise;
|
||||||
|
const readStream = await download.createReadStream();
|
||||||
|
const exportedText = await streamToString(readStream);
|
||||||
|
expect(exportedText).toContain('Foo bar entry');
|
||||||
|
});
|
||||||
|
|
||||||
|
test.fixme('can export multiple notebook entries as text ', async ({ page }) => {});
|
||||||
|
test.fixme('can export all notebook entry metdata', async ({ page }) => {});
|
||||||
|
test.fixme('can export all notebook tags', async ({ page }) => {});
|
||||||
|
test.fixme('can export all notebook snapshots', async ({ page }) => {});
|
||||||
|
});
|
||||||
|
@ -21,273 +21,210 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This test suite is dedicated to tests which verify form functionality.
|
This test suite is dedicated to tests which verify notebook tag functionality.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const { createDomainObjectWithDefaults, selectInspectorTab } = require('../../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
||||||
const nbUtils = require('../../../../helper/notebookUtils');
|
const {
|
||||||
|
enterTextEntry,
|
||||||
/**
|
createNotebookAndEntry,
|
||||||
* Creates a notebook object and adds an entry.
|
createNotebookEntryAndTags
|
||||||
* @param {import('@playwright/test').Page} - page to load
|
} = require('../../../../helper/notebookUtils');
|
||||||
* @param {number} [iterations = 1] - the number of entries to create
|
|
||||||
*/
|
|
||||||
async function createNotebookAndEntry(page, iterations = 1) {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
const notebook = createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
|
||||||
|
|
||||||
for (let iteration = 0; iteration < iterations; iteration++) {
|
|
||||||
await nbUtils.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 selectInspectorTab(page, 'Annotations');
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
test.describe('Tagging in Notebooks @addInit', () => {
|
test.describe('Tagging in Notebooks @addInit', () => {
|
||||||
test('Can load tags', async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await createNotebookAndEntry(page);
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
});
|
||||||
|
test('Can load tags', async ({ page }) => {
|
||||||
|
await createNotebookAndEntry(page);
|
||||||
|
|
||||||
// TODO can be removed with fix for https://github.com/nasa/openmct/issues/6411
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').click();
|
|
||||||
|
|
||||||
await selectInspectorTab(page, 'Annotations');
|
await page.locator('button:has-text("Add Tag")').click();
|
||||||
|
|
||||||
await page.locator('button:has-text("Add Tag")').click();
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText('Science');
|
||||||
|
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText('Drilling');
|
||||||
|
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText('Driving');
|
||||||
|
});
|
||||||
|
test('Can add tags', async ({ page }) => {
|
||||||
|
await createNotebookEntryAndTags(page);
|
||||||
|
|
||||||
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText("Science");
|
await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText('Science');
|
||||||
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText("Drilling");
|
await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText('Driving');
|
||||||
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText("Driving");
|
|
||||||
});
|
|
||||||
test('Can add tags', async ({ page }) => {
|
|
||||||
await createNotebookEntryAndTags(page);
|
|
||||||
|
|
||||||
await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText("Science");
|
await page.locator('button:has-text("Add Tag")').click();
|
||||||
await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText("Driving");
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
|
||||||
await page.locator('button:has-text("Add Tag")').click();
|
await expect(page.locator('[aria-label="Autocomplete Options"]')).not.toContainText('Science');
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
await expect(page.locator('[aria-label="Autocomplete Options"]')).not.toContainText('Driving');
|
||||||
|
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText('Drilling');
|
||||||
|
});
|
||||||
|
test('Can add tags with blank entry', async ({ page }) => {
|
||||||
|
await createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
|
||||||
await expect(page.locator('[aria-label="Autocomplete Options"]')).not.toContainText("Science");
|
await enterTextEntry(page, '');
|
||||||
await expect(page.locator('[aria-label="Autocomplete Options"]')).not.toContainText("Driving");
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText("Drilling");
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
});
|
|
||||||
test('Can cancel adding tags', async ({ page }) => {
|
|
||||||
await createNotebookAndEntry(page);
|
|
||||||
|
|
||||||
// TODO can be removed with fix for https://github.com/nasa/openmct/issues/6411
|
// Click inside the tag search input
|
||||||
await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').click();
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Driving" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
||||||
|
|
||||||
await selectInspectorTab(page, 'Annotations');
|
await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText('Driving');
|
||||||
|
});
|
||||||
|
test('Can cancel adding tags', async ({ page }) => {
|
||||||
|
await createNotebookAndEntry(page);
|
||||||
|
|
||||||
// Test canceling adding a tag after we click "Type to select tag"
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
await page.locator('button:has-text("Add Tag")').click();
|
|
||||||
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
// Test canceling adding a tag after we click "Type to select tag"
|
||||||
|
await page.locator('button:has-text("Add Tag")').click();
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
|
||||||
await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
|
|
||||||
// Test canceling adding a tag after we just click "Add Tag"
|
await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
|
||||||
await page.locator('button:has-text("Add Tag")').click();
|
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
// Test canceling adding a tag after we just click "Add Tag"
|
||||||
|
await page.locator('button:has-text("Add Tag")').click();
|
||||||
|
|
||||||
await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
});
|
|
||||||
test('Can search for tags and preview works properly', async ({ page }) => {
|
|
||||||
await createNotebookEntryAndTags(page);
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sc');
|
|
||||||
await expect(page.locator('[aria-label="Search Result"]')).toContainText("Science");
|
|
||||||
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
|
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
|
});
|
||||||
await expect(page.locator('[aria-label="Search Result"]')).toContainText("Science");
|
test('Can search for tags and preview works properly', async ({ page }) => {
|
||||||
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
|
await createNotebookEntryAndTags(page);
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sc');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]')).toContainText('Science');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText('Driving');
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
|
||||||
await expect(page.locator('text=No results found')).toBeVisible();
|
await expect(page.locator('[aria-label="Search Result"]')).toContainText('Science');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText('Driving');
|
||||||
|
|
||||||
await createDomainObjectWithDefaults(page, {
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
type: 'Display Layout'
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
|
||||||
});
|
await expect(page.locator('text=No results found')).toBeVisible();
|
||||||
|
|
||||||
// Go back into edit mode for the display layout
|
await createDomainObjectWithDefaults(page, {
|
||||||
await page.locator('button[title="Edit"]').click();
|
type: 'Display Layout'
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
|
|
||||||
await expect(page.locator('[aria-label="Search Result"]')).toContainText("Science");
|
|
||||||
await page.getByText('Entry 0').click();
|
|
||||||
await expect(page.locator('.js-preview-window')).toBeVisible();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can delete tags', async ({ page }) => {
|
// Go back into edit mode for the display layout
|
||||||
await createNotebookEntryAndTags(page);
|
await page.locator('button[title="Edit"]').click();
|
||||||
// Delete Driving
|
|
||||||
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
|
||||||
await page.locator('[aria-label="Remove tag Driving"]').click();
|
|
||||||
|
|
||||||
await expect(page.locator('[aria-label="Tags Inspector"]')).toContainText("Science");
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
|
||||||
await expect(page.locator('[aria-label="Tags Inspector"]')).not.toContainText("Driving");
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]')).toContainText('Science');
|
||||||
|
await page.getByText('Entry 0').click();
|
||||||
|
await expect(page.locator('.js-preview-window')).toBeVisible();
|
||||||
|
});
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sc');
|
test('Can delete tags', async ({ page }) => {
|
||||||
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
|
await createNotebookEntryAndTags(page);
|
||||||
|
// Delete Driving
|
||||||
|
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
||||||
|
await page.locator('[aria-label="Remove tag Driving"]').click();
|
||||||
|
|
||||||
|
await expect(page.locator('[aria-label="Tags Inspector"]')).toContainText('Science');
|
||||||
|
await expect(page.locator('[aria-label="Tags Inspector"]')).not.toContainText('Driving');
|
||||||
|
|
||||||
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sc');
|
||||||
|
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText('Driving');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Can delete entries without tags', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/5823'
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Can delete entries without tags', async ({ page }) => {
|
await createNotebookEntryAndTags(page);
|
||||||
test.info().annotations.push({
|
|
||||||
type: 'issue',
|
|
||||||
description: 'https://github.com/nasa/openmct/issues/5823'
|
|
||||||
});
|
|
||||||
|
|
||||||
await createNotebookEntryAndTags(page);
|
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
||||||
|
const entryLocator = `[aria-label="Notebook Entry Input"] >> nth = 1`;
|
||||||
|
await page.locator(entryLocator).click();
|
||||||
|
await page.locator(entryLocator).fill(`An entry without tags`);
|
||||||
|
await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').press('Enter');
|
||||||
|
|
||||||
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
|
await page.hover('[aria-label="Notebook Entry Input"] >> nth=1');
|
||||||
const entryLocator = `[aria-label="Notebook Entry Input"] >> nth = 1`;
|
await page.locator('button[title="Delete this entry"]').last().click();
|
||||||
await page.locator(entryLocator).click();
|
await expect(
|
||||||
await page.locator(entryLocator).fill(`An entry without tags`);
|
page.locator('text=This action will permanently delete this entry. Do you wish to continue?')
|
||||||
await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').press('Enter');
|
).toBeVisible();
|
||||||
|
await page.locator('button:has-text("Ok")').click();
|
||||||
|
await expect(
|
||||||
|
page.locator('text=This action will permanently delete this entry. Do you wish to continue?')
|
||||||
|
).toBeHidden();
|
||||||
|
});
|
||||||
|
|
||||||
await page.hover('[aria-label="Notebook Entry Input"] >> nth=1');
|
test('Can delete objects with tags and neither return in search', async ({ page }) => {
|
||||||
await page.locator('button[title="Delete this entry"]').last().click();
|
await createNotebookEntryAndTags(page);
|
||||||
await expect(page.locator('text=This action will permanently delete this entry. Do you wish to continue?')).toBeVisible();
|
// Delete Notebook
|
||||||
await page.locator('button:has-text("Ok")').click();
|
await page.locator('button[title="More options"]').click();
|
||||||
await expect(page.locator('text=This action will permanently delete this entry. Do you wish to continue?')).toBeHidden();
|
await page.locator('li[title="Remove this object from its containing object."]').click();
|
||||||
});
|
await page.locator('button:has-text("OK")').click();
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
test('Can delete objects with tags and neither return in search', async ({ page }) => {
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Unnamed');
|
||||||
await createNotebookEntryAndTags(page);
|
await expect(page.locator('text=No results found')).toBeVisible();
|
||||||
// Delete Notebook
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sci');
|
||||||
await page.locator('button[title="More options"]').click();
|
await expect(page.locator('text=No results found')).toBeVisible();
|
||||||
await page.locator('li[title="Remove this object from its containing object."]').click();
|
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('dri');
|
||||||
await page.locator('button:has-text("OK")').click();
|
await expect(page.locator('text=No results found')).toBeVisible();
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
});
|
||||||
|
test('Tags persist across reload', async ({ page }) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Unnamed');
|
const ITERATIONS = 4;
|
||||||
await expect(page.locator('text=No results found')).toBeVisible();
|
const notebook = await createNotebookEntryAndTags(page, ITERATIONS);
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sci');
|
await page.goto(notebook.url);
|
||||||
await expect(page.locator('text=No results found')).toBeVisible();
|
|
||||||
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('dri');
|
|
||||||
await expect(page.locator('text=No results found')).toBeVisible();
|
|
||||||
});
|
|
||||||
test('Tags persist across reload', async ({ page }) => {
|
|
||||||
//Go to baseURL
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
const clock = await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
// Verify tags are present
|
||||||
|
for (let iteration = 0; iteration < ITERATIONS; iteration++) {
|
||||||
|
const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
|
||||||
|
await expect(page.locator(entryLocator)).toContainText('Science');
|
||||||
|
await expect(page.locator(entryLocator)).toContainText('Driving');
|
||||||
|
}
|
||||||
|
|
||||||
const ITERATIONS = 4;
|
//Reload Page
|
||||||
const notebook = await createNotebookEntryAndTags(page, ITERATIONS);
|
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
for (let iteration = 0; iteration < ITERATIONS; iteration++) {
|
// Verify tags persist across reload
|
||||||
const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
|
for (let iteration = 0; iteration < ITERATIONS; iteration++) {
|
||||||
await expect(page.locator(entryLocator)).toContainText("Science");
|
const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
|
||||||
await expect(page.locator(entryLocator)).toContainText("Driving");
|
await expect(page.locator(entryLocator)).toContainText('Science');
|
||||||
}
|
await expect(page.locator(entryLocator)).toContainText('Driving');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('Can cancel adding a tag', async ({ page }) => {
|
||||||
|
await createNotebookAndEntry(page);
|
||||||
|
|
||||||
await Promise.all([
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
page.waitForNavigation(),
|
|
||||||
page.goto('./#/browse/mine?hideTree=false'),
|
|
||||||
page.click('.c-disclosure-triangle')
|
|
||||||
]);
|
|
||||||
|
|
||||||
const treePane = page.getByRole('tree', {
|
// Click on the "Add Tag" button
|
||||||
name: 'Main Tree'
|
await page.locator('button:has-text("Add Tag")').click();
|
||||||
});
|
|
||||||
// Click Clock
|
|
||||||
await treePane.getByRole('treeitem', {
|
|
||||||
name: clock.name
|
|
||||||
}).click();
|
|
||||||
// Click Notebook
|
|
||||||
await page.getByRole('treeitem', {
|
|
||||||
name: notebook.name
|
|
||||||
}).click();
|
|
||||||
|
|
||||||
for (let iteration = 0; iteration < ITERATIONS; iteration++) {
|
// Click inside the AutoComplete field
|
||||||
const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
await expect(page.locator(entryLocator)).toContainText("Science");
|
|
||||||
await expect(page.locator(entryLocator)).toContainText("Driving");
|
|
||||||
}
|
|
||||||
|
|
||||||
//Reload Page
|
// Click on the "Tags" header (simulating a click outside the autocomplete)
|
||||||
await Promise.all([
|
await page.locator('div.c-inspect-properties__header:has-text("Tags")').click();
|
||||||
page.reload(),
|
|
||||||
page.waitForLoadState('networkidle')
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Click Notebook
|
// Verify there is a button with text "Add Tag"
|
||||||
await page.click(`text="${notebook.name}"`);
|
await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
|
||||||
|
|
||||||
for (let iteration = 0; iteration < ITERATIONS; iteration++) {
|
// Verify the AutoComplete field is hidden
|
||||||
const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
|
await expect(page.locator('[placeholder="Type to select tag"]')).toBeHidden();
|
||||||
await expect(page.locator(entryLocator)).toContainText("Science");
|
});
|
||||||
await expect(page.locator(entryLocator)).toContainText("Driving");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
test('Can cancel adding a tag', async ({ page }) => {
|
|
||||||
await createNotebookAndEntry(page);
|
|
||||||
|
|
||||||
// TODO can be removed with fix for https://github.com/nasa/openmct/issues/6411
|
|
||||||
await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').click();
|
|
||||||
|
|
||||||
await selectInspectorTab(page, 'Annotations');
|
|
||||||
|
|
||||||
// Click on the "Add Tag" button
|
|
||||||
await page.locator('button:has-text("Add Tag")').click();
|
|
||||||
|
|
||||||
// Click inside the AutoComplete field
|
|
||||||
await page.locator('[placeholder="Type to select tag"]').click();
|
|
||||||
|
|
||||||
// Click on the "Tags" header (simulating a click outside the autocomplete)
|
|
||||||
await page.locator('div.c-inspect-properties__header:has-text("Tags")').click();
|
|
||||||
|
|
||||||
// Verify there is a button with text "Add Tag"
|
|
||||||
await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
|
|
||||||
|
|
||||||
// Verify the AutoComplete field is hidden
|
|
||||||
await expect(page.locator('[placeholder="Type to select tag"]')).toBeHidden();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
/*
|
/*
|
||||||
* This test suite is dedicated to testing the operator status plugin.
|
* This test suite is dedicated to testing the operator status plugin.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
@ -38,119 +38,127 @@ STUB (test.fixme) Rolling through each
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
test.describe('Operator Status', () => {
|
test.describe('Operator Status', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
// FIXME: determine if plugins will be added to index.html or need to be injected
|
// FIXME: determine if plugins will be added to index.html or need to be injected
|
||||||
// eslint-disable-next-line no-undef
|
await page.addInitScript({
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitExampleUser.js')});
|
path: path.join(__dirname, '../../../../helper/', 'addInitExampleUser.js')
|
||||||
// eslint-disable-next-line no-undef
|
|
||||||
await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitOperatorStatus.js')});
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
});
|
});
|
||||||
|
await page.addInitScript({
|
||||||
// verify that operator status is visible
|
path: path.join(__dirname, '../../../../helper/', 'addInitOperatorStatus.js')
|
||||||
test('operator status is visible and expands when clicked', async ({ page }) => {
|
|
||||||
await expect(page.locator('div[title="Set my operator status"]')).toBeVisible();
|
|
||||||
await page.locator('div[title="Set my operator status"]').click();
|
|
||||||
|
|
||||||
// expect default status to be 'GO'
|
|
||||||
await expect(page.locator('.c-status-poll-panel')).toBeVisible();
|
|
||||||
});
|
});
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await expect(page.getByText('Select Role')).toBeVisible();
|
||||||
|
// Description should be empty https://github.com/nasa/openmct/issues/6978
|
||||||
|
await expect(page.locator('.c-message__action-text')).toBeHidden();
|
||||||
|
// set role
|
||||||
|
await page.getByRole('button', { name: 'Select' }).click();
|
||||||
|
// dismiss role confirmation popup
|
||||||
|
await page.getByRole('button', { name: 'Dismiss' }).click();
|
||||||
|
});
|
||||||
|
|
||||||
test('poll question indicator remains when blank poll set', async ({ page }) => {
|
// verify that operator status is visible
|
||||||
await expect(page.locator('div[title="Set the current poll question"]')).toBeVisible();
|
test('operator status is visible and expands when clicked', async ({ page }) => {
|
||||||
await page.locator('div[title="Set the current poll question"]').click();
|
await expect(page.locator('div[title="Set my operator status"]')).toBeVisible();
|
||||||
// set to blank
|
await page.locator('div[title="Set my operator status"]').click();
|
||||||
await page.getByRole('button', { name: 'Update' }).click();
|
|
||||||
|
|
||||||
// should still be visible
|
// expect default status to be 'GO'
|
||||||
await expect(page.locator('div[title="Set the current poll question"]')).toBeVisible();
|
await expect(page.locator('.c-status-poll-panel')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verify that user 1 sees updates from user/role 2 (Not possible without openmct-yamcs implementation)
|
test('poll question indicator remains when blank poll set', async ({ page }) => {
|
||||||
test('operator status table reflects answered values', async ({ page }) => {
|
await expect(page.locator('div[title="Set the current poll question"]')).toBeVisible();
|
||||||
// user navigates to operator status poll
|
await page.locator('div[title="Set the current poll question"]').click();
|
||||||
const statusPollIndicator = page.locator('div[title="Set my operator status"]');
|
// set to blank
|
||||||
await statusPollIndicator.click();
|
await page.getByRole('button', { name: 'Update' }).click();
|
||||||
|
|
||||||
// get user role value
|
// should still be visible
|
||||||
const userRole = page.locator('.c-status-poll-panel__user-role');
|
await expect(page.locator('div[title="Set the current poll question"]')).toBeVisible();
|
||||||
const userRoleText = await userRole.innerText();
|
});
|
||||||
|
|
||||||
// get selected status value
|
// Verify that user 1 sees updates from user/role 2 (Not possible without openmct-yamcs implementation)
|
||||||
const selectStatus = page.locator('select[name="setStatus"]');
|
test('operator status table reflects answered values', async ({ page }) => {
|
||||||
await selectStatus.selectOption({ index: 1});
|
// user navigates to operator status poll
|
||||||
const initialStatusValue = await selectStatus.inputValue();
|
const statusPollIndicator = page.locator('div[title="Set my operator status"]');
|
||||||
|
await statusPollIndicator.click();
|
||||||
|
|
||||||
// open manage status poll
|
// get user role value
|
||||||
const manageStatusPollIndicator = page.locator('div[title="Set the current poll question"]');
|
const userRole = page.locator('.c-status-poll-panel__user-role');
|
||||||
await manageStatusPollIndicator.click();
|
const userRoleText = await userRole.innerText();
|
||||||
// parse the table row values
|
|
||||||
const row = page.locator(`tr:has-text("${userRoleText}")`);
|
|
||||||
const rowValues = await row.innerText();
|
|
||||||
const rowValuesArr = rowValues.split('\t');
|
|
||||||
const COLUMN_STATUS_INDEX = 1;
|
|
||||||
// check initial set value matches status table
|
|
||||||
expect(rowValuesArr[COLUMN_STATUS_INDEX].toLowerCase())
|
|
||||||
.toEqual(initialStatusValue.toLowerCase());
|
|
||||||
|
|
||||||
// change user status
|
// get selected status value
|
||||||
await statusPollIndicator.click();
|
const selectStatus = page.locator('select[name="setStatus"]');
|
||||||
// FIXME: might want to grab a dynamic option instead of arbitrary
|
await selectStatus.selectOption({ index: 1 });
|
||||||
await page.locator('select[name="setStatus"]').selectOption({ index: 2});
|
const initialStatusValue = await selectStatus.inputValue();
|
||||||
const updatedStatusValue = await selectStatus.inputValue();
|
|
||||||
// verify user status is reflected in table
|
|
||||||
await manageStatusPollIndicator.click();
|
|
||||||
|
|
||||||
const updatedRow = page.locator(`tr:has-text("${userRoleText}")`);
|
// open manage status poll
|
||||||
const updatedRowValues = await updatedRow.innerText();
|
const manageStatusPollIndicator = page.locator('div[title="Set the current poll question"]');
|
||||||
const updatedRowValuesArr = updatedRowValues.split('\t');
|
await manageStatusPollIndicator.click();
|
||||||
|
// parse the table row values
|
||||||
|
const row = page.locator(`tr:has-text("${userRoleText}")`);
|
||||||
|
const rowValues = await row.innerText();
|
||||||
|
const rowValuesArr = rowValues.split('\t');
|
||||||
|
const COLUMN_STATUS_INDEX = 1;
|
||||||
|
// check initial set value matches status table
|
||||||
|
expect(rowValuesArr[COLUMN_STATUS_INDEX].toLowerCase()).toEqual(
|
||||||
|
initialStatusValue.toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
expect(updatedRowValuesArr[COLUMN_STATUS_INDEX].toLowerCase())
|
// change user status
|
||||||
.toEqual(updatedStatusValue.toLowerCase());
|
await statusPollIndicator.click();
|
||||||
|
// FIXME: might want to grab a dynamic option instead of arbitrary
|
||||||
|
await page.locator('select[name="setStatus"]').selectOption({ index: 2 });
|
||||||
|
const updatedStatusValue = await selectStatus.inputValue();
|
||||||
|
// verify user status is reflected in table
|
||||||
|
await manageStatusPollIndicator.click();
|
||||||
|
|
||||||
});
|
const updatedRow = page.locator(`tr:has-text("${userRoleText}")`);
|
||||||
|
const updatedRowValues = await updatedRow.innerText();
|
||||||
|
const updatedRowValuesArr = updatedRowValues.split('\t');
|
||||||
|
|
||||||
test('clear poll button removes poll responses', async ({ page }) => {
|
expect(updatedRowValuesArr[COLUMN_STATUS_INDEX].toLowerCase()).toEqual(
|
||||||
// user navigates to operator status poll
|
updatedStatusValue.toLowerCase()
|
||||||
const statusPollIndicator = page.locator('div[title="Set my operator status"]');
|
);
|
||||||
await statusPollIndicator.click();
|
});
|
||||||
|
|
||||||
// get user role value
|
test('clear poll button removes poll responses', async ({ page }) => {
|
||||||
const userRole = page.locator('.c-status-poll-panel__user-role');
|
// user navigates to operator status poll
|
||||||
const userRoleText = await userRole.innerText();
|
const statusPollIndicator = page.locator('div[title="Set my operator status"]');
|
||||||
|
await statusPollIndicator.click();
|
||||||
|
|
||||||
// get selected status value
|
// get user role value
|
||||||
const selectStatus = page.locator('select[name="setStatus"]');
|
const userRole = page.locator('.c-status-poll-panel__user-role');
|
||||||
// FIXME: might want to grab a dynamic option instead of arbitrary
|
const userRoleText = await userRole.innerText();
|
||||||
await selectStatus.selectOption({ index: 1});
|
|
||||||
const initialStatusValue = await selectStatus.inputValue();
|
|
||||||
|
|
||||||
// open manage status poll
|
// get selected status value
|
||||||
const manageStatusPollIndicator = page.locator('div[title="Set the current poll question"]');
|
const selectStatus = page.locator('select[name="setStatus"]');
|
||||||
await manageStatusPollIndicator.click();
|
// FIXME: might want to grab a dynamic option instead of arbitrary
|
||||||
// parse the table row values
|
await selectStatus.selectOption({ index: 1 });
|
||||||
const row = page.locator(`tr:has-text("${userRoleText}")`);
|
const initialStatusValue = await selectStatus.inputValue();
|
||||||
const rowValues = await row.innerText();
|
|
||||||
const rowValuesArr = rowValues.split('\t');
|
|
||||||
const COLUMN_STATUS_INDEX = 1;
|
|
||||||
// check initial set value matches status table
|
|
||||||
expect(rowValuesArr[COLUMN_STATUS_INDEX].toLowerCase())
|
|
||||||
.toEqual(initialStatusValue.toLowerCase());
|
|
||||||
|
|
||||||
// clear the poll
|
// open manage status poll
|
||||||
await page.locator('button[title="Clear the previous poll question"]').click();
|
const manageStatusPollIndicator = page.locator('div[title="Set the current poll question"]');
|
||||||
|
await manageStatusPollIndicator.click();
|
||||||
|
// parse the table row values
|
||||||
|
const row = page.locator(`tr:has-text("${userRoleText}")`);
|
||||||
|
const rowValues = await row.innerText();
|
||||||
|
const rowValuesArr = rowValues.split('\t');
|
||||||
|
const COLUMN_STATUS_INDEX = 1;
|
||||||
|
// check initial set value matches status table
|
||||||
|
expect(rowValuesArr[COLUMN_STATUS_INDEX].toLowerCase()).toEqual(
|
||||||
|
initialStatusValue.toLowerCase()
|
||||||
|
);
|
||||||
|
|
||||||
const updatedRow = page.locator(`tr:has-text("${userRoleText}")`);
|
// clear the poll
|
||||||
const updatedRowValues = await updatedRow.innerText();
|
await page.locator('button[title="Clear the previous poll question"]').click();
|
||||||
const updatedRowValuesArr = updatedRowValues.split('\t');
|
|
||||||
const UNSET_VALUE_LABEL = 'Not set';
|
|
||||||
expect(updatedRowValuesArr[COLUMN_STATUS_INDEX])
|
|
||||||
.toEqual(UNSET_VALUE_LABEL);
|
|
||||||
|
|
||||||
});
|
const updatedRow = page.locator(`tr:has-text("${userRoleText}")`);
|
||||||
|
const updatedRowValues = await updatedRow.innerText();
|
||||||
test.fixme('iterate through all possible response values', async ({ page }) => {
|
const updatedRowValuesArr = updatedRowValues.split('\t');
|
||||||
// test all possible respone values for the poll
|
const UNSET_VALUE_LABEL = 'Not set';
|
||||||
});
|
expect(updatedRowValuesArr[COLUMN_STATUS_INDEX]).toEqual(UNSET_VALUE_LABEL);
|
||||||
|
});
|
||||||
|
|
||||||
|
test.fixme('iterate through all possible response values', async ({ page }) => {
|
||||||
|
// test all possible response values for the poll
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -24,155 +24,115 @@
|
|||||||
Testsuite for plot autoscale.
|
Testsuite for plot autoscale.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { selectInspectorTab } = require('../../../../appActions');
|
const { createDomainObjectWithDefaults } = require('../../../../appActions');
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
test.use({
|
test.use({
|
||||||
viewport: {
|
viewport: {
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720
|
height: 720
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test.describe('Autoscale', () => {
|
test.describe('Autoscale', () => {
|
||||||
test('User can set autoscale with a valid range @snapshot', async ({ page, openmctConfig }) => {
|
test('User can set autoscale with a valid range @snapshot', async ({ page }) => {
|
||||||
const { myItemsFolderName } = openmctConfig;
|
//This is necessary due to the size of the test suite.
|
||||||
|
test.slow();
|
||||||
|
|
||||||
//This is necessary due to the size of the test suite.
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
test.slow();
|
|
||||||
|
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
const overlayPlot = await createDomainObjectWithDefaults(page, {
|
||||||
|
name: 'Test Overlay Plot',
|
||||||
await setTimeRange(page);
|
type: 'Overlay Plot'
|
||||||
|
|
||||||
await createSinewaveOverlayPlot(page, myItemsFolderName);
|
|
||||||
|
|
||||||
await testYTicks(page, ['-1.00', '-0.50', '0.00', '0.50', '1.00']);
|
|
||||||
|
|
||||||
// enter edit mode
|
|
||||||
await page.click('button[title="Edit"]');
|
|
||||||
|
|
||||||
await selectInspectorTab(page, 'Config');
|
|
||||||
await turnOffAutoscale(page);
|
|
||||||
|
|
||||||
await setUserDefinedMinAndMax(page, '-2', '2');
|
|
||||||
|
|
||||||
// save
|
|
||||||
await page.click('button[title="Save"]');
|
|
||||||
await Promise.all([
|
|
||||||
page.locator('li[title = "Save and Finish Editing"]').click(),
|
|
||||||
//Wait for Save Banner to appear
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
//Wait until Save Banner is gone
|
|
||||||
await page.locator('.c-message-banner__close-button').click();
|
|
||||||
await page.waitForSelector('.c-message-banner__message', { state: 'detached'});
|
|
||||||
|
|
||||||
// Make sure that after turning off autoscale, the user entered range values are reflexted in the ticks.
|
|
||||||
await testYTicks(page, ['-2.00', '-1.50', '-1.00', '-0.50', '0.00', '0.50', '1.00', '1.50', '2.00']);
|
|
||||||
|
|
||||||
const canvas = page.locator('canvas').nth(1);
|
|
||||||
|
|
||||||
await canvas.hover({trial: true});
|
|
||||||
|
|
||||||
expect.soft(await canvas.screenshot()).toMatchSnapshot('autoscale-canvas-prepan.png', { animations: 'disabled' });
|
|
||||||
|
|
||||||
//Alt Drag Start
|
|
||||||
await page.keyboard.down('Alt');
|
|
||||||
|
|
||||||
await canvas.dragTo(canvas, {
|
|
||||||
sourcePosition: {
|
|
||||||
x: 200,
|
|
||||||
y: 200
|
|
||||||
},
|
|
||||||
targetPosition: {
|
|
||||||
x: 400,
|
|
||||||
y: 400
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//Alt Drag End
|
|
||||||
await page.keyboard.up('Alt');
|
|
||||||
|
|
||||||
// Ensure the drag worked.
|
|
||||||
await testYTicks(page, ['0.00', '0.50', '1.00', '1.50', '2.00', '2.50', '3.00', '3.50']);
|
|
||||||
|
|
||||||
//Wait for canvas to stablize.
|
|
||||||
await canvas.hover({trial: true});
|
|
||||||
|
|
||||||
expect.soft(await canvas.screenshot()).toMatchSnapshot('autoscale-canvas-panned.png', { animations: 'disabled' });
|
|
||||||
});
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
name: 'Test Sine Wave Generator',
|
||||||
|
type: 'Sine Wave Generator',
|
||||||
|
parent: overlayPlot.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
// Switch to fixed time, start: 2022-03-28 22:00:00.000 UTC, end: 2022-03-28 22:00:30.000 UTC
|
||||||
|
await page.goto(
|
||||||
|
`${overlayPlot.url}?tc.mode=fixed&tc.startBound=1648591200000&tc.endBound=1648591230000&tc.timeSystem=utc&view=plot-overlay`
|
||||||
|
);
|
||||||
|
|
||||||
|
await testYTicks(page, ['-1.00', '-0.50', '0.00', '0.50', '1.00']);
|
||||||
|
|
||||||
|
// enter edit mode
|
||||||
|
await page.click('button[title="Edit"]');
|
||||||
|
|
||||||
|
await page.getByRole('tab', { name: 'Config' }).click();
|
||||||
|
await turnOffAutoscale(page);
|
||||||
|
|
||||||
|
await setUserDefinedMinAndMax(page, '-2', '2');
|
||||||
|
|
||||||
|
// save
|
||||||
|
await page.click('button[title="Save"]');
|
||||||
|
await Promise.all([
|
||||||
|
page.locator('li[title = "Save and Finish Editing"]').click(),
|
||||||
|
//Wait for Save Banner to appear
|
||||||
|
page.waitForSelector('.c-message-banner__message')
|
||||||
|
]);
|
||||||
|
//Wait until Save Banner is gone
|
||||||
|
await page.locator('.c-message-banner__close-button').click();
|
||||||
|
await page.waitForSelector('.c-message-banner__message', { state: 'detached' });
|
||||||
|
|
||||||
|
// Make sure that after turning off autoscale, the user entered range values are reflected in the ticks.
|
||||||
|
await testYTicks(page, [
|
||||||
|
'-2.00',
|
||||||
|
'-1.50',
|
||||||
|
'-1.00',
|
||||||
|
'-0.50',
|
||||||
|
'0.00',
|
||||||
|
'0.50',
|
||||||
|
'1.00',
|
||||||
|
'1.50',
|
||||||
|
'2.00'
|
||||||
|
]);
|
||||||
|
|
||||||
|
const canvas = page.locator('canvas').nth(1);
|
||||||
|
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
await expect(page.locator('.js-series-data-loaded')).toBeVisible();
|
||||||
|
|
||||||
|
expect
|
||||||
|
.soft(await canvas.screenshot())
|
||||||
|
.toMatchSnapshot('autoscale-canvas-prepan.png', { animations: 'disabled' });
|
||||||
|
|
||||||
|
//Alt Drag Start
|
||||||
|
await page.keyboard.down('Alt');
|
||||||
|
|
||||||
|
await canvas.dragTo(canvas, {
|
||||||
|
sourcePosition: {
|
||||||
|
x: 200,
|
||||||
|
y: 200
|
||||||
|
},
|
||||||
|
targetPosition: {
|
||||||
|
x: 400,
|
||||||
|
y: 400
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Alt Drag End
|
||||||
|
await page.keyboard.up('Alt');
|
||||||
|
|
||||||
|
// Ensure the drag worked.
|
||||||
|
await testYTicks(page, ['-0.50', '0.00', '0.50', '1.00', '1.50', '2.00', '2.50', '3.00']);
|
||||||
|
|
||||||
|
//Wait for canvas to stabilize.
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
expect
|
||||||
|
.soft(await canvas.screenshot())
|
||||||
|
.toMatchSnapshot('autoscale-canvas-panned.png', { animations: 'disabled' });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {import('@playwright/test').Page} page
|
|
||||||
* @param {string} start
|
|
||||||
* @param {string} end
|
|
||||||
*/
|
|
||||||
async function setTimeRange(page, start = '2022-03-29 22:00:00.000Z', end = '2022-03-29 22:00:30.000Z') {
|
|
||||||
// Set a specific time range for consistency, otherwise it will change
|
|
||||||
// on every test to a range based on the current time.
|
|
||||||
|
|
||||||
const timeInputs = page.locator('input.c-input--datetime');
|
|
||||||
await timeInputs.first().click();
|
|
||||||
await timeInputs.first().fill(start);
|
|
||||||
|
|
||||||
await timeInputs.nth(1).click();
|
|
||||||
await timeInputs.nth(1).fill(end);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {import('@playwright/test').Page} page
|
|
||||||
* @param {string} myItemsFolderName
|
|
||||||
*/
|
|
||||||
async function createSinewaveOverlayPlot(page, myItemsFolderName) {
|
|
||||||
// click create button
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
|
||||||
|
|
||||||
// add overlay plot with defaults
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Overlay Plot")').click();
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('button:has-text("OK")').click(),
|
|
||||||
//Wait for Save Banner to appear1
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
//Wait until Save Banner is gone
|
|
||||||
await page.locator('.c-message-banner__close-button').click();
|
|
||||||
await page.waitForSelector('.c-message-banner__message', { state: 'detached'});
|
|
||||||
|
|
||||||
// save (exit edit mode)
|
|
||||||
await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1).click();
|
|
||||||
await page.locator('text=Save and Finish Editing').click();
|
|
||||||
|
|
||||||
// click create button
|
|
||||||
await page.locator('button:has-text("Create")').click();
|
|
||||||
|
|
||||||
// add sine wave generator with defaults
|
|
||||||
await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('button:has-text("OK")').click(),
|
|
||||||
//Wait for Save Banner to appear1
|
|
||||||
page.waitForSelector('.c-message-banner__message')
|
|
||||||
]);
|
|
||||||
//Wait until Save Banner is gone
|
|
||||||
await page.locator('.c-message-banner__close-button').click();
|
|
||||||
await page.waitForSelector('.c-message-banner__message', { state: 'detached'});
|
|
||||||
|
|
||||||
// focus the overlay plot
|
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('text=Unnamed Overlay Plot').first().click()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function turnOffAutoscale(page) {
|
async function turnOffAutoscale(page) {
|
||||||
// uncheck autoscale
|
// uncheck autoscale
|
||||||
await page.getByRole('listitem').filter({ hasText: 'Auto scale' }).getByRole('checkbox').uncheck();
|
await page.getByRole('checkbox', { name: 'Auto scale' }).uncheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -181,28 +141,23 @@ async function turnOffAutoscale(page) {
|
|||||||
* @param {string} max
|
* @param {string} max
|
||||||
*/
|
*/
|
||||||
async function setUserDefinedMinAndMax(page, min, max) {
|
async function setUserDefinedMinAndMax(page, min, max) {
|
||||||
// set minimum value
|
// set minimum value
|
||||||
const minRangeInput = page.getByRole('listitem').filter({ hasText: 'Minimum Value' }).locator('input[type="number"]');
|
await page.getByRole('spinbutton').first().fill(min);
|
||||||
await minRangeInput.click();
|
// set maximum value
|
||||||
await minRangeInput.fill(min);
|
await page.getByRole('spinbutton').nth(1).fill(max);
|
||||||
|
|
||||||
// set maximum value
|
|
||||||
const maxRangeInput = page.getByRole('listitem').filter({ hasText: 'Maximum Value' }).locator('input[type="number"]');
|
|
||||||
await maxRangeInput.click();
|
|
||||||
await maxRangeInput.fill(max);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function testYTicks(page, values) {
|
async function testYTicks(page, values) {
|
||||||
const yTicks = page.locator('.gl-plot-y-tick-label');
|
const yTicks = page.locator('.gl-plot-y-tick-label');
|
||||||
await page.locator('canvas >> nth=1').hover();
|
await page.locator('canvas >> nth=1').hover();
|
||||||
let promises = [yTicks.count().then(c => expect(c).toBe(values.length))];
|
let promises = [yTicks.count().then((c) => expect(c).toBe(values.length))];
|
||||||
|
|
||||||
for (let i = 0, l = values.length; i < l; i += 1) {
|
for (let i = 0, l = values.length; i < l; i += 1) {
|
||||||
promises.push(expect.soft(yTicks.nth(i)).toHaveText(values[i])); // eslint-disable-line
|
promises.push(expect.soft(yTicks.nth(i)).toHaveText(values[i])); // eslint-disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user