mirror of
https://github.com/nasa/openmct.git
synced 2025-01-09 14:32:43 +00:00
Merge branch 'master' into test-heuristics
This commit is contained in:
commit
afffdf35dd
@ -2,11 +2,15 @@ version: 2.1
|
|||||||
executors:
|
executors:
|
||||||
pw-focal-development:
|
pw-focal-development:
|
||||||
docker:
|
docker:
|
||||||
- image: mcr.microsoft.com/playwright:v1.25.2-focal
|
- image: mcr.microsoft.com/playwright:v1.39.0-focal
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
|
||||||
PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
|
PERCY_POSTINSTALL_BROWSER: "true" # Needed to store the percy browser in cache deps
|
||||||
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
PERCY_LOGLEVEL: "debug" # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
|
||||||
|
ubuntu:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2204:current
|
||||||
|
docker_layer_caching: true
|
||||||
parameters:
|
parameters:
|
||||||
BUST_CACHE:
|
BUST_CACHE:
|
||||||
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
|
||||||
@ -23,9 +27,8 @@ 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:
|
||||||
@ -34,10 +37,10 @@ commands:
|
|||||||
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:
|
||||||
@ -45,7 +48,7 @@ commands:
|
|||||||
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
|
||||||
@ -53,8 +56,8 @@ commands:
|
|||||||
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
|
||||||
@ -69,7 +72,7 @@ commands:
|
|||||||
- 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:
|
||||||
@ -102,7 +105,11 @@ jobs:
|
|||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
- browser-tools/install-chrome:
|
- browser-tools/install-chrome:
|
||||||
replace-existing: false
|
replace-existing: false
|
||||||
- run: npm run test
|
- run:
|
||||||
|
command: |
|
||||||
|
mkdir -p dist/reports/tests/
|
||||||
|
TESTFILES=$(circleci tests glob "src/**/*Spec.js")
|
||||||
|
echo "$TESTFILES" | circleci tests run --command="xargs npm run test" --verbose
|
||||||
- run: npm run cov:unit:publish
|
- run: npm run cov:unit:publish
|
||||||
- save_cache_cmd:
|
- save_cache_cmd:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: <<parameters.node-version>>
|
||||||
@ -110,24 +117,34 @@ jobs:
|
|||||||
path: dist/reports/tests/
|
path: dist/reports/tests/
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: coverage
|
path: coverage
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
e2e-test:
|
e2e-test:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
|
||||||
type: string
|
|
||||||
suite: #stable or full
|
suite: #stable or full
|
||||||
type: string
|
type: string
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
parallelism: 4
|
parallelism: 7
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: lts/hydrogen
|
||||||
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
- when: #Only install chrome-beta when running the 'full' suite to save $$$
|
||||||
condition:
|
condition:
|
||||||
equal: [ "full", <<parameters.suite>> ]
|
equal: ["full", <<parameters.suite>>]
|
||||||
steps:
|
steps:
|
||||||
- run: npx playwright install chrome-beta
|
- run: npx playwright install chrome-beta
|
||||||
- run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
|
- run:
|
||||||
|
command: |
|
||||||
|
mkdir test-results
|
||||||
|
TESTFILES=$(circleci tests glob "e2e/**/*.spec.js")
|
||||||
|
echo "$TESTFILES" | circleci tests run --command="xargs npm run test:e2e:<<parameters.suite>>" --verbose --split-by=timings
|
||||||
|
- 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:
|
- generate_e2e_code_cov_report:
|
||||||
suite: <<parameters.suite>>
|
suite: <<parameters.suite>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
@ -138,78 +155,161 @@ jobs:
|
|||||||
path: coverage
|
path: coverage
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
|
e2e-mobile:
|
||||||
|
executor: pw-focal-development
|
||||||
|
steps:
|
||||||
|
- build_and_install:
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- run: npm run test:e2e:mobile
|
||||||
|
- 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
|
||||||
|
- 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
|
||||||
|
e2e-couchdb:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- build_and_install:
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- run: npx playwright@1.39.0 install #Necessary for bare ubuntu machine
|
||||||
|
- run: |
|
||||||
|
export $(cat src/plugins/persistence/couch/.env.ci | xargs)
|
||||||
|
docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
||||||
|
sleep 3
|
||||||
|
bash src/plugins/persistence/couch/setup-couchdb.sh
|
||||||
|
- run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh #Replace LocalStorage Plugin with CouchDB
|
||||||
|
- run: npm run test:e2e:couchdb
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_e2e_code_cov_report:
|
||||||
|
suite: full #add to full suite
|
||||||
|
- store_test_results:
|
||||||
|
path: test-results/results.xml
|
||||||
|
- store_artifacts:
|
||||||
|
path: test-results
|
||||||
|
- store_artifacts:
|
||||||
|
path: coverage
|
||||||
|
- store_artifacts:
|
||||||
|
path: html-test-results
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
|
mem-test:
|
||||||
|
executor: pw-focal-development
|
||||||
|
steps:
|
||||||
|
- build_and_install:
|
||||||
|
node-version: lts/hydrogen
|
||||||
|
- run: npm run test:perf:memory
|
||||||
|
- store_test_results:
|
||||||
|
path: test-results/results.xml
|
||||||
|
- store_artifacts:
|
||||||
|
path: test-results
|
||||||
|
- store_artifacts:
|
||||||
|
path: html-test-results
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
perf-test:
|
perf-test:
|
||||||
parameters:
|
|
||||||
node-version:
|
|
||||||
type: string
|
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: lts/hydrogen
|
||||||
- run: npm run test:perf
|
- run: npm run test:perf:localhost
|
||||||
|
- run: npm run test:perf:contract
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
|
- 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
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
visual-test:
|
visual-a11y-tests:
|
||||||
parameters:
|
parameters:
|
||||||
node-version:
|
suite:
|
||||||
type: string
|
type: string # ci or full
|
||||||
executor: pw-focal-development
|
executor: pw-focal-development
|
||||||
steps:
|
steps:
|
||||||
- build_and_install:
|
- build_and_install:
|
||||||
node-version: <<parameters.node-version>>
|
node-version: lts/hydrogen
|
||||||
- run: npm run test:e2e:visual
|
- run: npm run test:e2e:visual:<<parameters.suite>>
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
path: test-results/results.xml
|
path: test-results/results.xml
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: test-results
|
path: test-results
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: html-test-results
|
path: html-test-results
|
||||||
|
- when:
|
||||||
|
condition:
|
||||||
|
equal: [42, 42] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
|
||||||
|
steps:
|
||||||
- generate_and_store_version_and_filesystem_artifacts
|
- generate_and_store_version_and_filesystem_artifacts
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
overall-circleci-commit-status: #These jobs run on every commit
|
overall-circleci-commit-status: #These jobs run on every commit
|
||||||
jobs:
|
jobs:
|
||||||
- lint:
|
- lint:
|
||||||
name: node14-lint
|
name: node20-lint
|
||||||
node-version: lts/fermium
|
node-version: lts/iron
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-stable
|
name: e2e-stable
|
||||||
node-version: lts/gallium
|
|
||||||
suite: stable
|
suite: stable
|
||||||
- perf-test:
|
- e2e-mobile
|
||||||
node-version: lts/gallium
|
- visual-a11y-tests:
|
||||||
- visual-test:
|
name: visual-a11y-test-ci
|
||||||
node-version: lts/gallium
|
suite: ci
|
||||||
|
|
||||||
the-nightly: #These jobs do not run on PRs, but against master at night
|
the-nightly: #These jobs do not run on PRs, but against master at night
|
||||||
jobs:
|
jobs:
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node14-chrome-nightly
|
name: node20-chrome-nightly
|
||||||
node-version: lts/fermium
|
node-version: lts/iron
|
||||||
- unit-test:
|
|
||||||
name: node16-chrome-nightly
|
|
||||||
node-version: lts/gallium
|
|
||||||
- unit-test:
|
- unit-test:
|
||||||
name: node18-chrome
|
name: node18-chrome
|
||||||
node-version: "18"
|
node-version: lts/hydrogen
|
||||||
- npm-audit:
|
- npm-audit:
|
||||||
node-version: lts/gallium
|
node-version: lts/hydrogen
|
||||||
- e2e-test:
|
- e2e-test:
|
||||||
name: e2e-full-nightly
|
name: e2e-full-nightly
|
||||||
node-version: lts/gallium
|
|
||||||
suite: full
|
suite: full
|
||||||
- perf-test:
|
- e2e-mobile
|
||||||
node-version: lts/gallium
|
- perf-test
|
||||||
- visual-test:
|
- mem-test
|
||||||
node-version: lts/gallium
|
- visual-a11y-tests:
|
||||||
|
name: visual-a11y-test-nightly
|
||||||
|
suite: full
|
||||||
|
- e2e-couchdb
|
||||||
triggers:
|
triggers:
|
||||||
- schedule:
|
- schedule:
|
||||||
cron: "0 0 * * *"
|
cron: "0 0 * * *"
|
||||||
|
513
.cspell.json
Normal file
513
.cspell.json
Normal file
@ -0,0 +1,513 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2",
|
||||||
|
"language": "en,en-us",
|
||||||
|
"words": [
|
||||||
|
"gress",
|
||||||
|
"doctoc",
|
||||||
|
"minmax",
|
||||||
|
"openmct",
|
||||||
|
"datasources",
|
||||||
|
"recieved",
|
||||||
|
"evalute",
|
||||||
|
"Sinewave",
|
||||||
|
"deregistration",
|
||||||
|
"unregisters",
|
||||||
|
"configutation",
|
||||||
|
"configuation",
|
||||||
|
"codecov",
|
||||||
|
"carryforward",
|
||||||
|
"Chacon",
|
||||||
|
"Straub",
|
||||||
|
"OWASP",
|
||||||
|
"Testathon",
|
||||||
|
"exploratorily",
|
||||||
|
"Testathons",
|
||||||
|
"testathon",
|
||||||
|
"npmjs",
|
||||||
|
"publishj",
|
||||||
|
"treeitem",
|
||||||
|
"timespan",
|
||||||
|
"Timespan",
|
||||||
|
"spinbutton",
|
||||||
|
"popout",
|
||||||
|
"textbox",
|
||||||
|
"tablist",
|
||||||
|
"Telem",
|
||||||
|
"codecoverage",
|
||||||
|
"browserless",
|
||||||
|
"networkidle",
|
||||||
|
"nums",
|
||||||
|
"mgmt",
|
||||||
|
"faultname",
|
||||||
|
"gantt",
|
||||||
|
"sharded",
|
||||||
|
"perfromance",
|
||||||
|
"MMOC",
|
||||||
|
"codegen",
|
||||||
|
"Unfortuantely",
|
||||||
|
"viewports",
|
||||||
|
"updatesnapshots",
|
||||||
|
"excercised",
|
||||||
|
"Circel",
|
||||||
|
"browsercontexts",
|
||||||
|
"miminum",
|
||||||
|
"testcase",
|
||||||
|
"testsuite",
|
||||||
|
"domcontentloaded",
|
||||||
|
"Tracefile",
|
||||||
|
"lcov",
|
||||||
|
"linecov",
|
||||||
|
"Browserless",
|
||||||
|
"webserver",
|
||||||
|
"yamcs",
|
||||||
|
"quickstart",
|
||||||
|
"subobject",
|
||||||
|
"autosize",
|
||||||
|
"Horz",
|
||||||
|
"vehicula",
|
||||||
|
"Praesent",
|
||||||
|
"pharetra",
|
||||||
|
"Duis",
|
||||||
|
"eget",
|
||||||
|
"arcu",
|
||||||
|
"elementum",
|
||||||
|
"mauris",
|
||||||
|
"Donec",
|
||||||
|
"nunc",
|
||||||
|
"quis",
|
||||||
|
"Proin",
|
||||||
|
"elit",
|
||||||
|
"Nunc",
|
||||||
|
"Aenean",
|
||||||
|
"mollis",
|
||||||
|
"hendrerit",
|
||||||
|
"Vestibulum",
|
||||||
|
"placerat",
|
||||||
|
"velit",
|
||||||
|
"augue",
|
||||||
|
"Quisque",
|
||||||
|
"mattis",
|
||||||
|
"lectus",
|
||||||
|
"rutrum",
|
||||||
|
"Fusce",
|
||||||
|
"tincidunt",
|
||||||
|
"nibh",
|
||||||
|
"blandit",
|
||||||
|
"urna",
|
||||||
|
"Nullam",
|
||||||
|
"congue",
|
||||||
|
"enim",
|
||||||
|
"Morbi",
|
||||||
|
"bibendum",
|
||||||
|
"Vivamus",
|
||||||
|
"imperdiet",
|
||||||
|
"Pellentesque",
|
||||||
|
"cursus",
|
||||||
|
"Aliquam",
|
||||||
|
"orci",
|
||||||
|
"Suspendisse",
|
||||||
|
"amet",
|
||||||
|
"justo",
|
||||||
|
"Etiam",
|
||||||
|
"vestibulum",
|
||||||
|
"ullamcorper",
|
||||||
|
"Cras",
|
||||||
|
"aliquet",
|
||||||
|
"Mauris",
|
||||||
|
"Nulla",
|
||||||
|
"scelerisque",
|
||||||
|
"viverra",
|
||||||
|
"metus",
|
||||||
|
"condimentum",
|
||||||
|
"varius",
|
||||||
|
"nulla",
|
||||||
|
"sapien",
|
||||||
|
"Curabitur",
|
||||||
|
"tristique",
|
||||||
|
"Nonsectetur",
|
||||||
|
"convallis",
|
||||||
|
"accumsan",
|
||||||
|
"lacus",
|
||||||
|
"posuere",
|
||||||
|
"turpis",
|
||||||
|
"egestas",
|
||||||
|
"feugiat",
|
||||||
|
"tortor",
|
||||||
|
"faucibus",
|
||||||
|
"euismod",
|
||||||
|
"pratices",
|
||||||
|
"pathing",
|
||||||
|
"pases",
|
||||||
|
"testcases",
|
||||||
|
"Noneditable",
|
||||||
|
"listitem",
|
||||||
|
"Gantt",
|
||||||
|
"timelist",
|
||||||
|
"timestrip",
|
||||||
|
"networkevents",
|
||||||
|
"fetchpriority",
|
||||||
|
"persistable",
|
||||||
|
"Persistable",
|
||||||
|
"persistability",
|
||||||
|
"Persistability",
|
||||||
|
"testdata",
|
||||||
|
"Testdata",
|
||||||
|
"metdata",
|
||||||
|
"timeconductor",
|
||||||
|
"contenteditable",
|
||||||
|
"autoscale",
|
||||||
|
"Autoscale",
|
||||||
|
"prepan",
|
||||||
|
"sinewave",
|
||||||
|
"cyanish",
|
||||||
|
"driv",
|
||||||
|
"searchbox",
|
||||||
|
"datetime",
|
||||||
|
"timeframe",
|
||||||
|
"recents",
|
||||||
|
"recentobjects",
|
||||||
|
"gsearch",
|
||||||
|
"Disp",
|
||||||
|
"Cloc",
|
||||||
|
"noselect",
|
||||||
|
"requestfailed",
|
||||||
|
"viewlarge",
|
||||||
|
"Imageurl",
|
||||||
|
"thumbstrip",
|
||||||
|
"checkmark",
|
||||||
|
"Unshelve",
|
||||||
|
"autosized",
|
||||||
|
"chacskaylo",
|
||||||
|
"numberfield",
|
||||||
|
"OPENMCT",
|
||||||
|
"Autoflow",
|
||||||
|
"Timelist",
|
||||||
|
"faultmanagement",
|
||||||
|
"GEOSPATIAL",
|
||||||
|
"geospatial",
|
||||||
|
"plotspatial",
|
||||||
|
"annnotation",
|
||||||
|
"keystrings",
|
||||||
|
"undelete",
|
||||||
|
"sometag",
|
||||||
|
"containee",
|
||||||
|
"composability",
|
||||||
|
"mutables",
|
||||||
|
"Mutables",
|
||||||
|
"composee",
|
||||||
|
"handleoutsideclick",
|
||||||
|
"Datetime",
|
||||||
|
"Perc",
|
||||||
|
"autodismiss",
|
||||||
|
"filetree",
|
||||||
|
"deeptailor",
|
||||||
|
"keystring",
|
||||||
|
"reindex",
|
||||||
|
"unlisten",
|
||||||
|
"symbolsfont",
|
||||||
|
"ellipsize",
|
||||||
|
"dismissable",
|
||||||
|
"TIMESYSTEM",
|
||||||
|
"Metadatas",
|
||||||
|
"stalenes",
|
||||||
|
"receieves",
|
||||||
|
"unsub",
|
||||||
|
"callbacktwo",
|
||||||
|
"unsubscribetwo",
|
||||||
|
"telem",
|
||||||
|
"Telemetery",
|
||||||
|
"unemitted",
|
||||||
|
"granually",
|
||||||
|
"timesystem",
|
||||||
|
"metadatas",
|
||||||
|
"iteratees",
|
||||||
|
"metadatum",
|
||||||
|
"printj",
|
||||||
|
"sprintf",
|
||||||
|
"unlisteners",
|
||||||
|
"amts",
|
||||||
|
"reregistered",
|
||||||
|
"hudsonfoo",
|
||||||
|
"onclone",
|
||||||
|
"autoflow",
|
||||||
|
"xdescribe",
|
||||||
|
"mockmct",
|
||||||
|
"Autoflowed",
|
||||||
|
"plotly",
|
||||||
|
"relayout",
|
||||||
|
"Plotly",
|
||||||
|
"Yaxis",
|
||||||
|
"showlegend",
|
||||||
|
"textposition",
|
||||||
|
"xaxis",
|
||||||
|
"automargin",
|
||||||
|
"fixedrange",
|
||||||
|
"yaxis",
|
||||||
|
"Axistype",
|
||||||
|
"showline",
|
||||||
|
"bglayer",
|
||||||
|
"autorange",
|
||||||
|
"hoverinfo",
|
||||||
|
"dotful",
|
||||||
|
"Dotful",
|
||||||
|
"cartesianlayer",
|
||||||
|
"scatterlayer",
|
||||||
|
"textfont",
|
||||||
|
"ampm",
|
||||||
|
"cdef",
|
||||||
|
"horz",
|
||||||
|
"STYLEABLE",
|
||||||
|
"styleable",
|
||||||
|
"afff",
|
||||||
|
"shdw",
|
||||||
|
"braintree",
|
||||||
|
"vals",
|
||||||
|
"Subobject",
|
||||||
|
"Shdw",
|
||||||
|
"Movebar",
|
||||||
|
"inspectable",
|
||||||
|
"Stringformatter",
|
||||||
|
"sclk",
|
||||||
|
"Objectpath",
|
||||||
|
"Keystring",
|
||||||
|
"duplicatable",
|
||||||
|
"composees",
|
||||||
|
"Composees",
|
||||||
|
"Composee",
|
||||||
|
"callthrough",
|
||||||
|
"objectpath",
|
||||||
|
"createable",
|
||||||
|
"noneditable",
|
||||||
|
"Classname",
|
||||||
|
"classname",
|
||||||
|
"selectedfaults",
|
||||||
|
"accum",
|
||||||
|
"newpersisted",
|
||||||
|
"Metadatum",
|
||||||
|
"MCWS",
|
||||||
|
"YAMCS",
|
||||||
|
"frameid",
|
||||||
|
"containerid",
|
||||||
|
"mmgis",
|
||||||
|
"PERC",
|
||||||
|
"curval",
|
||||||
|
"viewbox",
|
||||||
|
"mutablegauge",
|
||||||
|
"Flatbush",
|
||||||
|
"flatbush",
|
||||||
|
"Indicies",
|
||||||
|
"Marqueed",
|
||||||
|
"NSEW",
|
||||||
|
"nsew",
|
||||||
|
"vrover",
|
||||||
|
"gimbled",
|
||||||
|
"Pannable",
|
||||||
|
"unsynced",
|
||||||
|
"Unsynced",
|
||||||
|
"pannable",
|
||||||
|
"autoscroll",
|
||||||
|
"TIMESTRIP",
|
||||||
|
"TWENTYFOUR",
|
||||||
|
"FULLSIZE",
|
||||||
|
"intialize",
|
||||||
|
"Timestrip",
|
||||||
|
"spyon",
|
||||||
|
"Unlistener",
|
||||||
|
"multipane",
|
||||||
|
"DATESTRING",
|
||||||
|
"akhenry",
|
||||||
|
"Niklas",
|
||||||
|
"Hertzen",
|
||||||
|
"Kash",
|
||||||
|
"Nouroozi",
|
||||||
|
"Bostock",
|
||||||
|
"BOSTOCK",
|
||||||
|
"Arnout",
|
||||||
|
"Kazemier",
|
||||||
|
"Karolis",
|
||||||
|
"Narkevicius",
|
||||||
|
"Ashkenas",
|
||||||
|
"Madhavan",
|
||||||
|
"Iskren",
|
||||||
|
"Ivov",
|
||||||
|
"Chernev",
|
||||||
|
"Borshchov",
|
||||||
|
"painterro",
|
||||||
|
"sheetjs",
|
||||||
|
"Yuxi",
|
||||||
|
"ACITON",
|
||||||
|
"localstorage",
|
||||||
|
"Linkto",
|
||||||
|
"Painterro",
|
||||||
|
"Editability",
|
||||||
|
"filteredsnapshots",
|
||||||
|
"Fromimage",
|
||||||
|
"muliple",
|
||||||
|
"notebookstorage",
|
||||||
|
"Andpage",
|
||||||
|
"pixelize",
|
||||||
|
"Quickstart",
|
||||||
|
"indexhtml",
|
||||||
|
"youradminpassword",
|
||||||
|
"chttpd",
|
||||||
|
"sourcefiles",
|
||||||
|
"USERPASS",
|
||||||
|
"XPUT",
|
||||||
|
"adipiscing",
|
||||||
|
"eiusmod",
|
||||||
|
"tempor",
|
||||||
|
"incididunt",
|
||||||
|
"labore",
|
||||||
|
"dolore",
|
||||||
|
"aliqua",
|
||||||
|
"perspiciatis",
|
||||||
|
"iteree",
|
||||||
|
"submodels",
|
||||||
|
"symlog",
|
||||||
|
"Plottable",
|
||||||
|
"antisymlog",
|
||||||
|
"docstrings",
|
||||||
|
"webglcontextlost",
|
||||||
|
"gridlines",
|
||||||
|
"Xaxis",
|
||||||
|
"Crosshairs",
|
||||||
|
"telemetrylimit",
|
||||||
|
"xscale",
|
||||||
|
"yscale",
|
||||||
|
"untracks",
|
||||||
|
"swatched",
|
||||||
|
"NULLVALUE",
|
||||||
|
"unobserver",
|
||||||
|
"unsubscriber",
|
||||||
|
"drap",
|
||||||
|
"Averager",
|
||||||
|
"averager",
|
||||||
|
"movecolumnfromindex",
|
||||||
|
"callout",
|
||||||
|
"Konqueror",
|
||||||
|
"unmark",
|
||||||
|
"hitarea",
|
||||||
|
"Hitarea",
|
||||||
|
"Unmark",
|
||||||
|
"controlbar",
|
||||||
|
"reactified",
|
||||||
|
"perc",
|
||||||
|
"DHMS",
|
||||||
|
"timespans",
|
||||||
|
"timeframes",
|
||||||
|
"Timesystems",
|
||||||
|
"Hilite",
|
||||||
|
"datetimes",
|
||||||
|
"momentified",
|
||||||
|
"ucontents",
|
||||||
|
"TIMELIST",
|
||||||
|
"Timeframe",
|
||||||
|
"Guirk",
|
||||||
|
"resizeable",
|
||||||
|
"iframing",
|
||||||
|
"Btns",
|
||||||
|
"Ctrls",
|
||||||
|
"Chakra",
|
||||||
|
"Petch",
|
||||||
|
"propor",
|
||||||
|
"phoneandtablet",
|
||||||
|
"desktopandtablet",
|
||||||
|
"Imgs",
|
||||||
|
"UNICODES",
|
||||||
|
"datatable",
|
||||||
|
"csvg",
|
||||||
|
"cpath",
|
||||||
|
"cellipse",
|
||||||
|
"xlink",
|
||||||
|
"cstyle",
|
||||||
|
"bfill",
|
||||||
|
"ctitle",
|
||||||
|
"eicon",
|
||||||
|
"interactability",
|
||||||
|
"AFFORDANCES",
|
||||||
|
"affordance",
|
||||||
|
"scrollcontainer",
|
||||||
|
"Icomoon",
|
||||||
|
"icomoon",
|
||||||
|
"configurability",
|
||||||
|
"btns",
|
||||||
|
"AUTOFLOW",
|
||||||
|
"DATETIME",
|
||||||
|
"infobubble",
|
||||||
|
"thumbsbubble",
|
||||||
|
"codehilite",
|
||||||
|
"vscroll",
|
||||||
|
"bgsize",
|
||||||
|
"togglebutton",
|
||||||
|
"Hacskaylo",
|
||||||
|
"noie",
|
||||||
|
"fullscreen",
|
||||||
|
"horiz",
|
||||||
|
"menubutton",
|
||||||
|
"SNAPSHOTTING",
|
||||||
|
"snapshotting",
|
||||||
|
"PAINTERRO",
|
||||||
|
"ptro",
|
||||||
|
"PLOTLY",
|
||||||
|
"gridlayer",
|
||||||
|
"xtick",
|
||||||
|
"ytick",
|
||||||
|
"subobjects",
|
||||||
|
"Ucontents",
|
||||||
|
"Userand",
|
||||||
|
"Userbefore",
|
||||||
|
"brdr",
|
||||||
|
"pushs",
|
||||||
|
"ALPH",
|
||||||
|
"Recents",
|
||||||
|
"Qbert",
|
||||||
|
"Infobubble",
|
||||||
|
"haslink",
|
||||||
|
"VPID",
|
||||||
|
"vpid",
|
||||||
|
"updatedtest",
|
||||||
|
"KHTML",
|
||||||
|
"Chromezilla",
|
||||||
|
"Safarifox",
|
||||||
|
"deregistering",
|
||||||
|
"hundredtized",
|
||||||
|
"dhms",
|
||||||
|
"unthrottled",
|
||||||
|
"Codecov",
|
||||||
|
"dont",
|
||||||
|
"mediump",
|
||||||
|
"sinonjs",
|
||||||
|
"generatedata",
|
||||||
|
"grandsearch",
|
||||||
|
"websockets",
|
||||||
|
"swgs",
|
||||||
|
"memlab",
|
||||||
|
"devmode",
|
||||||
|
"blockquote",
|
||||||
|
"blockquotes",
|
||||||
|
"Blockquote",
|
||||||
|
"Blockquotes",
|
||||||
|
"oger",
|
||||||
|
"lcovonly",
|
||||||
|
"gcov",
|
||||||
|
"WCAG",
|
||||||
|
"stackedplot",
|
||||||
|
"Andale",
|
||||||
|
"unnormalized",
|
||||||
|
"checksnapshots",
|
||||||
|
"specced",
|
||||||
|
"composables",
|
||||||
|
"countup"
|
||||||
|
],
|
||||||
|
"dictionaries": ["npm", "softwareTerms", "node", "html", "css", "bash", "en_US", "en-gb", "misc"],
|
||||||
|
"ignorePaths": [
|
||||||
|
"package.json",
|
||||||
|
"dist/**",
|
||||||
|
"package-lock.json",
|
||||||
|
"node_modules",
|
||||||
|
"coverage",
|
||||||
|
"*.log",
|
||||||
|
"html-test-results",
|
||||||
|
"test-results"
|
||||||
|
]
|
||||||
|
}
|
181
.eslintrc.cjs
Normal file
181
.eslintrc.cjs
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
const LEGACY_FILES = ['example/**'];
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es6: true,
|
||||||
|
jasmine: true,
|
||||||
|
amd: true
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
_: 'readonly'
|
||||||
|
},
|
||||||
|
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:compat/recommended',
|
||||||
|
'plugin:vue/vue3-recommended',
|
||||||
|
'plugin:you-dont-need-lodash-underscore/compatible',
|
||||||
|
'plugin:prettier/recommended',
|
||||||
|
'plugin:no-unsanitized/DOM'
|
||||||
|
],
|
||||||
|
parser: 'vue-eslint-parser',
|
||||||
|
parserOptions: {
|
||||||
|
parser: '@babel/eslint-parser',
|
||||||
|
requireConfigFile: false,
|
||||||
|
allowImportExportEverywhere: true,
|
||||||
|
ecmaVersion: 2015,
|
||||||
|
ecmaFeatures: {
|
||||||
|
impliedStrict: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'simple-import-sort/imports': 'warn',
|
||||||
|
'simple-import-sort/exports': 'warn',
|
||||||
|
'vue/no-deprecated-dollar-listeners-api': 'warn',
|
||||||
|
'vue/no-deprecated-events-api': 'warn',
|
||||||
|
'vue/no-v-for-template-key': 'off',
|
||||||
|
'vue/no-v-for-template-key-on-child': 'error',
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
'you-dont-need-lodash-underscore/omit': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/throttle': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/flatten': 'off',
|
||||||
|
'you-dont-need-lodash-underscore/get': 'off',
|
||||||
|
'no-bitwise': 'error',
|
||||||
|
curly: 'error',
|
||||||
|
eqeqeq: 'error',
|
||||||
|
'guard-for-in': 'error',
|
||||||
|
'no-extend-native': 'error',
|
||||||
|
'no-inner-declarations': 'off',
|
||||||
|
'no-use-before-define': ['error', 'nofunc'],
|
||||||
|
'no-caller': 'error',
|
||||||
|
'no-irregular-whitespace': 'error',
|
||||||
|
'no-new': 'error',
|
||||||
|
'no-shadow': 'error',
|
||||||
|
'no-undef': 'error',
|
||||||
|
'no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
args: 'none'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-console': 'off',
|
||||||
|
'new-cap': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
capIsNew: false,
|
||||||
|
properties: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'dot-notation': 'error',
|
||||||
|
|
||||||
|
// https://eslint.org/docs/rules/no-case-declarations
|
||||||
|
'no-case-declarations': 'error',
|
||||||
|
// https://eslint.org/docs/rules/max-classes-per-file
|
||||||
|
'max-classes-per-file': ['error', 1],
|
||||||
|
// https://eslint.org/docs/rules/no-eq-null
|
||||||
|
'no-eq-null': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-eval
|
||||||
|
'no-eval': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-implicit-globals
|
||||||
|
'no-implicit-globals': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-implied-eval
|
||||||
|
'no-implied-eval': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-lone-blocks
|
||||||
|
'no-lone-blocks': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-loop-func
|
||||||
|
'no-loop-func': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-new-func
|
||||||
|
'no-new-func': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-new-wrappers
|
||||||
|
'no-new-wrappers': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-octal-escape
|
||||||
|
'no-octal-escape': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-proto
|
||||||
|
'no-proto': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-return-await
|
||||||
|
'no-return-await': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-script-url
|
||||||
|
'no-script-url': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-self-compare
|
||||||
|
'no-self-compare': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-sequences
|
||||||
|
'no-sequences': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
||||||
|
'no-unmodified-loop-condition': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-useless-call
|
||||||
|
'no-useless-call': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-nested-ternary
|
||||||
|
'no-nested-ternary': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-useless-computed-key
|
||||||
|
'no-useless-computed-key': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-var
|
||||||
|
'no-var': 'error',
|
||||||
|
// https://eslint.org/docs/rules/one-var
|
||||||
|
'one-var': ['error', 'never'],
|
||||||
|
// https://eslint.org/docs/rules/default-case-last
|
||||||
|
'default-case-last': 'error',
|
||||||
|
// https://eslint.org/docs/rules/default-param-last
|
||||||
|
'default-param-last': 'error',
|
||||||
|
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||||
|
'grouped-accessor-pairs': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-constructor-return
|
||||||
|
'no-constructor-return': 'error',
|
||||||
|
// https://eslint.org/docs/rules/array-callback-return
|
||||||
|
'array-callback-return': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-invalid-this
|
||||||
|
'no-invalid-this': 'error', // Believe this one actually surfaces some bugs
|
||||||
|
// https://eslint.org/docs/rules/func-style
|
||||||
|
'func-style': ['error', 'declaration'],
|
||||||
|
// https://eslint.org/docs/rules/no-unused-expressions
|
||||||
|
'no-unused-expressions': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-useless-concat
|
||||||
|
'no-useless-concat': 'error',
|
||||||
|
// https://eslint.org/docs/rules/radix
|
||||||
|
radix: 'error',
|
||||||
|
// https://eslint.org/docs/rules/require-await
|
||||||
|
'require-await': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-alert
|
||||||
|
'no-alert': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-useless-constructor
|
||||||
|
'no-useless-constructor': 'error',
|
||||||
|
// https://eslint.org/docs/rules/no-duplicate-imports
|
||||||
|
'no-duplicate-imports': 'error',
|
||||||
|
|
||||||
|
// https://eslint.org/docs/rules/no-implicit-coercion
|
||||||
|
'no-implicit-coercion': 'error',
|
||||||
|
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||||
|
'no-unneeded-ternary': 'error',
|
||||||
|
'unicorn/filename-case': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
cases: {
|
||||||
|
pascalCase: true
|
||||||
|
},
|
||||||
|
ignore: ['^.*\\.js$']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/first-attribute-linebreak': 'error',
|
||||||
|
'vue/multiline-html-element-content-newline': 'off',
|
||||||
|
'vue/singleline-html-element-content-newline': 'off',
|
||||||
|
'vue/no-mutating-props': 'off' // TODO: Remove this rule and fix resulting errors
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: LEGACY_FILES,
|
||||||
|
rules: {
|
||||||
|
'no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
vars: 'all',
|
||||||
|
args: 'none',
|
||||||
|
varsIgnorePattern: 'controller'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-nested-ternary': 'off',
|
||||||
|
'no-var': 'off',
|
||||||
|
'one-var': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
271
.eslintrc.js
271
.eslintrc.js
@ -1,271 +0,0 @@
|
|||||||
const LEGACY_FILES = ["example/**"];
|
|
||||||
module.exports = {
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es6": true,
|
|
||||||
"jasmine": true,
|
|
||||||
"amd": true
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"_": "readonly"
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:compat/recommended",
|
|
||||||
"plugin:vue/recommended",
|
|
||||||
"plugin:you-dont-need-lodash-underscore/compatible"
|
|
||||||
],
|
|
||||||
"parser": "vue-eslint-parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"parser": "@babel/eslint-parser",
|
|
||||||
"requireConfigFile": false,
|
|
||||||
"allowImportExportEverywhere": true,
|
|
||||||
"ecmaVersion": 2015,
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"impliedStrict": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"you-dont-need-lodash-underscore/omit": "off",
|
|
||||||
"you-dont-need-lodash-underscore/throttle": "off",
|
|
||||||
"you-dont-need-lodash-underscore/flatten": "off",
|
|
||||||
"you-dont-need-lodash-underscore/get": "off",
|
|
||||||
"no-bitwise": "error",
|
|
||||||
"curly": "error",
|
|
||||||
"eqeqeq": "error",
|
|
||||||
"guard-for-in": "error",
|
|
||||||
"no-extend-native": "error",
|
|
||||||
"no-inner-declarations": "off",
|
|
||||||
"no-use-before-define": ["error", "nofunc"],
|
|
||||||
"no-caller": "error",
|
|
||||||
"no-irregular-whitespace": "error",
|
|
||||||
"no-new": "error",
|
|
||||||
"no-shadow": "error",
|
|
||||||
"no-undef": "error",
|
|
||||||
"no-unused-vars": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-console": "off",
|
|
||||||
"no-trailing-spaces": "error",
|
|
||||||
"space-before-function-paren": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"anonymous": "always",
|
|
||||||
"asyncArrow": "always",
|
|
||||||
"named": "never"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"array-bracket-spacing": "error",
|
|
||||||
"space-in-parens": "error",
|
|
||||||
"space-before-blocks": "error",
|
|
||||||
"comma-dangle": "error",
|
|
||||||
"eol-last": "error",
|
|
||||||
"new-cap": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"capIsNew": false,
|
|
||||||
"properties": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dot-notation": "error",
|
|
||||||
"indent": ["error", 4],
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-case-declarations
|
|
||||||
"no-case-declarations": "error",
|
|
||||||
// https://eslint.org/docs/rules/max-classes-per-file
|
|
||||||
"max-classes-per-file": ["error", 1],
|
|
||||||
// https://eslint.org/docs/rules/no-eq-null
|
|
||||||
"no-eq-null": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-eval
|
|
||||||
"no-eval": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-floating-decimal
|
|
||||||
"no-floating-decimal": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-globals
|
|
||||||
"no-implicit-globals": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-implied-eval
|
|
||||||
"no-implied-eval": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-lone-blocks
|
|
||||||
"no-lone-blocks": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-loop-func
|
|
||||||
"no-loop-func": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-new-func
|
|
||||||
"no-new-func": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-new-wrappers
|
|
||||||
"no-new-wrappers": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-octal-escape
|
|
||||||
"no-octal-escape": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-proto
|
|
||||||
"no-proto": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-return-await
|
|
||||||
"no-return-await": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-script-url
|
|
||||||
"no-script-url": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-self-compare
|
|
||||||
"no-self-compare": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-sequences
|
|
||||||
"no-sequences": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
||||||
"no-unmodified-loop-condition": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-useless-call
|
|
||||||
"no-useless-call": "error",
|
|
||||||
// https://eslint.org/docs/rules/wrap-iife
|
|
||||||
"wrap-iife": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-nested-ternary
|
|
||||||
"no-nested-ternary": "error",
|
|
||||||
// https://eslint.org/docs/rules/switch-colon-spacing
|
|
||||||
"switch-colon-spacing": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-useless-computed-key
|
|
||||||
"no-useless-computed-key": "error",
|
|
||||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
|
||||||
"rest-spread-spacing": ["error"],
|
|
||||||
// https://eslint.org/docs/rules/no-var
|
|
||||||
"no-var": "error",
|
|
||||||
// https://eslint.org/docs/rules/one-var
|
|
||||||
"one-var": ["error", "never"],
|
|
||||||
// https://eslint.org/docs/rules/default-case-last
|
|
||||||
"default-case-last": "error",
|
|
||||||
// https://eslint.org/docs/rules/default-param-last
|
|
||||||
"default-param-last": "error",
|
|
||||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
|
||||||
"grouped-accessor-pairs": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-constructor-return
|
|
||||||
"no-constructor-return": "error",
|
|
||||||
// https://eslint.org/docs/rules/array-callback-return
|
|
||||||
"array-callback-return": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-invalid-this
|
|
||||||
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
|
|
||||||
// https://eslint.org/docs/rules/func-style
|
|
||||||
"func-style": ["error", "declaration"],
|
|
||||||
// https://eslint.org/docs/rules/no-unused-expressions
|
|
||||||
"no-unused-expressions": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-useless-concat
|
|
||||||
"no-useless-concat": "error",
|
|
||||||
// https://eslint.org/docs/rules/radix
|
|
||||||
"radix": "error",
|
|
||||||
// https://eslint.org/docs/rules/require-await
|
|
||||||
"require-await": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-alert
|
|
||||||
"no-alert": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-useless-constructor
|
|
||||||
"no-useless-constructor": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-duplicate-imports
|
|
||||||
"no-duplicate-imports": "error",
|
|
||||||
|
|
||||||
// https://eslint.org/docs/rules/no-implicit-coercion
|
|
||||||
"no-implicit-coercion": "error",
|
|
||||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
|
||||||
"no-unneeded-ternary": "error",
|
|
||||||
// https://eslint.org/docs/rules/semi
|
|
||||||
"semi": ["error", "always"],
|
|
||||||
// https://eslint.org/docs/rules/no-multi-spaces
|
|
||||||
"no-multi-spaces": "error",
|
|
||||||
// https://eslint.org/docs/rules/key-spacing
|
|
||||||
"key-spacing": ["error", {
|
|
||||||
"afterColon": true
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/keyword-spacing
|
|
||||||
"keyword-spacing": ["error", {
|
|
||||||
"before": true,
|
|
||||||
"after": true
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/comma-spacing
|
|
||||||
// Also requires one line code fix
|
|
||||||
"comma-spacing": ["error", {
|
|
||||||
"after": true
|
|
||||||
}],
|
|
||||||
//https://eslint.org/docs/rules/no-whitespace-before-property
|
|
||||||
"no-whitespace-before-property": "error",
|
|
||||||
// https://eslint.org/docs/rules/object-curly-newline
|
|
||||||
"object-curly-newline": ["error", {
|
|
||||||
"consistent": true,
|
|
||||||
"multiline": true
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/object-property-newline
|
|
||||||
"object-property-newline": "error",
|
|
||||||
// https://eslint.org/docs/rules/brace-style
|
|
||||||
"brace-style": "error",
|
|
||||||
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
|
||||||
"no-multiple-empty-lines": ["error", {"max": 1}],
|
|
||||||
// https://eslint.org/docs/rules/operator-linebreak
|
|
||||||
"operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}],
|
|
||||||
// https://eslint.org/docs/rules/padding-line-between-statements
|
|
||||||
"padding-line-between-statements": ["error", {
|
|
||||||
"blankLine": "always",
|
|
||||||
"prev": "multiline-block-like",
|
|
||||||
"next": "*"
|
|
||||||
}, {
|
|
||||||
"blankLine": "always",
|
|
||||||
"prev": "*",
|
|
||||||
"next": "return"
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/space-infix-ops
|
|
||||||
"space-infix-ops": "error",
|
|
||||||
// https://eslint.org/docs/rules/space-unary-ops
|
|
||||||
"space-unary-ops": ["error", {
|
|
||||||
"words": true,
|
|
||||||
"nonwords": false
|
|
||||||
}],
|
|
||||||
// https://eslint.org/docs/rules/arrow-spacing
|
|
||||||
"arrow-spacing": "error",
|
|
||||||
// https://eslint.org/docs/rules/semi-spacing
|
|
||||||
"semi-spacing": ["error", {
|
|
||||||
"before": false,
|
|
||||||
"after": true
|
|
||||||
}],
|
|
||||||
|
|
||||||
"vue/html-indent": [
|
|
||||||
"error",
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
"attribute": 1,
|
|
||||||
"baseIndent": 0,
|
|
||||||
"closeBracket": 0,
|
|
||||||
"alignAttributesVertically": true,
|
|
||||||
"ignores": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/html-self-closing": ["error",
|
|
||||||
{
|
|
||||||
"html": {
|
|
||||||
"void": "never",
|
|
||||||
"normal": "never",
|
|
||||||
"component": "always"
|
|
||||||
},
|
|
||||||
"svg": "always",
|
|
||||||
"math": "always"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/max-attributes-per-line": ["error", {
|
|
||||||
"singleline": 1,
|
|
||||||
"multiline": 1,
|
|
||||||
}],
|
|
||||||
"vue/first-attribute-linebreak": "error",
|
|
||||||
"vue/multiline-html-element-content-newline": "off",
|
|
||||||
"vue/singleline-html-element-content-newline": "off",
|
|
||||||
"vue/multi-word-component-names": "off", // TODO enable, align with conventions
|
|
||||||
"vue/no-mutating-props": "off"
|
|
||||||
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": LEGACY_FILES,
|
|
||||||
"rules": {
|
|
||||||
"no-unused-vars": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
"vars": "all",
|
|
||||||
"args": "none",
|
|
||||||
"varsIgnorePattern": "controller"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-nested-ternary": "off",
|
|
||||||
"no-var": "off",
|
|
||||||
"one-var": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
16
.git-blame-ignore-revs
Normal file
16
.git-blame-ignore-revs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# git-blame ignored revisions
|
||||||
|
# To configure, run:
|
||||||
|
# git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
|
# Requires Git > 2.23
|
||||||
|
# See https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
|
||||||
|
|
||||||
|
# vue-eslint update 2019
|
||||||
|
14a0f84c1bcd56886d7c9e4e6afa8f7d292734e5
|
||||||
|
# eslint changes 2022
|
||||||
|
d80b6923541704ab925abf0047cbbc58735c27e2
|
||||||
|
# Copyright year update 2022
|
||||||
|
4a9744e916d24122a81092f6b7950054048ba860
|
||||||
|
# Copyright year update 2023
|
||||||
|
8040b275fcf2ba71b42cd72d4daa64bb25c19c2d
|
||||||
|
# Apply `prettier` formatting
|
||||||
|
caa7bc6faebc204f67aedae3e35fb0d0d3ce27a7
|
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -8,22 +8,22 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
|
|||||||
|
|
||||||
* [ ] Have you followed the guidelines in our [Contributing document](https://github.com/nasa/openmct/blob/master/CONTRIBUTING.md)?
|
* [ ] Have you followed the guidelines in our [Contributing document](https://github.com/nasa/openmct/blob/master/CONTRIBUTING.md)?
|
||||||
* [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/nasa/openmct/pulls) for the same update/change?
|
* [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/nasa/openmct/pulls) for the same update/change?
|
||||||
* [ ] Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.
|
* [ ] Is this a notable change that will require a special callout in the release notes [Notable Change](../docs/src/process/release.md) ? For example, will this break compatibility with existing APIs or projects which source these plugins?
|
||||||
|
|
||||||
### Author Checklist
|
### Author Checklist
|
||||||
|
|
||||||
* [ ] Changes address original issue?
|
* [ ] Changes address original issue?
|
||||||
* [ ] Tests included and/or updated with changes?
|
* [ ] Tests included and/or updated with changes?
|
||||||
* [ ] Command line build passes?
|
|
||||||
* [ ] Has this been smoke tested?
|
* [ ] Has this been smoke tested?
|
||||||
|
* [ ] Have you associated this PR with a `type:` label? Note: this is not necessarily the same as the original issue.
|
||||||
|
* [ ] Have you associated a milestone with this PR? Note: leave blank if unsure.
|
||||||
|
* [ ] Is this a breaking change to be called out in the release notes?
|
||||||
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
* [ ] Testing instructions included in associated issue OR is this a dependency/testcase change?
|
||||||
|
|
||||||
### Reviewer Checklist
|
### Reviewer Checklist
|
||||||
|
|
||||||
* [ ] Changes appear to address issue?
|
* [ ] Changes appear to address issue?
|
||||||
|
* [ ] Reviewer has tested changes by following the provided instructions?
|
||||||
* [ ] Changes appear not to be breaking changes?
|
* [ ] Changes appear not to be breaking changes?
|
||||||
* [ ] Appropriate unit tests included?
|
* [ ] Appropriate automated tests included?
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
* [ ] Code style and in-line documentation are appropriate?
|
||||||
* [ ] Commit messages meet standards?
|
|
||||||
* [ ] Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
|
|
||||||
* [ ] Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)
|
|
||||||
|
1
.github/codeql/codeql-config.yml
vendored
Normal file
1
.github/codeql/codeql-config.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
name: 'Custom CodeQL config'
|
55
.github/dependabot.yml
vendored
55
.github/dependabot.yml
vendored
@ -1,31 +1,42 @@
|
|||||||
|
|
||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: 'npm'
|
||||||
directory: "/"
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'weekly'
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
rebase-strategy: 'disabled'
|
||||||
labels:
|
labels:
|
||||||
- "pr:e2e"
|
- 'pr:daveit'
|
||||||
- "type:maintenance"
|
- 'pr:e2e'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
- "pr:platform"
|
- 'pr:platform'
|
||||||
ignore:
|
ignore:
|
||||||
#We have to source the 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'
|
||||||
#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'
|
||||||
- package-ecosystem: "github-actions"
|
update-types: ['version-update:semver-patch']
|
||||||
directory: "/"
|
- dependency-name: 'sinon'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: 'moment-timezone'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: '@types/lodash'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- dependency-name: 'marked'
|
||||||
|
update-types: ['version-update:semver-patch']
|
||||||
|
- package-ecosystem: 'github-actions'
|
||||||
|
directory: '/'
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: 'daily'
|
||||||
|
rebase-strategy: 'disabled'
|
||||||
labels:
|
labels:
|
||||||
- "type:maintenance"
|
- 'pr:daveit'
|
||||||
- "dependencies"
|
- 'type:maintenance'
|
||||||
- "pr:daveit"
|
- 'dependencies'
|
||||||
|
26
.github/release.yml
vendored
Normal file
26
.github/release.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
changelog:
|
||||||
|
categories:
|
||||||
|
- title: 💥 Notable Changes
|
||||||
|
labels:
|
||||||
|
- notable_change
|
||||||
|
- title: 🏕 Features
|
||||||
|
labels:
|
||||||
|
- type:feature
|
||||||
|
- title: 🎉 Enhancements
|
||||||
|
labels:
|
||||||
|
- type:enhancement
|
||||||
|
exclude:
|
||||||
|
labels:
|
||||||
|
- type:feature
|
||||||
|
- title: 🔧 Maintenance
|
||||||
|
labels:
|
||||||
|
- type:maintenance
|
||||||
|
- title: ⚡ Performance
|
||||||
|
labels:
|
||||||
|
- performance
|
||||||
|
- title: 👒 Dependencies
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
- title: 🐛 Bug Fixes
|
||||||
|
labels:
|
||||||
|
- "*"
|
17
.github/workflows/codeql-analysis.yml
vendored
17
.github/workflows/codeql-analysis.yml
vendored
@ -1,11 +1,10 @@
|
|||||||
|
name: 'CodeQL'
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [master, 'release/*']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [master, 'release/*']
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**/*Spec.js'
|
- '**/*Spec.js'
|
||||||
- '**/*.md'
|
- '**/*.md'
|
||||||
@ -28,16 +27,18 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
|
config-file: ./.github/codeql/codeql-config.yml
|
||||||
languages: javascript
|
languages: javascript
|
||||||
|
queries: security-and-quality
|
||||||
|
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
|
88
.github/workflows/e2e-couchdb.yml
vendored
88
.github/workflows/e2e-couchdb.yml
vendored
@ -1,38 +1,88 @@
|
|||||||
name: "e2e-couchdb"
|
name: 'e2e-couchdb'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
env:
|
schedule:
|
||||||
OPENMCT_DATABASE_NAME: openmct
|
- cron: '0 0 * * *'
|
||||||
COUCH_ADMIN_USER: admin
|
|
||||||
COUCH_ADMIN_PASSWORD: password
|
|
||||||
COUCH_BASE_LOCAL: http://localhost:5984
|
|
||||||
COUCH_NODE_NAME: nonode@nohost
|
|
||||||
jobs:
|
jobs:
|
||||||
e2e-couchdb:
|
e2e-couchdb:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e:couchdb' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e:couchdb') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.action == 'opened'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run : docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
- uses: actions/setup-node@v4
|
||||||
- run : sleep 3 # wait until CouchDB has started (TODO: there must be a better way)
|
|
||||||
- run : bash src/plugins/persistence/couch/setup-couchdb.sh
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: 'lts/hydrogen'
|
||||||
- run: npx playwright@1.25.2 install
|
|
||||||
- run: npm install
|
- name: Cache NPM dependencies
|
||||||
- run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
uses: actions/cache@v3
|
||||||
- run: npm run test:e2e:couchdb
|
with:
|
||||||
- run: ls -latr
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- run: npx playwright@1.39.0 install
|
||||||
|
|
||||||
|
- name: Start CouchDB Docker Container and Init with Setup Scripts
|
||||||
|
run: |
|
||||||
|
export $(cat src/plugins/persistence/couch/.env.ci | xargs)
|
||||||
|
docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
|
||||||
|
sleep 3
|
||||||
|
bash src/plugins/persistence/couch/setup-couchdb.sh
|
||||||
|
bash src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
|
||||||
|
|
||||||
|
- name: Run CouchDB Tests
|
||||||
|
env:
|
||||||
|
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha }}
|
||||||
|
run: npm run test:e2e:couchdb
|
||||||
|
|
||||||
|
- name: Publish Results to Codecov.io
|
||||||
|
env:
|
||||||
|
SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: npm run cov:e2e:full:publish
|
||||||
|
|
||||||
- name: Archive test results
|
- 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}`);
|
||||||
|
}
|
||||||
|
61
.github/workflows/e2e-flakefinder.yml
vendored
Normal file
61
.github/workflows/e2e-flakefinder.yml
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
name: 'pr:e2e:flakefinder'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e-flakefinder:
|
||||||
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e:flakefinder') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event.action == 'opened'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 120
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 'lts/hydrogen'
|
||||||
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npx playwright@1.39.0 install
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
|
- name: Run E2E Tests (Repeated 10 Times)
|
||||||
|
run: npm run test:e2e:stable -- --retries=0 --repeat-each=10 --max-failures=50
|
||||||
|
|
||||||
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: test-results
|
||||||
|
|
||||||
|
- name: Remove pr:e2e:flakefinder label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:e2e:flakefinder';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
58
.github/workflows/e2e-perf.yml
vendored
Normal file
58
.github/workflows/e2e-perf.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
name: 'e2e-perf'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- labeled
|
||||||
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
jobs:
|
||||||
|
e2e-full:
|
||||||
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e:perf') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 60
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 'lts/hydrogen'
|
||||||
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npx playwright@1.39.0 install
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
- run: npm run test:perf:localhost
|
||||||
|
- run: npm run test:perf:contract
|
||||||
|
- run: npm run test:perf:memory
|
||||||
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
path: test-results
|
||||||
|
|
||||||
|
- name: Remove pr:e2e:perf label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:e2e:perf';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
80
.github/workflows/e2e-pr.yml
vendored
80
.github/workflows/e2e-pr.yml
vendored
@ -1,62 +1,68 @@
|
|||||||
name: "e2e-pr"
|
name: 'e2e-pr'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- labeled
|
- labeled
|
||||||
- opened
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
e2e-full:
|
||||||
if: ${{ github.event.label.name == 'pr:e2e' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:e2e') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Trigger Success
|
- uses: actions/checkout@v4
|
||||||
uses: actions/github-script@v6
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
script: |
|
node-version: 'lts/hydrogen'
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
- name: Cache NPM dependencies
|
||||||
owner: "nasa",
|
uses: actions/cache@v3
|
||||||
repo: "openmct",
|
|
||||||
body: 'Started e2e Run. Follow along: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
|
||||||
})
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
path: ~/.npm
|
||||||
- run: npx playwright@1.25.2 install
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- run: npx playwright@1.39.0 install
|
||||||
- run: npx playwright install chrome-beta
|
- run: npx playwright install chrome-beta
|
||||||
- run: npm install
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
- run: npm run test:e2e:full
|
- run: npm run test:e2e:full -- --max-failures=40
|
||||||
|
- run: npm run cov:e2e:report || true
|
||||||
|
- shell: bash
|
||||||
|
env:
|
||||||
|
SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
run: |
|
||||||
|
npm run cov:e2e:full:publish
|
||||||
- name: Archive test results
|
- name: Archive test results
|
||||||
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: test-results
|
path: test-results
|
||||||
- name: Test success
|
|
||||||
if: ${{ success() }}
|
- name: Remove pr:e2e label (if present)
|
||||||
|
if: always()
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
github.rest.issues.createComment({
|
const { owner, repo, number } = context.issue;
|
||||||
issue_number: context.issue.number,
|
const labelToRemove = 'pr:e2e';
|
||||||
owner: "nasa",
|
try {
|
||||||
repo: "openmct",
|
await github.rest.issues.removeLabel({
|
||||||
body: 'Success ✅ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
owner,
|
||||||
})
|
repo,
|
||||||
- name: Test failure
|
issue_number: number,
|
||||||
if: ${{ failure() }}
|
name: labelToRemove
|
||||||
uses: actions/github-script@v6
|
});
|
||||||
with:
|
} catch (error) {
|
||||||
script: |
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
github.rest.issues.createComment({
|
}
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: "nasa",
|
|
||||||
repo: "openmct",
|
|
||||||
body: 'Failure ❌ ! Build artifacts are here: https://github.com/nasa/openmct/actions/runs/' + context.runId
|
|
||||||
})
|
|
||||||
|
21
.github/workflows/e2e.yml
vendored
21
.github/workflows/e2e.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
name: "e2e"
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'Which branch do you want to test?' # Limited to branch for now
|
|
||||||
required: false
|
|
||||||
default: 'master'
|
|
||||||
jobs:
|
|
||||||
e2e:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.version }}
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- run: npm install
|
|
||||||
- name: Run the e2e tests
|
|
||||||
run: npm run test:e2e:ci
|
|
98
.github/workflows/lighthouse.yml
vendored
98
.github/workflows/lighthouse.yml
vendored
@ -1,98 +0,0 @@
|
|||||||
name: lighthouse
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
version:
|
|
||||||
description: 'Which branch do you want to test?' # Limited to branch for now
|
|
||||||
required: false
|
|
||||||
default: 'master'
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- labeled
|
|
||||||
jobs:
|
|
||||||
lighthouse-pr:
|
|
||||||
if: ${{ github.event.label.name == 'pr:lighthouse' }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Master for Baseline
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: master #explicitly checkout master for baseline
|
|
||||||
- name: Install Node 16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci against master to generate baseline and ignore exit codes
|
|
||||||
run: lhci autorun || true
|
|
||||||
- name: Perform clean checkout of PR
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
clean: true
|
|
||||||
- name: Install Node version which is compatible with PR
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci with PR
|
|
||||||
run: lhci autorun
|
|
||||||
env:
|
|
||||||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
||||||
lighthouse-nightly:
|
|
||||||
if: ${{ github.event.schedule }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Install Node 16
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v2
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci against master to generate baseline
|
|
||||||
run: lhci autorun
|
|
||||||
env:
|
|
||||||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
|
|
||||||
lighthouse-dispatch:
|
|
||||||
if: ${{ github.event.workflow_dispatch }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.inputs.version }}
|
|
||||||
- name: Install Node 14
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: '16'
|
|
||||||
- name: Cache node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
env:
|
|
||||||
cache-name: cache-node-modules
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
|
|
||||||
- name: npm install with lighthouse cli
|
|
||||||
run: npm install && npm install -g @lhci/cli
|
|
||||||
- name: Run lhci against master to generate baseline
|
|
||||||
run: lhci autorun
|
|
||||||
|
|
20
.github/workflows/npm-prerelease.yml
vendored
20
.github/workflows/npm-prerelease.yml
vendored
@ -11,23 +11,27 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: lts/hydrogen
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: |
|
||||||
|
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc
|
||||||
|
npm whoami
|
||||||
|
npm publish --access=public --tag unstable openmct
|
||||||
|
# - run: npm test
|
||||||
|
|
||||||
publish-npm-prerelease:
|
publish-npm-prerelease:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: lts/hydrogen
|
||||||
registry-url: https://registry.npmjs.org/
|
registry-url: https://registry.npmjs.org/
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm publish --access public --tag unstable
|
- run: npm publish --access=public --tag unstable
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
58
.github/workflows/pr-platform.yml
vendored
58
.github/workflows/pr-platform.yml
vendored
@ -1,13 +1,19 @@
|
|||||||
name: "pr-platform"
|
name: 'pr-platform'
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches: master
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [ labeled ]
|
types:
|
||||||
|
- labeled
|
||||||
|
- opened
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
jobs:
|
jobs:
|
||||||
e2e-full:
|
pr-platform:
|
||||||
if: ${{ github.event.label.name == 'pr:platform' }}
|
if: contains(github.event.pull_request.labels.*.name, 'pr:platform') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@ -16,19 +22,49 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
node_version:
|
node_version:
|
||||||
- 14
|
- lts/iron
|
||||||
- 16
|
- lts/hydrogen
|
||||||
- 18
|
|
||||||
architecture:
|
architecture:
|
||||||
- x64
|
- x64
|
||||||
|
|
||||||
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
- run: npm install
|
|
||||||
|
- name: Cache NPM dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ matrix.node_version }}-
|
||||||
|
|
||||||
|
- run: npm install --cache ~/.npm --no-audit --progress=false
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
- run: npm run lint -- --quiet
|
- run: npm run lint -- --quiet
|
||||||
|
|
||||||
|
- name: Remove pr:platform label (if present)
|
||||||
|
if: always()
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo, number } = context.issue;
|
||||||
|
const labelToRemove = 'pr:platform';
|
||||||
|
try {
|
||||||
|
await github.rest.issues.removeLabel({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
name: labelToRemove
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(`Failed to remove ' + labelToRemove + ' label: ${error.message}`);
|
||||||
|
}
|
||||||
|
24
.github/workflows/prcop.yml
vendored
24
.github/workflows/prcop.yml
vendored
@ -3,17 +3,17 @@ name: PRCop
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
|
- labeled
|
||||||
|
- unlabeled
|
||||||
- opened
|
- opened
|
||||||
- reopened
|
- reopened
|
||||||
- edited
|
|
||||||
- synchronize
|
- synchronize
|
||||||
- ready_for_review
|
- edited
|
||||||
- review_requested
|
|
||||||
- review_request_removed
|
|
||||||
pull_request_review_comment:
|
pull_request_review_comment:
|
||||||
types:
|
types:
|
||||||
- created
|
- created
|
||||||
|
env:
|
||||||
|
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }}
|
||||||
jobs:
|
jobs:
|
||||||
prcop:
|
prcop:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -22,5 +22,17 @@ jobs:
|
|||||||
- name: Linting Pull Request
|
- name: Linting Pull Request
|
||||||
uses: makaroni4/prcop@v1.0.35
|
uses: makaroni4/prcop@v1.0.35
|
||||||
with:
|
with:
|
||||||
config-file: ".github/workflows/prcop-config.json"
|
config-file: '.github/workflows/prcop-config.json'
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
check-type-label:
|
||||||
|
name: Check type Label
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- if: contains( env.LABELS, 'type:' ) == false
|
||||||
|
run: exit 1
|
||||||
|
check-milestone:
|
||||||
|
name: Check Milestone
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- if: github.event.pull_request.milestone == null && contains( env.LABELS, 'no milestone' ) == false
|
||||||
|
run: exit 1
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,6 +15,9 @@
|
|||||||
*.idea
|
*.idea
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/settings.json
|
||||||
|
|
||||||
# Build output
|
# Build output
|
||||||
target
|
target
|
||||||
dist
|
dist
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
# https://github.com/nasa/openmct/issues/4992
|
# https://github.com/nasa/openmct/issues/4992
|
||||||
!/example/**/*
|
!/example/**/*
|
||||||
|
|
||||||
# We will remove this in https://github.com/nasa/openmct/issues/4922
|
|
||||||
!/app.js
|
|
||||||
|
|
||||||
# ...except for these files in the above folders.
|
# ...except for these files in the above folders.
|
||||||
/src/**/*Spec.js
|
/src/**/*Spec.js
|
||||||
/src/**/test/
|
/src/**/test/
|
||||||
@ -25,3 +22,9 @@
|
|||||||
!index.html
|
!index.html
|
||||||
!openmct.js
|
!openmct.js
|
||||||
!SECURITY.md
|
!SECURITY.md
|
||||||
|
|
||||||
|
# Add e2e tests to npm package
|
||||||
|
!/e2e/**/*
|
||||||
|
|
||||||
|
# ... except our test-data folder files.
|
||||||
|
/e2e/test-data/*.json
|
||||||
|
3
.npmrc
3
.npmrc
@ -2,3 +2,6 @@ loglevel=warn
|
|||||||
|
|
||||||
#Prevent folks from ignoring an important error when building from source
|
#Prevent folks from ignoring an important error when building from source
|
||||||
engine-strict=true
|
engine-strict=true
|
||||||
|
|
||||||
|
# Dont include lockfile
|
||||||
|
package-lock=false
|
27
.prettierignore
Normal file
27
.prettierignore
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Docs
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# Build output
|
||||||
|
target
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Mac OS X Finder
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Node dependencies
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# npm-debug log
|
||||||
|
npm-debug.log
|
||||||
|
|
||||||
|
# karma reports
|
||||||
|
report.*.json
|
||||||
|
|
||||||
|
# e2e test artifacts
|
||||||
|
test-results
|
||||||
|
html-test-results
|
||||||
|
|
||||||
|
# codecov artifacts
|
||||||
|
.nyc_output
|
||||||
|
coverage
|
||||||
|
codecov
|
6
.prettierrc
Normal file
6
.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"trailingComma": "none",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 100,
|
||||||
|
"endOfLine": "auto"
|
||||||
|
}
|
14
.vscode/extensions.json
vendored
Normal file
14
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
||||||
|
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
||||||
|
|
||||||
|
// List of extensions which should be recommended for users of this workspace.
|
||||||
|
"recommendations": [
|
||||||
|
"Vue.volar",
|
||||||
|
"Vue.vscode-typescript-vue-plugin",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"rvest.vs-code-prettier-eslint"
|
||||||
|
],
|
||||||
|
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||||
|
"unwantedRecommendations": ["octref.vetur"]
|
||||||
|
}
|
185
.webpack/webpack.common.js
Normal file
185
.webpack/webpack.common.js
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
|
||||||
|
- webpack.prod.js - the production configuration for OpenMCT (default)
|
||||||
|
- webpack.dev.js - the development configuration for OpenMCT
|
||||||
|
- webpack.coverage.js - imports webpack.dev.js and adds code coverage
|
||||||
|
There are separate npm scripts to use these configurations, though simply running `npm install`
|
||||||
|
will use the default production configuration.
|
||||||
|
*/
|
||||||
|
import { execSync } from 'node:child_process';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||||
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
|
import { VueLoaderPlugin } from 'vue-loader';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
let gitRevision = 'error-retrieving-revision';
|
||||||
|
let gitBranch = 'error-retrieving-branch';
|
||||||
|
|
||||||
|
const packageDefinition = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url)));
|
||||||
|
|
||||||
|
try {
|
||||||
|
gitRevision = execSync('git rev-parse HEAD').toString().trim();
|
||||||
|
gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
const projectRootDir = fileURLToPath(new URL('../', import.meta.url));
|
||||||
|
|
||||||
|
/** @type {import('webpack').Configuration} */
|
||||||
|
const config = {
|
||||||
|
context: projectRootDir,
|
||||||
|
devServer: {
|
||||||
|
client: {
|
||||||
|
progress: true,
|
||||||
|
overlay: {
|
||||||
|
// Disable overlay for runtime errors.
|
||||||
|
// See: https://github.com/webpack/webpack-dev-server/issues/4771
|
||||||
|
runtimeErrors: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
openmct: './openmct.js',
|
||||||
|
generatorWorker: './example/generator/generatorWorker.js',
|
||||||
|
couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js',
|
||||||
|
inMemorySearchWorker: './src/api/objects/InMemorySearchWorker.js',
|
||||||
|
espressoTheme: './src/plugins/themes/espresso-theme.scss',
|
||||||
|
snowTheme: './src/plugins/themes/snow-theme.scss'
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
globalObject: 'this',
|
||||||
|
filename: '[name].js',
|
||||||
|
path: path.resolve(projectRootDir, 'dist'),
|
||||||
|
library: 'openmct',
|
||||||
|
libraryExport: 'default',
|
||||||
|
libraryTarget: 'umd',
|
||||||
|
publicPath: '',
|
||||||
|
hashFunction: 'xxhash64',
|
||||||
|
clean: true
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': path.join(projectRootDir, 'src'),
|
||||||
|
legacyRegistry: path.join(projectRootDir, 'src/legacyRegistry'),
|
||||||
|
csv: 'comma-separated-values',
|
||||||
|
EventEmitter: 'eventemitter3',
|
||||||
|
bourbon: 'bourbon.scss',
|
||||||
|
'plotly-basic': 'plotly.js-basic-dist-min',
|
||||||
|
'plotly-gl2d': 'plotly.js-gl2d-dist-min',
|
||||||
|
printj: 'printj/printj.mjs',
|
||||||
|
styles: path.join(projectRootDir, 'src/styles'),
|
||||||
|
MCT: path.join(projectRootDir, 'src/MCT'),
|
||||||
|
testUtils: path.join(projectRootDir, 'src/utils/testUtils.js'),
|
||||||
|
objectUtils: path.join(projectRootDir, 'src/api/objects/object-utils.js'),
|
||||||
|
utils: path.join(projectRootDir, 'src/utils'),
|
||||||
|
vue: 'vue/dist/vue.esm-bundler'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_VERSION__: `'${packageDefinition.version}'`,
|
||||||
|
__OPENMCT_BUILD_DATE__: `'${new Date()}'`,
|
||||||
|
__OPENMCT_REVISION__: `'${gitRevision}'`,
|
||||||
|
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`,
|
||||||
|
__VUE_OPTIONS_API__: true, // enable/disable Options API support, default: true
|
||||||
|
__VUE_PROD_DEVTOOLS__: false // enable/disable devtools support in production, default: false
|
||||||
|
}),
|
||||||
|
new VueLoaderPlugin(),
|
||||||
|
new CopyWebpackPlugin({
|
||||||
|
patterns: [
|
||||||
|
{
|
||||||
|
from: 'src/images/favicons',
|
||||||
|
to: 'favicons'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: './index.html',
|
||||||
|
transform: function (content) {
|
||||||
|
return content.toString().replace(/dist\//g, '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
from: 'src/plugins/imagery/layers',
|
||||||
|
to: 'imagery'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[name].css'
|
||||||
|
}),
|
||||||
|
// Add a UTF-8 BOM to CSS output to avoid random mojibake
|
||||||
|
new webpack.BannerPlugin({
|
||||||
|
test: /.*Theme\.css$/,
|
||||||
|
raw: true,
|
||||||
|
banner: '@charset "UTF-8";'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.(sc|sa|c)ss$/,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
{
|
||||||
|
loader: 'css-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'resolve-url-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: { sourceMap: true }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.vue$/,
|
||||||
|
loader: 'vue-loader',
|
||||||
|
options: {
|
||||||
|
compilerOptions: {
|
||||||
|
hoistStatic: false,
|
||||||
|
whitespace: 'preserve'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
type: 'asset/source'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(jpg|jpeg|png|svg)$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'images/[name][ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.ico$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'icons/[name][ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(woff|woff2?|eot|ttf)$/,
|
||||||
|
type: 'asset/resource',
|
||||||
|
generator: {
|
||||||
|
filename: 'fonts/[name][ext]'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
stats: 'errors-warnings',
|
||||||
|
performance: {
|
||||||
|
// We should eventually consider chunking to decrease
|
||||||
|
// these values
|
||||||
|
maxEntrypointSize: 27000000,
|
||||||
|
maxAssetSize: 27000000
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
35
.webpack/webpack.coverage.js
Normal file
35
.webpack/webpack.coverage.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
This file extends the webpack.dev.js config to add babel istanbul coverage.
|
||||||
|
OpenMCT Continuous Integration servers use this configuration to add code coverage
|
||||||
|
information to pull requests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import config from './webpack.dev.js';
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const CI = process.env.CI === 'true';
|
||||||
|
|
||||||
|
config.devtool = CI ? false : undefined;
|
||||||
|
|
||||||
|
config.devServer.hot = false;
|
||||||
|
|
||||||
|
config.module.rules.push({
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /(Spec\.js$)|(node_modules)/,
|
||||||
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
retainLines: true,
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
plugins: [
|
||||||
|
[
|
||||||
|
'babel-plugin-istanbul',
|
||||||
|
{
|
||||||
|
extension: ['.js', '.vue']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default config;
|
48
.webpack/webpack.dev.js
Normal file
48
.webpack/webpack.dev.js
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
This configuration should be used for development purposes. It contains full source map, a
|
||||||
|
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
|
||||||
|
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
|
||||||
|
*/
|
||||||
|
import path from 'path';
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import { merge } from 'webpack-merge';
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
import common from './webpack.common.js';
|
||||||
|
|
||||||
|
export default merge(common, {
|
||||||
|
mode: 'development',
|
||||||
|
watchOptions: {
|
||||||
|
// Since we use require.context, webpack is watching the entire directory.
|
||||||
|
// We need to exclude any files we don't want webpack to watch.
|
||||||
|
// See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
|
||||||
|
ignored: [
|
||||||
|
'**/{node_modules,dist,docs,e2e}', // All files in node_modules, dist, docs, e2e,
|
||||||
|
'**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}', // Config files
|
||||||
|
'**/*.{sh,md,png,ttf,woff,svg}', // Non source files
|
||||||
|
'**/.*' // dotfiles and dotfolders
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_ROOT_RELATIVE__: '"dist/"'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
devtool: 'eval-source-map',
|
||||||
|
devServer: {
|
||||||
|
devMiddleware: {
|
||||||
|
writeToDisk: (filePathString) => {
|
||||||
|
const filePath = path.parse(filePathString);
|
||||||
|
const shouldWrite = !filePath.base.includes('hot-update');
|
||||||
|
|
||||||
|
return shouldWrite;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watchFiles: ['**/*.css'],
|
||||||
|
static: {
|
||||||
|
directory: fileURLToPath(new URL('../dist', import.meta.url)),
|
||||||
|
publicPath: '/dist',
|
||||||
|
watch: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
19
.webpack/webpack.prod.js
Normal file
19
.webpack/webpack.prod.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
This configuration should be used for production installs.
|
||||||
|
It is the default webpack configuration.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import { merge } from 'webpack-merge';
|
||||||
|
|
||||||
|
import common from './webpack.common.js';
|
||||||
|
|
||||||
|
export default merge(common, {
|
||||||
|
mode: 'production',
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
__OPENMCT_ROOT_RELATIVE__: '""'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
devtool: 'source-map'
|
||||||
|
});
|
563
API.md
563
API.md
@ -2,10 +2,13 @@
|
|||||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
**Table of Contents**
|
**Table of Contents**
|
||||||
|
|
||||||
- [Building Applications With Open MCT](#building-applications-with-open-mct)
|
- [Developing Applications With Open MCT](#developing-applications-with-open-mct)
|
||||||
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
- [Scope and purpose of this document](#scope-and-purpose-of-this-document)
|
||||||
- [Building From Source](#building-from-source)
|
- [Building From Source](#building-from-source)
|
||||||
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
- [Starting an Open MCT application](#starting-an-open-mct-application)
|
||||||
|
- [Types](#types)
|
||||||
|
- [Using Types](#using-types)
|
||||||
|
- [Limitations](#limitations)
|
||||||
- [Plugins](#plugins)
|
- [Plugins](#plugins)
|
||||||
- [Defining and Installing a New Plugin](#defining-and-installing-a-new-plugin)
|
- [Defining and Installing a New Plugin](#defining-and-installing-a-new-plugin)
|
||||||
- [Domain Objects and Identifiers](#domain-objects-and-identifiers)
|
- [Domain Objects and Identifiers](#domain-objects-and-identifiers)
|
||||||
@ -23,7 +26,7 @@
|
|||||||
- [Value Hints](#value-hints)
|
- [Value Hints](#value-hints)
|
||||||
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
- [The Time Conductor and Telemetry](#the-time-conductor-and-telemetry)
|
||||||
- [Telemetry Providers](#telemetry-providers)
|
- [Telemetry Providers](#telemetry-providers)
|
||||||
- [Telemetry Requests and Responses.](#telemetry-requests-and-responses)
|
- [Telemetry Requests and Responses](#telemetry-requests-and-responses)
|
||||||
- [Request Strategies **draft**](#request-strategies-draft)
|
- [Request Strategies **draft**](#request-strategies-draft)
|
||||||
- [`latest` request strategy](#latest-request-strategy)
|
- [`latest` request strategy](#latest-request-strategy)
|
||||||
- [`minmax` request strategy](#minmax-request-strategy)
|
- [`minmax` request strategy](#minmax-request-strategy)
|
||||||
@ -41,8 +44,10 @@
|
|||||||
- [Clocks](#clocks)
|
- [Clocks](#clocks)
|
||||||
- [Defining and registering clocks](#defining-and-registering-clocks)
|
- [Defining and registering clocks](#defining-and-registering-clocks)
|
||||||
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
- [Getting and setting active clock](#getting-and-setting-active-clock)
|
||||||
- [Stopping an active clock](#stopping-an-active-clock)
|
- [⚠️ \[DEPRECATED\] Stopping an active clock](#️-deprecated-stopping-an-active-clock)
|
||||||
- [Clock Offsets](#clock-offsets)
|
- [Clock Offsets](#clock-offsets)
|
||||||
|
- [Time Modes](#time-modes)
|
||||||
|
- [Time Mode Helper Methods](#time-mode-helper-methods)
|
||||||
- [Time Events](#time-events)
|
- [Time Events](#time-events)
|
||||||
- [List of Time Events](#list-of-time-events)
|
- [List of Time Events](#list-of-time-events)
|
||||||
- [The Time Conductor](#the-time-conductor)
|
- [The Time Conductor](#the-time-conductor)
|
||||||
@ -57,7 +62,7 @@
|
|||||||
|
|
||||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
# Building Applications With Open MCT
|
# Developing Applications With Open MCT
|
||||||
|
|
||||||
## Scope and purpose of this document
|
## Scope and purpose of this document
|
||||||
|
|
||||||
@ -72,8 +77,7 @@ MCT, as well as addressing some common developer use cases.
|
|||||||
## Building From Source
|
## Building From Source
|
||||||
|
|
||||||
The latest version of Open MCT is available from [our GitHub repository](https://github.com/nasa/openmct).
|
The latest version of Open MCT is available from [our GitHub repository](https://github.com/nasa/openmct).
|
||||||
If you have `git`, and `node` installed, you can build Open MCT with the
|
If you have `git`, and `node` installed, you can build Open MCT with the commands
|
||||||
commands
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/nasa/openmct.git
|
git clone https://github.com/nasa/openmct.git
|
||||||
@ -90,6 +94,9 @@ well as assets such as html, css, and images necessary for the UI.
|
|||||||
|
|
||||||
## Starting an Open MCT application
|
## Starting an Open MCT application
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> Open MCT provides a development server via `webpack-dev-server` (`npm start`). **This should be used for development purposes only and should never be deployed to a production environment**.
|
||||||
|
|
||||||
To start a minimally functional Open MCT application, it is necessary to
|
To start a minimally functional Open MCT application, it is necessary to
|
||||||
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
include the Open MCT distributable, enable some basic plugins, and bootstrap
|
||||||
the application. The tutorials walk through the process of getting Open MCT up
|
the application. The tutorials walk through the process of getting Open MCT up
|
||||||
@ -134,6 +141,48 @@ do anything with the application initially. Any of these plugins can, in
|
|||||||
principle, be replaced with a custom plugin. The included plugins are
|
principle, be replaced with a custom plugin. The included plugins are
|
||||||
documented in the [Included Plugins](#included-plugins) section.
|
documented in the [Included Plugins](#included-plugins) section.
|
||||||
|
|
||||||
|
## Types
|
||||||
|
|
||||||
|
The Open MCT library includes its own TypeScript declaration files which can be
|
||||||
|
used to provide code hints and typechecking in your own Open MCT application.
|
||||||
|
|
||||||
|
Open MCT's type declarations are generated via `tsc` from JSDoc-style comment
|
||||||
|
blocks. For more information on this, [check out TypeScript's documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html).
|
||||||
|
|
||||||
|
### Using Types
|
||||||
|
|
||||||
|
In order to use Open MCT's provided types in your own application, create a
|
||||||
|
`jsconfig.js` at the root of your project with this minimal configuration:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "./",
|
||||||
|
"target": "es6",
|
||||||
|
"checkJs": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"paths": {
|
||||||
|
"openmct": ["node_modules/openmct/dist/openmct.d.ts"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, simply import and use `openmct` in your application:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import openmct from "openmct";
|
||||||
|
```
|
||||||
|
|
||||||
|
### Limitations
|
||||||
|
|
||||||
|
The effort to add types for Open MCT's public API is ongoing, and the provided
|
||||||
|
type declarations may be incomplete.
|
||||||
|
|
||||||
|
If you would like to contribute types to Open MCT, please check out
|
||||||
|
[TypeScript's documentation](https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html) on generating type declarations from JSDoc-style comment blocks.
|
||||||
|
Then read through our [contributing guide](https://github.com/nasa/openmct/blob/f7cf3f72c2efd46da7ce5719c5e52c8806d166f0/CONTRIBUTING.md) and open a PR!
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
|
|
||||||
### Defining and Installing a New Plugin
|
### Defining and Installing a New Plugin
|
||||||
@ -190,10 +239,10 @@ looks like this:
|
|||||||
|
|
||||||
The main attributes to note are the `identifier`, and `type` attributes.
|
The main attributes to note are the `identifier`, and `type` attributes.
|
||||||
|
|
||||||
* `identifier`: A composite key that provides a universally unique identifier
|
- `identifier`: A composite key that provides a universally unique identifier
|
||||||
for this object. The `namespace` and `key` are used to identify the object.
|
for this object. The `namespace` and `key` are used to identify the object.
|
||||||
The `key` must be unique within the namespace.
|
The `key` must be unique within the namespace.
|
||||||
* `type`: All objects in Open MCT have a type. Types allow you to form an
|
- `type`: All objects in Open MCT have a type. Types allow you to form an
|
||||||
ontology of knowledge and provide an abstraction for grouping, visualizing,
|
ontology of knowledge and provide an abstraction for grouping, visualizing,
|
||||||
and interpreting data. Details on how to define a new object type are
|
and interpreting data. Details on how to define a new object type are
|
||||||
provided below.
|
provided below.
|
||||||
@ -207,6 +256,7 @@ Custom types may be registered via the `addType` function on the Open MCT Type
|
|||||||
registry.
|
registry.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.types.addType('example.my-type', {
|
openmct.types.addType('example.my-type', {
|
||||||
name: "My Type",
|
name: "My Type",
|
||||||
@ -216,20 +266,21 @@ openmct.types.addType('example.my-type', {
|
|||||||
```
|
```
|
||||||
|
|
||||||
The `addType` function accepts two arguments:
|
The `addType` function accepts two arguments:
|
||||||
* A `string` key identifying the type. This key is used when specifying a type
|
|
||||||
|
- A `string` key identifying the type. This key is used when specifying a type
|
||||||
for an object. We recommend prefixing your types with a namespace to avoid
|
for an object. We recommend prefixing your types with a namespace to avoid
|
||||||
conflicts with other plugins.
|
conflicts with other plugins.
|
||||||
* An object type specification. An object type definition supports the following
|
- An object type specification. An object type definition supports the following
|
||||||
attributes
|
attributes
|
||||||
* `name`: a `string` naming this object type
|
- `name`: a `string` naming this object type
|
||||||
* `description`: a `string` specifying a longer-form description of this type
|
- `description`: a `string` specifying a longer-form description of this type
|
||||||
* `initialize`: a `function` which initializes the model for new domain objects
|
- `initialize`: a `function` which initializes the model for new domain objects
|
||||||
of this type. This can be used for setting default values on an object when
|
of this type. This can be used for setting default values on an object when
|
||||||
it is instantiated.
|
it is instantiated.
|
||||||
* `creatable`: A `boolean` indicating whether users should be allowed to create
|
- `creatable`: A `boolean` indicating whether users should be allowed to create
|
||||||
this type (default: `false`). This will determine whether the type appears
|
this type (default: `false`). This will determine whether the type appears
|
||||||
in the `Create` menu.
|
in the `Create` menu.
|
||||||
* `cssClass`: A `string` specifying a CSS class to apply to each representation
|
- `cssClass`: A `string` specifying a CSS class to apply to each representation
|
||||||
of this object. This is used for specifying an icon to appear next to each
|
of this object. This is used for specifying an icon to appear next to each
|
||||||
object of this type.
|
object of this type.
|
||||||
|
|
||||||
@ -247,6 +298,7 @@ as a hierarchy of telemetry-providing domain objects in this fashion.
|
|||||||
To do so, use the `addRoot` method of the object API.
|
To do so, use the `addRoot` method of the object API.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.objects.addRoot({
|
openmct.objects.addRoot({
|
||||||
namespace: "example.namespace",
|
namespace: "example.namespace",
|
||||||
@ -261,6 +313,7 @@ level objects, or a function that returns a promise for an identifier or an arra
|
|||||||
When using the `getAll` method of the object API, they will be returned in order of priority.
|
When using the `getAll` method of the object API, they will be returned in order of priority.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.objects.addRoot(identifier, openmct.priority.LOW); // low = -1000, will appear last in composition or tree
|
openmct.objects.addRoot(identifier, openmct.priority.LOW); // low = -1000, will appear last in composition or tree
|
||||||
openmct.objects.addRoot(otherIdentifier, openmct.priority.HIGH); // high = 1000, will appear first in composition or tree
|
openmct.objects.addRoot(otherIdentifier, openmct.priority.HIGH); // high = 1000, will appear first in composition or tree
|
||||||
@ -288,11 +341,12 @@ openmct.objects.addProvider('example.namespace', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The `addProvider` function takes two arguments:
|
The `addProvider` function takes two arguments:
|
||||||
|
|
||||||
* `namespace`: A `string` representing the namespace that this object provider
|
- `namespace`: A `string` representing the namespace that this object provider
|
||||||
will provide objects for.
|
will provide objects for.
|
||||||
* `provider`: An `object` with a single function, `get`. This function accepts an
|
- `provider`: An `object` with a single function, `get`. This function accepts an
|
||||||
[Identifier](#domain-objects-and-identifiers) for the object to be provided.
|
[Identifier](#domain-objects-and-identifiers) for the object to be provided.
|
||||||
It is expected that the `get` function will return a
|
It is expected that the `get` function will return a
|
||||||
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
|
||||||
@ -324,12 +378,13 @@ openmct.composition.addProvider({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The `addProvider` function accepts a Composition Provider object as its sole
|
The `addProvider` function accepts a Composition Provider object as its sole
|
||||||
argument. A Composition Provider is a javascript object exposing two functions:
|
argument. A Composition Provider is a javascript object exposing two functions:
|
||||||
* `appliesTo`: A `function` that accepts a `domainObject` argument, and returns
|
- `appliesTo`: A `function` that accepts a `domainObject` argument, and returns
|
||||||
a `boolean` value indicating whether this composition provider applies to the
|
a `boolean` value indicating whether this composition provider applies to the
|
||||||
given object.
|
given object.
|
||||||
* `load`: A `function` that accepts a `domainObject` as an argument, and returns
|
- `load`: A `function` that accepts a `domainObject` as an argument, and returns
|
||||||
a `Promise` that resolves with an array of [Identifier](#domain-objects-and-identifiers).
|
a `Promise` that resolves with an array of [Identifier](#domain-objects-and-identifiers).
|
||||||
These identifiers will be used to fetch Domain Objects from an [Object Provider](#object-provider)
|
These identifiers will be used to fetch Domain Objects from an [Object Provider](#object-provider)
|
||||||
|
|
||||||
@ -430,24 +485,22 @@ attribute | type | flags | notes
|
|||||||
`max` | number | optional | the maximum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a max value.
|
`max` | number | optional | the maximum possible value of this measurement. Will be used by plots, gauges, etc to automatically set a max value.
|
||||||
`enumerations` | array | optional | for objects where `format` is `"enum"`, this array tracks all possible enumerations of the value. Each entry in this array is an object, with a `value` property that is the numerical value of the enumeration, and a `string` property that is the text value of the enumeration. ex: `{"value": 0, "string": "OFF"}`. If you use an enumerations array, `min` and `max` will be set automatically for you.
|
`enumerations` | array | optional | for objects where `format` is `"enum"`, this array tracks all possible enumerations of the value. Each entry in this array is an object, with a `value` property that is the numerical value of the enumeration, and a `string` property that is the text value of the enumeration. ex: `{"value": 0, "string": "OFF"}`. If you use an enumerations array, `min` and `max` will be set automatically for you.
|
||||||
|
|
||||||
|
|
||||||
###### Value Hints
|
###### Value Hints
|
||||||
|
|
||||||
Each telemetry value description has an object defining hints. Keys in this object represent the hint itself, and the value represents the weight of that hint. A lower weight means the hint has a higher priority. For example, multiple values could be hinted for use as the y-axis of a plot (raw, engineering), but the highest priority would be the default choice. Likewise, a table will use hints to determine the default order of columns.
|
Each telemetry value description has an object defining hints. Keys in this object represent the hint itself, and the value represents the weight of that hint. A lower weight means the hint has a higher priority. For example, multiple values could be hinted for use as the y-axis of a plot (raw, engineering), but the highest priority would be the default choice. Likewise, a table will use hints to determine the default order of columns.
|
||||||
|
|
||||||
Known hints:
|
Known hints:
|
||||||
|
|
||||||
* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
- `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
|
||||||
* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
- `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
|
||||||
* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
- `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
|
||||||
* `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file.
|
- `imageDownloadName`: Indicates that the value may be interpreted as the name of the image file.
|
||||||
|
|
||||||
##### The Time Conductor and Telemetry
|
##### The Time Conductor and Telemetry
|
||||||
|
|
||||||
Open MCT provides a number of ways to pivot through data and link data via time. The Time Conductor helps synchronize multiple views around the same time.
|
Open MCT provides a number of ways to pivot through data and link data via time. The Time Conductor helps synchronize multiple views around the same time.
|
||||||
|
|
||||||
In order for the time conductor to work, there will always be an active "time system". All telemetry metadata *must* have a telemetry value with a `key` that matches the `key` of the active time system. You can use the `source` attribute on the value metadata to remap this to a different field in the telemetry datum-- especially useful if you are working with disparate datasources that have different field mappings.
|
In order for the time conductor to work, there will always be an active "time system". All telemetry metadata _must_ have a telemetry value with a `key` that matches the `key` of the active time system. You can use the `source` attribute on the value metadata to remap this to a different field in the telemetry datum-- especially useful if you are working with disparate datasources that have different field mappings.
|
||||||
|
|
||||||
|
|
||||||
#### Telemetry Providers
|
#### Telemetry Providers
|
||||||
|
|
||||||
@ -455,14 +508,14 @@ Telemetry providers are responsible for providing historical and real-time telem
|
|||||||
|
|
||||||
A telemetry provider is a javascript object with up to four methods:
|
A telemetry provider is a javascript object with up to four methods:
|
||||||
|
|
||||||
* `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options).
|
- `supportsSubscribe(domainObject, callback, options)` optional. Must be implemented to provide realtime telemetry. Should return `true` if the provider supports subscriptions for the given domain object (and request options).
|
||||||
* `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function.
|
- `subscribe(domainObject, callback, options)` required if `supportsSubscribe` is implemented. Establish a subscription for realtime data for the given domain object. Should invoke `callback` with a single telemetry datum every time data is received. Must return an unsubscribe function. Multiple views can subscribe to the same telemetry object, so it should always return a new unsubscribe function.
|
||||||
* `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object.
|
- `supportsRequest(domainObject, options)` optional. Must be implemented to provide historical telemetry. Should return `true` if the provider supports historical requests for the given domain object.
|
||||||
* `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests.
|
- `request(domainObject, options)` required if `supportsRequest` is implemented. Must return a promise for an array of telemetry datums that fulfills the request. The `options` argument will include a `start`, `end`, and `domain` attribute representing the query bounds. See [Telemetry Requests and Responses](#telemetry-requests-and-responses) for more info on how to respond to requests.
|
||||||
* `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for.
|
- `supportsMetadata(domainObject)` optional. Implement and return `true` for objects that you want to provide dynamic metadata for.
|
||||||
* `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition.
|
- `getMetadata(domainObject)` required if `supportsMetadata` is implemented. Must return a valid telemetry metadata definition that includes at least one valueMetadata definition.
|
||||||
* `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for.
|
- `supportsLimits(domainObject)` optional. Implement and return `true` for domain objects that you want to provide a limit evaluator for.
|
||||||
* `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object.
|
- `getLimitEvaluator(domainObject)` required if `supportsLimits` is implemented. Must return a valid LimitEvaluator for a given domain object.
|
||||||
|
|
||||||
Telemetry providers are registered by calling `openmct.telemetry.addProvider(provider)`, e.g.
|
Telemetry providers are registered by calling `openmct.telemetry.addProvider(provider)`, e.g.
|
||||||
|
|
||||||
@ -475,7 +528,7 @@ openmct.telemetry.addProvider({
|
|||||||
|
|
||||||
Note: it is not required to implement all of the methods on every provider. Depending on the complexity of your implementation, it may be helpful to instantiate and register your realtime, historical, and metadata providers separately.
|
Note: it is not required to implement all of the methods on every provider. Depending on the complexity of your implementation, it may be helpful to instantiate and register your realtime, historical, and metadata providers separately.
|
||||||
|
|
||||||
#### Telemetry Requests and Responses.
|
#### Telemetry Requests and Responses
|
||||||
|
|
||||||
Telemetry requests support time bounded queries. A call to a _Telemetry Provider_'s `request` function will include an `options` argument. These are simply javascript objects with attributes for the request parameters. An example of a telemetry request object with a start and end time is included below:
|
Telemetry requests support time bounded queries. A call to a _Telemetry Provider_'s `request` function will include an `options` argument. These are simply javascript objects with attributes for the request parameters. An example of a telemetry request object with a start and end time is included below:
|
||||||
|
|
||||||
@ -508,6 +561,7 @@ the number of results it desires. The `size` parameter is a hint; views
|
|||||||
must not assume the response will have the exact number of results requested.
|
must not assume the response will have the exact number of results requested.
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
start: 1487981997240,
|
start: 1487981997240,
|
||||||
@ -523,6 +577,7 @@ This strategy says "I want the latest data point in this time range". A provide
|
|||||||
##### `minmax` request strategy
|
##### `minmax` request strategy
|
||||||
|
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
start: 1487981997240,
|
start: 1487981997240,
|
||||||
@ -538,35 +593,108 @@ MinMax queries are issued by plots, and may be issued by other types as well. T
|
|||||||
#### Telemetry Formats
|
#### Telemetry Formats
|
||||||
|
|
||||||
Telemetry format objects define how to interpret and display telemetry data.
|
Telemetry format objects define how to interpret and display telemetry data.
|
||||||
They have a simple structure:
|
They have a simple structure, provided here as a TypeScript interface:
|
||||||
|
|
||||||
* `key`: A `string` that uniquely identifies this formatter.
|
```ts
|
||||||
* `format`: A `function` that takes a raw telemetry value, and returns a
|
interface Formatter {
|
||||||
human-readable `string` representation of that value. It has one required
|
key: string; // A string that uniquely identifies this formatter.
|
||||||
argument, and three optional arguments that provide context and can be used
|
|
||||||
for returning scaled representations of a value. An example of this is
|
format: (
|
||||||
representing time values in a scale such as the time conductor scale. There
|
value: any, // The raw telemetry value in its native type.
|
||||||
are multiple ways of representing a point in time, and by providing a minimum
|
minValue?: number, // An optional argument specifying the minimum displayed value.
|
||||||
scale value, maximum scale value, and a count, it's possible to provide more
|
maxValue?: number, // An optional argument specifying the maximum displayed value.
|
||||||
useful representations of time given the provided limitations.
|
count?: number // An optional argument specifying the number of displayed values.
|
||||||
* `value`: The raw telemetry value in its native type.
|
) => string; // Returns a human-readable string representation of the provided value.
|
||||||
* `minValue`: An __optional__ argument specifying the minimum displayed
|
|
||||||
value.
|
parse: (
|
||||||
* `maxValue`: An __optional__ argument specifying the maximum displayed
|
value: string | any // A string representation of a telemetry value or an already-parsed value.
|
||||||
value.
|
) => any; // Returns the value in its native type. This function should be idempotent.
|
||||||
* `count`: An __optional__ argument specifying the number of displayed
|
|
||||||
values.
|
validate: (value: string) => boolean; // Takes a string representation of a telemetry value and returns a boolean indicating whether the provided string can be parsed.
|
||||||
* `parse`: A `function` that takes a `string` representation of a telemetry
|
}
|
||||||
value, and returns the value in its native type. **Note** parse might receive an already-parsed value. This function should be idempotent.
|
```
|
||||||
* `validate`: A `function` that takes a `string` representation of a telemetry
|
|
||||||
value, and returns a `boolean` value indicating whether the provided string
|
##### Built-in Formats
|
||||||
can be parsed.
|
|
||||||
|
Open MCT on its own defines a handful of built-in formats:
|
||||||
|
|
||||||
|
###### **Number Format (default):**
|
||||||
|
|
||||||
|
Applied to data with `format: 'number'`
|
||||||
|
```js
|
||||||
|
valueMetadata = {
|
||||||
|
format: 'number'
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface NumberFormatter extends Formatter {
|
||||||
|
parse: (x: any) => number;
|
||||||
|
format: (x: number) => string;
|
||||||
|
validate: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
###### **String Format**:
|
||||||
|
|
||||||
|
Applied to data with `format: 'string'`
|
||||||
|
```js
|
||||||
|
valueMetadata = {
|
||||||
|
format: 'string'
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
```ts
|
||||||
|
interface StringFormatter extends Formatter {
|
||||||
|
parse: (value: any) => string;
|
||||||
|
format: (value: string) => string;
|
||||||
|
validate: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
###### **Enum Format**:
|
||||||
|
Applied to data with `format: 'enum'`
|
||||||
|
```js
|
||||||
|
valueMetadata = {
|
||||||
|
format: 'enum',
|
||||||
|
enumerations: [
|
||||||
|
{
|
||||||
|
value: 1,
|
||||||
|
string: 'APPLE'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 2,
|
||||||
|
string: 'PEAR',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 3,
|
||||||
|
string: 'ORANGE'
|
||||||
|
}]
|
||||||
|
// ...
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Creates a two-way mapping between enum string and value to be used in the `parse` and `format` methods.
|
||||||
|
Ex:
|
||||||
|
- `formatter.parse('APPLE') === 1;`
|
||||||
|
- `formatter.format(1) === 'APPLE';`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
interface EnumFormatter extends Formatter {
|
||||||
|
parse: (value: string) => string;
|
||||||
|
format: (value: number) => string;
|
||||||
|
validate: (value: any) => boolean;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
##### Registering Formats
|
##### Registering Formats
|
||||||
|
|
||||||
|
Formats implement the following interface (provided here as TypeScript for simplicity):
|
||||||
|
|
||||||
|
|
||||||
Formats are registered with the Telemetry API using the `addFormat` function. eg.
|
Formats are registered with the Telemetry API using the `addFormat` function. eg.
|
||||||
|
|
||||||
``` javascript
|
```javascript
|
||||||
openmct.telemetry.addFormat({
|
openmct.telemetry.addFormat({
|
||||||
key: 'number-to-string',
|
key: 'number-to-string',
|
||||||
format: function (number) {
|
format: function (number) {
|
||||||
@ -584,9 +712,9 @@ openmct.telemetry.addFormat({
|
|||||||
#### Telemetry Data
|
#### Telemetry Data
|
||||||
|
|
||||||
A single telemetry point is considered a Datum, and is represented by a standard
|
A single telemetry point is considered a Datum, and is represented by a standard
|
||||||
javascript object. Realtime subscriptions (obtained via __subscribe__) will
|
javascript object. Realtime subscriptions (obtained via **subscribe**) will
|
||||||
invoke the supplied callback once for each telemetry datum recieved. Telemetry
|
invoke the supplied callback once for each telemetry datum recieved. Telemetry
|
||||||
requests (obtained via __request__) will return a promise for an array of
|
requests (obtained via **request**) will return a promise for an array of
|
||||||
telemetry datums.
|
telemetry datums.
|
||||||
|
|
||||||
##### Telemetry Datums
|
##### Telemetry Datums
|
||||||
@ -623,7 +751,6 @@ For an example of a limit evaluator, take a look at `examples/generator/Sinewave
|
|||||||
|
|
||||||
The APIs for requesting telemetry from Open MCT -- e.g. for use in custom views -- are currently in draft state and are being revised. If you'd like to experiment with them before they are finalized, please contact the team via the contact-us link on our website.
|
The APIs for requesting telemetry from Open MCT -- e.g. for use in custom views -- are currently in draft state and are being revised. If you'd like to experiment with them before they are finalized, please contact the team via the contact-us link on our website.
|
||||||
|
|
||||||
|
|
||||||
## Time API
|
## Time API
|
||||||
|
|
||||||
Open MCT provides API for managing the temporal state of the application.
|
Open MCT provides API for managing the temporal state of the application.
|
||||||
@ -636,8 +763,9 @@ state of the application, and emits events to inform listeners when the state ch
|
|||||||
|
|
||||||
Because the data displayed tends to be time domain data, Open MCT must always
|
Because the data displayed tends to be time domain data, Open MCT must always
|
||||||
have at least one time system installed and activated. When you download Open
|
have at least one time system installed and activated. When you download Open
|
||||||
MCT, it will be pre-configured to use the UTC time system, which is installed and activated, along with other default plugins, in `index.html`. Installing and activating a time system is simple, and is covered
|
MCT, it will be pre-configured to use the UTC time system, which is installed and activated,
|
||||||
[in the next section](#defining-and-registering-time-systems).
|
along with other default plugins, in `index.html`. Installing and activating a time system
|
||||||
|
is simple, and is covered [in the next section](#defining-and-registering-time-systems).
|
||||||
|
|
||||||
### Time Systems and Bounds
|
### Time Systems and Bounds
|
||||||
|
|
||||||
@ -665,80 +793,98 @@ is configured and activated by default from `index.html` in the default
|
|||||||
installation of Open MCT if you download the source from GitHub. Some details of
|
installation of Open MCT if you download the source from GitHub. Some details of
|
||||||
each of the required properties is provided below.
|
each of the required properties is provided below.
|
||||||
|
|
||||||
* `key`: A `string` that uniquely identifies this time system.
|
- `key`: A `string` that uniquely identifies this time system.
|
||||||
* `name`: A `string` providing a brief human readable label. If the [Time Conductor](#the-time-conductor)
|
- `name`: A `string` providing a brief human readable label. If the [Time Conductor](#the-time-conductor)
|
||||||
plugin is enabled, this name will identify the time system in a dropdown menu.
|
plugin is enabled, this name will identify the time system in a dropdown menu.
|
||||||
* `cssClass`: A class name `string` that will be applied to the time system when
|
- `cssClass`: A class name `string` that will be applied to the time system when
|
||||||
it appears in the UI. This will be used to represent the time system with an icon.
|
it appears in the UI. This will be used to represent the time system with an icon.
|
||||||
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
||||||
or a custom class can be used here.
|
or a custom class can be used here.
|
||||||
* `timeFormat`: A `string` corresponding to the key of a registered
|
- `timeFormat`: A `string` corresponding to the key of a registered
|
||||||
[telemetry time format](#telemetry-formats). The format will be used for
|
[telemetry time format](#telemetry-formats). The format will be used for
|
||||||
displaying discrete timestamps from telemetry streams when this time system is
|
displaying discrete timestamps from telemetry streams when this time system is
|
||||||
activated. If the [UTCTimeSystem](#included-plugins) is enabled, then the `utc`
|
activated. If the [UTCTimeSystem](#included-plugins) is enabled, then the `utc`
|
||||||
format can be used if this is a utc-based time system
|
format can be used if this is a utc-based time system
|
||||||
* `durationFormat`: A `string` corresponding to the key of a registered
|
- `durationFormat`: A `string` corresponding to the key of a registered
|
||||||
[telemetry time format](#telemetry-formats). The format will be used for
|
[telemetry time format](#telemetry-formats). The format will be used for
|
||||||
displaying time ranges, for example `00:15:00` might be used to represent a time
|
displaying time ranges, for example `00:15:00` might be used to represent a time
|
||||||
period of fifteen minutes. These are used by the Time Conductor plugin to specify
|
period of fifteen minutes. These are used by the Time Conductor plugin to specify
|
||||||
relative time offsets. If the [UTCTimeSystem](#included-plugins) is enabled,
|
relative time offsets. If the [UTCTimeSystem](#included-plugins) is enabled,
|
||||||
then the `duration` format can be used if this is a utc-based time system
|
then the `duration` format can be used if this is a utc-based time system
|
||||||
* `isUTCBased`: A `boolean` that defines whether this time system represents
|
- `isUTCBased`: A `boolean` that defines whether this time system represents
|
||||||
numbers in UTC terrestrial time.
|
numbers in UTC terrestrial time.
|
||||||
|
|
||||||
#### Getting and Setting the Active Time System
|
#### Getting and Setting the Active Time System
|
||||||
|
|
||||||
Once registered, a time system can be activated by calling `timeSystem` with
|
Once registered, a time system can be activated by calling `setTimeSystem` with
|
||||||
the timeSystem `key` or an instance of the time system. If you are not using a
|
the timeSystem `key` or an instance of the time system. You can also specify
|
||||||
[clock](#clocks), you must also specify valid [bounds](#time-bounds) for the
|
valid [bounds](#time-bounds) for the timeSystem.
|
||||||
timeSystem.
|
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.time.timeSystem('utc', bounds);
|
openmct.time.setTimeSystem('utc', bounds);
|
||||||
|
```
|
||||||
|
|
||||||
|
The current time system can be retrieved as well by calling `getTimeSystem`.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
openmct.time.getTimeSystem();
|
||||||
```
|
```
|
||||||
|
|
||||||
A time system can be immediately activated after registration:
|
A time system can be immediately activated after registration:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
openmct.time.addTimeSystem(utcTimeSystem);
|
openmct.time.addTimeSystem(utcTimeSystem);
|
||||||
openmct.time.timeSystem(utcTimeSystem, bounds);
|
openmct.time.setTimeSystem(utcTimeSystem, bounds);
|
||||||
```
|
```
|
||||||
|
|
||||||
Setting the active time system will trigger a [`'timeSystem'`](#time-events)
|
Setting the active time system will trigger a [`'timeSystemChanged'`](#time-events)
|
||||||
event. If you supplied bounds, a [`'bounds'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
event. If you supplied bounds, a [`'boundsChanged'`](#time-events) event will be triggered afterwards with your newly supplied bounds.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `timeSystem()` is deprecated. Please use `getTimeSystem()` and `setTimeSystem()` as a replacement.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Time Bounds
|
#### Time Bounds
|
||||||
|
|
||||||
The TimeAPI provides a getter/setter for querying and setting time bounds. Time
|
The TimeAPI provides a getter and setter for querying and setting time bounds. Time
|
||||||
bounds are simply an object with a `start` and an end `end` attribute.
|
bounds are simply an object with a `start` and an end `end` attribute.
|
||||||
|
|
||||||
* `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
- `start`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
||||||
This will be used as the beginning of the time period displayed by time-responsive
|
This will be used as the beginning of the time period displayed by time-responsive
|
||||||
telemetry views.
|
telemetry views.
|
||||||
* `end`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
- `end`: A `number` representing a moment in time in the active [Time System](#defining-and-registering-time-systems).
|
||||||
This will be used as the end of the time period displayed by time-responsive
|
This will be used as the end of the time period displayed by time-responsive
|
||||||
telemetry views.
|
telemetry views.
|
||||||
|
|
||||||
If invoked with bounds, it will set the new time bounds system-wide. If invoked
|
New bounds can be set system wide by calling `setBounds` with [bounds](#time-bounds).
|
||||||
without any parameters, it will return the current application-wide time bounds.
|
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
const ONE_HOUR = 60 * 60 * 1000;
|
const ONE_HOUR = 60 * 60 * 1000;
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
openmct.time.bounds({start: now - ONE_HOUR, now);
|
openmct.time.setBounds({start: now - ONE_HOUR, now);
|
||||||
```
|
```
|
||||||
|
|
||||||
To respond to bounds change events, listen for the [`'bounds'`](#time-events)
|
Calling `getBounds` will return the current application-wide time bounds.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.getBounds();
|
||||||
|
```
|
||||||
|
|
||||||
|
To respond to bounds change events, listen for the [`'boundsChanged'`](#time-events)
|
||||||
event.
|
event.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `bounds()` is deprecated and will be removed in a future release. Please use `getBounds()` and `setBounds()` as a replacement.
|
||||||
|
|
||||||
### Clocks
|
### Clocks
|
||||||
|
|
||||||
The Time API can be set to follow a clock source which will cause the bounds
|
The Time API requires a clock source which will cause the bounds to be updated
|
||||||
to be updated automatically whenever the clock source "ticks". A clock is simply
|
automatically whenever the clock source "ticks". A clock is simply an object that
|
||||||
an object that supports registration of listeners and periodically invokes its
|
supports registration of listeners and periodically invokes its listeners with a
|
||||||
listeners with a number. Open MCT supports registration of new clock sources that
|
number. Open MCT supports registration of new clock sources that tick on almost
|
||||||
tick on almost anything. A tick occurs when the clock invokes callback functions
|
anything. A tick occurs when the clock invokes callback functions registered by its
|
||||||
registered by its listeners with a new time value.
|
listeners with a new time value.
|
||||||
|
|
||||||
An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js)
|
An example of a clock source is the [LocalClock](https://github.com/nasa/openmct/blob/master/src/plugins/utcTimeSystem/LocalClock.js)
|
||||||
which emits the current time in UTC every 100ms. Clocks can tick on anything. For
|
which emits the current time in UTC every 100ms. Clocks can tick on anything. For
|
||||||
@ -754,28 +900,28 @@ context of the active [Time System](#defining-and-registering-time-systems).
|
|||||||
|
|
||||||
A clock is an object that defines certain required metadata and functions:
|
A clock is an object that defines certain required metadata and functions:
|
||||||
|
|
||||||
* `key`: A `string` uniquely identifying this clock. This can be used later to
|
- `key`: A `string` uniquely identifying this clock. This can be used later to
|
||||||
reference the clock in places such as the [Time Conductor configuration](#time-conductor-configuration)
|
reference the clock in places such as the [Time Conductor configuration](#time-conductor-configuration)
|
||||||
* `cssClass`: A `string` identifying a CSS class to apply to this clock when it's
|
- `cssClass`: A `string` identifying a CSS class to apply to this clock when it's
|
||||||
displayed in the UI. This will be used to represent the time system with an icon.
|
displayed in the UI. This will be used to represent the time system with an icon.
|
||||||
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
There are a number of built-in icon classes [available in Open MCT](https://github.com/nasa/openmct/blob/master/platform/commonUI/general/res/sass/_glyphs.scss),
|
||||||
or a custom class can be used here.
|
or a custom class can be used here.
|
||||||
* `name`: A `string` providing a human-readable identifier for the clock source.
|
- `name`: A `string` providing a human-readable identifier for the clock source.
|
||||||
This will be displayed in the clock selector menu in the Time Conductor UI
|
This will be displayed in the clock selector menu in the Time Conductor UI
|
||||||
component, if active.
|
component, if active.
|
||||||
* `description`: An __optional__ `string` providing a longer description of the
|
- `description`: An **optional** `string` providing a longer description of the
|
||||||
clock. The description will be visible in the clock selection menu in the Time
|
clock. The description will be visible in the clock selection menu in the Time
|
||||||
Conductor plugin.
|
Conductor plugin.
|
||||||
* `on`: A `function` supporting registration of a new callback that will be
|
- `on`: A `function` supporting registration of a new callback that will be
|
||||||
invoked when the clock next ticks. It will be invoked with two arguments:
|
invoked when the clock next ticks. It will be invoked with two arguments:
|
||||||
* `eventName`: A `string` specifying the event to listen on. For now, clocks
|
- `eventName`: A `string` specifying the event to listen on. For now, clocks
|
||||||
support one event - `tick`.
|
support one event - `tick`.
|
||||||
* `callback`: A `function` that will be invoked when this clock ticks. The
|
- `callback`: A `function` that will be invoked when this clock ticks. The
|
||||||
function must be invoked with one parameter - a `number` representing a valid
|
function must be invoked with one parameter - a `number` representing a valid
|
||||||
time in the current time system.
|
time in the current time system.
|
||||||
* `off`: A `function` that allows deregistration of a tick listener. It accepts
|
- `off`: A `function` that allows deregistration of a tick listener. It accepts
|
||||||
the same arguments as `on`.
|
the same arguments as `on`.
|
||||||
* `currentValue`: A `function` that returns a `number` representing a point in
|
- `currentValue`: A `function` that returns a `number` representing a point in
|
||||||
time in the active time system. It should be the last value provided by a tick,
|
time in the active time system. It should be the last value provided by a tick,
|
||||||
or some default value if no ticking has yet occurred.
|
or some default value if no ticking has yet occurred.
|
||||||
|
|
||||||
@ -806,24 +952,31 @@ An example clock implementation is provided in the form of the [LocalClock](http
|
|||||||
|
|
||||||
#### Getting and setting active clock
|
#### Getting and setting active clock
|
||||||
|
|
||||||
Once registered a clock can be activated by calling the `clock` function on the
|
Once registered a clock can be activated by calling the `setClock` function on the
|
||||||
Time API passing in the key or instance of a registered clock. Only one clock
|
Time API passing in the key or instance of a registered clock. Only one clock
|
||||||
may be active at once, so activating a clock will deactivate any currently
|
may be active at once, so activating a clock will deactivate any currently
|
||||||
active clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock.
|
active clock and start the new clock. [`clockOffsets`](#clock-offsets) must be specified when changing a clock.
|
||||||
|
|
||||||
Setting the clock triggers a [`'clock'`](#time-events) event, followed by a [`'clockOffsets'`](#time-events) event, and then a [`'bounds'`](#time-events) event as the offsets are applied to the clock's currentValue().
|
|
||||||
|
|
||||||
|
Setting the clock triggers a [`'clockChanged'`](#time-events) event, followed by a [`'clockOffsetsChanged'`](#time-events) event, and then a [`'boundsChanged'`](#time-events) event as the offsets are applied to the clock's currentValue().
|
||||||
|
|
||||||
```
|
```
|
||||||
openmct.time.clock(someClock, clockOffsets);
|
openmct.time.setClock(someClock, clockOffsets);
|
||||||
```
|
```
|
||||||
|
|
||||||
Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`.
|
Upon being activated, the time API will listen for tick events on the clock by calling `clock.on`.
|
||||||
|
|
||||||
The currently active clock (if any) can be retrieved by calling the same
|
The currently active clock can be retrieved by calling `getClock`.
|
||||||
function without any arguments.
|
|
||||||
|
|
||||||
#### Stopping an active clock
|
```
|
||||||
|
openmct.time.getClock();
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `clock()` is deprecated and will be removed in a future release. Please use `getClock()` and `setClock()` as a replacement.
|
||||||
|
|
||||||
|
#### ⚠️ [DEPRECATED] Stopping an active clock
|
||||||
|
|
||||||
|
_As of July 2023, this method will be deprecated. Open MCT will always have a ticking clock._
|
||||||
|
|
||||||
The `stopClock` method can be used to stop an active clock, and to clear it. It
|
The `stopClock` method can be used to stop an active clock, and to clear it. It
|
||||||
will stop the clock from ticking, and set the active clock to `undefined`.
|
will stop the clock from ticking, and set the active clock to `undefined`.
|
||||||
@ -832,37 +985,95 @@ will stop the clock from ticking, and set the active clock to `undefined`.
|
|||||||
openmct.time.stopClock();
|
openmct.time.stopClock();
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `stopClock()` is deprecated and will be removed in a future release.
|
||||||
|
|
||||||
#### Clock Offsets
|
#### Clock Offsets
|
||||||
|
|
||||||
When a clock is active, the time bounds of the application will be updated
|
When in Real-time [mode](#time-modes), the time bounds of the application will be updated automatically each time the
|
||||||
automatically each time the clock "ticks". The bounds are calculated based on
|
clock "ticks". The bounds are calculated based on the current value provided by
|
||||||
the current value provided by the active clock (via its `tick` event, or its
|
the active clock (via its `tick` event, or its `currentValue()` method).
|
||||||
`currentValue()` method).
|
|
||||||
|
|
||||||
Unlike bounds, which represent absolute time values, clock offsets represent
|
Unlike bounds, which represent absolute time values, clock offsets represent
|
||||||
relative time spans. Offsets are defined as an object with two properties:
|
relative time spans. Offsets are defined as an object with two properties:
|
||||||
|
|
||||||
* `start`: A `number` that must be < 0 and which is used to calculate the start
|
- `start`: A `number` that must be < 0 and which is used to calculate the start
|
||||||
bounds on each clock tick. The start offset will be calculated relative to the
|
bounds on each clock tick. The start offset will be calculated relative to the
|
||||||
value provided by a clock's tick callback, or its `currentValue()` function.
|
value provided by a clock's tick callback, or its `currentValue()` function.
|
||||||
* `end`: A `number` that must be >= 0 and which is used to calculate the end
|
- `end`: A `number` that must be >= 0 and which is used to calculate the end
|
||||||
bounds on each clock tick.
|
bounds on each clock tick.
|
||||||
|
|
||||||
The `clockOffsets` function can be used to get or set clock offsets. For example,
|
The `setClockOffsets` function can be used to get or set clock offsets. For example,
|
||||||
to show the last fifteen minutes in a ms-based time system:
|
to show the last fifteen minutes in a ms-based time system:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
||||||
|
|
||||||
openmct.time.clockOffsets({
|
openmct.time.setClockOffsets({
|
||||||
start: -FIFTEEN_MINUTES,
|
start: -FIFTEEN_MINUTES,
|
||||||
end: 0
|
end: 0
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
__Note:__ Setting the clock offsets will trigger an immediate bounds change, as
|
The `getClockOffsets` method will return the currently set clock offsets.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
openmct.time.getClockOffsets()
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** Setting the clock offsets will trigger an immediate bounds change, as
|
||||||
new bounds will be calculated based on the `currentValue()` of the active clock.
|
new bounds will be calculated based on the `currentValue()` of the active clock.
|
||||||
Clock offsets are only relevant when a clock source is active.
|
Clock offsets are only relevant when in Real-time [mode](#time-modes).
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated**
|
||||||
|
> - The method `clockOffsets()` is deprecated and will be removed in a future release. Please use `getClockOffsets()` and `setClockOffsets()` as a replacement.
|
||||||
|
|
||||||
|
### Time Modes
|
||||||
|
|
||||||
|
There are two time modes in Open MCT, "Fixed" and "Real-time". In Real-time mode the
|
||||||
|
time bounds of the application will be updated automatically each time the clock "ticks".
|
||||||
|
The bounds are calculated based on the current value provided by the active clock. In
|
||||||
|
Fixed mode, the time bounds are set for a specified time range. When Open MCT is first
|
||||||
|
initialized, it will be in Real-time mode.
|
||||||
|
|
||||||
|
The `setMode` method can be used to set the current time mode. It accepts a mode argument,
|
||||||
|
`'realtime'` or `'fixed'` and it also accepts an optional [offsets](#clock-offsets)/[bounds](#time-bounds) argument dependent
|
||||||
|
on the current mode.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.setMode('fixed');
|
||||||
|
openmct.time.setMode('fixed', bounds); // with optional bounds
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.setMode('realtime');
|
||||||
|
openmct.time.setMode('realtime', offsets); // with optional offsets
|
||||||
|
```
|
||||||
|
|
||||||
|
The `getMode` method will return the current time mode, either `'realtime'` or `'fixed'`.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
openmct.time.getMode();
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Time Mode Helper Methods
|
||||||
|
|
||||||
|
There are two methods available to determine the current time mode in Open MCT programmatically,
|
||||||
|
`isRealTime` and `isFixed`. Each one will return a boolean value based on the current mode.
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
if (openmct.time.isRealTime()) {
|
||||||
|
// do real-time stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
``` javascript
|
||||||
|
if (openmct.time.isFixed()) {
|
||||||
|
// do fixed-time stuff
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Time Events
|
### Time Events
|
||||||
|
|
||||||
@ -871,7 +1082,7 @@ The Time API is a standard event emitter; you can register callbacks for events
|
|||||||
For example:
|
For example:
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
openmct.time.on('bounds', function callback (newBounds, tick) {
|
openmct.time.on('boundsChanged', function callback (newBounds, tick) {
|
||||||
// Do something with new bounds
|
// Do something with new bounds
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -880,11 +1091,11 @@ openmct.time.on('bounds', function callback (newBounds, tick) {
|
|||||||
|
|
||||||
The events emitted by the Time API are:
|
The events emitted by the Time API are:
|
||||||
|
|
||||||
* `bounds`: emitted whenever the bounds change. The callback will be invoked
|
- `boundsChanged`: emitted whenever the bounds change. The callback will be invoked
|
||||||
with two arguments:
|
with two arguments:
|
||||||
* `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
- `bounds`: A [bounds](#getting-and-setting-bounds) bounds object
|
||||||
representing a new time period bound by the specified start and send times.
|
representing a new time period bound by the specified start and send times.
|
||||||
* `tick`: A `boolean` indicating whether or not this bounds change is due to
|
- `tick`: A `boolean` indicating whether or not this bounds change is due to
|
||||||
a "tick" from a [clock source](#clocks). This information can be useful
|
a "tick" from a [clock source](#clocks). This information can be useful
|
||||||
when determining a strategy for fetching telemetry data in response to a
|
when determining a strategy for fetching telemetry data in response to a
|
||||||
bounds change event. For example, if the bounds change was automatic, and
|
bounds change event. For example, if the bounds change was automatic, and
|
||||||
@ -895,16 +1106,24 @@ The events emitted by the Time API are:
|
|||||||
If `tick` is false,then the bounds change was not due to an automatic tick,
|
If `tick` is false,then the bounds change was not due to an automatic tick,
|
||||||
and a query for historical data may be necessary, depending on your data
|
and a query for historical data may be necessary, depending on your data
|
||||||
caching strategy, and how significantly the start bound has changed.
|
caching strategy, and how significantly the start bound has changed.
|
||||||
* `timeSystem`: emitted whenever the active time system changes. The callback will be invoked with a single argument:
|
- `timeSystemChanged`: emitted whenever the active time system changes. The callback will be invoked with a single argument:
|
||||||
* `timeSystem`: The newly active [time system](#defining-and-registering-time-systems).
|
- `timeSystem`: The newly active [time system](#defining-and-registering-time-systems).
|
||||||
* `clock`: emitted whenever the clock changes. The callback will be invoked
|
- `clockChanged`: emitted whenever the clock changes. The callback will be invoked
|
||||||
with a single argument:
|
with a single argument:
|
||||||
* `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
- `clock`: The newly active [clock](#clocks), or `undefined` if an active
|
||||||
clock has been deactivated.
|
clock has been deactivated.
|
||||||
* `clockOffsets`: emitted whenever the active clock offsets change. The
|
- `clockOffsetsChanged`: emitted whenever the active clock offsets change. The
|
||||||
callback will be invoked with a single argument:
|
callback will be invoked with a single argument:
|
||||||
* `clockOffsets`: The new [clock offsets](#clock-offsets).
|
- `clockOffsets`: The new [clock offsets](#clock-offsets).
|
||||||
|
- `modeChanged`: emitted whenever the time [mode](#time-modes) changed. The callback will
|
||||||
|
be invoked with one argument:
|
||||||
|
- `mode`: A string representation of the current time mode, either `'realtime'` or `'fixed'`.
|
||||||
|
|
||||||
|
> ⚠️ **Deprecated Events** (These will be removed in a future release):
|
||||||
|
> - `bounds` → `boundsChanged`
|
||||||
|
> - `timeSystem` → `timeSystemChanged`
|
||||||
|
> - `clock` → `clockChanged`
|
||||||
|
> - `clockOffsets` → `clockOffsetsChanged`
|
||||||
|
|
||||||
### The Time Conductor
|
### The Time Conductor
|
||||||
|
|
||||||
@ -929,29 +1148,29 @@ array is an object with some properties specifying configuration. The configurat
|
|||||||
options specified are slightly different depending on whether or not it is for
|
options specified are slightly different depending on whether or not it is for
|
||||||
an active clock mode.
|
an active clock mode.
|
||||||
|
|
||||||
__Configuration for Fixed Time Mode (no active clock)__
|
**Configuration for Fixed Time Mode (no active clock)**
|
||||||
|
|
||||||
* `timeSystem`: A `string`, the key for the time system that this configuration
|
- `timeSystem`: A `string`, the key for the time system that this configuration
|
||||||
relates to.
|
relates to.
|
||||||
* `bounds`: A [`Time Bounds`](#time-bounds) object. These bounds will be applied
|
- `bounds`: A [`Time Bounds`](#time-bounds) object. These bounds will be applied
|
||||||
when the user selects the time system specified in the previous `timeSystem`
|
when the user selects the time system specified in the previous `timeSystem`
|
||||||
property.
|
property.
|
||||||
* `zoomOutLimit`: An __optional__ `number` specifying the longest period of time
|
- `zoomOutLimit`: An **optional** `number` specifying the longest period of time
|
||||||
that can be represented by the conductor when zooming. If a `zoomOutLimit` is
|
that can be represented by the conductor when zooming. If a `zoomOutLimit` is
|
||||||
provided, then a `zoomInLimit` must also be provided. If provided, the zoom
|
provided, then a `zoomInLimit` must also be provided. If provided, the zoom
|
||||||
slider will automatically become available in the Time Conductor UI.
|
slider will automatically become available in the Time Conductor UI.
|
||||||
* `zoomInLimit`: An __optional__ `number` specifying the shortest period of time
|
- `zoomInLimit`: An **optional** `number` specifying the shortest period of time
|
||||||
that can be represented by the conductor when zooming. If a `zoomInLimit` is
|
that can be represented by the conductor when zooming. If a `zoomInLimit` is
|
||||||
provided, then a `zoomOutLimit` must also be provided. If provided, the zoom
|
provided, then a `zoomOutLimit` must also be provided. If provided, the zoom
|
||||||
slider will automatically become available in the Time Conductor UI.
|
slider will automatically become available in the Time Conductor UI.
|
||||||
|
|
||||||
__Configuration for Active Clock__
|
**Configuration for Active Clock**
|
||||||
|
|
||||||
* `clock`: A `string`, the `key` of the clock that this configuration applies to.
|
- `clock`: A `string`, the `key` of the clock that this configuration applies to.
|
||||||
* `timeSystem`: A `string`, the key for the time system that this configuration
|
- `timeSystem`: A `string`, the key for the time system that this configuration
|
||||||
relates to. Separate configuration must be provided for each time system that you
|
relates to. Separate configuration must be provided for each time system that you
|
||||||
wish to be available to users when they select the specified clock.
|
wish to be available to users when they select the specified clock.
|
||||||
* `clockOffsets`: A [`clockOffsets`](#clock-offsets) object that will be
|
- `clockOffsets`: A [`clockOffsets`](#clock-offsets) object that will be
|
||||||
automatically applied when the combination of clock and time system specified in
|
automatically applied when the combination of clock and time system specified in
|
||||||
this configuration is selected from the UI.
|
this configuration is selected from the UI.
|
||||||
|
|
||||||
@ -1018,6 +1237,7 @@ A simple indicator with an icon and some text can be created and added with mini
|
|||||||
of this type exposes functions for customizing the text, icon, and style of the indicator.
|
of this type exposes functions for customizing the text, icon, and style of the indicator.
|
||||||
|
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
var myIndicator = openmct.indicators.simpleIndicator();
|
var myIndicator = openmct.indicators.simpleIndicator();
|
||||||
myIndicator.text("Hello World!");
|
myIndicator.text("Hello World!");
|
||||||
@ -1029,20 +1249,20 @@ By default, the indicator will appear as an information icon. Hovering over the
|
|||||||
reveal the text set via the call to `.text()`. The Indicator object returned by the API
|
reveal the text set via the call to `.text()`. The Indicator object returned by the API
|
||||||
call exposes a number of functions for customizing the content and appearance of the indicator:
|
call exposes a number of functions for customizing the content and appearance of the indicator:
|
||||||
|
|
||||||
* `.text([text])`: Gets or sets the text shown when the user hovers over the indicator.
|
- `.text([text])`: Gets or sets the text shown when the user hovers over the indicator.
|
||||||
Accepts an __optional__ `string` argument that, if provided, will be used to set the text.
|
Accepts an **optional** `string` argument that, if provided, will be used to set the text.
|
||||||
Hovering over the indicator will expand it to its full size, revealing this text alongside
|
Hovering over the indicator will expand it to its full size, revealing this text alongside
|
||||||
the icon. Returns the currently set text as a `string`.
|
the icon. Returns the currently set text as a `string`.
|
||||||
* `.description([description])`: Gets or sets the indicator's description. Accepts an
|
- `.description([description])`: Gets or sets the indicator's description. Accepts an
|
||||||
__optional__ `string` argument that, if provided, will be used to set the text. The description
|
**optional** `string` argument that, if provided, will be used to set the text. The description
|
||||||
allows for more detail to be provided in a tooltip when the user hovers over the indicator.
|
allows for more detail to be provided in a tooltip when the user hovers over the indicator.
|
||||||
Returns the currently set text as a `string`.
|
Returns the currently set text as a `string`.
|
||||||
* `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an __optional__
|
- `.iconClass([className])`: Gets or sets the CSS class used to define the icon. Accepts an **optional**
|
||||||
`string` parameter to be used to set the class applied to the indicator. Any of
|
`string` parameter to be used to set the class applied to the indicator. Any of
|
||||||
[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs)
|
[the built-in glyphs](https://nasa.github.io/openmct/style-guide/#/browse/styleguide:home/glyphs?view=styleguide.glyphs)
|
||||||
may be used here, or a custom CSS class can be provided. Returns the currently defined CSS
|
may be used here, or a custom CSS class can be provided. Returns the currently defined CSS
|
||||||
class as a `string`.
|
class as a `string`.
|
||||||
* `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional __
|
- `.statusClass([className])`: Gets or sets the CSS class used to determine status. Accepts an __optional__
|
||||||
`string` parameter to be used to set a status class applied to the indicator. May be used to apply
|
`string` parameter to be used to set a status class applied to the indicator. May be used to apply
|
||||||
different colors to indicate status.
|
different colors to indicate status.
|
||||||
|
|
||||||
@ -1069,6 +1289,7 @@ Open MCT provides some built-in priority values that can be used in the applicat
|
|||||||
### Priority Types
|
### Priority Types
|
||||||
|
|
||||||
Currently, the Open MCT Priority API provides (type: numeric value):
|
Currently, the Open MCT Priority API provides (type: numeric value):
|
||||||
|
|
||||||
- HIGH: 1000
|
- HIGH: 1000
|
||||||
- Default: 0
|
- Default: 0
|
||||||
- LOW: -1000
|
- LOW: -1000
|
||||||
@ -1083,3 +1304,61 @@ View provider Example:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Visibility-Based Rendering in View Providers
|
||||||
|
|
||||||
|
To enhance performance and resource efficiency in OpenMCT, a visibility-based rendering feature has been added. This feature is designed to defer the execution of rendering logic for views that are not currently visible. It ensures that views are only updated when they are in the viewport, similar to how modern browsers handle rendering of inactive tabs but optimized for the OpenMCT tabbed display. It also works when views are scrolled outside the viewport (e.g., in a Display Layout).
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
|
||||||
|
The show function is responsible for the rendering of a view. An [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) is used internally to determine whether the view is visible. This observer drives the visibility-based rendering feature, accessed via the `renderWhenVisible` function provided in the `viewOptions` parameter.
|
||||||
|
|
||||||
|
### Implementing Visibility-Based Rendering
|
||||||
|
|
||||||
|
The `renderWhenVisible` function is passed to the show function as part of the `viewOptions` object. This function can be used for all rendering logic that would otherwise be executed within a `requestAnimationFrame` call. When called, `renderWhenVisible` will either execute the provided function immediately (via `requestAnimationFrame`) if the view is currently visible, or defer its execution until the view becomes visible.
|
||||||
|
|
||||||
|
Additionally, `renderWhenVisible` returns a boolean value indicating whether the provided function was executed immediately (`true`) or deferred (`false`).
|
||||||
|
|
||||||
|
Monitoring of visibility begins after the first call to `renderWhenVisible` is made.
|
||||||
|
|
||||||
|
Here’s the signature for the show function:
|
||||||
|
|
||||||
|
`show(element, isEditing, viewOptions)`
|
||||||
|
|
||||||
|
* `element` (HTMLElement) - The DOM element where the view should be rendered.
|
||||||
|
* `isEditing` (boolean) - Indicates whether the view is in editing mode.
|
||||||
|
* `viewOptions` (Object) - An object with configuration options for the view, including:
|
||||||
|
* `renderWhenVisible` (Function) - This function wraps the `requestAnimationFrame` and only triggers the provided render logic when the view is visible in the viewport.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
An OpenMCT view provider might implement the show function as follows:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Define your view provider
|
||||||
|
const myViewProvider = {
|
||||||
|
// ... other properties and methods ...
|
||||||
|
show: function (element, isEditing, viewOptions) {
|
||||||
|
// Callback for rendering view content
|
||||||
|
const renderCallback = () => {
|
||||||
|
// Your view rendering logic goes here
|
||||||
|
};
|
||||||
|
|
||||||
|
// Use the renderWhenVisible function to ensure rendering only happens when view is visible
|
||||||
|
const wasRenderedImmediately = viewOptions.renderWhenVisible(renderCallback);
|
||||||
|
|
||||||
|
// Optionally handle the immediate rendering return value
|
||||||
|
if (wasRenderedImmediately) {
|
||||||
|
console.debug('🪞 Rendering triggered immediately as the view is visible.');
|
||||||
|
} else {
|
||||||
|
console.debug('🛑 Rendering has been deferred until the view becomes visible.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Note that `renderWhenVisible` defers rendering while the view is not visible and caters to the latest execution call. This provides responsiveness for dynamic content while ensuring performance optimizations.
|
||||||
|
|
||||||
|
Ensure your view logic is prepared to handle potentially multiple deferrals if using this API, as only the last call to renderWhenVisible will be queued for execution upon the view becoming visible.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ accept changes from external contributors.
|
|||||||
|
|
||||||
The short version:
|
The short version:
|
||||||
|
|
||||||
1. Write your contribution or describe your idea in the form of an [GitHub issue](https://github.com/nasa/openmct/issues/new/choose) or [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions)
|
1. Write your contribution or describe your idea in the form of a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose) or [start a GitHub discussion](https://github.com/nasa/openmct/discussions).
|
||||||
2. Make sure your contribution meets code, test, and commit message
|
2. Make sure your contribution meets code, test, and commit message
|
||||||
standards as described below.
|
standards as described below.
|
||||||
3. Submit a pull request from a topic branch back to `master`. Include a check
|
3. Submit a pull request from a topic branch back to `master`. Include a check
|
||||||
@ -24,7 +24,7 @@ The short version:
|
|||||||
|
|
||||||
Open MCT uses git for software version control, and for branching and
|
Open MCT uses git for software version control, and for branching and
|
||||||
merging. The central repository is at
|
merging. The central repository is at
|
||||||
https://github.com/nasa/openmct.git.
|
<https://github.com/nasa/openmct.git>.
|
||||||
|
|
||||||
### Roles
|
### Roles
|
||||||
|
|
||||||
@ -116,6 +116,7 @@ the pull request containing the reviewer checklist (from below) and complete
|
|||||||
the merge back to the master branch.
|
the merge back to the master branch.
|
||||||
|
|
||||||
Additionally:
|
Additionally:
|
||||||
|
|
||||||
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
* Every pull request must link to the issue that it addresses. Eg. “Addresses #1234” or “Closes #1234”. This is the responsibility of the pull request’s __author__. If no issue exists, [create one](https://github.com/nasa/openmct/issues/new/choose).
|
||||||
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
|
||||||
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull request’s __author__.
|
||||||
@ -132,14 +133,15 @@ changes.
|
|||||||
|
|
||||||
### Code Standards
|
### Code Standards
|
||||||
|
|
||||||
JavaScript sources in Open MCT must satisfy the ESLint rules defined in
|
JavaScript sources in Open MCT must satisfy the [ESLint](https://eslint.org/) rules defined in
|
||||||
this repository. This is verified by the command line build.
|
this repository. [Prettier](https://prettier.io/) is used in conjunction with ESLint to enforce code style
|
||||||
|
via automated formatting. These are verified by the command line build.
|
||||||
|
|
||||||
#### Code Guidelines
|
#### Code Guidelines
|
||||||
|
|
||||||
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
The following guidelines are provided for anyone contributing source code to the Open MCT project:
|
||||||
|
|
||||||
1. Write clean code. Here’s a good summary - https://github.com/ryanmcdermott/clean-code-javascript.
|
1. Write clean code. Here’s a good summary - <https://github.com/ryanmcdermott/clean-code-javascript>.
|
||||||
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
1. Include JSDoc for any exposed API (e.g. public methods, classes).
|
||||||
1. Include non-JSDoc comments as-needed for explaining private variables,
|
1. Include non-JSDoc comments as-needed for explaining private variables,
|
||||||
methods, or algorithms when they are non-obvious. Otherwise code
|
methods, or algorithms when they are non-obvious. Otherwise code
|
||||||
@ -159,17 +161,21 @@ 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.
|
||||||
@ -182,19 +188,24 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
* Finally, the returned value. A single return statement at the end of the function should be used, except where an early return would improve code clarity.
|
||||||
1. Avoid the use of "magic" values.
|
1. Avoid the use of "magic" values.
|
||||||
eg.
|
eg.
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
const UNAUTHORIZED = 401;
|
const UNAUTHORIZED = 401;
|
||||||
if (responseCode === UNAUTHORIZED)
|
if (responseCode === UNAUTHORIZED)
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
|
|
||||||
```JavaScript
|
```JavaScript
|
||||||
if (responseCode === 401)
|
if (responseCode === 401)
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
|
||||||
1. Test specs should reside alongside the source code they test, not in a separate directory.
|
1. Unit Test specs should reside alongside the source code they test, not in a separate directory.
|
||||||
1. Organize code by feature, not by type.
|
1. Organize code by feature, not by type.
|
||||||
eg.
|
eg.
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- row
|
- row
|
||||||
TableRow.js
|
TableRow.js
|
||||||
@ -206,8 +217,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
is preferable to
|
is preferable to
|
||||||
```
|
|
||||||
|
```txt
|
||||||
- telemetryTable
|
- telemetryTable
|
||||||
- components
|
- components
|
||||||
TableRow.vue
|
TableRow.vue
|
||||||
@ -219,47 +232,10 @@ The following guidelines are provided for anyone contributing source code to the
|
|||||||
plugin.js
|
plugin.js
|
||||||
pluginSpec.js
|
pluginSpec.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Deviations from Open MCT code style guidelines require two-party agreement,
|
Deviations from Open MCT code style guidelines require two-party agreement,
|
||||||
typically from the author of the change and its reviewer.
|
typically from the author of the change and its reviewer.
|
||||||
|
|
||||||
### Test Standards
|
|
||||||
|
|
||||||
Automated testing shall occur whenever changes are merged into the main
|
|
||||||
development branch and must be confirmed alongside any pull request.
|
|
||||||
|
|
||||||
Automated tests are tests which exercise plugins, API, and utility classes.
|
|
||||||
Tests are subject to code review along with the actual implementation, to
|
|
||||||
ensure that tests are applicable and useful.
|
|
||||||
|
|
||||||
Examples of useful tests:
|
|
||||||
* Tests which replicate bugs (or their root causes) to verify their
|
|
||||||
resolution.
|
|
||||||
* Tests which reflect details from software specifications.
|
|
||||||
* Tests which exercise edge or corner cases among inputs.
|
|
||||||
* Tests which verify expected interactions with other components in the
|
|
||||||
system.
|
|
||||||
|
|
||||||
#### Guidelines
|
|
||||||
* 100% statement coverage is achievable and desirable.
|
|
||||||
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
|
|
||||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
|
||||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
|
||||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
|
||||||
* Where builtin functions have been mocked, be sure to clear them between tests.
|
|
||||||
* Test at an appropriate level of isolation. Eg.
|
|
||||||
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
|
||||||
* You do not need to test that the view switcher works, there should be separate tests for that.
|
|
||||||
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
|
||||||
* Use your best judgement when deciding on appropriate scope.
|
|
||||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
|
||||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
|
||||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
|
||||||
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
|
|
||||||
|
|
||||||
#### Examples
|
|
||||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
|
||||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
|
||||||
|
|
||||||
### Commit Message Standards
|
### Commit Message Standards
|
||||||
|
|
||||||
Commit messages should:
|
Commit messages should:
|
||||||
@ -295,13 +271,13 @@ these standards.
|
|||||||
|
|
||||||
## Issue Reporting
|
## Issue Reporting
|
||||||
|
|
||||||
Issues are tracked at https://github.com/nasa/openmct/issues.
|
Issues are tracked at <https://github.com/nasa/openmct/issues>.
|
||||||
|
|
||||||
Issue severity is categorized as follows (in ascending order):
|
Issue severity is categorized as follows (in ascending order):
|
||||||
|
|
||||||
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
|
||||||
* _Medium_: Some impairment of use, but simple workarounds exist
|
* _Medium_: Some impairment of use, but simple workarounds exist
|
||||||
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though.
|
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though. Complex workarounds exist.
|
||||||
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
|
||||||
|
|
||||||
## Check Lists
|
## Check Lists
|
||||||
@ -310,22 +286,4 @@ The following check lists should be completed and attached to pull requests
|
|||||||
when they are filed (author checklist) and when they are merged (reviewer
|
when they are filed (author checklist) and when they are merged (reviewer
|
||||||
checklist).
|
checklist).
|
||||||
|
|
||||||
### Author Checklist
|
|
||||||
|
|
||||||
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
|
||||||
|
|
||||||
### Reviewer Checklist
|
|
||||||
|
|
||||||
* [ ] Changes appear to address issue?
|
|
||||||
* [ ] Changes appear not to be breaking changes?
|
|
||||||
* [ ] Appropriate unit tests included?
|
|
||||||
* [ ] Code style and in-line documentation are appropriate?
|
|
||||||
* [ ] Commit messages meet standards?
|
|
||||||
* [ ] Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)
|
|
||||||
* [ ] Has associated issue been labelled `bug`? (only applicable if this PR is for a bug fix)
|
|
||||||
* [ ] List of Acceptance Tests Performed.
|
|
||||||
|
|
||||||
Write out a small list of tests performed with just enough detail for another developer on the team
|
|
||||||
to execute.
|
|
||||||
|
|
||||||
i.e. ```When Clicking on Add button, new `object` appears in dropdown.```
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Open MCT License
|
# Open MCT License
|
||||||
|
|
||||||
Open MCT, Copyright (c) 2014-2022, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
Open MCT, Copyright (c) 2014-2024, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||||
|
|
||||||
Open MCT is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
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.
|
||||||
|
|
||||||
|
77
README.md
77
README.md
@ -1,34 +1,49 @@
|
|||||||
# Open MCT [![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/nasa/openmct.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/nasa/openmct/context:javascript) [![codecov](https://codecov.io/gh/nasa/openmct/branch/master/graph/badge.svg?token=7DQIipp3ej)](https://codecov.io/gh/nasa/openmct) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/b2e34b17/openmct) [![npm version](https://img.shields.io/npm/v/openmct.svg)](https://www.npmjs.com/package/openmct)
|
# Open MCT [![license](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![codecov](https://codecov.io/gh/nasa/openmct/branch/master/graph/badge.svg?token=7DQIipp3ej)](https://codecov.io/gh/nasa/openmct) [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/b2e34b17/openmct) [![npm version](https://img.shields.io/npm/v/openmct.svg)](https://www.npmjs.com/package/openmct) ![CodeQL](https://github.com/nasa/openmct/workflows/CodeQL/badge.svg)
|
||||||
|
|
||||||
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
|
||||||
|
|
||||||
Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
> [!NOTE]
|
||||||
|
> Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting Started Guide](https://nasa.github.io/openmct/getting-started/)
|
||||||
|
|
||||||
|
|
||||||
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
|
||||||
|
|
||||||
## See Open MCT in Action
|
![Screen Shot 2022-11-23 at 9 51 36 AM](https://user-images.githubusercontent.com/4215777/203617422-4d912bfc-766f-4074-8324-409d9bbe7c05.png)
|
||||||
|
|
||||||
Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/).
|
|
||||||
![Demo](https://nasa.github.io/openmct/static/res/images/Open-MCT.Browse.Layout.Mars-Weather-1.jpg)
|
|
||||||
|
|
||||||
## Building and Running Open MCT Locally
|
## Building and Running Open MCT Locally
|
||||||
|
|
||||||
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
Building and running Open MCT in your local dev environment is very easy. Be sure you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed, then follow the directions below. Need additional information? Check out the [Getting Started](https://nasa.github.io/openmct/getting-started/) page on our website.
|
||||||
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
(These instructions assume you are installing as a non-root user; developers have [reported issues](https://github.com/nasa/openmct/issues/1151) running these steps with root privileges.)
|
||||||
|
|
||||||
1. Clone the source code
|
1. Clone the source code:
|
||||||
|
|
||||||
`git clone https://github.com/nasa/openmct.git`
|
```
|
||||||
|
git clone https://github.com/nasa/openmct.git
|
||||||
|
```
|
||||||
|
|
||||||
2. Install development dependencies. Note: Check the package.json engine for our tested and supported node versions.
|
2. (Optional) Install the correct node version using [nvm](https://github.com/nvm-sh/nvm):
|
||||||
|
|
||||||
`npm install`
|
```
|
||||||
|
nvm install
|
||||||
|
```
|
||||||
|
|
||||||
3. Run a local development server
|
3. Install development dependencies (Note: Check the `package.json` engine for our tested and supported node versions):
|
||||||
|
|
||||||
`npm start`
|
```
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
4. Run a local development server:
|
||||||
|
|
||||||
|
```
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Open MCT is now running, and can be accessed by pointing a web browser at [http://localhost:8080/](http://localhost:8080/)
|
||||||
|
|
||||||
|
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
@ -40,19 +55,23 @@ The clearest examples for developing Open MCT plugins are in the
|
|||||||
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
[tutorials](https://github.com/nasa/openmct-tutorial) provided in
|
||||||
our documentation.
|
our documentation.
|
||||||
|
|
||||||
We want Open MCT to be as easy to use, install, run, and develop for as
|
> [!NOTE]
|
||||||
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
> We want Open MCT to be as easy to use, install, run, and develop for as
|
||||||
|
> possible, and your feedback will help us get there!
|
||||||
|
> Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose),
|
||||||
|
> [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions),
|
||||||
|
> or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
|
||||||
|
|
||||||
## Building Applications With Open MCT
|
## Developing Applications With Open MCT
|
||||||
|
|
||||||
Open MCT is built using [`npm`](http://npmjs.com/) and [`webpack`](https://webpack.js.org/).
|
For more on developing with Open MCT, see our documentation for a guide on [Developing Applications with Open MCT](./API.md#starting-an-open-mct-application).
|
||||||
|
|
||||||
See our documentation for a guide on [building Applications with Open MCT](https://github.com/nasa/openmct/blob/master/API.md#starting-an-open-mct-application).
|
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
||||||
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
This is a fast moving project and we do our best to test and support the widest possible range of browsers, operating systems, and nodejs APIs. We have a published list of support available in our package.json's `browserslist` key.
|
||||||
|
|
||||||
|
The project uses `nvm` to ensure the node and npm version used, is coherent in all projects. Install nvm (non-windows), [here](https://github.com/nvm-sh/nvm) or the windows equivalent [here](https://github.com/coreybutler/nvm-windows)
|
||||||
|
|
||||||
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
If you encounter an issue with a particular browser, OS, or nodejs API, please file a [GitHub issue](https://github.com/nasa/openmct/issues/new/choose)
|
||||||
|
|
||||||
## Plugins
|
## Plugins
|
||||||
@ -64,7 +83,7 @@ that is intended to be added or removed as a single unit.
|
|||||||
As well as providing an extension mechanism, most of the core Open MCT codebase is also
|
As well as providing an extension mechanism, most of the core Open MCT codebase is also
|
||||||
written as plugins.
|
written as plugins.
|
||||||
|
|
||||||
For information on writing plugins, please see [our API documentation](https://github.com/nasa/openmct/blob/master/API.md#plugins).
|
For information on writing plugins, please see [our API documentation](./API.md#plugins).
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
@ -97,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/) and our overall security report is available on [LGTM](https://lgtm.com/projects/g/nasa/openmct/)
|
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
|
||||||
|
|
||||||
@ -108,6 +127,8 @@ Each test suite generates a report in CircleCI. For a complete overview of testi
|
|||||||
|
|
||||||
Our code coverage is generated during the runtime of our unit, e2e, and visual tests. The combination of those reports is published to [codecov.io](https://app.codecov.io/gh/nasa/openmct/)
|
Our code coverage is generated during the runtime of our unit, e2e, and visual tests. The combination of those reports is published to [codecov.io](https://app.codecov.io/gh/nasa/openmct/)
|
||||||
|
|
||||||
|
For more on the specifics of our code coverage setup, [see](TESTING.md#code-coverage)
|
||||||
|
|
||||||
# Glossary
|
# Glossary
|
||||||
|
|
||||||
Certain terms are used throughout Open MCT with consistent meanings
|
Certain terms are used throughout Open MCT with consistent meanings
|
||||||
@ -163,3 +184,17 @@ You might still be using legacy API if your source code
|
|||||||
|
|
||||||
### What should I do if I am using legacy API?
|
### What should I do if I am using legacy API?
|
||||||
Please refer to [the modern Open MCT API](https://nasa.github.io/openmct/documentation/). Post any questions to the [Discussions section](https://github.com/nasa/openmct/discussions) of the Open MCT GitHub repository.
|
Please refer to [the modern Open MCT API](https://nasa.github.io/openmct/documentation/). Post any questions to the [Discussions section](https://github.com/nasa/openmct/discussions) of the Open MCT GitHub repository.
|
||||||
|
|
||||||
|
## Related Repos
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Although Open MCT functions as a standalone project, it is primarily an extensible framework intended to be used as a dependency with users' own plugins and packaging. Furthermore, Open MCT is intended to be used with an HTTP server such as Apache or Nginx. A great example of hosting Open MCT with Apache is `openmct-quickstart` and can be found in the table below.
|
||||||
|
|
||||||
|
| Repository | Description |
|
||||||
|
| --- | --- |
|
||||||
|
| [openmct-tutorial](https://github.com/nasa/openmct-tutorial) | A great place for beginners to learn how to use and extend Open MCT. |
|
||||||
|
| [openmct-quickstart](https://github.com/scottbell/openmct-quickstart) | A working example of Open MCT integrated with Apache HTTP server, YAMCS telemetry, and Couch DB for persistence.
|
||||||
|
| [Open MCT YAMCS Plugin](https://github.com/akhenry/openmct-yamcs) | Plugin for integrating YAMCS telemetry and command server with Open MCT. |
|
||||||
|
| [openmct-performance](https://github.com/unlikelyzero/openmct-performance) | Resources for performance testing Open MCT. |
|
||||||
|
| [openmct-as-a-dependency](https://github.com/unlikelyzero/openmct-as-a-dependency) | An advanced guide for users on how to build, develop, and test Open MCT when it's used as a dependency. |
|
||||||
|
|
||||||
|
120
TESTING.md
Normal file
120
TESTING.md
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
# Testing
|
||||||
|
Open MCT Testing is iterating and improving at a rapid pace. This document serves to capture and index existing testing documentation and house documentation which no other obvious location as our testing evolves.
|
||||||
|
|
||||||
|
## General Testing Process
|
||||||
|
Documentation located [here](./docs/src/process/testing/plan.md)
|
||||||
|
|
||||||
|
## Unit Testing
|
||||||
|
Unit testing is essential part of our test strategy and complements our e2e testing strategy.
|
||||||
|
|
||||||
|
#### Unit Test Guidelines
|
||||||
|
* Unit Test specs should reside alongside the source code they test, not in a separate directory.
|
||||||
|
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
|
||||||
|
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
|
||||||
|
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
|
||||||
|
* Where builtin functions have been mocked, be sure to clear them between tests.
|
||||||
|
* Test at an appropriate level of isolation. Eg.
|
||||||
|
* If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created.
|
||||||
|
* You do not need to test that the view switcher works, there should be separate tests for that.
|
||||||
|
* You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
|
||||||
|
* Use your best judgement when deciding on appropriate scope.
|
||||||
|
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
|
||||||
|
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
|
||||||
|
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
|
||||||
|
|
||||||
|
#### Unit Test Examples
|
||||||
|
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
|
||||||
|
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
|
||||||
|
|
||||||
|
#### Unit Testing Execution
|
||||||
|
|
||||||
|
The unit tests can be executed in one of two ways:
|
||||||
|
`npm run test` which runs the entire suite against headless chrome
|
||||||
|
`npm run test:debug` for debugging the tests in realtime in an active chrome session.
|
||||||
|
|
||||||
|
## e2e, performance, and visual testing
|
||||||
|
Documentation located [here](./e2e/README.md)
|
||||||
|
|
||||||
|
## Code Coverage
|
||||||
|
|
||||||
|
It's up to the individual developer as to whether they want to add line coverage in the form of a unit test or e2e test.
|
||||||
|
|
||||||
|
Line Code Coverage is generated by our unit tests and e2e tests, then combined by ([Codecov.io Flags](https://docs.codecov.com/docs/flags)), and finally reported in GitHub PRs by Codecov.io's PR Bot. This workflow gives a comprehensive (if flawed) view of line coverage.
|
||||||
|
|
||||||
|
### Karma-istanbul
|
||||||
|
|
||||||
|
Line coverage is generated by our `karma-coverage-istanbul-reporter` package as defined in our `karma.conf.js` file:
|
||||||
|
|
||||||
|
```js
|
||||||
|
coverageIstanbulReporter: {
|
||||||
|
fixWebpackSourcePaths: true,
|
||||||
|
skipFilesWithNoCoverage: true,
|
||||||
|
dir: 'coverage/unit', //Sets coverage file to be consumed by codecov.io
|
||||||
|
reports: ['lcovonly']
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the file is generated, it can be published to codecov with
|
||||||
|
|
||||||
|
```json
|
||||||
|
"cov:unit:publish": "codecov --disable=gcov -f ./coverage/unit/lcov.info -F unit",
|
||||||
|
```
|
||||||
|
|
||||||
|
### e2e
|
||||||
|
The e2e line coverage is a bit more complex than the karma implementation. This is the general sequence of events:
|
||||||
|
|
||||||
|
1. Each e2e suite will start webpack with the ```npm run start:coverage``` command with config `webpack.coverage.js` and the `babel-plugin-istanbul` plugin to generate code coverage during e2e test execution using our custom [baseFixture](./baseFixtures.js).
|
||||||
|
1. During testcase execution, each e2e shard will generate its piece of the larger coverage suite. **This coverage file is not merged**. The raw coverage file is stored in a `.nyc_report` directory.
|
||||||
|
1. [nyc](https://github.com/istanbuljs/nyc) converts this directory into a `lcov` file with the following command `npm run cov:e2e:report`
|
||||||
|
1. Most of the tests are run in the '@stable' configuration and focus on chrome/ubuntu at a single resolution. This coverage is published to codecov with `npm run cov:e2e:stable:publish`.
|
||||||
|
1. The rest of our coverage only appears when run against `@unstable` tests, persistent datastore (couchdb), non-ubuntu machines, and non-chrome browsers with the `npm run cov:e2e:full:publish` flag. Since this happens about once a day, we have leveraged codecov.io's carryforward flag to report on lines covered outside of each commit on an individual PR.
|
||||||
|
|
||||||
|
|
||||||
|
### Limitations in our code coverage reporting
|
||||||
|
Our code coverage implementation has some known limitations:
|
||||||
|
- [Variability](https://github.com/nasa/openmct/issues/5811)
|
||||||
|
- [Accuracy](https://github.com/nasa/openmct/issues/7015)
|
||||||
|
- [Vue instrumentation gaps](https://github.com/nasa/openmct/issues/4973)
|
||||||
|
|
||||||
|
## Troubleshooting CI
|
||||||
|
The following is an evolving guide to troubleshoot CI and PR issues.
|
||||||
|
|
||||||
|
### Github Checks failing
|
||||||
|
There are a few reasons that your GitHub PR could be failing beyond simple failed tests.
|
||||||
|
* Required Checks. We're leveraging required checks in GitHub so that we can quickly and precisely control what becomes and informational failure vs a hard requirement. The only way to determine the difference between a required vs information check is check for the `(Required)` emblem next to the step details in GitHub Checks.
|
||||||
|
* Not all required checks are run per commit. You may need to manually trigger addition GitHub checks with a `pr:<label>` label added to your PR.
|
||||||
|
|
||||||
|
### Flaky tests
|
||||||
|
|
||||||
|
(CircleCI's test insights feature)[https://circleci.com/blog/introducing-test-insights-with-flaky-test-detection/] collects historical data about the individual test results for both unit and e2e tests. Note: only a 14 day window of flake is available.
|
||||||
|
|
||||||
|
### Local=Pass and CI=Fail
|
||||||
|
Although rare, it is possible that your test can pass locally but fail in CI.
|
||||||
|
|
||||||
|
#### Busting Cache
|
||||||
|
In certain circumstances, the CircleCI cache can become stale. In order to bust the cache, we've implemented a runtime boolean parameter in Circle CI creatively name BUST_CACHE. To execute:
|
||||||
|
1. Navigate to the branch in Circle CI believed to have stale cache.
|
||||||
|
1. Click on the 'Trigger Pipeline' button.
|
||||||
|
1. Add Parameter -> Parameter Type = boolean , Name = BUST_CACHE ,Value = true
|
||||||
|
1. Click 'Trigger Pipeline'
|
||||||
|
|
||||||
|
#### Run tests in the same container as CI
|
||||||
|
|
||||||
|
In extreme cases, tests can fail due to the constraints of running within a container. To execute tests in exactly the same way as run in CircleCI.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
// Replace {X.X.X} with the current Playwright version
|
||||||
|
// from our package.json or circleCI configuration file
|
||||||
|
docker run --rm --network host --cpus="2" -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
At this point, you're running inside the same container and with 2 cpu cores. You can specify the unit tests:
|
||||||
|
```sh
|
||||||
|
npm run test
|
||||||
|
```
|
||||||
|
or e2e tests:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep <the testcase name>
|
||||||
|
```
|
92
app.js
92
app.js
@ -1,92 +0,0 @@
|
|||||||
/*global process*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Usage:
|
|
||||||
*
|
|
||||||
* npm install minimist express
|
|
||||||
* node app.js [options]
|
|
||||||
*/
|
|
||||||
|
|
||||||
const options = require('minimist')(process.argv.slice(2));
|
|
||||||
const express = require('express');
|
|
||||||
const app = express();
|
|
||||||
const fs = require('fs');
|
|
||||||
const request = require('request');
|
|
||||||
const __DEV__ = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
|
|
||||||
|
|
||||||
// Defaults
|
|
||||||
options.port = options.port || options.p || 8080;
|
|
||||||
options.host = options.host || 'localhost';
|
|
||||||
options.directory = options.directory || options.D || '.';
|
|
||||||
|
|
||||||
// Show command line options
|
|
||||||
if (options.help || options.h) {
|
|
||||||
console.log("\nUsage: node app.js [options]\n");
|
|
||||||
console.log("Options:");
|
|
||||||
console.log(" --help, -h Show this message.");
|
|
||||||
console.log(" --port, -p <number> Specify port.");
|
|
||||||
console.log(" --directory, -D <bundle> Serve files from specified directory.");
|
|
||||||
console.log("");
|
|
||||||
process.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
app.disable('x-powered-by');
|
|
||||||
|
|
||||||
app.use('/proxyUrl', function proxyRequest(req, res, next) {
|
|
||||||
console.log('Proxying request to: ', req.query.url);
|
|
||||||
req.pipe(request({
|
|
||||||
url: req.query.url,
|
|
||||||
strictSSL: false
|
|
||||||
}).on('error', next)).pipe(res);
|
|
||||||
});
|
|
||||||
|
|
||||||
class WatchRunPlugin {
|
|
||||||
apply(compiler) {
|
|
||||||
compiler.hooks.emit.tapAsync('WatchRunPlugin', (compilation, callback) => {
|
|
||||||
console.log('Begin compile at ' + new Date());
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const webpack = require('webpack');
|
|
||||||
let webpackConfig;
|
|
||||||
if (__DEV__) {
|
|
||||||
webpackConfig = require('./webpack.dev');
|
|
||||||
webpackConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
|
||||||
webpackConfig.entry.openmct = [
|
|
||||||
'webpack-hot-middleware/client?reload=true',
|
|
||||||
webpackConfig.entry.openmct
|
|
||||||
];
|
|
||||||
webpackConfig.plugins.push(new WatchRunPlugin());
|
|
||||||
} else {
|
|
||||||
webpackConfig = require('./webpack.coverage');
|
|
||||||
}
|
|
||||||
|
|
||||||
const compiler = webpack(webpackConfig);
|
|
||||||
|
|
||||||
app.use(require('webpack-dev-middleware')(
|
|
||||||
compiler,
|
|
||||||
{
|
|
||||||
publicPath: '/dist',
|
|
||||||
stats: 'errors-warnings'
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
if (__DEV__) {
|
|
||||||
app.use(require('webpack-hot-middleware')(
|
|
||||||
compiler,
|
|
||||||
{}
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expose index.html for development users.
|
|
||||||
app.get('/', function (req, res) {
|
|
||||||
fs.createReadStream('index.html').pipe(res);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Finally, open the HTTP server and log the instance to the console
|
|
||||||
app.listen(options.port, options.host, function () {
|
|
||||||
console.log('Open MCT application running at %s:%s', options.host, options.port);
|
|
||||||
});
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#*****************************************************************************
|
#*****************************************************************************
|
||||||
#* Open MCT, Copyright (c) 2014-2022, United States Government
|
#* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
#* as represented by the Administrator of the National Aeronautics and Space
|
#* as represented by the Administrator of the National Aeronautics and Space
|
||||||
#* Administration. All rights reserved.
|
#* Administration. All rights reserved.
|
||||||
#*
|
#*
|
||||||
|
10
codecov.yml
10
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
|
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
Open MCT, Copyright (c) 2014-2022, United States Government
|
Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
as represented by the Administrator of the National Aeronautics and Space
|
as represented by the Administrator of the National Aeronautics and Space
|
||||||
Administration. All rights reserved.
|
Administration. All rights reserved.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<hr>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
209
docs/gendocs.js
209
docs/gendocs.js
@ -1,209 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
|
||||||
* Administration. All rights reserved.
|
|
||||||
*
|
|
||||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* Open MCT includes source code licensed under additional open source
|
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
||||||
* this source code distribution or the Licensing information page available
|
|
||||||
* at runtime from the About dialog for additional information.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*global require,process,__dirname,GLOBAL*/
|
|
||||||
/*jslint nomen: false */
|
|
||||||
|
|
||||||
|
|
||||||
// Usage:
|
|
||||||
// node gendocs.js --in <source directory> --out <dest directory>
|
|
||||||
|
|
||||||
var CONSTANTS = {
|
|
||||||
DIAGRAM_WIDTH: 800,
|
|
||||||
DIAGRAM_HEIGHT: 500
|
|
||||||
},
|
|
||||||
TOC_HEAD = "# Table of Contents";
|
|
||||||
|
|
||||||
GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be defined
|
|
||||||
(function () {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var fs = require("fs"),
|
|
||||||
mkdirp = require("mkdirp"),
|
|
||||||
path = require("path"),
|
|
||||||
glob = require("glob"),
|
|
||||||
marked = require("marked"),
|
|
||||||
split = require("split"),
|
|
||||||
stream = require("stream"),
|
|
||||||
nomnoml = require('nomnoml'),
|
|
||||||
toc = require("markdown-toc"),
|
|
||||||
Canvas = require('canvas'),
|
|
||||||
header = fs.readFileSync(path.resolve(__dirname, 'header.html')),
|
|
||||||
footer = fs.readFileSync(path.resolve(__dirname, 'footer.html')),
|
|
||||||
options = require("minimist")(process.argv.slice(2));
|
|
||||||
|
|
||||||
// Convert from nomnoml source to a target PNG file.
|
|
||||||
function renderNomnoml(source, target) {
|
|
||||||
var canvas =
|
|
||||||
new Canvas(CONSTANTS.DIAGRAM_WIDTH, CONSTANTS.DIAGRAM_HEIGHT);
|
|
||||||
nomnoml.draw(canvas, source, 1.0);
|
|
||||||
canvas.pngStream().pipe(fs.createWriteStream(target));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stream transform.
|
|
||||||
// Pulls out nomnoml diagrams from fenced code blocks and renders them
|
|
||||||
// as PNG files in the output directory, prefixed with a provided name.
|
|
||||||
// The fenced code blocks will be replaced with Markdown in the
|
|
||||||
// output of this stream.
|
|
||||||
function nomnomlifier(outputDirectory, prefix) {
|
|
||||||
var transform = new stream.Transform({ objectMode: true }),
|
|
||||||
isBuilding = false,
|
|
||||||
counter = 1,
|
|
||||||
outputPath,
|
|
||||||
source = "";
|
|
||||||
|
|
||||||
transform._transform = function (chunk, encoding, done) {
|
|
||||||
if (!isBuilding) {
|
|
||||||
if (chunk.trim().indexOf("```nomnoml") === 0) {
|
|
||||||
var outputFilename = prefix + '-' + counter + '.png';
|
|
||||||
outputPath = path.join(outputDirectory, outputFilename);
|
|
||||||
this.push([
|
|
||||||
"\n![Diagram ",
|
|
||||||
counter,
|
|
||||||
"](",
|
|
||||||
outputFilename,
|
|
||||||
")\n\n"
|
|
||||||
].join(""));
|
|
||||||
isBuilding = true;
|
|
||||||
source = "";
|
|
||||||
counter += 1;
|
|
||||||
} else {
|
|
||||||
// Otherwise, pass through
|
|
||||||
this.push(chunk + '\n');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (chunk.trim() === "```") {
|
|
||||||
// End nomnoml
|
|
||||||
renderNomnoml(source, outputPath);
|
|
||||||
isBuilding = false;
|
|
||||||
} else {
|
|
||||||
source += chunk + '\n';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
|
|
||||||
return transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert from Github-flavored Markdown to HTML
|
|
||||||
function gfmifier(renderTOC) {
|
|
||||||
var transform = new stream.Transform({ objectMode: true }),
|
|
||||||
markdown = "";
|
|
||||||
transform._transform = function (chunk, encoding, done) {
|
|
||||||
markdown += chunk;
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
transform._flush = function (done) {
|
|
||||||
if (renderTOC){
|
|
||||||
// Prepend table of contents
|
|
||||||
markdown =
|
|
||||||
[ TOC_HEAD, toc(markdown).content, "", markdown ].join("\n");
|
|
||||||
}
|
|
||||||
this.push(header);
|
|
||||||
this.push(marked(markdown));
|
|
||||||
this.push(footer);
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
return transform;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom renderer for marked; converts relative links from md to html,
|
|
||||||
// and makes headings linkable.
|
|
||||||
function CustomRenderer() {
|
|
||||||
var renderer = new marked.Renderer(),
|
|
||||||
customRenderer = Object.create(renderer);
|
|
||||||
customRenderer.heading = function (text, level) {
|
|
||||||
var escapedText = (text || "").trim().toLowerCase().replace(/\W/g, "-"),
|
|
||||||
aOpen = "<a name=\"" + escapedText + "\" href=\"#" + escapedText + "\">",
|
|
||||||
aClose = "</a>";
|
|
||||||
return aOpen + renderer.heading.apply(renderer, arguments) + aClose;
|
|
||||||
};
|
|
||||||
// Change links to .md files to .html
|
|
||||||
customRenderer.link = function (href, title, text) {
|
|
||||||
// ...but only if they look like relative paths
|
|
||||||
return (href || "").indexOf(":") === -1 && href[0] !== "/" ?
|
|
||||||
renderer.link(href.replace(/\.md/, ".html"), title, text) :
|
|
||||||
renderer.link.apply(renderer, arguments);
|
|
||||||
};
|
|
||||||
return customRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
options['in'] = options['in'] || options.i;
|
|
||||||
options.out = options.out || options.o;
|
|
||||||
|
|
||||||
marked.setOptions({
|
|
||||||
renderer: new CustomRenderer(),
|
|
||||||
gfm: true,
|
|
||||||
tables: true,
|
|
||||||
breaks: false,
|
|
||||||
pedantic: false,
|
|
||||||
sanitize: true,
|
|
||||||
smartLists: true,
|
|
||||||
smartypants: false
|
|
||||||
});
|
|
||||||
|
|
||||||
// Convert all markdown files.
|
|
||||||
// First, pull out nomnoml diagrams.
|
|
||||||
// Then, convert remaining Markdown to HTML.
|
|
||||||
glob(options['in'] + "/**/*.md", {}, function (err, files) {
|
|
||||||
files.forEach(function (file) {
|
|
||||||
var destination = file.replace(options['in'], options.out)
|
|
||||||
.replace(/md$/, "html"),
|
|
||||||
destPath = path.dirname(destination),
|
|
||||||
prefix = path.basename(destination).replace(/\.html$/, ""),
|
|
||||||
//Determine whether TOC should be rendered for this file based
|
|
||||||
//on regex provided as command line option
|
|
||||||
renderTOC = file.match(options['suppress-toc'] || "") === null;
|
|
||||||
|
|
||||||
mkdirp(destPath, function (err) {
|
|
||||||
fs.createReadStream(file, { encoding: 'utf8' })
|
|
||||||
.pipe(split())
|
|
||||||
.pipe(nomnomlifier(destPath, prefix))
|
|
||||||
.pipe(gfmifier(renderTOC))
|
|
||||||
.pipe(fs.createWriteStream(destination, {
|
|
||||||
encoding: 'utf8'
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Also copy over all HTML, CSS, or PNG files
|
|
||||||
glob(options['in'] + "/**/*.@(html|css|png)", {}, function (err, files) {
|
|
||||||
files.forEach(function (file) {
|
|
||||||
var destination = file.replace(options['in'], options.out),
|
|
||||||
destPath = path.dirname(destination),
|
|
||||||
streamOptions = {};
|
|
||||||
if (file.match(/png$/)) {
|
|
||||||
streamOptions.encoding = null;
|
|
||||||
} else {
|
|
||||||
streamOptions.encoding = 'utf8';
|
|
||||||
}
|
|
||||||
|
|
||||||
mkdirp(destPath, function (err) {
|
|
||||||
fs.createReadStream(file, streamOptions)
|
|
||||||
.pipe(fs.createWriteStream(destination, streamOptions));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}());
|
|
@ -1,9 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="//nasa.github.io/openmct/static/res/css/styles.css">
|
|
||||||
<link rel="stylesheet"
|
|
||||||
href="//nasa.github.io/openmct/static/res/css/documentation.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
## Sections
|
## Sections
|
||||||
|
|
||||||
* The [API](api/) document is generated from inline documentation
|
* The [API](api/) uses inline documentation
|
||||||
using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
|
using [TypeScript](https://www.typescriptlang.org) and some legacy [JSDoc](https://jsdoc.app/). It describes the JavaScript objects and
|
||||||
functions that make up the software platform.
|
functions that make up the software platform.
|
||||||
|
|
||||||
* The [Development Process](process/) document describes the
|
* The [Development Process](process/) document describes the
|
||||||
|
30
docs/src/process/release.md
Normal file
30
docs/src/process/release.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
# Release of NASA Open MCT NPM Package
|
||||||
|
|
||||||
|
This document outlines the process and key considerations for releasing a new version of the NASA Open MCT project as an NPM (Node Package Manager) package.
|
||||||
|
|
||||||
|
## 1. Pre-requisites
|
||||||
|
|
||||||
|
Before releasing a new version of the NASA Open MCT NPM package, ensure all dependencies are updated, and comprehensive tests are performed. This ensures compatibility and performance of the Open MCT within the Node.js ecosystem.
|
||||||
|
|
||||||
|
## 2. Versioning
|
||||||
|
|
||||||
|
Versioning is a critical step for package release. The Open MCT team follows [Semantic Versioning (SemVer)](https://semver.org) that consists of three major components: MAJOR.MINOR.PATCH. These ensure a structured process for updating, bug fixes, backward compatibility, and software progress.
|
||||||
|
|
||||||
|
## 3. Changelog Maintenance
|
||||||
|
|
||||||
|
A comprehensive changelog file, `CHANGELOG.md`, documents any changes, adding a high level of transparencies for anyone desiring to look into the status of new and past progress. It includes the summation of any major new enhancements, changes, bug fixes, and the credits to the users responsible for each unique progress.
|
||||||
|
|
||||||
|
## 4. Notable Changes Labels on GitHub PRs
|
||||||
|
|
||||||
|
For the Open MCT package, we leverage GitHub's Pull Request (PR) mechanisms extensively, with three important PR labels dedicated to signifying 'notable_changes':
|
||||||
|
|
||||||
|
- **Breaking Change** Highlights the integration of changes that are suspected to break, or without a doubt will break, backward compatibility. These should signal to users the upgrade might be seamless only if dependency and integration factors are properly managed, if not, one should expect to manage atypical technical snags.
|
||||||
|
- **API change** Signifies when a contribution makes any complete or under layer changes to the communication or its supporting access processes. This label flags required see-through insight on how the web-based control panel sees and manipulates any value and or network logs.
|
||||||
|
- **Default Behavior Change:** In the incident an update either adjusts a form to or integrates a not previously kept setting or plugin. i.e. autoscale is enabled by default when working with plots.
|
||||||
|
|
||||||
|
## 6. Community & Contributions
|
||||||
|
|
||||||
|
A flat community and the rounded center are kept in continuous celebration, with the given station open for two open-specifying dialogues, research, and all-for development probing. State the ownership for a handed looped, a welcome for even structure-core and architectural draft and impend.
|
||||||
|
|
||||||
|
Thank you for your collaboration and commitment to moving the project onto a text big club.
|
@ -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.
|
||||||
|
15
e2e/.eslintrc.cjs
Normal file
15
e2e/.eslintrc.cjs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
module.exports = {
|
||||||
|
extends: ['plugin:playwright/playwright-test'],
|
||||||
|
rules: {
|
||||||
|
'playwright/max-nested-describe': ['error', { max: 1 }]
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['tests/visual/*.spec.js'],
|
||||||
|
rules: {
|
||||||
|
'playwright/no-wait-for-timeout': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
@ -1,15 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
module.exports = {
|
|
||||||
"extends": ["plugin:playwright/playwright-test"],
|
|
||||||
"rules": {
|
|
||||||
"playwright/max-nested-describe": ["error", { "max": 1 }]
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["tests/visual/*.spec.js"],
|
|
||||||
"rules": {
|
|
||||||
"playwright/no-wait-for-timeout": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
33
e2e/.percy.ci.yml
Normal file
33
e2e/.percy.ci.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
version: 2
|
||||||
|
snapshot:
|
||||||
|
widths: [1024]
|
||||||
|
min-height: 1440 # px
|
||||||
|
percyCSS: |
|
||||||
|
/* Clock indicator... your days are numbered */
|
||||||
|
.t-indicator-clock > .label {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
.c-input--datetime {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Timer object text */
|
||||||
|
.c-ne__time-and-creator {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor ticks */
|
||||||
|
div.c-conductor-axis.c-conductor__ticks > svg {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Embedded timestamp in notebooks */
|
||||||
|
.c-ne__embed__time{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor Start Time */
|
||||||
|
.c-compact-tc__setting-value{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Chart Area for Plots */
|
||||||
|
.gl-plot-chart-area{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
|
32
e2e/.percy.nightly.yml
Normal file
32
e2e/.percy.nightly.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
version: 2
|
||||||
|
snapshot:
|
||||||
|
widths: [1024, 2000]
|
||||||
|
min-height: 1440 # px
|
||||||
|
percyCSS: |
|
||||||
|
/* Clock indicator... your days are numbered */
|
||||||
|
.t-indicator-clock > .label {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
.c-input--datetime {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Timer object text */
|
||||||
|
.c-ne__time-and-creator {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor ticks */
|
||||||
|
div.c-conductor-axis.c-conductor__ticks > svg {
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Embedded timestamp in notebooks */
|
||||||
|
.c-ne__embed__time{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Time Conductor Start Time */
|
||||||
|
.c-compact-tc__setting-value{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
||||||
|
/* Chart Area for Plots */
|
||||||
|
.gl-plot-chart-area{
|
||||||
|
opacity: 0 !important;
|
||||||
|
}
|
@ -1,6 +0,0 @@
|
|||||||
version: 2
|
|
||||||
snapshot:
|
|
||||||
widths: [1024, 2000]
|
|
||||||
min-height: 1440 # px
|
|
||||||
discovery:
|
|
||||||
concurrency: 2 # https://github.com/percy/cli/discussions/1067
|
|
386
e2e/README.md
386
e2e/README.md
@ -8,7 +8,7 @@ This document is designed to capture on the What, Why, and How's of writing and
|
|||||||
|
|
||||||
1. [Getting Started](#getting-started)
|
1. [Getting Started](#getting-started)
|
||||||
2. [Types of Testing](#types-of-e2e-testing)
|
2. [Types of Testing](#types-of-e2e-testing)
|
||||||
3. [Architecture](#architecture)
|
3. [Architecture](#test-architecture-and-ci)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
@ -51,11 +51,13 @@ Next, you should walk through our implementation of Playwright in Open MCT:
|
|||||||
|
|
||||||
## Types of e2e Testing
|
## Types of e2e Testing
|
||||||
|
|
||||||
e2e testing describes the layer at which a test is performed without prescribing the assertions which are made. Generally, when writing an e2e test, we have three choices to make on an assertion strategy:
|
e2e testing describes the layer at which a test is performed without prescribing the assertions which are made. Generally, when writing an e2e test, we have five choices to make on an assertion strategy:
|
||||||
|
|
||||||
1. Functional - Verifies the functional correctness of the application. Sometimes interchanged with e2e or regression testing.
|
1. Functional - Verifies the functional correctness of the application. Sometimes interchanged with e2e or regression testing.
|
||||||
2. Visual - Verifies the "look and feel" of the application and can only detect _undesirable changes when compared to a previous baseline_.
|
2. Visual - Verifies the "look and feel" of the application and can only detect _undesirable changes when compared to a previous baseline_.
|
||||||
3. Snapshot - Similar to Visual in that it captures the "look" of the application and can only detect _undesirable changes when compared to a previous baseline_. **Generally not preferred due to advanced setup necessary.**
|
3. Snapshot - Similar to Visual in that it captures the "look" of the application and can only detect _undesirable changes when compared to a previous baseline_. **Generally not preferred due to advanced setup necessary.**
|
||||||
|
4. Accessibility - Verifies that the application meets the accessibility standards defined by the [WCAG organization](https://www.w3.org/WAI/standards-guidelines/wcag/).
|
||||||
|
5. Performance - Verifies that application provides a performant experience. Like Snapshot testing, these tests are generally not recommended due to their difficulty in providing a consistent result.
|
||||||
|
|
||||||
When choosing between the different testing strategies, think only about the assertion that is made at the end of the series of test steps. "I want to verify that the Timer plugin functions correctly" vs "I want to verify that the Timer plugin does not look different than originally designed".
|
When choosing between the different testing strategies, think only about the assertion that is made at the end of the series of test steps. "I want to verify that the Timer plugin functions correctly" vs "I want to verify that the Timer plugin does not look different than originally designed".
|
||||||
|
|
||||||
@ -72,63 +74,136 @@ 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
|
||||||
|
|
||||||
- Our Snapshot tests receive a `@snapshot` tag.
|
- Our Snapshot tests receive a `@snapshot` tag.
|
||||||
- Snapshots need to be executed within the official Playwright container to ensure we're using the exact rendering platform in CI and locally.
|
- Snapshots need to be executed within the official Playwright container to ensure we're using the exact rendering platform in CI and locally. To do a valid comparison locally:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:[GET THIS VERSION FROM OUR CIRCLECI CONFIG FILE]-focal /bin/bash
|
// Replace {X.X.X} with the current Playwright version
|
||||||
|
// from our package.json or circleCI configuration file
|
||||||
|
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
|
||||||
npm install
|
npm install
|
||||||
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot
|
npm run test:e2e:checksnapshots
|
||||||
```
|
```
|
||||||
|
|
||||||
### (WIP) Updating Snapshots
|
### Updating Snapshots
|
||||||
|
|
||||||
When the `@snapshot` tests fail, they will need to be evaluated to see if the failure is an acceptable change or
|
When the `@snapshot` tests fail, they will need to be evaluated to determine if the failure is an acceptable and desireable or an unintended regression.
|
||||||
|
|
||||||
|
To compare a snapshot, run a test and open the html report with the 'Expected' vs 'Actual' screenshot. If the actual screenshot is preferred, then the source-controlled 'Expected' snapshots will need to be updated with the following scripts.
|
||||||
|
|
||||||
|
MacOS
|
||||||
|
|
||||||
|
```
|
||||||
|
npm run test:e2e:updatesnapshots
|
||||||
|
```
|
||||||
|
|
||||||
|
Linux/CI
|
||||||
|
|
||||||
|
```sh
|
||||||
|
// Replace {X.X.X} with the current Playwright version
|
||||||
|
// from our package.json or circleCI configuration file
|
||||||
|
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
|
||||||
|
npm install
|
||||||
|
npm run test:e2e:updatesnapshots
|
||||||
|
```
|
||||||
|
|
||||||
|
Once that's done, you'll need to run the following to verify that the changes do not cause more problems:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run test:e2e:checksnapshots
|
||||||
|
```
|
||||||
|
|
||||||
|
## Automated Accessibility (a11y) Testing
|
||||||
|
|
||||||
|
Open MCT incorporates accessibility testing through two primary methods to ensure its compliance with accessibility standards:
|
||||||
|
|
||||||
|
1. **Usage of Playwright's Locator Strategy**: Open MCT utilizes Playwright's locator strategy, specifically the [page.getByRole('') function](https://playwright.dev/docs/api/class-framelocator#frame-locator-get-by-role), to ensure that web elements are accessible via assistive technologies. This approach focuses on the accessibility of elements rather than full adherence to a11y guidelines, which is covered in the second method.
|
||||||
|
|
||||||
|
2. **Enforcing a11y Guidelines with Playwright Axe Plugin**: To rigorously enforce a11y guideline compliance, Open MCT employs the [playwright axe plugin](https://playwright.dev/docs/accessibility-testing). This is achieved through the `scanForA11yViolations` function within the visual testing suite. This method not only benefits from the existing coverage of the visual tests but also targets specific a11y issues, such as `color-contrast` violations, which are particularly pertinent in the context of visual testing.
|
||||||
|
|
||||||
|
### a11y Standards (WCAG and Section 508)
|
||||||
|
|
||||||
|
Playwright axe supports a wide range of [WCAG Standards](https://playwright.dev/docs/accessibility-testing#scanning-for-wcag-violations) to test against. Open MCT is testing against the [Section 508](https://www.section508.gov/test/testing-overview/) accessibility guidelines with the intent to support higher standards over time. As of 2024, Section508 requirements now map completely to WCAG 2.0 AA. In the future, Section 508 requirements may map to WCAG 2.1 AA.
|
||||||
|
|
||||||
|
### Reading an a11y test failure
|
||||||
|
|
||||||
|
When an a11y test fails, the result must be interpreted in the html test report or the a11y report json artifact stored in the `/test-results/` folder. The json structure should be parsed for `"violations"` by `"id"` and identified `"target"`. Example provided for the 'color-contrast-enhanced' violation.
|
||||||
|
|
||||||
|
```json
|
||||||
|
"violations":
|
||||||
|
{
|
||||||
|
"id": "color-contrast-enhanced",
|
||||||
|
"impact": "serious",
|
||||||
|
"html": "<span class=\"label c-indicator__label\">0 Snapshots <button aria-label=\"Show Snapshots\">Show</button></span>",
|
||||||
|
"target": [
|
||||||
|
".s-status-off > .label.c-indicator__label"
|
||||||
|
],
|
||||||
|
"failureSummary": "Fix any of the following:\n Element has insufficient color contrast of 6.51 (foreground color: #aaaaaa, background color: #262626, font size: 8.1pt (10.8px), font weight: normal). Expected contrast ratio of 7:1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Performance Testing
|
## Performance Testing
|
||||||
|
|
||||||
The open source performance tests function mostly as a contract for the locator logic, functionality, and assumptions will work in our downstream, closed source test suites.
|
The open source performance tests function in three ways which match their naming and folder structure:
|
||||||
|
|
||||||
They're found under `./e2e/tests/performance` and are to be executed with the following npm script:
|
`./e2e/tests/performance` - The tests at the root of this folder path detect functional changes which are mostly apparent with large performance regressions like [this](https://github.com/nasa/openmct/issues/6879). These tests run against openmct webpack in `production-mode` with the `npm run test:perf:localhost` script.
|
||||||
|
`./e2e/tests/performance/contract/` - These tests serve as [contracts](https://martinfowler.com/bliki/ContractTest.html) for the locator logic, functionality, and assumptions will work in our downstream, closed source test suites. These tests run against openmct webpack in `dev-mode` with the `npm run test:perf:contract` script.
|
||||||
`npm run test:perf`
|
`./e2e/tests/performance/memory/` - These tests execute memory leak detection checks in various ways. This is expected to evolve as we move to the `memlab` project. These tests run against openmct webpack in `production-mode` with the `npm run test:perf:memory` script.
|
||||||
|
|
||||||
These tests are expected to become blocking and gating with assertions as we extend the capabilities of Playwright.
|
These tests are expected to become blocking and gating with assertions as we extend the capabilities of Playwright.
|
||||||
|
|
||||||
|
In addition to the explicit definition of performance tests, we also ensure that our test timeout timing is "tight" to catch performance regressions detectable by action timeouts. i.e. [Notebooks load much slower than they used to #6459](https://github.com/nasa/openmct/issues/6459)
|
||||||
|
|
||||||
## Test Architecture and CI
|
## Test Architecture and CI
|
||||||
|
|
||||||
### Architecture (TODO)
|
### Architecture
|
||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
|
|
||||||
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
|
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
|
||||||
|
|
||||||
- `./helper` - contains helper functions or scripts which are leveraged directly within the testsuites. i.e. non-default plugin scripts injected into DOM
|
|File Path|Description|
|
||||||
- `./test-data` - contains test data which is leveraged or generated in the functional, performance, or visual test suites. i.e. localStorage data
|
|:-:|-|
|
||||||
- `./tests/functional` - the bulk of the tests are contained within this folder to verify the functionality of open mct
|
|`./helper` | Contains helper functions or scripts which are leveraged directly within the test suites (e.g.: non-default plugin scripts injected into the DOM)|
|
||||||
- `./tests/functional/example/` - tests which specifically verify the example plugins
|
|`./test-data` | Contains test data which is leveraged or generated in the functional, performance, or visual test suites (e.g.: localStorage data).|
|
||||||
- `./tests/functional/plugins/` - tests which loosely test each plugin. This folder is the most likely to change. Note: some @snapshot tests are still contained within this structure
|
|`./tests/functional` | The bulk of the tests are contained within this folder to verify the functionality of Open MCT.|
|
||||||
- `./tests/framework/` - tests which verify that our testframework functionality and assumptions will continue to work based on further refactoring or playwright version changes
|
|`./tests/functional/example/` | Tests which specifically verify the example plugins (e.g.: Sine Wave Generator).|
|
||||||
- `./tests/performance/` - performance tests
|
|`./tests/functional/plugins/` | Tests which loosely test each plugin. This folder is the most likely to change. Note: some `@snapshot` tests are still contained within this structure.|
|
||||||
- `./tests/visual/` - Visual tests
|
|`./tests/framework/` | Tests which verify that our testing framework's functionality and assumptions will continue to work based on further refactoring or Playwright version changes (e.g.: verifying custom fixtures and appActions).|
|
||||||
- `./appActions.js` - Contains common fixtures which can be leveraged by testcase authors to quickly move through the application when writing new tests.
|
|`./tests/performance/` | Performance tests which should be run on every commit.|
|
||||||
- `./baseFixture.js` - Contains base fixtures which only extend default `@playwright/test` functionality. The goal is to remove these fixtures as native Playwright APIs improve.
|
|`./tests/performance/contract/` | A subset of performance tests which are designed to provide a contract between the open source tests which are run on every commit and the downstream tests which are run post merge and with other frameworks.|
|
||||||
|
|`./tests/performance/memory` | A subset of performance tests which are designed to test for memory leaks.|
|
||||||
|
|`./tests/visual-a11y/` | Visual tests and accessibility tests.|
|
||||||
|
|`./tests/visual-a11y/component/` | Visual and accessibility tests which are only run against a single component.|
|
||||||
|
|`./appActions.js` | Contains common methods which can be leveraged by test case authors to quickly move through the application when writing new tests.|
|
||||||
|
|`./baseFixture.js` | Contains base fixtures which only extend default `@playwright/test` functionality. The expectation is that these fixtures will be removed as the native Playwright API improves|
|
||||||
|
|
||||||
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
|
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
|
||||||
|
|
||||||
@ -138,10 +213,13 @@ Where possible, we try to run Open MCT without modification or configuration cha
|
|||||||
|
|
||||||
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
|
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
|
||||||
|
|
||||||
- `./playwright-ci.config.js` - Used when running in CI or to debug CI issues locally
|
|Config File|Description|
|
||||||
- `./playwright-local.config.js` - Used when running locally
|
|:-:|-|
|
||||||
- `./playwright-performance.config.js` - Used when running performance tests in CI or locally
|
|`./playwright-ci.config.js` | Used when running in CI or to debug CI issues locally|
|
||||||
- `./playwright-visual.config.js` - Used to run the visual tests in CI or locally
|
|`./playwright-local.config.js` | Used when running locally|
|
||||||
|
|`./playwright-performance.config.js` | Used when running performance tests in CI or locally|
|
||||||
|
|`./playwright-performance-devmode.config.js` | Used when running performance tests in CI or locally|
|
||||||
|
|`./playwright-visual-a11y.config.js` | Used to run the visual and a11y tests in CI or locally|
|
||||||
|
|
||||||
#### Test Tags
|
#### Test Tags
|
||||||
|
|
||||||
@ -149,13 +227,17 @@ Test tags are a great way of organizing tests outside of a file structure. To le
|
|||||||
|
|
||||||
Current list of test tags:
|
Current list of test tags:
|
||||||
|
|
||||||
- `@ipad` - Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no Create button).
|
|Test Tag|Description|
|
||||||
- `@gds` - Denotes a GDS Test Case used in the VIPER Mission.
|
|:-:|-|
|
||||||
- `@addInit` - Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of app.js.
|
|`@mobile` | Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no create button).|
|
||||||
- `@localStorage` - Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).
|
|`@a11y` | Test case or test suite to execute playwright-axe accessibility checks and generate a11y reports.|
|
||||||
- `@snapshot` - Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.
|
|`@gds` | Denotes a GDS Test Case used in the VIPER Mission.|
|
||||||
- `@unstable` - A new test or test which is known to be flaky.
|
|`@addInit` | Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of `npm start`.|
|
||||||
- `@2p` - Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.
|
|`@localStorage` | Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB). See [note](#utilizing-localstorage)|
|
||||||
|
|`@snapshot` | Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.|
|
||||||
|
|`@unstable` | A new test or test which is known to be flaky.|
|
||||||
|
|`@2p` | Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.|
|
||||||
|
|`@generatedata` | Indicates that a test is used to generate testdata or test the generated test data. Usually to be associated with localstorage, but this may grow over time.|
|
||||||
|
|
||||||
### Continuous Integration
|
### Continuous Integration
|
||||||
|
|
||||||
@ -174,24 +256,27 @@ CircleCI
|
|||||||
- Stable e2e tests against ubuntu and chrome
|
- Stable e2e tests against ubuntu and chrome
|
||||||
- Performance tests against ubuntu and chrome
|
- Performance tests against ubuntu and chrome
|
||||||
- e2e tests are linted
|
- e2e tests are linted
|
||||||
|
- Visual and a11y tests are run in a single resolution on the default `espresso` theme
|
||||||
|
|
||||||
#### 2. Per-Merge Testing
|
#### 2. Per-Merge Testing
|
||||||
|
|
||||||
Github Actions / Workflow
|
Github Actions / Workflow
|
||||||
|
|
||||||
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
|
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
|
||||||
- Visual Tests. Triggered with Github Label Event 'pr:visual'
|
- CouchDB Tests. Triggered on PR Create and again with Github Label Event 'pr:e2e:couchdb'
|
||||||
|
|
||||||
#### 3. Scheduled / Batch Testing
|
#### 3. Scheduled / Batch Testing
|
||||||
|
|
||||||
Nightly Testing in Circle CI
|
Nightly Testing in Circle CI
|
||||||
|
|
||||||
- Full e2e suite against ubuntu and chrome
|
- Full e2e suite against ubuntu and chrome, firefox, and an MMOC resolution profile
|
||||||
- Performance tests against ubuntu and chrome
|
- Performance tests against ubuntu and chrome
|
||||||
|
- CouchDB suite
|
||||||
|
- Visual and a11y Tests are run in the full profile
|
||||||
|
|
||||||
Github Actions / Workflow
|
Github Actions / Workflow
|
||||||
|
|
||||||
- Visual Test baseline generation.
|
- None at the moment
|
||||||
|
|
||||||
#### Parallelism and Fast Feedback
|
#### Parallelism and Fast Feedback
|
||||||
|
|
||||||
@ -211,7 +296,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:
|
||||||
|
|
||||||
@ -222,7 +308,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:**
|
||||||
|
|
||||||
@ -236,10 +322,22 @@ 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 a Mission-need to support iPad and mobile devices. To run our test suites with mobile devices, please see our `playwright-mobile.config.js` projects.
|
||||||
|
|
||||||
|
In general, our test suite is not designed to run against mobile devices as the mobile experience is a focused version of the application. Core functionality is missing (chiefly the 'Create' button). To bypass the object creation, we leverage the `storageState` properties for starting the mobile tests with localstorage.
|
||||||
|
|
||||||
|
For now, the mobile tests will exist in the /tests/mobile/ suites and be executed with the
|
||||||
|
```sh
|
||||||
|
npm run test:e2e:mobile
|
||||||
|
```
|
||||||
|
command.
|
||||||
|
|
||||||
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
#### **Skipping or executing tests based on browser, os, and/os browser version:**
|
||||||
|
|
||||||
@ -267,29 +365,154 @@ 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 (TODO)
|
In general, strive to test only through the UI as a user would. As stated in the [Playwright Best Practices](https://playwright.dev/docs/best-practices#test-user-visible-behavior):
|
||||||
|
|
||||||
#### How to write a great visual test (TODO)
|
> "Automated tests should verify that the application code works for the end users, and avoid relying on implementation details such as things which users will not typically use, see, or even know about such as the name of a function, whether something is an array, or the CSS class of some element. The end user will see or interact with what is rendered on the page, so your test should typically only see/interact with the same rendered output."
|
||||||
|
|
||||||
|
By adhering to this principle, we can create tests that are both robust and reflective of actual user experiences.
|
||||||
|
|
||||||
|
#### How to make tests robust to function in other contexts (VISTA, COUCHDB, YAMCS, VIPER, etc.)
|
||||||
|
1. Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`. This ensures that your tests will create unique instances of objects for your test to interact with.
|
||||||
|
1. Do not assert on the order or structure of objects available unless you created them yourself. These tests may be used against a persistent datastore like couchdb with many objects in the tree.
|
||||||
|
1. Do not search for your created objects. Open MCT does not performance uniqueness checks so it's possible that your tests will break when run twice.
|
||||||
|
1. Avoid creating locator aliases. This likely means that you're compensating for a bad locator. Improve the application instead.
|
||||||
|
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });` instead of `{ waitUntil: 'networkidle' }`. Tests run against deployments with websockets often have issues with the networkidle detection.
|
||||||
|
|
||||||
|
#### How to make tests faster and more resilient
|
||||||
|
1. Avoid app interaction when possible. The best way of doing this is to navigate directly by URL:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// You can capture the CreatedObjectInfo returned from this appAction:
|
||||||
|
const clock = await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
||||||
|
|
||||||
|
// ...and use its `url` property to navigate directly to it later in the test:
|
||||||
|
await page.goto(clock.url);
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });`
|
||||||
|
- Initial navigation should _almost_ always use the `{ waitUntil: 'domcontentloaded' }` option.
|
||||||
|
1. Avoid repeated setup to test a single assertion. Write longer tests with multiple soft assertions.
|
||||||
|
This ensures that your changes will be picked up with large refactors.
|
||||||
|
|
||||||
|
##### Utilizing LocalStorage
|
||||||
|
1. In order to save test runtime in the case of tests that require a decent amount of initial setup (such as in the case of testing complex displays), you may use [Playwright's `storageState` feature](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state) to generate and load localStorage states.
|
||||||
|
1. To generate a localStorage state to be used in a test:
|
||||||
|
- Add an e2e test to our generateLocalStorageData suite which sets the initial state (creating/configuring objects, etc.), saving it in the `test-data` folder:
|
||||||
|
```js
|
||||||
|
// Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/display_layout_with_child_layouts.json')
|
||||||
|
});
|
||||||
|
```
|
||||||
|
- Load the state from file at the beginning of the desired test suite (within the `test.describe()`). (NOTE: the storage state will be used for each test in the suite, so you may need to create a new suite):
|
||||||
|
```js
|
||||||
|
const LOCALSTORAGE_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'../../../../test-data/display_layout_with_child_layouts.json'
|
||||||
|
);
|
||||||
|
test.use({
|
||||||
|
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH)
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### How to write a great test
|
||||||
|
|
||||||
|
- Avoid using css locators to find elements to the page. Use modern web accessible locators like `getByRole`
|
||||||
|
- Use our [App Actions](./appActions.js) for performing common actions whenever applicable.
|
||||||
|
- Use `waitForPlotsToRender()` before asserting against anything that is dependent upon plot series data being loaded and drawn.
|
||||||
|
- If you create an object outside of using the `createDomainObjectWithDefaults` App Action, make sure to fill in the 'Notes' section of your object with `page.testNotes`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
// Fill the "Notes" section with information about the
|
||||||
|
// currently running test and its project.
|
||||||
|
const { testNotes } = page;
|
||||||
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
await notesInput.fill(testNotes);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### How to Write a Great Visual Test
|
||||||
|
|
||||||
|
1. **Look for the Unknown Unknowns**: Avoid asserting on specific differences in the visual diff. Visual tests are most effective for identifying unknown unknowns.
|
||||||
|
|
||||||
|
2. **Get the App into Interesting States**: Prioritize getting Open MCT into unusual layouts or behaviors before capturing a visual snapshot. For instance, you could open a dropdown menu.
|
||||||
|
|
||||||
|
3. **Expect the Unexpected**: Use functional expect statements only to verify assumptions about the state between steps. A great visual test doesn't fail during the test itself, but rather when changes are reviewed in Percy.io.
|
||||||
|
|
||||||
|
4. **Control Variability**: Account for variations inherent in working with time-based telemetry and clocks.
|
||||||
|
- Utilize `percyCSS` to ignore time-based elements. For more details, consult our [percyCSS file](./.percy.ci.yml).
|
||||||
|
- Use Open MCT's fixed-time mode unless explicitly testing realtime clock
|
||||||
|
- Employ the `createExampleTelemetryObject` appAction to source telemetry and specify a `name` to avoid autogenerated names.
|
||||||
|
|
||||||
|
5. **Hide the Tree and Inspector**: Generally, your test will not require comparisons involving the tree and inspector. These aspects are covered in component-specific tests (explained below). To exclude them from the comparison by default, navigate to the root of the main view with the tree and inspector hidden:
|
||||||
|
- `await page.goto('./#/browse/mine?hideTree=true&hideInspector=true')`
|
||||||
|
|
||||||
|
6. **Component-Specific Tests**: If you wish to focus on a particular component, use the `/visual-a11y/component/` folder and limit the scope of the comparison to that component. For instance:
|
||||||
|
```js
|
||||||
|
await percySnapshot(page, `Tree Pane w/ single level expanded (theme: ${theme})`, {
|
||||||
|
scope: treePane
|
||||||
|
});
|
||||||
|
```
|
||||||
|
- Note: The `scope` variable can be any valid CSS selector.
|
||||||
|
|
||||||
|
7. **Write many `percySnapshot` commands in a single test**: In line with our approach to longer functional tests, we recommend that many test percySnapshots are taken in a single test. For instance:
|
||||||
|
```js
|
||||||
|
//<Some interesting state>
|
||||||
|
await percySnapshot(page, `Before object expanded (theme: ${theme})`);
|
||||||
|
//<Click on object>
|
||||||
|
await percySnapshot(page, `object expanded (theme: ${theme})`);
|
||||||
|
//Select from object
|
||||||
|
await percySnapshot(page, `object selected (theme: ${theme})`)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### How to write a great network test
|
||||||
|
|
||||||
|
- Where possible, it is best to mock out third-party network activity to ensure we are testing application behavior of Open MCT.
|
||||||
|
- It is best to be as specific as possible about the expected network request/response structures in creating your mocks.
|
||||||
|
- Make sure to only mock requests which are relevant to the specific behavior being tested.
|
||||||
|
- Where possible, network requests and responses should be treated in an order-agnostic manner, as the order in which certain requests/responses happen is dynamic and subject to change.
|
||||||
|
|
||||||
|
Some examples of mocking network responses in regards to CouchDB can be found in our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) test file.
|
||||||
|
|
||||||
### Best Practices
|
### Best Practices
|
||||||
|
|
||||||
For now, our best practices exist as self-tested, living documentation in our [exampleTemplate.e2e.spec.js](./tests/framework/exampleTemplate.e2e.spec.js) file.
|
For now, our best practices exist as self-tested, living documentation in our [exampleTemplate.e2e.spec.js](./tests/framework/exampleTemplate.e2e.spec.js) file.
|
||||||
|
|
||||||
### Tips & Tricks (TODO)
|
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
|
||||||
|
|
||||||
|
### Tips & Tricks
|
||||||
|
|
||||||
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
|
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
|
||||||
|
|
||||||
|
- (Advanced) Overriding the Browser's Clock
|
||||||
|
It is possible to override the browser's clock in order to control time-based elements. Since this can cause unwanted behavior (i.e. Tree not rendering), only use this sparingly. To do this, use the `overrideClock` fixture as such:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import { test, expect } from '../../pluginFixtures.js';
|
||||||
|
|
||||||
|
test.describe('foo test suite', () => {
|
||||||
|
|
||||||
|
// All subsequent tests in this suite will override the clock
|
||||||
|
test.use({
|
||||||
|
clockOptions: {
|
||||||
|
now: 1732413600000, // A timestamp given as milliseconds since the epoch
|
||||||
|
shouldAdvanceTime: true // Should the clock tick?
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('bar test', async ({ page }) => {
|
||||||
|
// ...
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
More info and options for `overrideClock` can be found in [baseFixtures.js](baseFixtures.js)
|
||||||
|
|
||||||
- Working with multiple pages
|
- 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
|
||||||
|
|
||||||
@ -303,25 +526,17 @@ We leverage the following official Playwright reporters:
|
|||||||
- Tracefile
|
- Tracefile
|
||||||
- Screenshots
|
- Screenshots
|
||||||
|
|
||||||
When running the tests locally with the `npm run test:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
|
When running the tests locally with the `npm run test:e2e:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
|
||||||
|
|
||||||
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
|
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
|
||||||
|
|
||||||
### e2e Code Coverage
|
### e2e Code Coverage
|
||||||
|
|
||||||
Code coverage is collected during test execution using our custom [baseFixture](./baseFixtures.js). The raw coverage files are stored in a `.nyc_report` directory to be converted into a lcov file with the following [nyc](https://github.com/istanbuljs/nyc) command:
|
Our e2e code coverage is captured and combined with our unit test coverage. For more information, please see our [code coverage documentation](../TESTING.md)
|
||||||
|
|
||||||
```npm run cov:e2e:report```
|
#### Generating e2e code coverage
|
||||||
|
|
||||||
At this point, the nyc linecov report can be published to [codecov.io](https://about.codecov.io/) with the following command:
|
Please read more about our code coverage [here](../TESTING.md#code-coverage)
|
||||||
|
|
||||||
```npm run cov:e2e:stable:publish``` for the stable suite running in ubuntu.
|
|
||||||
or
|
|
||||||
```npm run cov:e2e:full:publish``` for the full suite running against all available platforms.
|
|
||||||
|
|
||||||
Codecov.io will combine each of the above commands with [Codecov.io Flags](https://docs.codecov.com/docs/flags). Effectively, this allows us to combine multiple reports which are run at various stages of our CI Pipeline or run as part of a parallel process.
|
|
||||||
|
|
||||||
This e2e coverage is combined with our unit test report to give a comprehensive (if flawed) view of line coverage.
|
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
@ -371,10 +586,39 @@ A single e2e test in Open MCT is extended to run:
|
|||||||
- How is Open MCT extending default Playwright functionality?
|
- How is Open MCT extending default Playwright functionality?
|
||||||
- What about Component Testing?
|
- What about Component Testing?
|
||||||
|
|
||||||
### Troubleshooting
|
### Writing Tests
|
||||||
|
|
||||||
|
Playwright provides 3 supported methods of debugging and authoring tests:
|
||||||
|
- A 'watch mode' for running tests locally and debugging on the fly
|
||||||
|
- A 'debug mode' for debugging tests and writing assertions against tests
|
||||||
|
- A 'VSCode plugin' for debugging tests within the VSCode IDE.
|
||||||
|
|
||||||
|
Generally, we encourage folks to use the watch mode and provide a script `npm run test:e2e:watch` which launches the launch mode ui and enables hot reloading on the dev server.
|
||||||
|
|
||||||
|
### e2e Troubleshooting
|
||||||
|
|
||||||
|
Please follow the general guide troubleshooting in [the general troubleshooting doc](../TESTING.md#troubleshooting-ci)
|
||||||
|
|
||||||
- Why is my test failing on CI and not locally?
|
|
||||||
- How can I view the failing tests on CI?
|
|
||||||
- Tests won't start because 'Error: <http://localhost:8080/># is already used...'
|
- Tests won't start because 'Error: <http://localhost:8080/># is already used...'
|
||||||
This error will appear when running the tests locally. Sometimes, the webserver is left in an orphaned state and needs to be cleaned up. To clear up the orphaned webserver, execute the following from your Terminal:
|
This error will appear when running the tests locally. Sometimes, the webserver is left in an orphaned state and needs to be cleaned up. To clear up the orphaned webserver, execute the following from your Terminal:
|
||||||
```lsof -n -i4TCP:8080 | awk '{print$2}' | tail -1 | xargs kill -9```
|
```lsof -n -i4TCP:8080 | awk '{print$2}' | tail -1 | xargs kill -9```
|
||||||
|
|
||||||
|
### Upgrading Playwright
|
||||||
|
|
||||||
|
In order to upgrade from one version of Playwright to another, the version should be updated in several places in both `openmct` and `openmct-yamcs` repos. An easy way to identify these locations is to search for the current version in all files and find/replace.
|
||||||
|
|
||||||
|
For reference, all of the locations where the version should be updated are listed below:
|
||||||
|
|
||||||
|
#### **In `openmct`:**
|
||||||
|
|
||||||
|
- `package.json`
|
||||||
|
- Both packages `@playwright/test` and `playwright-core` should be updated to the same target version.
|
||||||
|
- `.circleci/config.yml`
|
||||||
|
- `.github/workflows/e2e-couchdb.yml`
|
||||||
|
- `.github/workflows/e2e-pr.yml`
|
||||||
|
|
||||||
|
#### **In `openmct-yamcs`:**
|
||||||
|
|
||||||
|
- `package.json`
|
||||||
|
- `@playwright/test` should be updated to the target version.
|
||||||
|
- `.github/workflows/yamcs-quickstart-e2e.yml`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -35,6 +35,7 @@
|
|||||||
* @property {string} type the type of domain object to create (e.g.: "Sine Wave Generator").
|
* @property {string} 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'}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +46,17 @@
|
|||||||
* @property {string} url the relative url to the object (for use with `page.goto()`)
|
* @property {string} url the relative url to the object (for use with `page.goto()`)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const Buffer = require('buffer').Buffer;
|
/**
|
||||||
|
* Defines parameters to be used in the creation of a notification.
|
||||||
|
* @typedef {Object} CreateNotificationOptions
|
||||||
|
* @property {string} message the message
|
||||||
|
* @property {'info' | 'alert' | 'error'} severity the severity
|
||||||
|
* @property {import('../src/api/notifications/NotificationAPI').NotificationOptions} [notificationOptions] additional options
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { expect } from '@playwright/test';
|
||||||
|
import { Buffer } from 'buffer';
|
||||||
|
import { v4 as genUuid } from 'uuid';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
* This common function creates a domain object with the default options. It is the preferred way of creating objects
|
||||||
@ -55,31 +66,49 @@ const Buffer = require('buffer').Buffer;
|
|||||||
* @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(
|
||||||
|
page,
|
||||||
|
{ type, name, parent = 'mine', customParameters = {} }
|
||||||
|
) {
|
||||||
|
if (!name) {
|
||||||
|
name = `${type}:${genUuid()}`;
|
||||||
|
}
|
||||||
|
|
||||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
// Navigate to the parent object. This is necessary to create the object
|
// Navigate to the parent object. This is necessary to create the object
|
||||||
// in the correct location, such as a folder, layout, or plot.
|
// in the correct location, such as a folder, layout, or plot.
|
||||||
await page.goto(`${parentUrl}?hideTree=true`);
|
await page.goto(`${parentUrl}`);
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
//Click the Create button
|
//Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
// Click the object specified by 'type'
|
// Click the object specified by 'type'
|
||||||
await page.click(`li: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'
|
||||||
if (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) {
|
||||||
|
// Fill the "Notes" section with information about the
|
||||||
|
// currently running test and its project.
|
||||||
|
const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
|
||||||
|
await notesInput.fill(page.testNotes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are any further parameters, fill them in
|
||||||
|
for (const [key, value] of Object.entries(customParameters)) {
|
||||||
|
const input = page.locator(`form[name="mctForm"] ${key}`);
|
||||||
|
await input.fill('');
|
||||||
|
await input.fill(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click OK button and wait for Navigate event
|
// Click OK button and wait for Navigate event
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.waitForLoadState(),
|
page.waitForLoadState(),
|
||||||
page.click('[aria-label="Save"]'),
|
await page.getByRole('button', { name: 'Save' }).click(),
|
||||||
// Wait for Save Banner to appear
|
// Wait for Save Banner to appear
|
||||||
page.waitForSelector('.c-message-banner__message')
|
page.waitForSelector('.c-message-banner__message')
|
||||||
]);
|
]);
|
||||||
@ -91,23 +120,45 @@ async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine
|
|||||||
|
|
||||||
if (await _isInEditMode(page, uuid)) {
|
if (await _isInEditMode(page, uuid)) {
|
||||||
// Save (exit edit mode)
|
// Save (exit edit mode)
|
||||||
await page.locator('button[title="Save"]').click();
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
await page.locator('li[title="Save and Finish Editing"]').click();
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: name || `Unnamed ${type}`,
|
name,
|
||||||
uuid: uuid,
|
uuid,
|
||||||
url: objectUrl
|
url: objectUrl
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Generate a notification with the given options.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {CreateNotificationOptions} createNotificationOptions
|
||||||
|
*/
|
||||||
|
async function createNotification(page, createNotificationOptions) {
|
||||||
|
await page.evaluate((_createNotificationOptions) => {
|
||||||
|
const { message, severity, options } = _createNotificationOptions;
|
||||||
|
const notificationApi = window.openmct.notifications;
|
||||||
|
if (severity === 'info') {
|
||||||
|
notificationApi.info(message, options);
|
||||||
|
} else if (severity === 'alert') {
|
||||||
|
notificationApi.alert(message, options);
|
||||||
|
} else {
|
||||||
|
notificationApi.error(message, options);
|
||||||
|
}
|
||||||
|
}, createNotificationOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expand an item in the tree by a given object name.
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
*/
|
*/
|
||||||
async function expandTreePaneItemByName(page, name) {
|
async function expandTreePaneItemByName(page, name) {
|
||||||
const treePane = page.locator('#tree-pane');
|
const treePane = page.getByRole('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();
|
||||||
@ -120,24 +171,26 @@ 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) {
|
||||||
|
name = `Plan:${genUuid()}`;
|
||||||
|
}
|
||||||
|
|
||||||
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
// Navigate to the parent object. This is necessary to create the object
|
// Navigate to the parent object. This is necessary to create the object
|
||||||
// in the correct location, such as a folder, layout, or plot.
|
// in the correct location, such as a folder, layout, or plot.
|
||||||
await page.goto(`${parentUrl}?hideTree=true`);
|
await page.goto(`${parentUrl}`);
|
||||||
|
|
||||||
//Click the Create button
|
// Click the Create button
|
||||||
await page.click('button:has-text("Create")');
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
// Click 'Plan' menu option
|
// Click 'Plan' menu option
|
||||||
await page.click(`li:text("Plan")`);
|
await page.click(`li:text("Plan")`);
|
||||||
|
|
||||||
// Modify the name input field of the domain object to accept 'name'
|
// Modify the name input field of the domain object to accept 'name'
|
||||||
if (name) {
|
const nameInput = page.getByLabel('Title', { exact: true });
|
||||||
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);
|
||||||
}
|
|
||||||
|
|
||||||
// Upload buffer from memory
|
// Upload buffer from memory
|
||||||
await page.locator('input#fileElem').setInputFiles({
|
await page.locator('input#fileElem').setInputFiles({
|
||||||
@ -155,7 +208,7 @@ async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
// Wait until the URL is updated
|
// Wait until the URL is updated
|
||||||
await page.waitForURL(`**/mine/*`);
|
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);
|
||||||
|
|
||||||
@ -167,20 +220,102 @@ async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open the given `domainObject`'s context menu from the object tree.
|
* Create a standardized Telemetry Object (Sine Wave Generator) for use in visual tests
|
||||||
* Expands the path to the object and scrolls to it if necessary.
|
* and tests against plotting telemetry (e.g. logPlot tests).
|
||||||
*
|
* @param {import('@playwright/test').Page} page
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the uuid or identifier of the parent object. Defaults to 'mine'
|
||||||
* @param {string} url the url to the object
|
* @returns {Promise<CreatedObjectInfo>} An object containing information about the telemetry object.
|
||||||
*/
|
*/
|
||||||
|
async function createExampleTelemetryObject(page, parent = 'mine') {
|
||||||
|
const parentUrl = await getHashUrlToDomainObject(page, parent);
|
||||||
|
|
||||||
|
await page.goto(`${parentUrl}`);
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
|
await page.locator('li:has-text("Sine Wave Generator")').click();
|
||||||
|
|
||||||
|
const name = 'VIPER Rover Heading';
|
||||||
|
await page.getByRole('dialog').locator('input[type="text"]').fill(name);
|
||||||
|
|
||||||
|
// Fill out the fields with default values
|
||||||
|
await page.getByRole('spinbutton', { name: 'Period' }).fill('10');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Amplitude' }).fill('1');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Offset' }).fill('0');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Data Rate (hz)' }).fill('1');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Phase (radians)' }).fill('0');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Randomness' }).fill('0');
|
||||||
|
await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('0');
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: 'Save' }).click();
|
||||||
|
|
||||||
|
// Wait until the URL is updated
|
||||||
|
await page.waitForURL(`**/${parent}/*`);
|
||||||
|
|
||||||
|
const uuid = await getFocusedObjectUuid(page);
|
||||||
|
const url = await getHashUrlToDomainObject(page, uuid);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
uuid,
|
||||||
|
url
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigates directly to a given object url, in fixed time mode, with the given start and end bounds.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} url The url to the domainObject
|
||||||
|
* @param {string | number} start The starting time bound in milliseconds since epoch
|
||||||
|
* @param {string | number} end The ending time bound in milliseconds since epoch
|
||||||
|
*/
|
||||||
|
async function navigateToObjectWithFixedTimeBounds(page, url, start, end) {
|
||||||
|
await page.goto(
|
||||||
|
`${url}?tc.mode=fixed&tc.timeSystem=utc&tc.startBound=${start}&tc.endBound=${end}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the given `domainObject`'s context menu from the object tree.
|
||||||
|
* Expands the path to the object and scrolls to it if necessary.
|
||||||
|
*
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} url the url to the object
|
||||||
|
*/
|
||||||
async function openObjectTreeContextMenu(page, url) {
|
async function openObjectTreeContextMenu(page, url) {
|
||||||
await page.goto(url);
|
await page.goto(url);
|
||||||
await page.click('button[title="Show selected item in tree"]');
|
await page.getByLabel('Show selected item in tree').click();
|
||||||
await page.locator('.is-navigated-object').click({
|
await page.locator('.is-navigated-object').click({
|
||||||
button: 'right'
|
button: 'right'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expands the entire object tree (every expandable tree item).
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
|
||||||
|
*/
|
||||||
|
async function expandEntireTree(page, treeName = 'Main Tree') {
|
||||||
|
const treeLocator = page.getByRole('tree', {
|
||||||
|
name: treeName
|
||||||
|
});
|
||||||
|
const collapsedTreeItems = treeLocator
|
||||||
|
.getByRole('treeitem', {
|
||||||
|
expanded: false
|
||||||
|
})
|
||||||
|
.locator('span.c-disclosure-triangle.is-enabled');
|
||||||
|
|
||||||
|
while ((await collapsedTreeItems.count()) > 0) {
|
||||||
|
await collapsedTreeItems.nth(0).click();
|
||||||
|
|
||||||
|
// FIXME: Replace hard wait with something event-driven.
|
||||||
|
// Without the wait, this fails periodically due to a race condition
|
||||||
|
// with Vue rendering (loop exits prematurely).
|
||||||
|
// eslint-disable-next-line playwright/no-wait-for-timeout
|
||||||
|
await page.waitForTimeout(200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the UUID of the currently focused object by parsing the current URL
|
* Gets the UUID of the currently focused object by parsing the current URL
|
||||||
* and returning the last UUID in the path.
|
* and returning the last UUID in the path.
|
||||||
@ -203,13 +338,17 @@ 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);
|
||||||
|
let url =
|
||||||
|
'./#/browse/' +
|
||||||
|
[...path]
|
||||||
|
.reverse()
|
||||||
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
.map((object) => window.openmct.objects.makeKeyString(object.identifier))
|
||||||
.join('/');
|
.join('/');
|
||||||
|
|
||||||
@ -219,21 +358,21 @@ async function getHashUrlToDomainObject(page, uuid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}, uuid);
|
}, identifier);
|
||||||
|
|
||||||
return hashUrl;
|
return hashUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilizes the OpenMCT API to detect if the given object has an active transaction (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
|
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} identifier
|
||||||
* @return {Promise<boolean>} true if the object has an active transaction, false otherwise
|
* @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((objectIdentifier) => window.openmct.objects.isTransactionActive(objectIdentifier), identifier);
|
return await page.evaluate(() => window.openmct.editor.isEditing());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -243,13 +382,15 @@ async function _isInEditMode(page, identifier) {
|
|||||||
*/
|
*/
|
||||||
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
async function setTimeConductorMode(page, isFixedTimespan = true) {
|
||||||
// Click 'mode' button
|
// Click 'mode' button
|
||||||
await page.locator('.c-mode-button').click();
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await page.getByRole('button', { name: 'Time Conductor Mode Menu' }).click();
|
||||||
// Switch time conductor mode
|
// Switch time conductor mode. Note, need to wait here for URL to update as the router is debounced.
|
||||||
if (isFixedTimespan) {
|
if (isFixedTimespan) {
|
||||||
await page.locator('data-testid=conductor-modeOption-fixed').click();
|
await page.getByRole('menuitem', { name: /Fixed Timespan/ }).click();
|
||||||
|
await page.waitForURL(/tc\.mode=fixed/);
|
||||||
} else {
|
} else {
|
||||||
await page.locator('data-testid=conductor-modeOption-realtime').click();
|
await page.getByRole('menuitem', { name: /Real-Time/ }).click();
|
||||||
|
await page.waitForURL(/tc\.mode=local/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,9 +412,12 @@ async function setRealTimeMode(page) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -282,23 +426,36 @@ async function setRealTimeMode(page) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
* @param {import('@playwright/test').Locator} offsetButton
|
* @param {import('@playwright/test').Locator} offsetButton
|
||||||
*/
|
*/
|
||||||
async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
async function setTimeConductorOffset(
|
||||||
await offsetButton.click();
|
page,
|
||||||
|
{ startHours, startMins, startSecs, endHours, endMins, endSecs }
|
||||||
if (hours) {
|
) {
|
||||||
await page.fill('.pr-time-controls__hrs', hours);
|
if (startHours) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'Start offset hours' }).fill(startHours);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mins) {
|
if (startMins) {
|
||||||
await page.fill('.pr-time-controls__mins', mins);
|
await page.getByRole('spinbutton', { name: 'Start offset minutes' }).fill(startMins);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secs) {
|
if (startSecs) {
|
||||||
await page.fill('.pr-time-controls__secs', secs);
|
await page.getByRole('spinbutton', { name: 'Start offset seconds' }).fill(startSecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endHours) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'End offset hours' }).fill(endHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endMins) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'End offset minutes' }).fill(endMins);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endSecs) {
|
||||||
|
await page.getByRole('spinbutton', { name: 'End offset seconds' }).fill(endSecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click the check button
|
// Click the check button
|
||||||
await page.locator('.pr-time__buttons .icon-check').click();
|
await page.locator('.pr-time-input--buttons .icon-check').click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -307,8 +464,9 @@ async function setTimeConductorOffset(page, {hours, mins, secs}, offsetButton) {
|
|||||||
* @param {OffsetValues} offset
|
* @param {OffsetValues} offset
|
||||||
*/
|
*/
|
||||||
async function setStartOffset(page, offset) {
|
async function setStartOffset(page, offset) {
|
||||||
const startOffsetButton = page.locator('data-testid=conductor-start-offset-button');
|
// Click 'mode' button
|
||||||
await setTimeConductorOffset(page, offset, startOffsetButton);
|
await page.getByRole('button', { name: 'Time Conductor Mode', exact: true }).click();
|
||||||
|
await setTimeConductorOffset(page, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,20 +475,193 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
/**
|
||||||
module.exports = {
|
* Set the time conductor bounds in fixed time mode
|
||||||
|
*
|
||||||
|
* NOTE: Unless explicitly testing the Time Conductor itself, it is advised to instead
|
||||||
|
* navigate directly to the object with the desired time bounds using `navigateToObjectWithFixedTimeBounds()`.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
|
async function setTimeConductorBounds(page, startDate, endDate) {
|
||||||
|
// Bring up the time conductor popup
|
||||||
|
expect(await page.locator('.l-shell__time-conductor.c-compact-tc').count()).toBe(1);
|
||||||
|
await page.click('.l-shell__time-conductor.c-compact-tc');
|
||||||
|
|
||||||
|
await setTimeBounds(page, startDate, endDate);
|
||||||
|
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the independent time conductor bounds in fixed time mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
|
async function setIndependentTimeConductorBounds(page, startDate, endDate) {
|
||||||
|
// Activate Independent Time Conductor in Fixed Time Mode
|
||||||
|
await page.getByRole('switch').click();
|
||||||
|
|
||||||
|
// Bring up the time conductor popup
|
||||||
|
await page.click('.c-conductor-holder--compact .c-compact-tc');
|
||||||
|
await expect(page.locator('.itc-popout')).toBeInViewport();
|
||||||
|
|
||||||
|
await setTimeBounds(page, startDate, endDate);
|
||||||
|
|
||||||
|
await page.keyboard.press('Enter');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the bounds of the visible conductor in fixed time mode
|
||||||
|
* @private
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
|
async function setTimeBounds(page, startDate, endDate) {
|
||||||
|
if (startDate) {
|
||||||
|
// Fill start time
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Start date' })
|
||||||
|
.fill(startDate.toString().substring(0, 10));
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'Start time' })
|
||||||
|
.fill(startDate.toString().substring(11, 19));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endDate) {
|
||||||
|
// Fill end time
|
||||||
|
await page.getByRole('textbox', { name: 'End date' }).fill(endDate.toString().substring(0, 10));
|
||||||
|
await page
|
||||||
|
.getByRole('textbox', { name: 'End time' })
|
||||||
|
.fill(endDate.toString().substring(11, 19));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Waits and asserts that all plot series data on the page
|
||||||
|
* is loaded and drawn.
|
||||||
|
*
|
||||||
|
* In lieu of a better way to detect when a plot is done rendering,
|
||||||
|
* we [attach a class to the '.gl-plot' element](https://github.com/nasa/openmct/blob/5924d7ea95a0c2d4141c602a3c7d0665cb91095f/src/plugins/plot/MctPlot.vue#L27)
|
||||||
|
* once all pending series data has been loaded. The following appAction retrieves
|
||||||
|
* all plots on the page and waits up to the default timeout for the class to be
|
||||||
|
* attached to each plot.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function waitForPlotsToRender(page) {
|
||||||
|
const plotLocator = page.locator('.gl-plot');
|
||||||
|
for (const plot of await plotLocator.all()) {
|
||||||
|
await expect(plot).toHaveClass(/js-series-data-loaded/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} PlotPixel
|
||||||
|
* @property {number} r The value of the red channel (0-255)
|
||||||
|
* @property {number} g The value of the green channel (0-255)
|
||||||
|
* @property {number} b The value of the blue channel (0-255)
|
||||||
|
* @property {number} a The value of the alpha channel (0-255)
|
||||||
|
* @property {string} strValue The rgba string value of the pixel
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for all plots to render and then retrieve and return an array
|
||||||
|
* of canvas plot pixel data (RGBA values).
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} canvasSelector The selector for the canvas element
|
||||||
|
* @return {Promise<PlotPixel[]>}
|
||||||
|
*/
|
||||||
|
async function getCanvasPixels(page, canvasSelector) {
|
||||||
|
const getTelemValuePromise = new Promise((resolve) =>
|
||||||
|
page.exposeFunction('getCanvasValue', resolve)
|
||||||
|
);
|
||||||
|
const canvasHandle = await page.evaluateHandle(
|
||||||
|
(canvas) => document.querySelector(canvas),
|
||||||
|
canvasSelector
|
||||||
|
);
|
||||||
|
const canvasContextHandle = await page.evaluateHandle(
|
||||||
|
(canvas) => canvas.getContext('2d'),
|
||||||
|
canvasHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
await page.evaluate(
|
||||||
|
([canvas, ctx]) => {
|
||||||
|
// The document canvas is where the plot points and lines are drawn.
|
||||||
|
// The only way to access the canvas is using document (using page.evaluate)
|
||||||
|
/** @type {ImageData} */
|
||||||
|
const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data;
|
||||||
|
/** @type {number[]} */
|
||||||
|
const imageDataValues = Object.values(data);
|
||||||
|
/** @type {PlotPixel[]} */
|
||||||
|
const plotPixels = [];
|
||||||
|
// Each pixel consists of four values within the ImageData.data array. The for loop iterates by multiples of four.
|
||||||
|
// The values associated with each pixel are R (red), G (green), B (blue), and A (alpha), in that order.
|
||||||
|
for (let i = 0; i < imageDataValues.length; ) {
|
||||||
|
if (imageDataValues[i] > 0) {
|
||||||
|
plotPixels.push({
|
||||||
|
r: imageDataValues[i],
|
||||||
|
g: imageDataValues[i + 1],
|
||||||
|
b: imageDataValues[i + 2],
|
||||||
|
a: imageDataValues[i + 3],
|
||||||
|
strValue: `rgb(${imageDataValues[i]}, ${imageDataValues[i + 1]}, ${
|
||||||
|
imageDataValues[i + 2]
|
||||||
|
}, ${imageDataValues[i + 3]})`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
i = i + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.getCanvasValue(plotPixels);
|
||||||
|
},
|
||||||
|
[canvasHandle, canvasContextHandle]
|
||||||
|
);
|
||||||
|
|
||||||
|
return getTelemValuePromise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} myItemsFolderName
|
||||||
|
* @param {string} url
|
||||||
|
* @param {string} newName
|
||||||
|
*/
|
||||||
|
async function renameObjectFromContextMenu(page, url, newName) {
|
||||||
|
await openObjectTreeContextMenu(page, url);
|
||||||
|
await page.click('li:text("Edit Properties")');
|
||||||
|
const nameInput = page.getByLabel('Title', { exact: true });
|
||||||
|
await nameInput.fill('');
|
||||||
|
await nameInput.fill(newName);
|
||||||
|
await page.click('[aria-label="Save"]');
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
createDomainObjectWithDefaults,
|
createDomainObjectWithDefaults,
|
||||||
expandTreePaneItemByName,
|
createExampleTelemetryObject,
|
||||||
|
createNotification,
|
||||||
createPlanFromJSON,
|
createPlanFromJSON,
|
||||||
openObjectTreeContextMenu,
|
expandEntireTree,
|
||||||
getHashUrlToDomainObject,
|
expandTreePaneItemByName,
|
||||||
|
getCanvasPixels,
|
||||||
getFocusedObjectUuid,
|
getFocusedObjectUuid,
|
||||||
|
getHashUrlToDomainObject,
|
||||||
|
navigateToObjectWithFixedTimeBounds,
|
||||||
|
openObjectTreeContextMenu,
|
||||||
|
renameObjectFromContextMenu,
|
||||||
|
setEndOffset,
|
||||||
setFixedTimeMode,
|
setFixedTimeMode,
|
||||||
|
setIndependentTimeConductorBounds,
|
||||||
setRealTimeMode,
|
setRealTimeMode,
|
||||||
setStartOffset,
|
setStartOffset,
|
||||||
setEndOffset
|
setTimeConductorBounds,
|
||||||
|
waitForPlotsToRender
|
||||||
};
|
};
|
||||||
|
96
e2e/avpFixtures.js
Normal file
96
e2e/avpFixtures.js
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* avpFixtures.js
|
||||||
|
*
|
||||||
|
* @file This module provides custom fixtures specifically tailored for Accessibility, Visual, and Performance (AVP) tests.
|
||||||
|
* These fixtures extend the base functionality of the Playwright fixtures and appActions, and are designed to be
|
||||||
|
* generalized across all plugins. They offer functionalities like scanning for accessibility violations, integrating
|
||||||
|
* with axe-core, and more.
|
||||||
|
*
|
||||||
|
* IMPORTANT NOTE: This fixture file is not intended to be extended further by other fixtures. If you find yourself
|
||||||
|
* needing to do so, please consult the documentation and consider creating a specialized fixture or modifying the
|
||||||
|
* existing ones.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import AxeBuilder from '@axe-core/playwright';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
import { expect, test } from './pluginFixtures.js';
|
||||||
|
|
||||||
|
// Constants for repeated values
|
||||||
|
const TEST_RESULTS_DIR = './test-results';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scans for accessibility violations on a page and writes a report to disk if violations are found.
|
||||||
|
* Automatically asserts that no violations should be present.
|
||||||
|
*
|
||||||
|
* @typedef {object} GenerateReportOptions
|
||||||
|
* @property {string} [reportName] - The name for the report file.
|
||||||
|
*
|
||||||
|
* @param {import('playwright').Page} page - The page object from Playwright.
|
||||||
|
* @param {string} testCaseName - The name of the test case.
|
||||||
|
* @param {GenerateReportOptions} [options={}] - The options for the report generation.
|
||||||
|
*
|
||||||
|
* @returns {Promise<object|null>} Returns the accessibility scan results if violations are found,
|
||||||
|
* otherwise returns null.
|
||||||
|
*/
|
||||||
|
/* eslint-disable no-undef */
|
||||||
|
export async function scanForA11yViolations(page, testCaseName, options = {}) {
|
||||||
|
const builder = new AxeBuilder({ page });
|
||||||
|
builder.withTags(['wcag2aa']);
|
||||||
|
// https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md
|
||||||
|
const accessibilityScanResults = await builder.analyze();
|
||||||
|
|
||||||
|
// Assert that no violations should be present
|
||||||
|
expect(
|
||||||
|
accessibilityScanResults.violations,
|
||||||
|
`Accessibility violations found in test case: ${testCaseName}`
|
||||||
|
).toEqual([]);
|
||||||
|
|
||||||
|
// Check if there are any violations
|
||||||
|
if (accessibilityScanResults.violations.length > 0) {
|
||||||
|
let reportName = options.reportName || testCaseName;
|
||||||
|
let sanitizedReportName = reportName.replace(/\//g, '_');
|
||||||
|
const reportPath = path.join(TEST_RESULTS_DIR, `${sanitizedReportName}.json`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(TEST_RESULTS_DIR)) {
|
||||||
|
fs.mkdirSync(TEST_RESULTS_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(reportPath, JSON.stringify(accessibilityScanResults, null, 2));
|
||||||
|
console.log(`Accessibility report with violations saved successfully as ${reportPath}`);
|
||||||
|
return accessibilityScanResults;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error writing the accessibility report to file ${reportPath}:`, err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('No accessibility violations found, no report generated.');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { expect, test };
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -28,12 +28,12 @@
|
|||||||
* GitHub issues.
|
* GitHub issues.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const base = require('@playwright/test');
|
import { expect, request, test } from '@playwright/test';
|
||||||
const { expect } = base;
|
import fs from 'fs';
|
||||||
const fs = require('fs');
|
import path from 'path';
|
||||||
const path = require('path');
|
import sinon from 'sinon';
|
||||||
const { v4: uuid } = require('uuid');
|
import { fileURLToPath } from 'url';
|
||||||
const sinon = require('sinon');
|
import { v4 as uuid } from 'uuid';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a `ConsoleMessage` and returns a formatted string. Used to enable console log error detection.
|
* Takes a `ConsoleMessage` and returns a formatted string. Used to enable console log error detection.
|
||||||
@ -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)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,15 +68,20 @@ function waitForAnimations(locator) {
|
|||||||
*/
|
*/
|
||||||
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
const istanbulCLIOutput = path.join(process.cwd(), '.nyc_output');
|
||||||
|
|
||||||
exports.test = base.test.extend({
|
const extendedTest = 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.
|
||||||
|
*
|
||||||
|
* Warning: Has many limitations and secondary side effects in Open MCT.
|
||||||
|
* 1. The tree component does not render.
|
||||||
|
* 2. page.WaitForNavigation does not trigger.
|
||||||
|
*
|
||||||
* Usage:
|
* Usage:
|
||||||
* ```
|
* ```js
|
||||||
* test.use({
|
* test.use({
|
||||||
* clockOptions: {
|
* clockOptions: {
|
||||||
* now: 0,
|
* now: MISSION_TIME,
|
||||||
* shouldAdvanceTime: true
|
* shouldAdvanceTime: true
|
||||||
* ```
|
* ```
|
||||||
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
* If clockOptions are provided, will override the default clock with fake timers provided by SinonJS.
|
||||||
@ -88,12 +90,14 @@ exports.test = base.test.extend({
|
|||||||
*
|
*
|
||||||
* @see {@link https://github.com/microsoft/playwright/issues/6347 Github RFE}
|
* @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}
|
* @see {@link https://github.com/sinonjs/fake-timers/#var-clock--faketimersinstallconfig SinonJS FakeTimers Config}
|
||||||
|
* @type {import('@types/sinonjs__fake-timers').FakeTimerInstallOpts}
|
||||||
*/
|
*/
|
||||||
clockOptions: [undefined, { option: true }],
|
clockOptions: [undefined, { option: true }],
|
||||||
overrideClock: [async ({ context, clockOptions }, use) => {
|
overrideClock: [
|
||||||
|
async ({ context, clockOptions }, use) => {
|
||||||
if (clockOptions !== undefined) {
|
if (clockOptions !== undefined) {
|
||||||
await context.addInitScript({
|
await context.addInitScript({
|
||||||
path: path.join(__dirname, '../', './node_modules/sinon/pkg/sinon.js')
|
path: fileURLToPath(new URL('../node_modules/sinon/pkg/sinon.js', import.meta.url))
|
||||||
});
|
});
|
||||||
await context.addInitScript((options) => {
|
await context.addInitScript((options) => {
|
||||||
window.__clock = sinon.useFakeTimers(options);
|
window.__clock = sinon.useFakeTimers(options);
|
||||||
@ -101,10 +105,12 @@ exports.test = base.test.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
await use(context);
|
await use(context);
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
auto: true,
|
auto: true,
|
||||||
scope: 'test'
|
scope: 'test'
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
/**
|
/**
|
||||||
* Extends the base context class to add codecoverage shim.
|
* Extends the base context class to add codecoverage shim.
|
||||||
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
* @see {@link https://github.com/mxschmitt/playwright-test-coverage Github Project}
|
||||||
@ -112,19 +118,24 @@ exports.test = base.test.extend({
|
|||||||
context: async ({ context }, use) => {
|
context: async ({ context }, use) => {
|
||||||
await context.addInitScript(() =>
|
await context.addInitScript(() =>
|
||||||
window.addEventListener('beforeunload', () =>
|
window.addEventListener('beforeunload', () =>
|
||||||
(window).collectIstanbulCoverage(JSON.stringify((window).__coverage__))
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
|
await fs.promises.mkdir(istanbulCLIOutput, { recursive: true });
|
||||||
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
|
await context.exposeFunction('collectIstanbulCoverage', (coverageJSON) => {
|
||||||
if (coverageJSON) {
|
if (coverageJSON) {
|
||||||
fs.writeFileSync(path.join(istanbulCLIOutput, `playwright_coverage_${uuid()}.json`), coverageJSON);
|
fs.writeFileSync(
|
||||||
|
path.join(istanbulCLIOutput, `playwright_coverage_${uuid()}.json`),
|
||||||
|
coverageJSON
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
await use(context);
|
await use(context);
|
||||||
for (const page of context.pages()) {
|
for (const page of context.pages()) {
|
||||||
await page.evaluate(() => (window).collectIstanbulCoverage(JSON.stringify((window).__coverage__)));
|
await page.evaluate(() =>
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -138,7 +149,24 @@ exports.test = base.test.extend({
|
|||||||
* Extends the base page class to enable console log error detection.
|
* Extends the base page class to enable console log error detection.
|
||||||
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
* @see {@link https://github.com/microsoft/playwright/discussions/11690 Github Discussion}
|
||||||
*/
|
*/
|
||||||
page: async ({ page, failOnConsoleError }, use) => {
|
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
|
// Capture any console errors during test execution
|
||||||
const messages = [];
|
const messages = [];
|
||||||
page.on('console', (msg) => messages.push(msg));
|
page.on('console', (msg) => messages.push(msg));
|
||||||
@ -147,8 +175,10 @@ exports.test = base.test.extend({
|
|||||||
|
|
||||||
// Assert against console errors during teardown
|
// Assert against console errors during teardown
|
||||||
if (failOnConsoleError) {
|
if (failOnConsoleError) {
|
||||||
messages.forEach(
|
messages.forEach((msg) =>
|
||||||
msg => expect.soft(msg.type(), `Console error detected: ${_consoleMessageToString(msg)}`).not.toEqual('error')
|
expect
|
||||||
|
.soft(msg.type(), `Console error detected: ${_consoleMessageToString(msg)}`)
|
||||||
|
.not.toEqual('error')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -170,5 +200,5 @@ exports.test = base.test.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
exports.expect = expect;
|
|
||||||
exports.waitForAnimations = waitForAnimations;
|
export { expect, request, extendedTest as test, waitForAnimations };
|
||||||
|
19
e2e/constants.js
Normal file
19
e2e/constants.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/* eslint-disable prettier/prettier */
|
||||||
|
/**
|
||||||
|
* Constants which may be used across all e2e tests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time Constants
|
||||||
|
* - Used for overriding the browser clock in tests.
|
||||||
|
*/
|
||||||
|
export const MISSION_TIME = 1732413600000; // Saturday, November 23, 2024 6:00:00 PM GMT-08:00 (Thanksgiving Dinner Time)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL Constants
|
||||||
|
* - This is the URL that the browser will be directed to when running visual tests. This URL
|
||||||
|
* - hides the tree and inspector to prevent visual noise
|
||||||
|
* - sets the time bounds to a fixed range
|
||||||
|
*/
|
||||||
|
export const VISUAL_URL =
|
||||||
|
'./#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
|
30
e2e/helper/addInitDataVisualization.js
Normal file
30
e2e/helper/addInitDataVisualization.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This should be used to install the Example User
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.example.ExampleDataVisualizationSourcePlugin());
|
||||||
|
openmct.install(
|
||||||
|
openmct.plugins.InspectorDataVisualization({ type: 'exampleDataVisualizationSource' })
|
||||||
|
);
|
||||||
|
});
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, 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.
|
||||||
*
|
*
|
||||||
|
27
e2e/helper/addInitExampleUser.js
Normal file
27
e2e/helper/addInitExampleUser.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This should be used to install the Example User
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.example.ExampleUser());
|
||||||
|
});
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
|
71
e2e/helper/addInitFileInputObject.js
Normal file
71
e2e/helper/addInitFileInputObject.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
class DomainObjectViewProvider {
|
||||||
|
constructor(openmct) {
|
||||||
|
this.key = 'doViewProvider';
|
||||||
|
this.name = 'Domain Object View Provider';
|
||||||
|
this.openmct = openmct;
|
||||||
|
}
|
||||||
|
|
||||||
|
canView(domainObject) {
|
||||||
|
return domainObject.type === 'imageFileInput' || domainObject.type === 'jsonFileInput';
|
||||||
|
}
|
||||||
|
|
||||||
|
view(domainObject, objectPath) {
|
||||||
|
let content;
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: function (element) {
|
||||||
|
const body = domainObject.selectFile.body;
|
||||||
|
const type = typeof body;
|
||||||
|
|
||||||
|
content = document.createElement('div');
|
||||||
|
content.id = 'file-input-type';
|
||||||
|
content.textContent = JSON.stringify(type);
|
||||||
|
element.appendChild(content);
|
||||||
|
},
|
||||||
|
destroy: function (element) {
|
||||||
|
element.removeChild(content);
|
||||||
|
content = undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const openmct = window.openmct;
|
||||||
|
|
||||||
|
openmct.types.addType('jsonFileInput', {
|
||||||
|
key: 'jsonFileInput',
|
||||||
|
name: 'JSON File Input Object',
|
||||||
|
creatable: true,
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
name: 'Upload File',
|
||||||
|
key: 'selectFile',
|
||||||
|
control: 'file-input',
|
||||||
|
required: true,
|
||||||
|
text: 'Select File...',
|
||||||
|
type: 'application/json',
|
||||||
|
property: ['selectFile']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
openmct.types.addType('imageFileInput', {
|
||||||
|
key: 'imageFileInput',
|
||||||
|
name: 'Image File Input Object',
|
||||||
|
creatable: true,
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
name: 'Upload File',
|
||||||
|
key: 'selectFile',
|
||||||
|
control: 'file-input',
|
||||||
|
required: true,
|
||||||
|
text: 'Select File...',
|
||||||
|
type: 'image/*',
|
||||||
|
property: ['selectFile']
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
|
||||||
|
});
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -20,29 +20,13 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
import {
|
// This should be used to install the re-instal default Notebook plugin with a simple url whitelist.
|
||||||
createOpenMct,
|
// e.g.
|
||||||
resetApplicationState
|
// await page.addInitScript({ path: path.join(__dirname, 'addInitNotebookWithUrls.js') });
|
||||||
} from 'utils/testing';
|
const NOTEBOOK_NAME = 'Notebook';
|
||||||
|
const URL_WHITELIST = ['google.com'];
|
||||||
|
|
||||||
describe('UI Components', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
let openmct;
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
|
||||||
beforeEach(done => {
|
|
||||||
openmct = createOpenMct();
|
|
||||||
openmct.on('start', done);
|
|
||||||
openmct.startHeadless();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
return resetApplicationState();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('are exposed to users', () => {
|
|
||||||
expect(openmct.components).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('exposes the object view', () => {
|
|
||||||
expect(openmct.components.ObjectView).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
});
|
27
e2e/helper/addInitOperatorStatus.js
Normal file
27
e2e/helper/addInitOperatorStatus.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
// This should be used to install the Operator Status
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const openmct = window.openmct;
|
||||||
|
openmct.install(openmct.plugins.OperatorStatus());
|
||||||
|
});
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -24,4 +24,4 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}());
|
})();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -19,15 +19,15 @@
|
|||||||
* 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.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
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({
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitExampleFaultProvider.js') });
|
path: fileURLToPath(new URL('./addInitExampleFaultProvider.js', import.meta.url))
|
||||||
|
});
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
@ -36,8 +36,9 @@ async function navigateToFaultManagementWithExample(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: fileURLToPath(new URL('./addInitExampleFaultProviderStatic.js', import.meta.url))
|
||||||
|
});
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
@ -46,8 +47,9 @@ async function navigateToFaultManagementWithStaticExample(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({
|
||||||
await page.addInitScript({ path: path.join(__dirname, './', 'addInitFaultManagementPlugin.js') });
|
path: fileURLToPath(new URL('./addInitFaultManagementPlugin.js', import.meta.url))
|
||||||
|
});
|
||||||
|
|
||||||
await navigateToFaultItemInTree(page);
|
await navigateToFaultItemInTree(page);
|
||||||
}
|
}
|
||||||
@ -58,8 +60,16 @@ async function navigateToFaultManagementWithoutExample(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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +80,6 @@ async function acknowledgeFault(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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,8 +150,7 @@ async function clearSearch(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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +198,9 @@ async function getFaultResultCount(page) {
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
@ -208,7 +218,9 @@ function getFaultByName(page, name) {
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
@ -217,7 +229,9 @@ async function getFaultName(page, rowNumber) {
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
@ -226,7 +240,9 @@ async function getFaultSeverity(page, rowNumber) {
|
|||||||
* @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;
|
||||||
}
|
}
|
||||||
@ -235,7 +251,9 @@ async function getFaultNamespace(page, rowNumber) {
|
|||||||
* @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();
|
||||||
}
|
}
|
||||||
@ -245,33 +263,33 @@ async function getFaultTriggerTime(page, rowNumber) {
|
|||||||
*/
|
*/
|
||||||
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
|
export {
|
||||||
module.exports = {
|
|
||||||
navigateToFaultManagementWithExample,
|
|
||||||
navigateToFaultManagementWithStaticExample,
|
|
||||||
navigateToFaultManagementWithoutExample,
|
|
||||||
navigateToFaultItemInTree,
|
|
||||||
acknowledgeFault,
|
acknowledgeFault,
|
||||||
shelveMultipleFaults,
|
|
||||||
acknowledgeMultipleFaults,
|
acknowledgeMultipleFaults,
|
||||||
shelveFault,
|
|
||||||
changeViewTo,
|
changeViewTo,
|
||||||
sortFaultsBy,
|
|
||||||
enterSearchTerm,
|
|
||||||
clearSearch,
|
clearSearch,
|
||||||
selectFaultItem,
|
enterSearchTerm,
|
||||||
getHighestSeverity,
|
|
||||||
getLowestSeverity,
|
|
||||||
getFaultResultCount,
|
|
||||||
getFault,
|
getFault,
|
||||||
getFaultByName,
|
getFaultByName,
|
||||||
getFaultName,
|
getFaultName,
|
||||||
getFaultSeverity,
|
|
||||||
getFaultNamespace,
|
getFaultNamespace,
|
||||||
|
getFaultResultCount,
|
||||||
|
getFaultSeverity,
|
||||||
getFaultTriggerTime,
|
getFaultTriggerTime,
|
||||||
openFaultRowMenu
|
getHighestSeverity,
|
||||||
|
getLowestSeverity,
|
||||||
|
navigateToFaultItemInTree,
|
||||||
|
navigateToFaultManagementWithExample,
|
||||||
|
navigateToFaultManagementWithoutExample,
|
||||||
|
navigateToFaultManagementWithStaticExample,
|
||||||
|
openFaultRowMenu,
|
||||||
|
selectFaultItem,
|
||||||
|
shelveFault,
|
||||||
|
shelveMultipleFaults,
|
||||||
|
sortFaultsBy
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -20,46 +20,131 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import { createDomainObjectWithDefaults } from '../appActions.js';
|
||||||
|
|
||||||
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
|
||||||
|
const CUSTOM_NAME = 'CUSTOM_NAME';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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('div.c-ne__text').click();
|
await page.getByLabel('Notebook Entry Input').last().fill(text);
|
||||||
await page.locator('div.c-ne__text').fill(text);
|
await commitEntry(page);
|
||||||
await page.locator('div.c-ne__text').press('Enter');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function dragAndDropEmbed(page, myItemsFolderName) {
|
async function dragAndDropEmbed(page, notebookObject) {
|
||||||
// Click button:has-text("Create")
|
// Create example telemetry object
|
||||||
await page.locator('button:has-text("Create")').click();
|
const swg = await createDomainObjectWithDefaults(page, {
|
||||||
// Click li:has-text("Sine Wave Generator")
|
type: 'Sine Wave Generator'
|
||||||
await page.locator('li:has-text("Sine Wave Generator")').click();
|
});
|
||||||
// Click form[name="mctForm"] >> text=My Items
|
// Navigate to notebook
|
||||||
await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
|
await page.goto(notebookObject.url);
|
||||||
// Click text=OK
|
// Expand the tree to reveal the notebook
|
||||||
await page.locator('text=OK').click();
|
await page.getByLabel('Show selected item in tree').click();
|
||||||
// Click text=Open MCT My Items >> span >> nth=3
|
// Drag and drop the SWG into the notebook
|
||||||
await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
|
await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
|
||||||
// Click text=Unnamed CUSTOM_NAME
|
await commitEntry(page);
|
||||||
await Promise.all([
|
|
||||||
page.waitForNavigation(),
|
|
||||||
page.locator('text=Unnamed CUSTOM_NAME').click()
|
|
||||||
]);
|
|
||||||
|
|
||||||
await page.dragAndDrop('text=UNNAMED SINE WAVE GENERATOR', NOTEBOOK_DROP_AREA);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
/**
|
||||||
module.exports = {
|
* @private
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function commitEntry(page) {
|
||||||
|
//Click the Commit Entry button
|
||||||
|
await page.locator('.c-ne__save-button > button').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function startAndAddRestrictedNotebookObject(page) {
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
await page.addInitScript({
|
||||||
|
path: fileURLToPath(new URL('./addInitRestrictedNotebook.js', import.meta.url))
|
||||||
|
});
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
return createDomainObjectWithDefaults(page, {
|
||||||
|
type: CUSTOM_NAME,
|
||||||
|
name: 'Restricted Test Notebook'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
*/
|
||||||
|
async function lockPage(page) {
|
||||||
|
const commitButton = page.locator('button:has-text("Commit Entries")');
|
||||||
|
await commitButton.click();
|
||||||
|
|
||||||
|
//Wait until Lock Banner is visible
|
||||||
|
await page.locator('text=Lock Page').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object and adds an entry.
|
||||||
|
* @param {import('@playwright/test').Page} - page to load
|
||||||
|
* @param {number} [iterations = 1] - the number of entries to create
|
||||||
|
*/
|
||||||
|
async function createNotebookAndEntry(page, iterations = 1) {
|
||||||
|
const notebook = createDomainObjectWithDefaults(page, { type: 'Notebook' });
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
await enterTextEntry(page, `Entry ${iteration}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a notebook object, adds an entry, and adds a tag.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {number} [iterations = 1] - the number of entries (and tags) to create
|
||||||
|
*/
|
||||||
|
async function createNotebookEntryAndTags(page, iterations = 1) {
|
||||||
|
const notebook = await createNotebookAndEntry(page, iterations);
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
|
||||||
|
for (let iteration = 0; iteration < iterations; iteration++) {
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.locator(`[aria-label="Notebook Entry"] >> nth = ${iteration}`).click();
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Driving" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
|
||||||
|
|
||||||
|
// Hover and click "Add Tag" button
|
||||||
|
// Hover is needed here to "slow down" the actions while running in headless mode
|
||||||
|
await page.hover(`button:has-text("Add Tag")`);
|
||||||
|
await page.locator(`button:has-text("Add Tag")`).click();
|
||||||
|
// Click inside the tag search input
|
||||||
|
await page.locator('[placeholder="Type to select tag"]').click();
|
||||||
|
// Select the "Science" tag
|
||||||
|
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
return notebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
createNotebookAndEntry,
|
||||||
|
createNotebookEntryAndTags,
|
||||||
|
dragAndDropEmbed,
|
||||||
enterTextEntry,
|
enterTextEntry,
|
||||||
dragAndDropEmbed
|
lockPage,
|
||||||
|
startAndAddRestrictedNotebookObject
|
||||||
};
|
};
|
||||||
|
174
e2e/helper/planningUtils.js
Normal file
174
e2e/helper/planningUtils.js
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import { expect } from '../pluginFixtures.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the number of activities in the plan view matches the number of
|
||||||
|
* activities in the plan data within the specified time bounds. Performs an assertion
|
||||||
|
* for each activity in the plan data per group, using the earliest activity's
|
||||||
|
* start time as the start bound and the current activity's end time as the end bound.
|
||||||
|
* @param {import('@playwright/test').Page} page the page
|
||||||
|
* @param {object} plan The raw plan json to assert against
|
||||||
|
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||||
|
*/
|
||||||
|
export async function assertPlanActivities(page, plan, objectUrl) {
|
||||||
|
const groups = Object.keys(plan);
|
||||||
|
for (const group of groups) {
|
||||||
|
for (let i = 0; i < plan[group].length; i++) {
|
||||||
|
// Set the startBound to the start time of the first activity in the group
|
||||||
|
const startBound = plan[group][0].start;
|
||||||
|
// Set the endBound to the end time of the current activity
|
||||||
|
let endBound = plan[group][i].end;
|
||||||
|
if (endBound === startBound) {
|
||||||
|
// Prevent oddities with setting start and end bound equal
|
||||||
|
// via URL params
|
||||||
|
endBound += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Switch to fixed time mode with all plan events within the bounds
|
||||||
|
await page.goto(
|
||||||
|
`${objectUrl}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert that the number of activities in the plan view matches the number of
|
||||||
|
// activities in the plan data within the specified time bounds
|
||||||
|
const eventCount = await page.locator('.activity-bounds').count();
|
||||||
|
expect(eventCount).toEqual(
|
||||||
|
Object.values(plan)
|
||||||
|
.flat()
|
||||||
|
.filter((event) =>
|
||||||
|
activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)
|
||||||
|
).length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the activities time bounds overlap, false otherwise.
|
||||||
|
* @param {number} start1 the start time of the first activity
|
||||||
|
* @param {number} end1 the end time of the first activity
|
||||||
|
* @param {number} start2 the start time of the second activity
|
||||||
|
* @param {number} end2 the end time of the second activity
|
||||||
|
* @returns {boolean} true if the activities overlap, false otherwise
|
||||||
|
*/
|
||||||
|
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
|
||||||
|
return (
|
||||||
|
(start1 >= start2 && start1 <= end2) ||
|
||||||
|
(end1 >= start2 && end1 <= end2) ||
|
||||||
|
(start2 >= start1 && start2 <= end1) ||
|
||||||
|
(end2 >= start1 && end2 <= end1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the swim lanes / groups in the plan view matches the order of
|
||||||
|
* groups in the plan data.
|
||||||
|
* @param {import('@playwright/test').Page} page the page
|
||||||
|
* @param {object} plan The raw plan json to assert against
|
||||||
|
* @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
|
||||||
|
*/
|
||||||
|
export async function assertPlanOrderedSwimLanes(page, plan, objectUrl) {
|
||||||
|
// Switch to the plan view
|
||||||
|
await page.goto(`${objectUrl}?view=plan.view`);
|
||||||
|
const planGroups = await page
|
||||||
|
.locator('.c-plan__contents > div > .c-swimlane__lane-label .c-object-label__name')
|
||||||
|
.all();
|
||||||
|
|
||||||
|
const groups = plan.Groups;
|
||||||
|
|
||||||
|
for (let i = 0; i < groups.length; i++) {
|
||||||
|
// Assert that the order of groups in the plan view matches the order of
|
||||||
|
// groups in the plan data
|
||||||
|
const groupName = await planGroups[i].innerText();
|
||||||
|
expect(groupName).toEqual(groups[i].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigate to the plan view, switch to fixed time mode,
|
||||||
|
* and set the bounds to span all activities.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {object} planJson
|
||||||
|
* @param {string} planObjectUrl
|
||||||
|
*/
|
||||||
|
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
|
||||||
|
// Get the earliest start value
|
||||||
|
const start = getEarliestStartTime(planJson);
|
||||||
|
// Get the latest end value
|
||||||
|
const end = getLatestEndTime(planJson);
|
||||||
|
// Set the start and end bounds to the earliest start and latest end
|
||||||
|
await page.goto(
|
||||||
|
`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {object} planJson
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
export function getEarliestStartTime(planJson) {
|
||||||
|
const activities = Object.values(planJson).flat();
|
||||||
|
return Math.min(...activities.map((activity) => activity.start));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {object} planJson
|
||||||
|
* @returns {number}
|
||||||
|
*/
|
||||||
|
export function getLatestEndTime(planJson) {
|
||||||
|
const activities = Object.values(planJson).flat();
|
||||||
|
return Math.max(...activities.map((activity) => activity.end));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the Open MCT API to set the status of a plan to 'draft'.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {import('../../appActions').CreatedObjectInfo} plan
|
||||||
|
*/
|
||||||
|
export async function setDraftStatusForPlan(page, plan) {
|
||||||
|
await page.evaluate(async (planObject) => {
|
||||||
|
await window.openmct.status.set(planObject.uuid, 'draft');
|
||||||
|
}, plan);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addPlanGetInterceptor(page) {
|
||||||
|
await page.waitForLoadState('load');
|
||||||
|
await page.evaluate(async () => {
|
||||||
|
await window.openmct.objects.addGetInterceptor({
|
||||||
|
appliesTo: (identifier, domainObject) => {
|
||||||
|
return domainObject && domainObject.type === 'plan';
|
||||||
|
},
|
||||||
|
invoke: (identifier, object) => {
|
||||||
|
if (object) {
|
||||||
|
object.sourceMap = {
|
||||||
|
orderedGroups: 'Groups'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
189
e2e/helper/plotTagsUtils.js
Normal file
189
e2e/helper/plotTagsUtils.js
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import { waitForPlotsToRender } from '../appActions.js';
|
||||||
|
import { expect } from '../pluginFixtures.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a canvas and a set of points, tags the points on the canvas.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {HTMLCanvasElement} canvas a telemetry item with a plot
|
||||||
|
* @param {Number} xEnd a telemetry item with a plot
|
||||||
|
* @param {Number} yEnd a telemetry item with a plot
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export async function createTags({ page, canvas, xEnd = 700, yEnd = 520 }) {
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
//Alt+Shift Drag Start to select some points to tag
|
||||||
|
await page.keyboard.down('Alt');
|
||||||
|
await page.keyboard.down('Shift');
|
||||||
|
|
||||||
|
await canvas.dragTo(canvas, {
|
||||||
|
sourcePosition: {
|
||||||
|
x: 1,
|
||||||
|
y: 1
|
||||||
|
},
|
||||||
|
targetPosition: {
|
||||||
|
x: xEnd,
|
||||||
|
y: yEnd
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Alt Drag End
|
||||||
|
await page.keyboard.up('Alt');
|
||||||
|
await page.keyboard.up('Shift');
|
||||||
|
|
||||||
|
//Wait for canvas to stabilize.
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
// add some tags
|
||||||
|
await page.getByText('Annotations').click();
|
||||||
|
await page.getByRole('button', { name: /Add Tag/ }).click();
|
||||||
|
await page.getByPlaceholder('Type to select tag').click();
|
||||||
|
await page.getByText('Driving').click();
|
||||||
|
|
||||||
|
await page.getByRole('button', { name: /Add Tag/ }).click();
|
||||||
|
await page.getByPlaceholder('Type to select tag').click();
|
||||||
|
await page.getByText('Science').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a telemetry item (e.g., a Sine Wave Generator) with a plot, tests that the plot can be tagged.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {import('../../../../appActions').CreatedObjectInfo} telemetryItem a telemetry item with a plot
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export async function testTelemetryItem(page, telemetryItem) {
|
||||||
|
// Check that telemetry item also received the tag
|
||||||
|
await page.goto(telemetryItem.url);
|
||||||
|
|
||||||
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
|
||||||
|
const canvas = page.locator('canvas').nth(1);
|
||||||
|
//Wait for canvas to stabilize.
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
|
||||||
|
await expect(canvas).toBeInViewport();
|
||||||
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
|
// click on the tagged plot point
|
||||||
|
await canvas.click({
|
||||||
|
position: {
|
||||||
|
x: 100,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeHidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a page, tests that tags are searchable, deletable, and persist across reloads.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export async function basicTagsTests(page) {
|
||||||
|
// Search for Driving
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
|
||||||
|
// Clicking elsewhere should cause annotation selection to be cleared
|
||||||
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
//
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).fill('driv');
|
||||||
|
|
||||||
|
// Always click on the first Sine Wave result
|
||||||
|
await page
|
||||||
|
.getByLabel('Search Result')
|
||||||
|
.getByText(/Sine Wave/)
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Delete Driving Tag
|
||||||
|
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
||||||
|
await page.locator('[aria-label="Remove tag Driving"]').click();
|
||||||
|
|
||||||
|
// Search for Science Tag
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).fill('sc');
|
||||||
|
|
||||||
|
//Expect Science Tag to be present and and Driving Tags to be deleted
|
||||||
|
await expect(page.getByLabel('Search Result').first()).toContainText('Science');
|
||||||
|
await expect(page.getByLabel('Search Result').first()).not.toContainText('Driving');
|
||||||
|
|
||||||
|
// Search for Driving Tag and expect nothing found
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||||
|
await page.getByRole('searchbox', { name: 'Search Input' }).fill('driv');
|
||||||
|
await expect(page.getByText('No results found')).toBeVisible();
|
||||||
|
|
||||||
|
await page.reload({ waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
|
||||||
|
//Navigate to the Inspector and check that all tags have been removed
|
||||||
|
await expect(page.getByRole('tab', { name: 'Annotations' })).not.toHaveClass(/is-current/);
|
||||||
|
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||||
|
await expect(page.getByRole('tab', { name: 'Annotations' })).toHaveClass(/is-current/);
|
||||||
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
|
||||||
|
const canvas = page.locator('canvas').nth(1);
|
||||||
|
// click on the tagged plot point
|
||||||
|
await canvas.click({
|
||||||
|
position: {
|
||||||
|
x: 100,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//Expect Science to be visible but Driving to be hidden
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeHidden();
|
||||||
|
|
||||||
|
//Click elsewhere
|
||||||
|
await page.locator('body').click();
|
||||||
|
//Click on tagged plot point again
|
||||||
|
await canvas.click({
|
||||||
|
position: {
|
||||||
|
x: 100,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add Driving Tag again
|
||||||
|
await page.getByText('Annotations').click();
|
||||||
|
await page.getByRole('button', { name: /Add Tag/ }).click();
|
||||||
|
await page.getByPlaceholder('Type to select tag').click();
|
||||||
|
await page.getByText('Driving').click();
|
||||||
|
|
||||||
|
//Science and Driving Tags should be visible
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeVisible();
|
||||||
|
|
||||||
|
// Delete Driving Tag again
|
||||||
|
await page.hover('[aria-label="Tag"]:has-text("Driving")');
|
||||||
|
await page.locator('[aria-label="Remove tag Driving"]').click();
|
||||||
|
|
||||||
|
//Science Tag should be visible and Driving Tag should be hidden
|
||||||
|
await expect(page.getByText('Science')).toBeVisible();
|
||||||
|
await expect(page.getByText('Driving')).toBeHidden();
|
||||||
|
}
|
104
e2e/helper/stylingUtils.js
Normal file
104
e2e/helper/stylingUtils.js
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import { expect } from '../pluginFixtures.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a hex color value to its RGB equivalent.
|
||||||
|
*
|
||||||
|
* @param {string} hex - The hex color value. i.e. '#5b0f00'
|
||||||
|
* @returns {string} The RGB equivalent of the hex color.
|
||||||
|
*/
|
||||||
|
function hexToRGB(hex) {
|
||||||
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||||
|
return result
|
||||||
|
? `rgb(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)})`
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the background and text color of a given element.
|
||||||
|
*
|
||||||
|
* @param {import('@playwright/test').Page} page - The Playwright page object.
|
||||||
|
* @param {string} borderColorHex - The hex value of the border color to set, or 'No Style'.
|
||||||
|
* @param {string} backgroundColorHex - The hex value of the background color to set, or 'No Style'.
|
||||||
|
* @param {string} textColorHex - The hex value of the text color to set, or 'No Style'.
|
||||||
|
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be set.
|
||||||
|
*/
|
||||||
|
async function setStyles(page, borderColorHex, backgroundColorHex, textColorHex, locator) {
|
||||||
|
await locator.click(); // Assuming the locator is clickable and opens the style setting UI
|
||||||
|
await page.getByLabel('Set border color').click();
|
||||||
|
await page.getByLabel(borderColorHex).click();
|
||||||
|
await page.getByLabel('Set background color').click();
|
||||||
|
await page.getByLabel(backgroundColorHex).click();
|
||||||
|
await page.getByLabel('Set text color').click();
|
||||||
|
await page.getByLabel(textColorHex).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the styles of an element match the expected values.
|
||||||
|
*
|
||||||
|
* @param {string} expectedBorderColor - The expected border color in RGB format. Default is '#e6b8af' or 'rgb(230, 184, 175)'
|
||||||
|
* @param {string} expectedBackgroundColor - The expected background color in RGB format.
|
||||||
|
* @param {string} expectedTextColor - The expected text color in RGB format. Default is #aaaaaa or 'rgb(170, 170, 170)'
|
||||||
|
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be checked.
|
||||||
|
*/
|
||||||
|
async function checkStyles(
|
||||||
|
expectedBorderColor,
|
||||||
|
expectedBackgroundColor,
|
||||||
|
expectedTextColor,
|
||||||
|
locator
|
||||||
|
) {
|
||||||
|
const layoutStyles = await locator.evaluate((el) => {
|
||||||
|
return {
|
||||||
|
border: window.getComputedStyle(el).getPropertyValue('border-top-color'), //infer the left, right, and bottom
|
||||||
|
background: window.getComputedStyle(el).getPropertyValue('background-color'),
|
||||||
|
fontColor: window.getComputedStyle(el).getPropertyValue('color')
|
||||||
|
};
|
||||||
|
});
|
||||||
|
expect(layoutStyles.border).toContain(expectedBorderColor);
|
||||||
|
expect(layoutStyles.background).toContain(expectedBackgroundColor);
|
||||||
|
expect(layoutStyles.fontColor).toContain(expectedTextColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the font Styles of an element match the expected values.
|
||||||
|
*
|
||||||
|
* @param {string} expectedFontSize - The expected font size in '72px' format. Default is 'Default'
|
||||||
|
* @param {string} expectedFontWeight - The expected font Type. Format as '700' for bold. Default is 'Default'
|
||||||
|
* @param {string} expectedFontFamily - The expected font Type. Format as "\"Andale Mono\", sans-serif". Default is 'Default'
|
||||||
|
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be checked.
|
||||||
|
*/
|
||||||
|
async function checkFontStyles(expectedFontSize, expectedFontWeight, expectedFontFamily, locator) {
|
||||||
|
const layoutStyles = await locator.evaluate((el) => {
|
||||||
|
return {
|
||||||
|
fontSize: window.getComputedStyle(el).getPropertyValue('font-size'),
|
||||||
|
fontWeight: window.getComputedStyle(el).getPropertyValue('font-weight'),
|
||||||
|
fontFamily: window.getComputedStyle(el).getPropertyValue('font-family')
|
||||||
|
};
|
||||||
|
});
|
||||||
|
expect(layoutStyles.fontSize).toContain(expectedFontSize);
|
||||||
|
expect(layoutStyles.fontWeight).toContain(expectedFontWeight);
|
||||||
|
expect(layoutStyles.fontFamily).toContain(expectedFontFamily);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { checkFontStyles, checkStyles, hexToRGB, setStyles };
|
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
// playwright.config.js
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { devices } = require('@playwright/test');
|
import { devices } from '@playwright/test';
|
||||||
const MAX_FAILURES = 5;
|
const MAX_FAILURES = 5;
|
||||||
const NUM_WORKERS = 2;
|
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',
|
||||||
|
grepInvert: /@mobile/, //Ignore mobile 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: 'cross-env NODE_ENV=test npm run start',
|
command: 'npm run start:coverage',
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 200 * 1000,
|
timeout: 200 * 1000,
|
||||||
reuseExistingServer: false
|
reuseExistingServer: true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
|
||||||
},
|
},
|
||||||
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
||||||
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
||||||
@ -69,13 +69,15 @@ const config = {
|
|||||||
],
|
],
|
||||||
reporter: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['html', {
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
open: 'never',
|
open: 'never',
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
}],
|
}
|
||||||
['junit', { outputFile: 'test-results/results.xml' }],
|
],
|
||||||
['github']
|
['junit', { outputFile: '../test-results/results.xml' }]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
export default config;
|
||||||
|
@ -1,28 +1,22 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
// playwright.config.js
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
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',
|
||||||
|
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
||||||
testIgnore: '**/*.perf.spec.js',
|
testIgnore: '**/*.perf.spec.js',
|
||||||
timeout: 30 * 1000,
|
timeout: 30 * 1000,
|
||||||
webServer: {
|
webServer: {
|
||||||
env: {
|
command: 'npm run start:coverage',
|
||||||
NODE_ENV: 'test'
|
|
||||||
},
|
|
||||||
command: 'npm run start',
|
|
||||||
url: 'http://localhost:8080/#',
|
url: 'http://localhost:8080/#',
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: true
|
reuseExistingServer: true
|
||||||
},
|
},
|
||||||
workers: 1,
|
workers: 1,
|
||||||
use: {
|
use: {
|
||||||
browserName: "chromium",
|
browserName: 'chromium',
|
||||||
baseURL: 'http://localhost:8080/',
|
baseURL: 'http://localhost:8080/',
|
||||||
headless: false,
|
headless: false,
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
@ -39,7 +33,6 @@ const config = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'MMOC',
|
name: 'MMOC',
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
@ -51,8 +44,6 @@ const config = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'safari',
|
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/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'webkit'
|
browserName: 'webkit'
|
||||||
@ -60,7 +51,6 @@ const config = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'firefox',
|
name: 'firefox',
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'firefox'
|
browserName: 'firefox'
|
||||||
@ -68,7 +58,6 @@ const config = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'canary',
|
name: 'canary',
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
@ -77,31 +66,23 @@ const config = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'chrome-beta',
|
name: 'chrome-beta',
|
||||||
testMatch: '**/*.e2e.spec.js', // only run e2e tests
|
|
||||||
grepInvert: /@snapshot/,
|
grepInvert: /@snapshot/,
|
||||||
use: {
|
use: {
|
||||||
browserName: 'chromium',
|
browserName: 'chromium',
|
||||||
channel: 'chrome-beta'
|
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: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['html', {
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
open: 'on-failure',
|
open: 'on-failure',
|
||||||
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
}]
|
}
|
||||||
|
]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
export default config;
|
||||||
|
69
e2e/playwright-mobile.config.js
Normal file
69
e2e/playwright-mobile.config.js
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { devices } from '@playwright/test';
|
||||||
|
const MAX_FAILURES = 5;
|
||||||
|
const NUM_WORKERS = 2;
|
||||||
|
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 1, //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
|
||||||
|
testDir: 'tests',
|
||||||
|
testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
|
||||||
|
timeout: 30 * 1000,
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start:coverage',
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
|
||||||
|
},
|
||||||
|
maxFailures: MAX_FAILURES, //Limits failures to 5 to reduce CI Waste
|
||||||
|
workers: NUM_WORKERS, //Limit to 2 for CircleCI Agent
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'ipad',
|
||||||
|
grep: /@mobile/,
|
||||||
|
use: {
|
||||||
|
storageState: fileURLToPath(
|
||||||
|
new URL('./test-data/display_layout_with_child_layouts.json', import.meta.url)
|
||||||
|
),
|
||||||
|
browserName: 'webkit',
|
||||||
|
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'iphone',
|
||||||
|
grep: /@mobile/,
|
||||||
|
use: {
|
||||||
|
storageState: fileURLToPath(
|
||||||
|
new URL('./test-data/display_layout_with_child_layouts.json', import.meta.url)
|
||||||
|
),
|
||||||
|
browserName: 'webkit',
|
||||||
|
...devices['iPhone 14 Pro'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'never',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
|
],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
42
e2e/playwright-performance-dev.config.js
Normal file
42
e2e/playwright-performance-dev.config.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
|
testDir: 'tests/performance/',
|
||||||
|
testMatch: '*.contract.perf.spec.js', //Run everything except contract tests which require marks in dev mode
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Only run in serial with 1 worker
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start', //need development mode for performance.marks and others
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: false
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: false, //HTTP performance varies!
|
||||||
|
screenshot: 'off',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testIgnore: '*.memory.perf.spec.js', //Do not run memory tests without proper flags. Shouldn't get here
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
59
e2e/playwright-performance-prod.config.js
Normal file
59
e2e/playwright-performance-prod.config.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, //Only for debugging purposes for trace: 'on-first-retry'
|
||||||
|
testDir: 'tests/performance/',
|
||||||
|
testIgnore: '*.contract.perf.spec.js', //Run everything except contract tests which require marks in dev mode
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Only run in serial with 1 worker
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start:prod', //Production mode
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: false //Must be run with this option to prevent dev mode
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: false, //HTTP performance varies!
|
||||||
|
screenshot: 'off',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome-memory',
|
||||||
|
testMatch: '*.memory.perf.spec.js', //Only run memory tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
launchOptions: {
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-notifications',
|
||||||
|
'--use-fake-ui-for-media-stream',
|
||||||
|
'--use-fake-device-for-media-stream',
|
||||||
|
'--js-flags=--no-move-object-start --expose-gc',
|
||||||
|
'--enable-precise-memory-info',
|
||||||
|
'--display=:100'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testIgnore: '*.memory.perf.spec.js', //Do not run memory tests without proper flags
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
['json', { outputFile: '../test-results/results.json' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
@ -1,43 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
const CI = process.env.CI === 'true';
|
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
||||||
const config = {
|
|
||||||
retries: 1, //Only for debugging purposes because trace is enabled only on first retry
|
|
||||||
testDir: 'tests/performance/',
|
|
||||||
timeout: 60 * 1000,
|
|
||||||
workers: 1, //Only run in serial with 1 worker
|
|
||||||
webServer: {
|
|
||||||
command: 'cross-env NODE_ENV=test npm run start',
|
|
||||||
url: 'http://localhost:8080/#',
|
|
||||||
timeout: 200 * 1000,
|
|
||||||
reuseExistingServer: !CI
|
|
||||||
},
|
|
||||||
use: {
|
|
||||||
browserName: "chromium",
|
|
||||||
baseURL: 'http://localhost:8080/',
|
|
||||||
headless: CI, //Only if running locally
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
screenshot: 'off',
|
|
||||||
trace: 'on-first-retry',
|
|
||||||
video: 'off'
|
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
reporter: [
|
|
||||||
['list'],
|
|
||||||
['junit', { outputFile: 'test-results/results.xml' }],
|
|
||||||
['json', { outputFile: 'test-results/results.json' }]
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = config;
|
|
54
e2e/playwright-visual-a11y.config.js
Normal file
54
e2e/playwright-visual-a11y.config.js
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* eslint-disable no-undef */
|
||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
||||||
|
testDir: 'tests/visual-a11y',
|
||||||
|
testMatch: '**/*.visual.spec.js', // only run visual tests
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start:coverage',
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: !process.env.CI
|
||||||
|
},
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'chrome-snow-theme', //Runs the same visual tests but with snow-theme enabled
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium',
|
||||||
|
theme: 'snow'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'on-failure',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
@ -1,51 +0,0 @@
|
|||||||
/* eslint-disable no-undef */
|
|
||||||
// playwright.config.js
|
|
||||||
// @ts-check
|
|
||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
|
|
||||||
const config = {
|
|
||||||
retries: 1, // visual tests should never retry due to snapshot comparison errors. Leaving as a shim
|
|
||||||
testDir: 'tests/visual',
|
|
||||||
testMatch: '**/*.visual.spec.js', // only run visual tests
|
|
||||||
timeout: 60 * 1000,
|
|
||||||
workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
|
|
||||||
webServer: {
|
|
||||||
command: 'cross-env NODE_ENV=test npm run start',
|
|
||||||
url: 'http://localhost:8080/#',
|
|
||||||
timeout: 200 * 1000,
|
|
||||||
reuseExistingServer: !process.env.CI
|
|
||||||
},
|
|
||||||
use: {
|
|
||||||
baseURL: 'http://localhost:8080/',
|
|
||||||
headless: true, // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
screenshot: 'only-on-failure',
|
|
||||||
trace: 'on-first-retry',
|
|
||||||
video: 'off'
|
|
||||||
},
|
|
||||||
projects: [
|
|
||||||
{
|
|
||||||
name: 'chrome',
|
|
||||||
use: {
|
|
||||||
browserName: 'chromium'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'chrome-snow-theme',
|
|
||||||
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;
|
|
71
e2e/playwright-watch.config.js
Normal file
71
e2e/playwright-watch.config.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// playwright.config.js
|
||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { devices } from '@playwright/test';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
|
const config = {
|
||||||
|
retries: 0, //Retries are not needed with watch mode
|
||||||
|
testDir: 'tests',
|
||||||
|
timeout: 60 * 1000,
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run start', //Start in dev mode for hot reloading
|
||||||
|
url: 'http://localhost:8080/#',
|
||||||
|
timeout: 200 * 1000,
|
||||||
|
reuseExistingServer: true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
|
||||||
|
},
|
||||||
|
workers: '75%', //Limit to 75% of the CPU to support running with dev server
|
||||||
|
use: {
|
||||||
|
baseURL: 'http://localhost:8080/',
|
||||||
|
headless: true,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
screenshot: 'only-on-failure',
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
video: 'off'
|
||||||
|
},
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chrome',
|
||||||
|
testMatch: '**/*.spec.js', // run all tests
|
||||||
|
use: {
|
||||||
|
browserName: 'chromium'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ipad',
|
||||||
|
grep: /@mobile/,
|
||||||
|
use: {
|
||||||
|
storageState: fileURLToPath(
|
||||||
|
new URL('./test-data/display_layout_with_child_layouts.json', import.meta.url)
|
||||||
|
),
|
||||||
|
browserName: 'webkit',
|
||||||
|
...devices['iPad (gen 7) landscape'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'iphone',
|
||||||
|
grep: /@mobile/,
|
||||||
|
use: {
|
||||||
|
storageState: fileURLToPath(
|
||||||
|
new URL('./test-data/display_layout_with_child_layouts.json', import.meta.url)
|
||||||
|
),
|
||||||
|
browserName: 'webkit',
|
||||||
|
...devices['iPhone 14 Pro'] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
reporter: [
|
||||||
|
['list'],
|
||||||
|
[
|
||||||
|
'html',
|
||||||
|
{
|
||||||
|
open: 'never',
|
||||||
|
outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
|
||||||
|
}
|
||||||
|
],
|
||||||
|
['junit', { outputFile: '../test-results/results.xml' }]
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -26,9 +26,10 @@
|
|||||||
* 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');
|
// import { createDomainObjectWithDefaults } from './appActions.js';
|
||||||
// const { createDomainObjectWithDefaults } = require('./appActions');
|
import { fileURLToPath } from 'url';
|
||||||
const path = require('path');
|
|
||||||
|
import { expect, request, test } from './baseFixtures.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} ObjectCreateOptions
|
* @typedef {Object} ObjectCreateOptions
|
||||||
@ -45,8 +46,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 +64,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,19 +116,26 @@ const theme = 'espresso';
|
|||||||
*
|
*
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
const myItemsFolderName = "My Items";
|
const myItemsFolderName = 'My Items';
|
||||||
|
|
||||||
exports.test = test.extend({
|
const extendedTest = 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) => {
|
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: fileURLToPath(new URL('./helper/useSnowTheme.js', import.meta.url))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach info about the currently running test and its project.
|
||||||
|
// This will be used by appActions to fill in the created
|
||||||
|
// domain object's notes.
|
||||||
|
page.testNotes = [`${testInfo.titlePath.join('\n')}`, `${testInfo.project.name}`].join('\n');
|
||||||
|
|
||||||
await use(page);
|
await use(page);
|
||||||
},
|
},
|
||||||
myItemsFolderName: [myItemsFolderName, { option: true }],
|
myItemsFolderName: [myItemsFolderName, { option: true }],
|
||||||
@ -140,22 +143,20 @@ exports.test = test.extend({
|
|||||||
openmctConfig: async ({ myItemsFolderName }, use) => {
|
openmctConfig: async ({ myItemsFolderName }, use) => {
|
||||||
await use({ myItemsFolderName });
|
await use({ myItemsFolderName });
|
||||||
}
|
}
|
||||||
// objectCreateOptions: [objectCreateOptions, {option: true}],
|
|
||||||
// eslint-disable-next-line no-shadow
|
|
||||||
// domainObject: [async ({ page, objectCreateOptions }, use) => {
|
|
||||||
// // FIXME: This is a false-positive caused by a bug in the eslint-plugin-playwright rule.
|
|
||||||
// // eslint-disable-next-line playwright/no-conditional-in-test
|
|
||||||
// if (objectCreateOptions === null) {
|
|
||||||
// await use(page);
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Go to baseURL
|
|
||||||
// await page.goto('./', { waitUntil: 'networkidle' });
|
|
||||||
|
|
||||||
// const uuid = await getOrCreateDomainObject(page, objectCreateOptions);
|
|
||||||
// await use({ uuid });
|
|
||||||
// }, { auto: true }]
|
|
||||||
});
|
});
|
||||||
exports.expect = expect;
|
|
||||||
|
export { expect, request, extendedTest as test };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a readable stream and returns a string.
|
||||||
|
* @param {ReadableStream} readable - the readable stream
|
||||||
|
* @return {Promise<String>} the stringified stream
|
||||||
|
*/
|
||||||
|
export async function streamToString(readable) {
|
||||||
|
let result = '';
|
||||||
|
for await (const chunk of readable) {
|
||||||
|
result += chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
2180
e2e/test-data/ExampleLayouts.json
Normal file
2180
e2e/test-data/ExampleLayouts.json
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1,90 @@
|
|||||||
{"openmct":{"b3cee102-86dd-4c0a-8eec-4d5d276f8691":{"identifier":{"key":"b3cee102-86dd-4c0a-8eec-4d5d276f8691","namespace":""},"name":"Performance Display Layout","type":"layout","composition":[{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""}],"configuration":{"items":[{"width":32,"height":18,"x":12,"y":9,"identifier":{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""},"hasFrame":true,"fontSize":"default","font":"default","type":"subobject-view","id":"23ca351d-a67d-46aa-a762-290eb742d2f1"}],"layoutGrid":[10,10]},"modified":1654299875432,"location":"mine","persisted":1654299878751},"9666e7b4-be0c-47a5-94b8-99accad7155e":{"identifier":{"key":"9666e7b4-be0c-47a5-94b8-99accad7155e","namespace":""},"name":"Performance Example Imagery","type":"example.imagery","configuration":{"imageLocation":"","imageLoadDelayInMilliSeconds":20000,"imageSamples":[],"layers":[{"source":"dist/imagery/example-imagery-layer-16x9.png","name":"16:9","visible":false},{"source":"dist/imagery/example-imagery-layer-safe.png","name":"Safe","visible":false},{"source":"dist/imagery/example-imagery-layer-scale.png","name":"Scale","visible":false}]},"telemetry":{"values":[{"name":"Name","key":"name"},{"name":"Time","key":"utc","format":"utc","hints":{"domain":2}},{"name":"Local Time","key":"local","format":"local-format","hints":{"domain":1}},{"name":"Image","key":"url","format":"image","hints":{"image":1},"layers":[{"source":"dist/imagery/example-imagery-layer-16x9.png","name":"16:9"},{"source":"dist/imagery/example-imagery-layer-safe.png","name":"Safe"},{"source":"dist/imagery/example-imagery-layer-scale.png","name":"Scale"}]},{"name":"Image Download Name","key":"imageDownloadName","format":"imageDownloadName","hints":{"imageDownloadName":1}}]},"modified":1654299840077,"location":"b3cee102-86dd-4c0a-8eec-4d5d276f8691","persisted":1654299840078}},"rootId":"b3cee102-86dd-4c0a-8eec-4d5d276f8691"}
|
{
|
||||||
|
"openmct": {
|
||||||
|
"b3cee102-86dd-4c0a-8eec-4d5d276f8691": {
|
||||||
|
"identifier": { "key": "b3cee102-86dd-4c0a-8eec-4d5d276f8691", "namespace": "" },
|
||||||
|
"name": "Performance Display Layout",
|
||||||
|
"type": "layout",
|
||||||
|
"composition": [{ "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" }],
|
||||||
|
"configuration": {
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"width": 32,
|
||||||
|
"height": 18,
|
||||||
|
"x": 12,
|
||||||
|
"y": 9,
|
||||||
|
"identifier": { "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" },
|
||||||
|
"hasFrame": true,
|
||||||
|
"fontSize": "default",
|
||||||
|
"font": "default",
|
||||||
|
"type": "subobject-view",
|
||||||
|
"id": "23ca351d-a67d-46aa-a762-290eb742d2f1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"layoutGrid": [10, 10]
|
||||||
|
},
|
||||||
|
"modified": 1654299875432,
|
||||||
|
"location": "mine",
|
||||||
|
"persisted": 1654299878751
|
||||||
|
},
|
||||||
|
"9666e7b4-be0c-47a5-94b8-99accad7155e": {
|
||||||
|
"identifier": { "key": "9666e7b4-be0c-47a5-94b8-99accad7155e", "namespace": "" },
|
||||||
|
"name": "Performance Example Imagery",
|
||||||
|
"type": "example.imagery",
|
||||||
|
"configuration": {
|
||||||
|
"imageLocation": "",
|
||||||
|
"imageLoadDelayInMilliSeconds": 20000,
|
||||||
|
"imageSamples": [],
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-16x9.png",
|
||||||
|
"name": "16:9",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-safe.png",
|
||||||
|
"name": "Safe",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"source": "dist/imagery/example-imagery-layer-scale.png",
|
||||||
|
"name": "Scale",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"telemetry": {
|
||||||
|
"values": [
|
||||||
|
{ "name": "Name", "key": "name" },
|
||||||
|
{ "name": "Time", "key": "utc", "format": "utc", "hints": { "domain": 2 } },
|
||||||
|
{
|
||||||
|
"name": "Local Time",
|
||||||
|
"key": "local",
|
||||||
|
"format": "local-format",
|
||||||
|
"hints": { "domain": 1 }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Image",
|
||||||
|
"key": "url",
|
||||||
|
"format": "image",
|
||||||
|
"hints": { "image": 1 },
|
||||||
|
"layers": [
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-16x9.png", "name": "16:9" },
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-safe.png", "name": "Safe" },
|
||||||
|
{ "source": "dist/imagery/example-imagery-layer-scale.png", "name": "Scale" }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Image Download Name",
|
||||||
|
"key": "imageDownloadName",
|
||||||
|
"format": "imageDownloadName",
|
||||||
|
"hints": { "imageDownloadName": 1 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"modified": 1654299840077,
|
||||||
|
"location": "b3cee102-86dd-4c0a-8eec-4d5d276f8691",
|
||||||
|
"persisted": 1654299840078
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rootId": "b3cee102-86dd-4c0a-8eec-4d5d276f8691"
|
||||||
|
}
|
||||||
|
@ -1 +1,96 @@
|
|||||||
{"openmct":{"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d":{"identifier":{"key":"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d","namespace":""},"name":"Performance Notebook","type":"notebook","configuration":{"defaultSort":"oldest","entries":{"3e31c412-33ba-4757-8ade-e9821f6ba321":{"8c8f6035-631c-45af-8c24-786c60295335":[{"id":"entry-1652815305457","createdOn":1652815305457,"createdBy":"","text":"Existing Entry 1","embeds":[]},{"id":"entry-1652815313465","createdOn":1652815313465,"createdBy":"","text":"Existing Entry 2","embeds":[]},{"id":"entry-1652815399955","createdOn":1652815399955,"createdBy":"","text":"Existing Entry 3","embeds":[]}]}},"imageMigrationVer":"v1","pageTitle":"Page","sections":[{"id":"3e31c412-33ba-4757-8ade-e9821f6ba321","isDefault":false,"isSelected":false,"name":"Section1","pages":[{"id":"8c8f6035-631c-45af-8c24-786c60295335","isDefault":false,"isSelected":false,"name":"Page1","pageTitle":"Page"},{"id":"36555942-c9aa-439c-bbdb-0aaf50db50f5","isDefault":false,"isSelected":false,"name":"Page2","pageTitle":"Page"}],"sectionTitle":"Section"},{"id":"dab0bd1d-2c5a-405c-987f-107123d6189a","isDefault":false,"isSelected":true,"name":"Section2","pages":[{"id":"f625a86a-cb99-4898-8082-80543c8de534","isDefault":false,"isSelected":false,"name":"Page1","pageTitle":"Page"},{"id":"e77ef810-f785-42a7-942e-07e999b79c59","isDefault":false,"isSelected":true,"name":"Page2","pageTitle":"Page"}],"sectionTitle":"Section"}],"sectionTitle":"Section","type":"General","showTime":"0"},"modified":1652815915219,"location":"mine","persisted":1652815915222}},"rootId":"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d"}
|
{
|
||||||
|
"openmct": {
|
||||||
|
"6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d": {
|
||||||
|
"identifier": { "key": "6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d", "namespace": "" },
|
||||||
|
"name": "Performance Notebook",
|
||||||
|
"type": "notebook",
|
||||||
|
"configuration": {
|
||||||
|
"defaultSort": "oldest",
|
||||||
|
"entries": {
|
||||||
|
"3e31c412-33ba-4757-8ade-e9821f6ba321": {
|
||||||
|
"8c8f6035-631c-45af-8c24-786c60295335": [
|
||||||
|
{
|
||||||
|
"id": "entry-1652815305457",
|
||||||
|
"createdOn": 1652815305457,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 1",
|
||||||
|
"embeds": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "entry-1652815313465",
|
||||||
|
"createdOn": 1652815313465,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 2",
|
||||||
|
"embeds": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "entry-1652815399955",
|
||||||
|
"createdOn": 1652815399955,
|
||||||
|
"createdBy": "",
|
||||||
|
"text": "Existing Entry 3",
|
||||||
|
"embeds": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"imageMigrationVer": "v1",
|
||||||
|
"pageTitle": "Page",
|
||||||
|
"sections": [
|
||||||
|
{
|
||||||
|
"id": "3e31c412-33ba-4757-8ade-e9821f6ba321",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Section1",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"id": "8c8f6035-631c-45af-8c24-786c60295335",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page1",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "36555942-c9aa-439c-bbdb-0aaf50db50f5",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page2",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "dab0bd1d-2c5a-405c-987f-107123d6189a",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": true,
|
||||||
|
"name": "Section2",
|
||||||
|
"pages": [
|
||||||
|
{
|
||||||
|
"id": "f625a86a-cb99-4898-8082-80543c8de534",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": false,
|
||||||
|
"name": "Page1",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "e77ef810-f785-42a7-942e-07e999b79c59",
|
||||||
|
"isDefault": false,
|
||||||
|
"isSelected": true,
|
||||||
|
"name": "Page2",
|
||||||
|
"pageTitle": "Page"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sectionTitle": "Section",
|
||||||
|
"type": "General",
|
||||||
|
"showTime": "0"
|
||||||
|
},
|
||||||
|
"modified": 1652815915219,
|
||||||
|
"location": "mine",
|
||||||
|
"persisted": 1652815915222
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rootId": "6d2fa9fd-f2aa-461a-a1e1-164ac44bec9d"
|
||||||
|
}
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
{
|
|
||||||
"cookies": [],
|
|
||||||
"origins": [
|
|
||||||
{
|
|
||||||
"origin": "http://localhost:8080",
|
|
||||||
"localStorage": [
|
|
||||||
{
|
|
||||||
"name": "tcHistory",
|
|
||||||
"value": "{\"utc\":[{\"start\":1658617611983,\"end\":1658619411983}]}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mct",
|
|
||||||
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"persisted\":1658619412848,\"modified\":1658619412848},\"7fa5749b-8969-494c-9d85-c272516d333c\":{\"identifier\":{\"key\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"namespace\":\"\"},\"name\":\"Unnamed Overlay Plot\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"}}]},\"modified\":1658619413566,\"location\":\"mine\",\"persisted\":1658619413567},\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\":{\"name\":\"Unnamed Sine Wave Generator\",\"type\":\"generator\",\"identifier\":{\"key\":\"67cbb9fc-af46-4148-b9e5-aea11179ae4b\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":\"5000\"},\"modified\":1658619413552,\"location\":\"7fa5749b-8969-494c-9d85-c272516d333c\",\"persisted\":1658619413552}}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "mct-tree-expanded",
|
|
||||||
"value": "[\"/browse/mine\"]"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
22
e2e/test-data/display_layout_with_child_layouts.json
Normal file
22
e2e/test-data/display_layout_with_child_layouts.json
Normal file
File diff suppressed because one or more lines are too long
54
e2e/test-data/examplePlans/ExamplePlanWithOrderedLanes.json
Normal file
54
e2e/test-data/examplePlans/ExamplePlanWithOrderedLanes.json
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"Groups": [
|
||||||
|
{
|
||||||
|
"name": "Group 1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Group 2"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Group 2": [
|
||||||
|
{
|
||||||
|
"name": "Past event 3",
|
||||||
|
"start": 1660493208000,
|
||||||
|
"end": 1660503981000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 4",
|
||||||
|
"start": 1660579608000,
|
||||||
|
"end": 1660624108000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 5",
|
||||||
|
"start": 1660666008000,
|
||||||
|
"end": 1660681529000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Group 1": [
|
||||||
|
{
|
||||||
|
"name": "Past event 1",
|
||||||
|
"start": 1660320408000,
|
||||||
|
"end": 1660343797000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 2",
|
||||||
|
"start": 1660406808000,
|
||||||
|
"end": 1660429160000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1080
e2e/test-data/examplePlans/ExamplePlan_Large.json
Normal file
1080
e2e/test-data/examplePlans/ExamplePlan_Large.json
Normal file
File diff suppressed because it is too large
Load Diff
49
e2e/test-data/examplePlans/ExamplePlan_Small1.json
Normal file
49
e2e/test-data/examplePlans/ExamplePlan_Small1.json
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"Group 1": [
|
||||||
|
{
|
||||||
|
"name": "Past event 1",
|
||||||
|
"start": 1660320408000,
|
||||||
|
"end": 1660343797000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 2",
|
||||||
|
"start": 1660406808000,
|
||||||
|
"end": 1660429160000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 3",
|
||||||
|
"start": 1660493208000,
|
||||||
|
"end": 1660503981000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 4",
|
||||||
|
"start": 1660579608000,
|
||||||
|
"end": 1660624108000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Past event 5",
|
||||||
|
"start": 1660666008000,
|
||||||
|
"end": 1660681529000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
38
e2e/test-data/examplePlans/ExamplePlan_Small2.json
Normal file
38
e2e/test-data/examplePlans/ExamplePlan_Small2.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"Group 1": [
|
||||||
|
{
|
||||||
|
"name": "Group 1 event 1",
|
||||||
|
"start": 1650320408000,
|
||||||
|
"end": 1660343797000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Group 1 event 2",
|
||||||
|
"start": 1660005808000,
|
||||||
|
"end": 1660429160000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "yellow",
|
||||||
|
"textColor": "white"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Group 2": [
|
||||||
|
{
|
||||||
|
"name": "Group 2 event 1",
|
||||||
|
"start": 1660320408000,
|
||||||
|
"end": 1660420408000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "green",
|
||||||
|
"textColor": "white"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Group 2 event 2",
|
||||||
|
"start": 1660406808000,
|
||||||
|
"end": 1690429160000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "blue",
|
||||||
|
"textColor": "white"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
42
e2e/test-data/examplePlans/ExamplePlan_Small3.json
Normal file
42
e2e/test-data/examplePlans/ExamplePlan_Small3.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"Group 1": [
|
||||||
|
{
|
||||||
|
"name": "Time until birthday",
|
||||||
|
"start": 1650320402000,
|
||||||
|
"end": 1660343797000,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "orange",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Time until supper",
|
||||||
|
"start": 1650320402000,
|
||||||
|
"end": 1650420410000,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "blue",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 2
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Group 2": [
|
||||||
|
{
|
||||||
|
"name": "Time since the last time I ate",
|
||||||
|
"start": 1650320102001,
|
||||||
|
"end": 1650320102001,
|
||||||
|
"type": "Group 2",
|
||||||
|
"color": "green",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Time since last accident",
|
||||||
|
"start": 1650320102002,
|
||||||
|
"end": 1650320102002,
|
||||||
|
"type": "Group 1",
|
||||||
|
"color": "yellow",
|
||||||
|
"textColor": "white",
|
||||||
|
"id": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
22
e2e/test-data/flexible_layout_with_child_layouts.json
Normal file
22
e2e/test-data/flexible_layout_with_child_layouts.json
Normal file
File diff suppressed because one or more lines are too long
1
e2e/test-data/memory-leak-detection.json
Normal file
1
e2e/test-data/memory-leak-detection.json
Normal file
File diff suppressed because one or more lines are too long
22
e2e/test-data/overlay_plot_storage.json
Normal file
22
e2e/test-data/overlay_plot_storage.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},\"e78ca721-fb5e-409b-bf6d-597c87cb716f\":{\"identifier\":{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603880,\"location\":\"mine\",\"created\":1732413601740,\"persisted\":1732413603880},\"c6100044-56be-44b3-acca-6b9fddfb3849\":{\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"},\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602460,\"location\":\"mine\",\"created\":1732413602460,\"persisted\":1732413602460}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-recent-objects",
|
||||||
|
"value": "[{\"objectPath\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602460,\"location\":\"mine\",\"created\":1732413602460,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/c6100044-56be-44b3-acca-6b9fddfb3849\",\"domainObject\":{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":0,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602460,\"location\":\"mine\",\"created\":1732413602460,\"persisted\":1732413602460}},{\"objectPath\":[{\"identifier\":{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603880,\"location\":\"mine\",\"created\":1732413601740,\"persisted\":1732413603880},{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine/e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"domainObject\":{\"identifier\":{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},\"name\":\"Overlay Plot with Telemetry Object\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with Telemetry Object\\nchrome\",\"modified\":1732413603880,\"location\":\"mine\",\"created\":1732413601740,\"persisted\":1732413603880}},{\"objectPath\":[{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460},{\"identifier\":{\"key\":\"ROOT\",\"namespace\":\"\"},\"name\":\"Open MCT\",\"type\":\"root\",\"composition\":[{\"key\":\"mine\",\"namespace\":\"\"}]}],\"navigationPath\":\"/browse/mine\",\"domainObject\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"e78ca721-fb5e-409b-bf6d-597c87cb716f\",\"namespace\":\"\"},{\"key\":\"c6100044-56be-44b3-acca-6b9fddfb3849\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413602460,\"created\":1732413600960,\"persisted\":1732413602460}}]"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
18
e2e/test-data/overlay_plot_with_delay_storage.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"cookies": [],
|
||||||
|
"origins": [
|
||||||
|
{
|
||||||
|
"origin": "http://localhost:8080",
|
||||||
|
"localStorage": [
|
||||||
|
{
|
||||||
|
"name": "mct",
|
||||||
|
"value": "{\"mine\":{\"identifier\":{\"key\":\"mine\",\"namespace\":\"\"},\"name\":\"My Items\",\"type\":\"folder\",\"composition\":[{\"key\":\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\",\"namespace\":\"\"}],\"location\":\"ROOT\",\"modified\":1732413601720,\"created\":1732413600920,\"persisted\":1732413601720},\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\":{\"identifier\":{\"key\":\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\",\"namespace\":\"\"},\"name\":\"Overlay Plot with 5s Delay\",\"type\":\"telemetry.plot.overlay\",\"composition\":[{\"key\":\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\",\"namespace\":\"\"}],\"configuration\":{\"series\":[{\"identifier\":{\"key\":\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\",\"namespace\":\"\"}}]},\"notes\":\"framework/generateLocalStorageData.e2e.spec.js\\nGenerate Visual Test Data @localStorage @generatedata\\nGenerate Overlay Plot with 5s Delay\\nchrome\",\"modified\":1732413603020,\"location\":\"mine\",\"created\":1732413601720,\"persisted\":1732413603020},\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\":{\"identifier\":{\"key\":\"8f524b49-ad06-47f9-98e0-087b31a2f3e0\",\"namespace\":\"\"},\"name\":\"VIPER Rover Heading\",\"type\":\"generator\",\"telemetry\":{\"period\":10,\"amplitude\":1,\"offset\":0,\"dataRateInHz\":1,\"phase\":0,\"randomness\":0,\"loadDelay\":5000,\"infinityValues\":false,\"exceedFloat32\":false,\"staleness\":false},\"modified\":1732413602920,\"location\":\"67ca2e0a-b37e-4eda-86a4-ccdbb228bbc0\",\"created\":1732413602420,\"persisted\":1732413602920}}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mct-tree-expanded",
|
||||||
|
"value": "[]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
BIN
e2e/test-data/rick.jpg
Normal file
BIN
e2e/test-data/rick.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
@ -1,5 +1,5 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Open MCT, Copyright (c) 2014-2022, United States Government
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
* Administration. All rights reserved.
|
* Administration. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -20,12 +20,17 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
const { test, expect } = require('../../baseFixtures.js');
|
import {
|
||||||
const { createDomainObjectWithDefaults } = require('../../appActions.js');
|
createDomainObjectWithDefaults,
|
||||||
|
createNotification,
|
||||||
|
expandEntireTree,
|
||||||
|
openObjectTreeContextMenu
|
||||||
|
} from '../../appActions.js';
|
||||||
|
import { expect, test } from '../../pluginFixtures.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',
|
||||||
@ -49,12 +54,12 @@ test.describe('AppActions', () => {
|
|||||||
parent: e2eFolder.uuid
|
parent: e2eFolder.uuid
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.goto(timer1.url, { waitUntil: 'networkidle' });
|
await page.goto(timer1.url);
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Timer Foo');
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
|
||||||
await page.goto(timer2.url, { waitUntil: 'networkidle' });
|
await page.goto(timer2.url);
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Timer Bar');
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
|
||||||
await page.goto(timer3.url, { waitUntil: 'networkidle' });
|
await page.goto(timer3.url);
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Timer Baz');
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer3.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step('Create multiple nested objects in a row', async () => {
|
await test.step('Create multiple nested objects in a row', async () => {
|
||||||
@ -73,16 +78,102 @@ test.describe('AppActions', () => {
|
|||||||
name: 'Folder Baz',
|
name: 'Folder Baz',
|
||||||
parent: folder2.uuid
|
parent: folder2.uuid
|
||||||
});
|
});
|
||||||
await page.goto(folder1.url, { waitUntil: 'networkidle' });
|
await page.goto(folder1.url);
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Folder Foo');
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
|
||||||
await page.goto(folder2.url, { waitUntil: 'networkidle' });
|
await page.goto(folder2.url);
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Folder Bar');
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
|
||||||
await page.goto(folder3.url, { waitUntil: 'networkidle' });
|
await page.goto(folder3.url);
|
||||||
await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Folder Baz');
|
await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder3.name);
|
||||||
|
|
||||||
expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
|
expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
|
||||||
expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
|
expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
|
||||||
expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
|
expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
test('createNotification', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test info notification',
|
||||||
|
severity: 'info'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test info notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/info/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test alert notification',
|
||||||
|
severity: 'alert'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test alert notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/alert/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
await createNotification(page, {
|
||||||
|
message: 'Test error notification',
|
||||||
|
severity: 'error'
|
||||||
|
});
|
||||||
|
await expect(page.locator('.c-message-banner__message')).toHaveText('Test error notification');
|
||||||
|
await expect(page.locator('.c-message-banner')).toHaveClass(/error/);
|
||||||
|
await page.locator('[aria-label="Dismiss"]').click();
|
||||||
|
});
|
||||||
|
test('expandEntireTree', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const rootFolder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
const folder1 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: rootFolder.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Clock',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
const folder2 = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder1.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder',
|
||||||
|
parent: folder2.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
await expandEntireTree(page);
|
||||||
|
const treePane = page.getByRole('tree', {
|
||||||
|
name: 'Main Tree'
|
||||||
|
});
|
||||||
|
const treePaneCollapsedItems = treePane.getByRole('treeitem', { expanded: false });
|
||||||
|
expect(await treePaneCollapsedItems.count()).toBe(0);
|
||||||
|
|
||||||
|
await page.goto('./#/browse/mine');
|
||||||
|
//Click the Create button
|
||||||
|
await page.getByRole('button', { name: 'Create' }).click();
|
||||||
|
|
||||||
|
// Click the object specified by 'type'
|
||||||
|
await page.click(`li[role='menuitem']:text("Clock")`);
|
||||||
|
await expandEntireTree(page, 'Create Modal Tree');
|
||||||
|
const locatorTree = page.getByRole('tree', {
|
||||||
|
name: 'Create Modal Tree'
|
||||||
|
});
|
||||||
|
const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
|
||||||
|
expect(await locatorTreeCollapsedItems.count()).toBe(0);
|
||||||
|
});
|
||||||
|
test('openObjectTreeContextMenu', async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
|
||||||
|
const folder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
await openObjectTreeContextMenu(page, folder.url);
|
||||||
|
await expect(page.getByLabel('Menu')).toBeVisible();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user