Compare commits
	
		
			281 Commits
		
	
	
		
			sprint-2.1
			...
			mct5773
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ee049cf957 | ||
| 
						 | 
					a798ddf05e | ||
| 
						 | 
					7af7e68779 | ||
| 
						 | 
					c200999659 | ||
| 
						 | 
					ddeeff4822 | ||
| 
						 | 
					5610846147 | ||
| 
						 | 
					88fde47932 | ||
| 
						 | 
					2a0faba35f | ||
| 
						 | 
					a47abf5f96 | ||
| 
						 | 
					968eee6698 | ||
| 
						 | 
					43d56a68bb | ||
| 
						 | 
					f055a8a0c7 | ||
| 
						 | 
					2820237d60 | ||
| 
						 | 
					b83d40af51 | ||
| 
						 | 
					dbdc9bb4e2 | ||
| 
						 | 
					a9a98380f2 | ||
| 
						 | 
					aaf25fcb01 | ||
| 
						 | 
					e3ab085dd5 | ||
| 
						 | 
					519135527b | ||
| 
						 | 
					fc37f6e05b | ||
| 
						 | 
					ab1df89396 | ||
| 
						 | 
					9ee5ab96f3 | ||
| 
						 | 
					8b2c6e3fb3 | ||
| 
						 | 
					b8b0a08eeb | ||
| 
						 | 
					633b6be2fd | ||
| 
						 | 
					4963aff8a0 | ||
| 
						 | 
					6786be54fa | ||
| 
						 | 
					b081389e68 | ||
| 
						 | 
					7a3ec3a241 | ||
| 
						 | 
					c0c383bf18 | ||
| 
						 | 
					fe1c99de12 | ||
| 
						 | 
					2e60da0401 | ||
| 
						 | 
					bc3a5408b4 | ||
| 
						 | 
					344bf8eed3 | ||
| 
						 | 
					cbb3368937 | ||
| 
						 | 
					b7a671d392 | ||
| 
						 | 
					4f10a93ef5 | ||
| 
						 | 
					f8186e4b4e | ||
| 
						 | 
					4e0c364d89 | ||
| 
						 | 
					f3bed9c651 | ||
| 
						 | 
					4d93907d58 | ||
| 
						 | 
					6f656a6783 | ||
| 
						 | 
					767fb6c5fd | ||
| 
						 | 
					b0a0b4bb58 | ||
| 
						 | 
					340f4a9e79 | ||
| 
						 | 
					3007b28b0f | ||
| 
						 | 
					20789601b4 | ||
| 
						 | 
					a56cfed732 | ||
| 
						 | 
					7ec2c4475b | ||
| 
						 | 
					8f59b16465 | ||
| 
						 | 
					36cfb1d515 | ||
| 
						 | 
					2ff7132e90 | ||
| 
						 | 
					d0ca398e01 | ||
| 
						 | 
					59278e8a06 | ||
| 
						 | 
					c8377f392b | ||
| 
						 | 
					29df748f2b | ||
| 
						 | 
					665ba6dae1 | ||
| 
						 | 
					f39f8df4e2 | ||
| 
						 | 
					4aa572d489 | ||
| 
						 | 
					0b24c4f2c5 | ||
| 
						 | 
					e4657f79cd | ||
| 
						 | 
					f2059406e0 | ||
| 
						 | 
					3e3dc7dd83 | ||
| 
						 | 
					50742c4f82 | ||
| 
						 | 
					2f04add2a3 | ||
| 
						 | 
					0ce5060246 | ||
| 
						 | 
					00353cdccf | ||
| 
						 | 
					a1ac209d74 | ||
| 
						 | 
					bdd8477b54 | ||
| 
						 | 
					f690f36bfb | ||
| 
						 | 
					e174f075df | ||
| 
						 | 
					8cf12db104 | ||
| 
						 | 
					453b1f3009 | ||
| 
						 | 
					201c669328 | ||
| 
						 | 
					1b7fb9b952 | ||
| 
						 | 
					a3c5450205 | ||
| 
						 | 
					8831b75c5d | ||
| 
						 | 
					8fe0472af2 | ||
| 
						 | 
					6cb5c47f3a | ||
| 
						 | 
					eff0cc96b9 | ||
| 
						 | 
					6ac7f24c63 | ||
| 
						 | 
					39463c515f | ||
| 
						 | 
					25c0dab346 | ||
| 
						 | 
					3714958627 | ||
| 
						 | 
					270a3d4f49 | ||
| 
						 | 
					1dc137f95e | ||
| 
						 | 
					ff3a20e446 | ||
| 
						 | 
					0b3e0e7efd | ||
| 
						 | 
					22cc28d733 | ||
| 
						 | 
					006fa0bcc7 | ||
| 
						 | 
					817d8da3e4 | ||
| 
						 | 
					8df81f0ea9 | ||
| 
						 | 
					1f30706d27 | ||
| 
						 | 
					600890c4a6 | ||
| 
						 | 
					b5002e166a | ||
| 
						 | 
					39cff51db0 | ||
| 
						 | 
					73734d99ea | ||
| 
						 | 
					1d4cf1ff06 | ||
| 
						 | 
					f388d9a548 | ||
| 
						 | 
					8040b275fc | ||
| 
						 | 
					0dd12bce85 | ||
| 
						 | 
					9c9e0442f1 | ||
| 
						 | 
					d49f057698 | ||
| 
						 | 
					c74ad1279c | ||
| 
						 | 
					470a451956 | ||
| 
						 | 
					fa6cbb6f4d | ||
| 
						 | 
					52c00cfaef | ||
| 
						 | 
					96d723a424 | ||
| 
						 | 
					fb4b80862e | ||
| 
						 | 
					bb2c8cfa63 | ||
| 
						 | 
					ceffee9f22 | ||
| 
						 | 
					a08ccd80dc | ||
| 
						 | 
					3509eacdec | ||
| 
						 | 
					d4496cba41 | ||
| 
						 | 
					64f300d466 | ||
| 
						 | 
					8de24a109a | ||
| 
						 | 
					6d62e0e73c | ||
| 
						 | 
					5da1c9c0d7 | ||
| 
						 | 
					4fa9a9697b | ||
| 
						 | 
					bf48a6e306 | ||
| 
						 | 
					00ad452930 | ||
| 
						 | 
					8df1f6406b | ||
| 
						 | 
					a50960d66c | ||
| 
						 | 
					e3a69c8856 | ||
| 
						 | 
					672cb7e621 | ||
| 
						 | 
					7dcccee1ae | ||
| 
						 | 
					302dbe7359 | ||
| 
						 | 
					b4df01965e | ||
| 
						 | 
					5a8f1d542e | ||
| 
						 | 
					10decda94e | ||
| 
						 | 
					5b1f8d0eac | ||
| 
						 | 
					2f6e1b703a | ||
| 
						 | 
					5384022a59 | ||
| 
						 | 
					b57974b462 | ||
| 
						 | 
					3c36ba9a71 | ||
| 
						 | 
					2ac463de90 | ||
| 
						 | 
					be38c3e654 | ||
| 
						 | 
					0f312a88bb | ||
| 
						 | 
					422b7f3e09 | ||
| 
						 | 
					800062d37e | ||
| 
						 | 
					c1e8c7915c | ||
| 
						 | 
					c1c1d87953 | ||
| 
						 | 
					0382d22f7f | ||
| 
						 | 
					f570424357 | ||
| 
						 | 
					393c801426 | ||
| 
						 | 
					6d63339b23 | ||
| 
						 | 
					66d7c626e1 | ||
| 
						 | 
					2246f33023 | ||
| 
						 | 
					871362d469 | ||
| 
						 | 
					cc1bf47f5a | ||
| 
						 | 
					9c784398b3 | ||
| 
						 | 
					21ce013df2 | ||
| 
						 | 
					d20c2a3e3c | ||
| 
						 | 
					8d1a2e6716 | ||
| 
						 | 
					01f724959d | ||
| 
						 | 
					3ae6290ec3 | ||
| 
						 | 
					ba5ed27e74 | ||
| 
						 | 
					ca737d8afa | ||
| 
						 | 
					33a275e8bc | ||
| 
						 | 
					60e808689c | ||
| 
						 | 
					8847c862fa | ||
| 
						 | 
					1b71a3bf33 | ||
| 
						 | 
					9980aab18f | ||
| 
						 | 
					5e530aa625 | ||
| 
						 | 
					986c596d90 | ||
| 
						 | 
					4d84b16d8b | ||
| 
						 | 
					20c7b23a4f | ||
| 
						 | 
					d1c7d133fc | ||
| 
						 | 
					edbbebe329 | ||
| 
						 | 
					f98a2cdd6b | ||
| 
						 | 
					22621aaaf8 | ||
| 
						 | 
					e0ca6200bb | ||
| 
						 | 
					70074c52c8 | ||
| 
						 | 
					d5adaf6e8c | ||
| 
						 | 
					8125632728 | ||
| 
						 | 
					14c9dd0a32 | ||
| 
						 | 
					9ae58f8441 | ||
| 
						 | 
					4889284335 | ||
| 
						 | 
					c2183d4de2 | ||
| 
						 | 
					902d80c214 | ||
| 
						 | 
					22ce817443 | ||
| 
						 | 
					cdb202d8ba | ||
| 
						 | 
					905373f294 | ||
| 
						 | 
					60c07ab506 | ||
| 
						 | 
					7336abc111 | ||
| 
						 | 
					8fe9da89a3 | ||
| 
						 | 
					e6bdaa957a | ||
| 
						 | 
					93b5519c4b | ||
| 
						 | 
					04ef4b369c | ||
| 
						 | 
					5424a62db5 | ||
| 
						 | 
					9ed9e62202 | ||
| 
						 | 
					327fc826c1 | ||
| 
						 | 
					a9e3eca35c | ||
| 
						 | 
					cbecd79f71 | ||
| 
						 | 
					3deb2e3dc2 | ||
| 
						 | 
					d6e80447ab | ||
| 
						 | 
					1a4bd0fb55 | ||
| 
						 | 
					80f89c7609 | ||
| 
						 | 
					b82649772f | ||
| 
						 | 
					7f2ed27106 | ||
| 
						 | 
					57e02db6b5 | ||
| 
						 | 
					d54335d21c | ||
| 
						 | 
					e0ed0bb6e2 | ||
| 
						 | 
					ed3fd8f965 | ||
| 
						 | 
					e6d59c61d1 | ||
| 
						 | 
					b74b27c464 | ||
| 
						 | 
					d35e161701 | ||
| 
						 | 
					653cb62f9c | ||
| 
						 | 
					19b3232fa0 | ||
| 
						 | 
					19892aab53 | ||
| 
						 | 
					a168ce25cf | ||
| 
						 | 
					189c58f952 | ||
| 
						 | 
					0dfc028e1b | ||
| 
						 | 
					77e93f1aee | ||
| 
						 | 
					394fbbe61b | ||
| 
						 | 
					40afb04f0c | ||
| 
						 | 
					be73b0158a | ||
| 
						 | 
					625205f24b | ||
| 
						 | 
					a706a8b73e | ||
| 
						 | 
					1ddf5e5137 | ||
| 
						 | 
					a79646a915 | ||
| 
						 | 
					d5266e7ac7 | ||
| 
						 | 
					05de7ee2e0 | ||
| 
						 | 
					dad88112c4 | ||
| 
						 | 
					202d6d8c5d | ||
| 
						 | 
					e70bcc414c | ||
| 
						 | 
					7bb4a136d7 | ||
| 
						 | 
					8af3b4309f | ||
| 
						 | 
					bed3d83fd7 | ||
| 
						 | 
					efda42cf6d | ||
| 
						 | 
					e8ee5b3fc9 | ||
| 
						 | 
					393cb9767f | ||
| 
						 | 
					8b5daad65c | ||
| 
						 | 
					fabfecdb3e | ||
| 
						 | 
					a2d8b13204 | ||
| 
						 | 
					4b14d2d6d2 | ||
| 
						 | 
					d545124942 | ||
| 
						 | 
					6abdbfdff0 | ||
| 
						 | 
					500e655476 | ||
| 
						 | 
					5e1f026db2 | ||
| 
						 | 
					d9efae98c8 | ||
| 
						 | 
					091f6406a8 | ||
| 
						 | 
					42a0e503cc | ||
| 
						 | 
					4697352f60 | ||
| 
						 | 
					015c764ab3 | ||
| 
						 | 
					8fe465d9fc | ||
| 
						 | 
					9c1368885a | ||
| 
						 | 
					391c0b2e7c | ||
| 
						 | 
					2ae061dbcd | ||
| 
						 | 
					41fc502564 | ||
| 
						 | 
					b4554d2fc1 | ||
| 
						 | 
					feba5f6d3b | ||
| 
						 | 
					4357d35f4a | ||
| 
						 | 
					5041f80e5b | ||
| 
						 | 
					9e23f79bc8 | ||
| 
						 | 
					bd1e869f6a | ||
| 
						 | 
					e4a36532e7 | ||
| 
						 | 
					2bc2316613 | ||
| 
						 | 
					2fa36b2176 | ||
| 
						 | 
					efa38d779e | ||
| 
						 | 
					951cc6ec0d | ||
| 
						 | 
					ef4b8a9934 | ||
| 
						 | 
					c14b48917e | ||
| 
						 | 
					26165d0a99 | ||
| 
						 | 
					f7cf3f72c2 | ||
| 
						 | 
					cb8e09c9f9 | ||
| 
						 | 
					026eb86f5f | ||
| 
						 | 
					866859a937 | ||
| 
						 | 
					afc54f41f6 | ||
| 
						 | 
					72c980f991 | ||
| 
						 | 
					9bf39a9cd4 | ||
| 
						 | 
					33fd95cb2b | ||
| 
						 | 
					8c92178895 | ||
| 
						 | 
					35bbebbbc7 | ||
| 
						 | 
					ce463babff | ||
| 
						 | 
					27c30132d2 | ||
| 
						 | 
					2bdac56505 | ||
| 
						 | 
					35c42ba43d | ||
| 
						 | 
					6bdb8c9e1c | ||
| 
						 | 
					4a5467aba7 | ||
| 
						 | 
					b85238d7d0 | 
@@ -2,11 +2,15 @@ version: 2.1
 | 
			
		||||
executors:
 | 
			
		||||
  pw-focal-development:
 | 
			
		||||
    docker:
 | 
			
		||||
      - image: mcr.microsoft.com/playwright:v1.25.2-focal
 | 
			
		||||
      - image: mcr.microsoft.com/playwright:v1.32.3-focal
 | 
			
		||||
    environment:
 | 
			
		||||
      NODE_ENV: development # Needed to ensure 'dist' folder created and devDependencies installed
 | 
			
		||||
      PERCY_POSTINSTALL_BROWSER: 'true' # Needed to store the percy browser in cache deps
 | 
			
		||||
      PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue: https://github.com/nasa/openmct/issues/5742)
 | 
			
		||||
  ubuntu:
 | 
			
		||||
    machine:
 | 
			
		||||
      image: ubuntu-2204:current
 | 
			
		||||
      docker_layer_caching: true
 | 
			
		||||
parameters:
 | 
			
		||||
  BUST_CACHE:
 | 
			
		||||
    description: "Set this with the CircleCI UI Trigger Workflow button (boolean = true) to bust the cache!"
 | 
			
		||||
@@ -23,9 +27,8 @@ commands:
 | 
			
		||||
      - restore_cache_cmd:
 | 
			
		||||
          node-version: << parameters.node-version >>
 | 
			
		||||
      - node/install:
 | 
			
		||||
          install-npm: true
 | 
			
		||||
          node-version: << parameters.node-version >>
 | 
			
		||||
      - run: npm install --prefer-offline --no-audit --progress=false
 | 
			
		||||
      - run: npm install --no-audit --progress=false
 | 
			
		||||
  restore_cache_cmd:
 | 
			
		||||
    description: "Custom command for restoring cache with the ability to bust cache. When BUST_CACHE is set to true, jobs will not restore cache"
 | 
			
		||||
    parameters:
 | 
			
		||||
@@ -37,7 +40,7 @@ commands:
 | 
			
		||||
            equal: [false, << pipeline.parameters.BUST_CACHE >> ]
 | 
			
		||||
          steps:
 | 
			
		||||
            - restore_cache:
 | 
			
		||||
                key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
 | 
			
		||||
                key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
 | 
			
		||||
  save_cache_cmd:
 | 
			
		||||
    description: "Custom command for saving cache."
 | 
			
		||||
    parameters:
 | 
			
		||||
@@ -45,7 +48,7 @@ commands:
 | 
			
		||||
        type: string
 | 
			
		||||
    steps:
 | 
			
		||||
      - save_cache:
 | 
			
		||||
          key: deps-{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
 | 
			
		||||
          key: deps--{{ arch }}--{{ .Branch }}--<< parameters.node-version >>--{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}
 | 
			
		||||
          paths:
 | 
			
		||||
            - ~/.npm
 | 
			
		||||
            - node_modules
 | 
			
		||||
@@ -53,8 +56,8 @@ commands:
 | 
			
		||||
    description: "Track important packages and files"
 | 
			
		||||
    steps:
 | 
			
		||||
      - run: |
 | 
			
		||||
          mkdir /tmp/artifacts
 | 
			
		||||
          printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt
 | 
			
		||||
          [[ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
 | 
			
		||||
          printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt || true
 | 
			
		||||
          npm -v >> /tmp/artifacts/npm-version.txt
 | 
			
		||||
          node -v >> /tmp/artifacts/node-version.txt
 | 
			
		||||
          ls -latR >> /tmp/artifacts/dir.txt
 | 
			
		||||
@@ -69,7 +72,7 @@ commands:
 | 
			
		||||
    - run: npm run cov:e2e:report || true
 | 
			
		||||
    - run: npm run cov:e2e:<<parameters.suite>>:publish
 | 
			
		||||
orbs:
 | 
			
		||||
  node: circleci/node@4.9.0
 | 
			
		||||
  node: circleci/node@5.1.0
 | 
			
		||||
  browser-tools: circleci/browser-tools@1.3.0
 | 
			
		||||
jobs:
 | 
			
		||||
  npm-audit:
 | 
			
		||||
@@ -110,7 +113,11 @@ jobs:
 | 
			
		||||
          path: dist/reports/tests/
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: coverage
 | 
			
		||||
      - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
            - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
  e2e-test:
 | 
			
		||||
    parameters:
 | 
			
		||||
      node-version:
 | 
			
		||||
@@ -128,8 +135,12 @@ jobs:
 | 
			
		||||
          steps:
 | 
			
		||||
            - run: npx playwright install chrome-beta
 | 
			
		||||
      - run: SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
 | 
			
		||||
      - generate_e2e_code_cov_report:
 | 
			
		||||
         suite: <<parameters.suite>>          
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
          - generate_e2e_code_cov_report:
 | 
			
		||||
              suite: <<parameters.suite>>          
 | 
			
		||||
      - store_test_results:
 | 
			
		||||
          path: test-results/results.xml
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
@@ -138,7 +149,46 @@ jobs:
 | 
			
		||||
          path: coverage
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: html-test-results
 | 
			
		||||
      - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
            - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
  e2e-couchdb:
 | 
			
		||||
    parameters:
 | 
			
		||||
      node-version:
 | 
			
		||||
        type: string
 | 
			
		||||
    executor: ubuntu
 | 
			
		||||
    steps:
 | 
			
		||||
      - build_and_install:
 | 
			
		||||
          node-version: <<parameters.node-version>>
 | 
			
		||||
      - run: npx playwright@1.32.3 install #Necessary for bare ubuntu machine
 | 
			
		||||
      - run: |
 | 
			
		||||
          export $(cat src/plugins/persistence/couch/.env.ci | xargs)
 | 
			
		||||
          docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
 | 
			
		||||
          sleep 3
 | 
			
		||||
          bash src/plugins/persistence/couch/setup-couchdb.sh
 | 
			
		||||
      - run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh #Replace LocalStorage Plugin with CouchDB 
 | 
			
		||||
      - run: npm run test:e2e:couchdb
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
          - generate_e2e_code_cov_report:
 | 
			
		||||
              suite: full #add to full suite
 | 
			
		||||
      - store_test_results:
 | 
			
		||||
          path: test-results/results.xml
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: test-results
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: coverage
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: html-test-results
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
            - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
  perf-test:
 | 
			
		||||
    parameters:
 | 
			
		||||
      node-version:
 | 
			
		||||
@@ -154,7 +204,11 @@ jobs:
 | 
			
		||||
          path: test-results
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: html-test-results
 | 
			
		||||
      - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
            - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
  visual-test:
 | 
			
		||||
    parameters:
 | 
			
		||||
      node-version:
 | 
			
		||||
@@ -170,46 +224,49 @@ jobs:
 | 
			
		||||
          path: test-results
 | 
			
		||||
      - store_artifacts:
 | 
			
		||||
          path: html-test-results
 | 
			
		||||
      - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
      - when:
 | 
			
		||||
          condition:
 | 
			
		||||
            equal: [ 42, 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
 | 
			
		||||
          steps:
 | 
			
		||||
            - generate_and_store_version_and_filesystem_artifacts
 | 
			
		||||
workflows:
 | 
			
		||||
  overall-circleci-commit-status: #These jobs run on every commit
 | 
			
		||||
    jobs:
 | 
			
		||||
      - lint:
 | 
			
		||||
          name: node14-lint
 | 
			
		||||
          node-version: lts/fermium
 | 
			
		||||
          name: node16-lint
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
      - unit-test:
 | 
			
		||||
          name: node18-chrome
 | 
			
		||||
          node-version: "18"
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
      - e2e-test:
 | 
			
		||||
          name: e2e-stable
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
          suite: stable
 | 
			
		||||
      - perf-test:
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
      - visual-test:
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
        
 | 
			
		||||
  the-nightly: #These jobs do not run on PRs, but against master at night
 | 
			
		||||
    jobs:
 | 
			
		||||
      - unit-test:
 | 
			
		||||
          name: node14-chrome-nightly
 | 
			
		||||
          node-version: lts/fermium
 | 
			
		||||
      - unit-test:
 | 
			
		||||
          name: node16-chrome-nightly
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
      - unit-test:
 | 
			
		||||
          name: node18-chrome
 | 
			
		||||
          node-version: "18"
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
      - npm-audit:
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
      - e2e-test:
 | 
			
		||||
          name: e2e-full-nightly
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
          suite: full
 | 
			
		||||
      - perf-test:
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
      - visual-test:
 | 
			
		||||
          node-version: lts/gallium
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
      - e2e-couchdb:
 | 
			
		||||
          node-version: lts/hydrogen
 | 
			
		||||
    triggers:
 | 
			
		||||
      - schedule:
 | 
			
		||||
          cron: "0 0 * * *"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								.github/PULL_REQUEST_TEMPLATE.md
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -21,9 +21,9 @@ Closes <!--- Insert Issue Number(s) this PR addresses. Start by typing # will op
 | 
			
		||||
### Reviewer Checklist
 | 
			
		||||
 | 
			
		||||
* [ ] Changes appear to address issue?
 | 
			
		||||
* [ ] Reviewer has tested changes by following the provided instructions?
 | 
			
		||||
* [ ] Changes appear not to be breaking changes?
 | 
			
		||||
* [ ] Appropriate unit tests included?
 | 
			
		||||
* [ ] Appropriate automated 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)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								.github/codeql/codeql-config.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1 @@
 | 
			
		||||
name: 'Custom CodeQL config'
 | 
			
		||||
							
								
								
									
										22
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -4,28 +4,36 @@ updates:
 | 
			
		||||
  - package-ecosystem: "npm"
 | 
			
		||||
    directory: "/"
 | 
			
		||||
    schedule:
 | 
			
		||||
      interval: "daily"  
 | 
			
		||||
      interval: "weekly"  
 | 
			
		||||
    open-pull-requests-limit: 10
 | 
			
		||||
    labels:
 | 
			
		||||
      - "pr:daveit"
 | 
			
		||||
      - "pr:e2e"
 | 
			
		||||
      - "type:maintenance"
 | 
			
		||||
      - "dependencies"
 | 
			
		||||
      - "pr:daveit"
 | 
			
		||||
      - "pr:platform"
 | 
			
		||||
    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"
 | 
			
		||||
        #Lots of noise in these type patch releases.
 | 
			
		||||
      - dependency-name: "playwright-core"
 | 
			
		||||
      #Lots of noise in these type patch releases.
 | 
			
		||||
      - dependency-name: "@babel/eslint-parser"
 | 
			
		||||
        update-types: ["version-update:semver-patch"]
 | 
			
		||||
        update-types: ["version-update:semver-patch"] 
 | 
			
		||||
      - dependency-name: "eslint-plugin-vue"
 | 
			
		||||
        update-types: ["version-update:semver-patch"]
 | 
			
		||||
 | 
			
		||||
      - dependency-name: "babel-loader"
 | 
			
		||||
        update-types: ["version-update:semver-patch"]
 | 
			
		||||
      - dependency-name: "sinon"
 | 
			
		||||
        update-types: ["version-update:semver-patch"]
 | 
			
		||||
      - dependency-name: "moment-timezone"
 | 
			
		||||
        update-types: ["version-update:semver-patch"]
 | 
			
		||||
      - dependency-name: "@types/lodash"
 | 
			
		||||
        update-types: ["version-update:semver-patch"]
 | 
			
		||||
  - package-ecosystem: "github-actions"
 | 
			
		||||
    directory: "/"
 | 
			
		||||
    schedule:
 | 
			
		||||
      interval: "daily"    
 | 
			
		||||
    labels:
 | 
			
		||||
      - "pr:daveit"
 | 
			
		||||
      - "type:maintenance"
 | 
			
		||||
      - "dependencies"
 | 
			
		||||
      - "pr:daveit"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								.github/workflows/codeql-analysis.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -1,11 +1,10 @@
 | 
			
		||||
 | 
			
		||||
name: "CodeQL"
 | 
			
		||||
name: 'CodeQL'
 | 
			
		||||
 | 
			
		||||
on:
 | 
			
		||||
  push:
 | 
			
		||||
    branches: [ master ]
 | 
			
		||||
    branches: [master, 'release/*']
 | 
			
		||||
  pull_request:
 | 
			
		||||
    branches: [ master ]
 | 
			
		||||
    branches: [master, 'release/*']
 | 
			
		||||
    paths-ignore:
 | 
			
		||||
      - '**/*Spec.js'
 | 
			
		||||
      - '**/*.md'
 | 
			
		||||
@@ -27,17 +26,19 @@ jobs:
 | 
			
		||||
      security-events: write
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
    - name: Checkout repository
 | 
			
		||||
      uses: actions/checkout@v3
 | 
			
		||||
      - name: Checkout repository
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
    # Initializes the CodeQL tools for scanning.
 | 
			
		||||
    - name: Initialize CodeQL
 | 
			
		||||
      uses: github/codeql-action/init@v2
 | 
			
		||||
      with:
 | 
			
		||||
        languages: javascript
 | 
			
		||||
      # Initializes the CodeQL tools for scanning.
 | 
			
		||||
      - name: Initialize CodeQL
 | 
			
		||||
        uses: github/codeql-action/init@v2
 | 
			
		||||
        with:
 | 
			
		||||
          config-file: ./.github/codeql/codeql-config.yml
 | 
			
		||||
          languages: javascript
 | 
			
		||||
          queries: security-and-quality
 | 
			
		||||
 | 
			
		||||
    - name: Autobuild
 | 
			
		||||
      uses: github/codeql-action/autobuild@v2
 | 
			
		||||
      - name: Autobuild
 | 
			
		||||
        uses: github/codeql-action/autobuild@v2
 | 
			
		||||
 | 
			
		||||
    - name: Perform CodeQL Analysis
 | 
			
		||||
      uses: github/codeql-action/analyze@v2
 | 
			
		||||
      - name: Perform CodeQL Analysis
 | 
			
		||||
        uses: github/codeql-action/analyze@v2
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										35
									
								
								.github/workflows/e2e-couchdb.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -5,34 +5,39 @@ on:
 | 
			
		||||
    types:
 | 
			
		||||
      - labeled
 | 
			
		||||
      - opened
 | 
			
		||||
env:
 | 
			
		||||
  OPENMCT_DATABASE_NAME: openmct
 | 
			
		||||
  COUCH_ADMIN_USER: admin
 | 
			
		||||
  COUCH_ADMIN_PASSWORD: password
 | 
			
		||||
  COUCH_BASE_LOCAL: http://localhost:5984
 | 
			
		||||
  COUCH_NODE_NAME: nonode@nohost
 | 
			
		||||
jobs:
 | 
			
		||||
  e2e-couchdb:
 | 
			
		||||
    if: ${{ github.event.label.name == 'pr:e2e:couchdb' }}
 | 
			
		||||
    if: ${{ github.event.label.name == 'pr:e2e:couchdb' }} || ${{ github.event.action == 'opened' }}
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - uses: actions/checkout@v3
 | 
			
		||||
      - run : docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
 | 
			
		||||
      - run : sleep 3 # wait until CouchDB has started (TODO: there must be a better way)
 | 
			
		||||
      - run : bash src/plugins/persistence/couch/setup-couchdb.sh
 | 
			
		||||
      - uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '16'
 | 
			
		||||
      - run: npx playwright@1.25.2 install
 | 
			
		||||
          node-version: 'lts/gallium'
 | 
			
		||||
      - run: npx playwright@1.32.3 install
 | 
			
		||||
      - run: npm install
 | 
			
		||||
      - run: sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
 | 
			
		||||
      - run: npm run test:e2e:couchdb
 | 
			
		||||
      - run: ls -latr
 | 
			
		||||
      - name: Start CouchDB Docker Container and Init with Setup Scripts
 | 
			
		||||
        run : |
 | 
			
		||||
          export $(cat src/plugins/persistence/couch/.env.ci | xargs)
 | 
			
		||||
          docker-compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
 | 
			
		||||
          sleep 3
 | 
			
		||||
          bash src/plugins/persistence/couch/setup-couchdb.sh
 | 
			
		||||
          bash src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh
 | 
			
		||||
      - name: Run CouchDB Tests and publish to deploysentinel
 | 
			
		||||
        env:
 | 
			
		||||
          DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }} 
 | 
			
		||||
        run: npm run test:e2e:couchdb
 | 
			
		||||
      - name: Publish Results to Codecov.io
 | 
			
		||||
        env: 
 | 
			
		||||
          SUPER_SECRET: ${{ secrets.CODECOV_TOKEN }}
 | 
			
		||||
        run: npm run cov:e2e:full:publish
 | 
			
		||||
      - name: Archive test results
 | 
			
		||||
        if: success() || failure()
 | 
			
		||||
        uses: actions/upload-artifact@v3
 | 
			
		||||
        with:
 | 
			
		||||
          path: test-results
 | 
			
		||||
      - name: Archive html test results
 | 
			
		||||
        if: success() || failure()
 | 
			
		||||
        uses: actions/upload-artifact@v3
 | 
			
		||||
        with:
 | 
			
		||||
          path: html-test-results
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								.github/workflows/e2e-pr.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -5,7 +5,6 @@ on:
 | 
			
		||||
    types:
 | 
			
		||||
      - labeled
 | 
			
		||||
      - opened
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  e2e-full:
 | 
			
		||||
    if: ${{ github.event.label.name == 'pr:e2e' }}
 | 
			
		||||
@@ -30,11 +29,18 @@ jobs:
 | 
			
		||||
      - uses: actions/setup-node@v3
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: '16'
 | 
			
		||||
      - run: npx playwright@1.25.2 install
 | 
			
		||||
      - run: npx playwright@1.32.3 install
 | 
			
		||||
      - run: npx playwright install chrome-beta
 | 
			
		||||
      - run: npm install
 | 
			
		||||
      - 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
 | 
			
		||||
        if: success() || failure()
 | 
			
		||||
        uses: actions/upload-artifact@v3
 | 
			
		||||
        with:
 | 
			
		||||
          path: test-results
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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
									
									
								
							
							
						
						@@ -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
 | 
			
		||||
        
 | 
			
		||||
							
								
								
									
										8
									
								
								.github/workflows/npm-prerelease.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -16,7 +16,11 @@ jobs:
 | 
			
		||||
        with:
 | 
			
		||||
          node-version: 16
 | 
			
		||||
      - 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:
 | 
			
		||||
    needs: build
 | 
			
		||||
@@ -28,6 +32,6 @@ jobs:
 | 
			
		||||
          node-version: 16
 | 
			
		||||
          registry-url: https://registry.npmjs.org/
 | 
			
		||||
      - run: npm install
 | 
			
		||||
      - run: npm publish --access public --tag unstable
 | 
			
		||||
      - run: npm publish --access=public --tag unstable
 | 
			
		||||
        env:
 | 
			
		||||
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								.github/workflows/pr-platform.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						@@ -16,7 +16,6 @@ jobs:
 | 
			
		||||
          - macos-latest
 | 
			
		||||
          - windows-latest
 | 
			
		||||
        node_version:
 | 
			
		||||
          - 14
 | 
			
		||||
          - 16
 | 
			
		||||
          - 18
 | 
			
		||||
        architecture:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								.npmignore
									
									
									
									
									
								
							
							
						
						@@ -10,9 +10,6 @@
 | 
			
		||||
# https://github.com/nasa/openmct/issues/4992
 | 
			
		||||
!/example/**/*
 | 
			
		||||
 | 
			
		||||
# We will remove this in https://github.com/nasa/openmct/issues/4922
 | 
			
		||||
!/app.js
 | 
			
		||||
 | 
			
		||||
# ...except for these files in the above folders.
 | 
			
		||||
/src/**/*Spec.js
 | 
			
		||||
/src/**/test/
 | 
			
		||||
@@ -24,4 +21,10 @@
 | 
			
		||||
!copyright-notice.html
 | 
			
		||||
!index.html
 | 
			
		||||
!openmct.js
 | 
			
		||||
!SECURITY.md
 | 
			
		||||
!SECURITY.md
 | 
			
		||||
 | 
			
		||||
# Add e2e tests to npm package
 | 
			
		||||
!/e2e/**/*
 | 
			
		||||
 | 
			
		||||
# ... except our test-data folder files.
 | 
			
		||||
/e2e/test-data/*.json
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										176
									
								
								.webpack/webpack.common.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,176 @@
 | 
			
		||||
/* global __dirname module */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This is the OpenMCT common webpack file. It is imported by the other three webpack configurations:
 | 
			
		||||
 - webpack.prod.js - the production configuration for OpenMCT (default)
 | 
			
		||||
 - webpack.dev.js - the development configuration for OpenMCT
 | 
			
		||||
 - webpack.coverage.js - imports webpack.dev.js and adds code coverage
 | 
			
		||||
There are separate npm scripts to use these configurations, though simply running `npm install`
 | 
			
		||||
will use the default production configuration.
 | 
			
		||||
*/
 | 
			
		||||
const path = require("path");
 | 
			
		||||
const packageDefinition = require("../package.json");
 | 
			
		||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
 | 
			
		||||
const webpack = require("webpack");
 | 
			
		||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
 | 
			
		||||
 | 
			
		||||
const { VueLoaderPlugin } = require("vue-loader");
 | 
			
		||||
let gitRevision = "error-retrieving-revision";
 | 
			
		||||
let gitBranch = "error-retrieving-branch";
 | 
			
		||||
 | 
			
		||||
try {
 | 
			
		||||
    gitRevision = require("child_process")
 | 
			
		||||
        .execSync("git rev-parse HEAD")
 | 
			
		||||
        .toString()
 | 
			
		||||
        .trim();
 | 
			
		||||
    gitBranch = require("child_process")
 | 
			
		||||
        .execSync("git rev-parse --abbrev-ref HEAD")
 | 
			
		||||
        .toString()
 | 
			
		||||
        .trim();
 | 
			
		||||
} catch (err) {
 | 
			
		||||
    console.warn(err);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const projectRootDir = path.resolve(__dirname, "..");
 | 
			
		||||
 | 
			
		||||
/** @type {import('webpack').Configuration} */
 | 
			
		||||
const config = {
 | 
			
		||||
    context: projectRootDir,
 | 
			
		||||
    entry: {
 | 
			
		||||
        openmct: "./openmct.js",
 | 
			
		||||
        generatorWorker: "./example/generator/generatorWorker.js",
 | 
			
		||||
        couchDBChangesFeed:
 | 
			
		||||
            "./src/plugins/persistence/couch/CouchChangesFeed.js",
 | 
			
		||||
        inMemorySearchWorker: "./src/api/objects/InMemorySearchWorker.js",
 | 
			
		||||
        espressoTheme: "./src/plugins/themes/espresso-theme.scss",
 | 
			
		||||
        snowTheme: "./src/plugins/themes/snow-theme.scss"
 | 
			
		||||
    },
 | 
			
		||||
    output: {
 | 
			
		||||
        globalObject: "this",
 | 
			
		||||
        filename: "[name].js",
 | 
			
		||||
        path: path.resolve(projectRootDir, "dist"),
 | 
			
		||||
        library: "openmct",
 | 
			
		||||
        libraryTarget: "umd",
 | 
			
		||||
        publicPath: "",
 | 
			
		||||
        hashFunction: "xxhash64",
 | 
			
		||||
        clean: true
 | 
			
		||||
    },
 | 
			
		||||
    resolve: {
 | 
			
		||||
        alias: {
 | 
			
		||||
            "@": path.join(projectRootDir, "src"),
 | 
			
		||||
            legacyRegistry: path.join(projectRootDir, "src/legacyRegistry"),
 | 
			
		||||
            saveAs: "file-saver/src/FileSaver.js",
 | 
			
		||||
            csv: "comma-separated-values",
 | 
			
		||||
            EventEmitter: "eventemitter3",
 | 
			
		||||
            bourbon: "bourbon.scss",
 | 
			
		||||
            "plotly-basic": "plotly.js-basic-dist",
 | 
			
		||||
            "plotly-gl2d": "plotly.js-gl2d-dist",
 | 
			
		||||
            "d3-scale": path.join(
 | 
			
		||||
                projectRootDir,
 | 
			
		||||
                "node_modules/d3-scale/dist/d3-scale.min.js"
 | 
			
		||||
            ),
 | 
			
		||||
            printj: path.join(
 | 
			
		||||
                projectRootDir,
 | 
			
		||||
                "node_modules/printj/dist/printj.min.js"
 | 
			
		||||
            ),
 | 
			
		||||
            styles: path.join(projectRootDir, "src/styles"),
 | 
			
		||||
            MCT: path.join(projectRootDir, "src/MCT"),
 | 
			
		||||
            testUtils: path.join(projectRootDir, "src/utils/testUtils.js"),
 | 
			
		||||
            objectUtils: path.join(
 | 
			
		||||
                projectRootDir,
 | 
			
		||||
                "src/api/objects/object-utils.js"
 | 
			
		||||
            ),
 | 
			
		||||
            "kdbush": path.join(projectRootDir, "node_modules/kdbush/kdbush.min.js"),
 | 
			
		||||
            utils: path.join(projectRootDir, "src/utils")
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    plugins: [
 | 
			
		||||
        new webpack.DefinePlugin({
 | 
			
		||||
            __OPENMCT_VERSION__: `'${packageDefinition.version}'`,
 | 
			
		||||
            __OPENMCT_BUILD_DATE__: `'${new Date()}'`,
 | 
			
		||||
            __OPENMCT_REVISION__: `'${gitRevision}'`,
 | 
			
		||||
            __OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`
 | 
			
		||||
        }),
 | 
			
		||||
        new VueLoaderPlugin(),
 | 
			
		||||
        new CopyWebpackPlugin({
 | 
			
		||||
            patterns: [
 | 
			
		||||
                {
 | 
			
		||||
                    from: "src/images/favicons",
 | 
			
		||||
                    to: "favicons"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    from: "./index.html",
 | 
			
		||||
                    transform: function (content) {
 | 
			
		||||
                        return content.toString().replace(/dist\//g, "");
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    from: "src/plugins/imagery/layers",
 | 
			
		||||
                    to: "imagery"
 | 
			
		||||
                }
 | 
			
		||||
            ]
 | 
			
		||||
        }),
 | 
			
		||||
        new MiniCssExtractPlugin({
 | 
			
		||||
            filename: "[name].css",
 | 
			
		||||
            chunkFilename: "[name].css"
 | 
			
		||||
        })
 | 
			
		||||
    ],
 | 
			
		||||
    module: {
 | 
			
		||||
        rules: [
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.(sc|sa|c)ss$/,
 | 
			
		||||
                use: [
 | 
			
		||||
                    MiniCssExtractPlugin.loader,
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: "css-loader"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: "resolve-url-loader"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: "sass-loader",
 | 
			
		||||
                        options: { sourceMap: true }
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.vue$/,
 | 
			
		||||
                use: "vue-loader"
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.html$/,
 | 
			
		||||
                type: "asset/source"
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.(jpg|jpeg|png|svg)$/,
 | 
			
		||||
                type: "asset/resource",
 | 
			
		||||
                generator: {
 | 
			
		||||
                    filename: "images/[name][ext]"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.ico$/,
 | 
			
		||||
                type: "asset/resource",
 | 
			
		||||
                generator: {
 | 
			
		||||
                    filename: "icons/[name][ext]"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.(woff|woff2?|eot|ttf)$/,
 | 
			
		||||
                type: "asset/resource",
 | 
			
		||||
                generator: {
 | 
			
		||||
                    filename: "fonts/[name][ext]"
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    stats: "errors-warnings",
 | 
			
		||||
    performance: {
 | 
			
		||||
        // We should eventually consider chunking to decrease
 | 
			
		||||
        // these values
 | 
			
		||||
        maxEntrypointSize: 27000000,
 | 
			
		||||
        maxAssetSize: 27000000
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports = config;
 | 
			
		||||
							
								
								
									
										37
									
								
								.webpack/webpack.coverage.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,37 @@
 | 
			
		||||
/* global module */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This file extends the webpack.dev.js config to add babel istanbul coverage.
 | 
			
		||||
OpenMCT Continuous Integration servers use this configuration to add code coverage
 | 
			
		||||
information to pull requests.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const config = require("./webpack.dev");
 | 
			
		||||
// eslint-disable-next-line no-undef
 | 
			
		||||
const CI = process.env.CI === "true";
 | 
			
		||||
 | 
			
		||||
config.devtool = CI ? false : undefined;
 | 
			
		||||
 | 
			
		||||
config.devServer.hot = false;
 | 
			
		||||
 | 
			
		||||
config.module.rules.push({
 | 
			
		||||
    test: /\.js$/,
 | 
			
		||||
    exclude: /(Spec\.js$)|(node_modules)/,
 | 
			
		||||
    use: {
 | 
			
		||||
        loader: "babel-loader",
 | 
			
		||||
        options: {
 | 
			
		||||
            retainLines: true,
 | 
			
		||||
            // eslint-disable-next-line no-undef
 | 
			
		||||
            plugins: [
 | 
			
		||||
                [
 | 
			
		||||
                    "babel-plugin-istanbul",
 | 
			
		||||
                    {
 | 
			
		||||
                        extension: [".js", ".vue"]
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            ]
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
module.exports = config;
 | 
			
		||||
							
								
								
									
										63
									
								
								.webpack/webpack.dev.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,63 @@
 | 
			
		||||
/* global __dirname module */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This configuration should be used for development purposes. It contains full source map, a
 | 
			
		||||
devServer (which be invoked using by `npm start`), and a non-minified Vue.js distribution.
 | 
			
		||||
If OpenMCT is to be used for a production server, use webpack.prod.js instead.
 | 
			
		||||
*/
 | 
			
		||||
const path = require("path");
 | 
			
		||||
const webpack = require("webpack");
 | 
			
		||||
const { merge } = require("webpack-merge");
 | 
			
		||||
 | 
			
		||||
const common = require("./webpack.common");
 | 
			
		||||
const projectRootDir = path.resolve(__dirname, "..");
 | 
			
		||||
 | 
			
		||||
module.exports = merge(common, {
 | 
			
		||||
    mode: "development",
 | 
			
		||||
    watchOptions: {
 | 
			
		||||
        // Since we use require.context, webpack is watching the entire directory.
 | 
			
		||||
        // We need to exclude any files we don't want webpack to watch.
 | 
			
		||||
        // See: https://webpack.js.org/configuration/watch/#watchoptions-exclude
 | 
			
		||||
        ignored: [
 | 
			
		||||
            "**/{node_modules,dist,docs,e2e}", // All files in node_modules, dist, docs, e2e,
 | 
			
		||||
            "**/{*.yml,Procfile,webpack*.js,babel*.js,package*.json,tsconfig.json}", // Config files
 | 
			
		||||
            "**/*.{sh,md,png,ttf,woff,svg}", // Non source files
 | 
			
		||||
            "**/.*" // dotfiles and dotfolders
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    resolve: {
 | 
			
		||||
        alias: {
 | 
			
		||||
            vue: path.join(projectRootDir, "node_modules/vue/dist/vue.js")
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    plugins: [
 | 
			
		||||
        new webpack.DefinePlugin({
 | 
			
		||||
            __OPENMCT_ROOT_RELATIVE__: '"dist/"'
 | 
			
		||||
        })
 | 
			
		||||
    ],
 | 
			
		||||
    devtool: "eval-source-map",
 | 
			
		||||
    devServer: {
 | 
			
		||||
        devMiddleware: {
 | 
			
		||||
            writeToDisk: (filePathString) => {
 | 
			
		||||
                const filePath = path.parse(filePathString);
 | 
			
		||||
                const shouldWrite = !filePath.base.includes("hot-update");
 | 
			
		||||
 | 
			
		||||
                return shouldWrite;
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        watchFiles: ["**/*.css"],
 | 
			
		||||
        static: {
 | 
			
		||||
            directory: path.join(__dirname, "..", "/dist"),
 | 
			
		||||
            publicPath: "/dist",
 | 
			
		||||
            watch: false
 | 
			
		||||
        },
 | 
			
		||||
        client: {
 | 
			
		||||
            progress: true,
 | 
			
		||||
            overlay: {
 | 
			
		||||
                // Disable overlay for runtime errors.
 | 
			
		||||
                // See: https://github.com/webpack/webpack-dev-server/issues/4771
 | 
			
		||||
                runtimeErrors: false
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										27
									
								
								.webpack/webpack.prod.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,27 @@
 | 
			
		||||
/* global __dirname module */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This configuration should be used for production installs.
 | 
			
		||||
It is the default webpack configuration.
 | 
			
		||||
*/
 | 
			
		||||
const path = require("path");
 | 
			
		||||
const webpack = require("webpack");
 | 
			
		||||
const { merge } = require("webpack-merge");
 | 
			
		||||
 | 
			
		||||
const common = require("./webpack.common");
 | 
			
		||||
const projectRootDir = path.resolve(__dirname, "..");
 | 
			
		||||
 | 
			
		||||
module.exports = merge(common, {
 | 
			
		||||
    mode: "production",
 | 
			
		||||
    resolve: {
 | 
			
		||||
        alias: {
 | 
			
		||||
            vue: path.join(projectRootDir, "node_modules/vue/dist/vue.min.js")
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    plugins: [
 | 
			
		||||
        new webpack.DefinePlugin({
 | 
			
		||||
            __OPENMCT_ROOT_RELATIVE__: '""'
 | 
			
		||||
        })
 | 
			
		||||
    ],
 | 
			
		||||
    devtool: "source-map"
 | 
			
		||||
});
 | 
			
		||||
@@ -10,7 +10,7 @@ accept changes from external contributors.
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
   standards as described below.
 | 
			
		||||
3. Submit a pull request from a topic branch back to `master`. Include a check
 | 
			
		||||
@@ -191,7 +191,7 @@ The following guidelines are provided for anyone contributing source code to the
 | 
			
		||||
   if (responseCode === 401)
 | 
			
		||||
   ```
 | 
			
		||||
1. Use the ternary operator only for simple cases such as variable assignment. Nested ternaries should be avoided in all cases.
 | 
			
		||||
1. Test specs should reside alongside the source code they test, not in a separate directory.
 | 
			
		||||
1. Unit Test specs should reside alongside the source code they test, not in a separate directory.
 | 
			
		||||
1. Organize code by feature, not by type.
 | 
			
		||||
   eg.
 | 
			
		||||
   ```
 | 
			
		||||
@@ -222,44 +222,6 @@ The following guidelines are provided for anyone contributing source code to the
 | 
			
		||||
Deviations from Open MCT code style guidelines require two-party agreement,
 | 
			
		||||
typically from the author of the change and its reviewer.
 | 
			
		||||
 | 
			
		||||
### Test Standards
 | 
			
		||||
 | 
			
		||||
Automated testing shall occur whenever changes are merged into the main
 | 
			
		||||
development branch and must be confirmed alongside any pull request.
 | 
			
		||||
 | 
			
		||||
Automated tests are tests which exercise plugins, API, and utility classes. 
 | 
			
		||||
Tests are subject to code review along with the actual implementation, to 
 | 
			
		||||
ensure that tests are applicable and useful.
 | 
			
		||||
 | 
			
		||||
Examples of useful tests:
 | 
			
		||||
* Tests which replicate bugs (or their root causes) to verify their
 | 
			
		||||
  resolution.
 | 
			
		||||
* Tests which reflect details from software specifications.
 | 
			
		||||
* Tests which exercise edge or corner cases among inputs.
 | 
			
		||||
* Tests which verify expected interactions with other components in the
 | 
			
		||||
  system.
 | 
			
		||||
 | 
			
		||||
#### Guidelines
 | 
			
		||||
* 100% statement coverage is achievable and desirable.
 | 
			
		||||
* Do blackbox testing. Test external behaviors, not internal details. Write tests that describe what your plugin is supposed to do. How it does this doesn't matter, so don't test it.
 | 
			
		||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
 | 
			
		||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
 | 
			
		||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
 | 
			
		||||
* Where builtin functions have been mocked, be sure to clear them between tests.
 | 
			
		||||
* Test at an appropriate level of isolation. Eg. 
 | 
			
		||||
    * If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created. 
 | 
			
		||||
    * You do not need to test that the view switcher works, there should be separate tests for that. 
 | 
			
		||||
    * You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
 | 
			
		||||
    * Use your best judgement when deciding on appropriate scope.
 | 
			
		||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
 | 
			
		||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
 | 
			
		||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
 | 
			
		||||
* If writing unit tests for legacy Angular code be sure to follow [best practices in order to avoid memory leaks](https://www.thecodecampus.de/blog/avoid-memory-leaks-angularjs-unit-tests/).
 | 
			
		||||
 | 
			
		||||
#### Examples
 | 
			
		||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
 | 
			
		||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
 | 
			
		||||
 | 
			
		||||
### Commit Message Standards
 | 
			
		||||
 | 
			
		||||
Commit messages should:
 | 
			
		||||
@@ -301,7 +263,7 @@ Issue severity is categorized as follows (in ascending order):
 | 
			
		||||
 | 
			
		||||
* _Trivial_: Minimal impact on the usefulness and functionality of the software; a "nice-to-have." Visual impact without functional impact,
 | 
			
		||||
* _Medium_: Some impairment of use, but simple workarounds exist
 | 
			
		||||
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though.
 | 
			
		||||
* _Critical_: Significant loss of functionality or impairment of use. Display of telemetry data is not affected though. Complex workarounds exist.
 | 
			
		||||
* _Blocker_: Major functionality is impaired or lost, threatening mission success. Display of telemetry data is impaired or blocked by the bug, which could lead to loss of situational awareness.
 | 
			
		||||
 | 
			
		||||
## Check Lists
 | 
			
		||||
@@ -310,22 +272,4 @@ The following check lists should be completed and attached to pull requests
 | 
			
		||||
when they are filed (author checklist) and when they are merged (reviewer
 | 
			
		||||
checklist).
 | 
			
		||||
 | 
			
		||||
### Author Checklist
 | 
			
		||||
 | 
			
		||||
[Within PR Template](.github/PULL_REQUEST_TEMPLATE.md)
 | 
			
		||||
 | 
			
		||||
### Reviewer Checklist
 | 
			
		||||
 | 
			
		||||
* [ ] Changes appear to address issue?
 | 
			
		||||
* [ ] Changes appear not to be breaking changes?
 | 
			
		||||
* [ ] Appropriate unit tests included?
 | 
			
		||||
* [ ] Code style and in-line documentation are appropriate?
 | 
			
		||||
* [ ] Commit messages meet standards?
 | 
			
		||||
* [ ] Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)
 | 
			
		||||
* [ ] Has associated issue been labelled `bug`? (only applicable if this PR is for a bug fix)
 | 
			
		||||
* [ ] List of Acceptance Tests Performed.
 | 
			
		||||
 | 
			
		||||
Write out a small list of tests performed with just enough detail for another developer on the team 
 | 
			
		||||
to execute. 
 | 
			
		||||
 | 
			
		||||
i.e. ```When Clicking on Add button, new `object` appears in dropdown.```
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
# Open MCT License
 | 
			
		||||
 | 
			
		||||
Open MCT, Copyright (c) 2014-2022, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
 | 
			
		||||
Open MCT, Copyright (c) 2014-2023, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
 | 
			
		||||
 | 
			
		||||
Open MCT is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								README.md
									
									
									
									
									
								
							
							
						
						@@ -1,4 +1,4 @@
 | 
			
		||||
# Open MCT [](http://www.apache.org/licenses/LICENSE-2.0) [](https://lgtm.com/projects/g/nasa/openmct/context:javascript) [](https://codecov.io/gh/nasa/openmct) [](https://percy.io/b2e34b17/openmct) [](https://www.npmjs.com/package/openmct) 
 | 
			
		||||
# Open MCT [](http://www.apache.org/licenses/LICENSE-2.0) [](https://codecov.io/gh/nasa/openmct) [](https://percy.io/b2e34b17/openmct) [](https://www.npmjs.com/package/openmct) 
 | 
			
		||||
 | 
			
		||||
Open MCT (Open Mission Control Technologies) is a next-generation mission control framework for visualization of data on desktop and mobile devices. It is developed at NASA's Ames Research Center, and is being used by NASA for data analysis of spacecraft missions, as well as planning and operation of experimental rover systems. As a generalizable and open source framework, Open MCT could be used as the basis for building applications for planning, operation, and analysis of any systems producing telemetry data.
 | 
			
		||||
 | 
			
		||||
@@ -6,10 +6,8 @@ Please visit our [Official Site](https://nasa.github.io/openmct/) and [Getting S
 | 
			
		||||
 | 
			
		||||
Once you've created something amazing with Open MCT, showcase your work in our GitHub Discussions [Show and Tell](https://github.com/nasa/openmct/discussions/categories/show-and-tell) section. We love seeing unique and wonderful implementations of Open MCT!
 | 
			
		||||
 | 
			
		||||
## See Open MCT in Action
 | 
			
		||||

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

 | 
			
		||||
 | 
			
		||||
## Building and Running Open MCT Locally
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +28,8 @@ Building and running Open MCT in your local dev environment is very easy. Be sur
 | 
			
		||||
 | 
			
		||||
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 is available on the [Open MCT website](https://nasa.github.io/openmct/documentation/).
 | 
			
		||||
@@ -43,11 +43,9 @@ our documentation.
 | 
			
		||||
We want Open MCT to be as easy to use, install, run, and develop for as
 | 
			
		||||
possible, and your feedback will help us get there! Feedback can be provided via [GitHub issues](https://github.com/nasa/openmct/issues/new/choose), [Starting a GitHub Discussion](https://github.com/nasa/openmct/discussions), or by emailing us at [arc-dl-openmct@mail.nasa.gov](mailto:arc-dl-openmct@mail.nasa.gov).
 | 
			
		||||
 | 
			
		||||
## 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/).
 | 
			
		||||
 | 
			
		||||
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).
 | 
			
		||||
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).
 | 
			
		||||
 | 
			
		||||
## Compatibility
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +62,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 
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
@@ -100,7 +98,7 @@ To run the performance tests:
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
### 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 avaiable in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml).
 | 
			
		||||
 | 
			
		||||
### Test Reporting and Code Coverage
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										50
									
								
								TESTING.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,50 @@
 | 
			
		||||
# Testing
 | 
			
		||||
Open MCT Testing is iterating and improving at a rapid pace. This document serves to capture and index existing testing documentation and house documentation which no other obvious location as our testing evolves.
 | 
			
		||||
 | 
			
		||||
## General Testing Process
 | 
			
		||||
Documentation located [here](./docs/src/process/testing/plan.md)
 | 
			
		||||
 | 
			
		||||
## Unit Testing
 | 
			
		||||
Unit testing is essential part of our test strategy and complements our e2e testing strategy.
 | 
			
		||||
 | 
			
		||||
#### Unit Test Guidelines
 | 
			
		||||
* Unit Test specs should reside alongside the source code they test, not in a separate directory.
 | 
			
		||||
* Unit test specs for plugins should be defined at the plugin level. Start with one test spec per plugin named pluginSpec.js, and as this test spec grows too big, break it up into multiple test specs that logically group related tests.
 | 
			
		||||
* Unit tests for API or for utility functions and classes may be defined at a per-source file level.
 | 
			
		||||
* Wherever possible only use and mock public API, builtin functions, and UI in your test specs. Do not directly invoke any private functions. ie. only call or mock functions and objects exposed by openmct.* (eg. openmct.telemetry, openmct.objectView, etc.), and builtin browser functions (fetch, requestAnimationFrame, setTimeout, etc.).
 | 
			
		||||
* Where builtin functions have been mocked, be sure to clear them between tests.
 | 
			
		||||
* Test at an appropriate level of isolation. Eg. 
 | 
			
		||||
    * If you’re testing a view, you do not need to test the whole application UI, you can just fetch the view provider using the public API and render the view into an element that you have created. 
 | 
			
		||||
    * You do not need to test that the view switcher works, there should be separate tests for that. 
 | 
			
		||||
    * You do not need to test that telemetry providers work, you can mock openmct.telemetry.request() to feed test data to the view.
 | 
			
		||||
    * Use your best judgement when deciding on appropriate scope.
 | 
			
		||||
* Automated tests for plugins should start by actually installing the plugin being tested, and then test that installing the plugin adds the desired features and behavior to Open MCT, observing the above rules.
 | 
			
		||||
* All variables used in a test spec, including any instances of the Open MCT API should be declared inside of an appropriate block scope (not at the root level of the source file), and should be initialized in the relevant beforeEach block. `beforeEach` is preferable to `beforeAll` to avoid leaking of state between tests.
 | 
			
		||||
* A `afterEach` or `afterAll` should be used to do any clean up necessary to prevent leakage of state between test specs. This can happen when functions on `window` are wrapped, or when the URL is changed. [A convenience function](https://github.com/nasa/openmct/blob/master/src/utils/testing.js#L59) is provided for resetting the URL and clearing builtin spies between tests.
 | 
			
		||||
 | 
			
		||||
#### Unit Test Examples
 | 
			
		||||
* [Example of an automated test spec for an object view plugin](https://github.com/nasa/openmct/blob/master/src/plugins/telemetryTable/pluginSpec.js)
 | 
			
		||||
* [Example of an automated test spec for API](https://github.com/nasa/openmct/blob/master/src/api/time/TimeAPISpec.js)
 | 
			
		||||
 | 
			
		||||
#### Unit Testing Execution
 | 
			
		||||
 | 
			
		||||
The unit tests can be executed in one of two ways:
 | 
			
		||||
`npm run test` which runs the entire suite against headless chrome
 | 
			
		||||
`npm run test:debug` for debugging the tests in realtime in an active chrome session.
 | 
			
		||||
 | 
			
		||||
## e2e, performance, and visual testing
 | 
			
		||||
Documentation located [here](./e2e/README.md)
 | 
			
		||||
 | 
			
		||||
## Code Coverage
 | 
			
		||||
 | 
			
		||||
* 100% statement coverage is achievable and desirable.
 | 
			
		||||
 | 
			
		||||
Codecov.io will combine each of the above commands with [Codecov.io Flags](https://docs.codecov.com/docs/flags). Effectively, this allows us to combine multiple reports which are run at various stages of our CI Pipeline or run as part of a parallel process.
 | 
			
		||||
 | 
			
		||||
This e2e coverage is combined with our unit test report to give a comprehensive (if flawed) view of line coverage.
 | 
			
		||||
 | 
			
		||||
### Limitations in our code coverage reporting
 | 
			
		||||
 | 
			
		||||
Our code coverage implementation has two known limitations:
 | 
			
		||||
- [Variability and accuracy](https://github.com/nasa/openmct/issues/5811)
 | 
			
		||||
- [Vue instrumentation](https://github.com/nasa/openmct/issues/4973)
 | 
			
		||||
							
								
								
									
										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
 | 
			
		||||
 | 
			
		||||
#*****************************************************************************
 | 
			
		||||
#* Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
#* Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
#* as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
#* Administration. All rights reserved.
 | 
			
		||||
#*
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								codecov.yml
									
									
									
									
									
								
							
							
						
						@@ -15,14 +15,14 @@ coverage:
 | 
			
		||||
 | 
			
		||||
flags:
 | 
			
		||||
  unit:
 | 
			
		||||
    carryforward: true 
 | 
			
		||||
  e2e-ci:
 | 
			
		||||
    carryforward: true
 | 
			
		||||
    carryforward: false
 | 
			
		||||
  e2e-stable:
 | 
			
		||||
    carryforward: false
 | 
			
		||||
  e2e-full:
 | 
			
		||||
    carryforward: true    
 | 
			
		||||
 | 
			
		||||
comment:
 | 
			
		||||
  layout: "reach,diff,flags,files,footer"
 | 
			
		||||
  layout: "diff,flags,files,footer"
 | 
			
		||||
  behavior: default
 | 
			
		||||
  require_changes: false
 | 
			
		||||
  show_carryforward_flags: true
 | 
			
		||||
  show_carryforward_flags: true
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<!--
 | 
			
		||||
 Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 Administration. All rights reserved.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
        <hr>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										209
									
								
								docs/gendocs.js
									
									
									
									
									
								
							
							
						
						@@ -1,209 +0,0 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*global require,process,__dirname,GLOBAL*/
 | 
			
		||||
/*jslint nomen: false */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Usage:
 | 
			
		||||
//   node gendocs.js --in <source directory> --out <dest directory>
 | 
			
		||||
 | 
			
		||||
var CONSTANTS = {
 | 
			
		||||
        DIAGRAM_WIDTH: 800,
 | 
			
		||||
        DIAGRAM_HEIGHT: 500
 | 
			
		||||
    },
 | 
			
		||||
    TOC_HEAD = "# Table of Contents";
 | 
			
		||||
 | 
			
		||||
GLOBAL.window = GLOBAL.window ||  GLOBAL; // nomnoml expects window to be defined
 | 
			
		||||
(function () {
 | 
			
		||||
    "use strict";
 | 
			
		||||
 | 
			
		||||
    var fs = require("fs"),
 | 
			
		||||
        mkdirp = require("mkdirp"),
 | 
			
		||||
        path = require("path"),
 | 
			
		||||
        glob = require("glob"),
 | 
			
		||||
        marked = require("marked"),
 | 
			
		||||
        split = require("split"),
 | 
			
		||||
        stream = require("stream"),
 | 
			
		||||
        nomnoml = require('nomnoml'),
 | 
			
		||||
        toc = require("markdown-toc"),
 | 
			
		||||
        Canvas = require('canvas'),
 | 
			
		||||
        header = fs.readFileSync(path.resolve(__dirname, 'header.html')),
 | 
			
		||||
        footer = fs.readFileSync(path.resolve(__dirname, 'footer.html')),
 | 
			
		||||
        options = require("minimist")(process.argv.slice(2));
 | 
			
		||||
 | 
			
		||||
    // Convert from nomnoml source to a target PNG file.
 | 
			
		||||
    function renderNomnoml(source, target) {
 | 
			
		||||
        var canvas =
 | 
			
		||||
            new Canvas(CONSTANTS.DIAGRAM_WIDTH, CONSTANTS.DIAGRAM_HEIGHT);
 | 
			
		||||
        nomnoml.draw(canvas, source, 1.0);
 | 
			
		||||
        canvas.pngStream().pipe(fs.createWriteStream(target));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Stream transform.
 | 
			
		||||
    // Pulls out nomnoml diagrams from fenced code blocks and renders them
 | 
			
		||||
    // as PNG files in the output directory, prefixed with a provided name.
 | 
			
		||||
    // The fenced code blocks will be replaced with Markdown in the
 | 
			
		||||
    // output of this stream.
 | 
			
		||||
    function nomnomlifier(outputDirectory, prefix) {
 | 
			
		||||
        var transform = new stream.Transform({ objectMode: true }),
 | 
			
		||||
            isBuilding = false,
 | 
			
		||||
            counter = 1,
 | 
			
		||||
            outputPath,
 | 
			
		||||
            source = "";
 | 
			
		||||
 | 
			
		||||
        transform._transform = function (chunk, encoding, done) {
 | 
			
		||||
            if (!isBuilding) {
 | 
			
		||||
                if (chunk.trim().indexOf("```nomnoml") === 0) {
 | 
			
		||||
                    var outputFilename = prefix + '-' + counter + '.png';
 | 
			
		||||
                    outputPath = path.join(outputDirectory, outputFilename);
 | 
			
		||||
                    this.push([
 | 
			
		||||
                        "\n\n\n"
 | 
			
		||||
                    ].join(""));
 | 
			
		||||
                    isBuilding = true;
 | 
			
		||||
                    source = "";
 | 
			
		||||
                    counter += 1;
 | 
			
		||||
                } else {
 | 
			
		||||
                    // Otherwise, pass through
 | 
			
		||||
                    this.push(chunk + '\n');
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                if (chunk.trim() === "```") {
 | 
			
		||||
                    // End nomnoml
 | 
			
		||||
                    renderNomnoml(source, outputPath);
 | 
			
		||||
                    isBuilding = false;
 | 
			
		||||
                } else {
 | 
			
		||||
                    source += chunk + '\n';
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            done();
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        return transform;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Convert from Github-flavored Markdown to HTML
 | 
			
		||||
    function gfmifier(renderTOC) {
 | 
			
		||||
        var transform = new stream.Transform({ objectMode: true }),
 | 
			
		||||
            markdown = "";
 | 
			
		||||
        transform._transform = function (chunk, encoding, done) {
 | 
			
		||||
            markdown += chunk;
 | 
			
		||||
            done();
 | 
			
		||||
        };
 | 
			
		||||
        transform._flush = function (done) {
 | 
			
		||||
            if (renderTOC){
 | 
			
		||||
                // Prepend table of contents
 | 
			
		||||
                markdown =
 | 
			
		||||
                    [ TOC_HEAD, toc(markdown).content, "", markdown ].join("\n");
 | 
			
		||||
            }
 | 
			
		||||
            this.push(header);
 | 
			
		||||
            this.push(marked(markdown));
 | 
			
		||||
            this.push(footer);
 | 
			
		||||
            done();
 | 
			
		||||
        };
 | 
			
		||||
        return transform;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Custom renderer for marked; converts relative links from md to html,
 | 
			
		||||
    // and makes headings linkable.
 | 
			
		||||
    function CustomRenderer() {
 | 
			
		||||
        var renderer = new marked.Renderer(),
 | 
			
		||||
            customRenderer = Object.create(renderer);
 | 
			
		||||
        customRenderer.heading = function (text, level) {
 | 
			
		||||
            var escapedText = (text || "").trim().toLowerCase().replace(/\W/g, "-"),
 | 
			
		||||
                aOpen = "<a name=\"" + escapedText + "\" href=\"#" + escapedText + "\">",
 | 
			
		||||
                aClose = "</a>";
 | 
			
		||||
            return aOpen + renderer.heading.apply(renderer, arguments) + aClose;
 | 
			
		||||
        };
 | 
			
		||||
        // Change links to .md files to .html
 | 
			
		||||
        customRenderer.link = function (href, title, text) {
 | 
			
		||||
            // ...but only if they look like relative paths
 | 
			
		||||
            return (href || "").indexOf(":") === -1 && href[0] !== "/" ?
 | 
			
		||||
                    renderer.link(href.replace(/\.md/, ".html"), title, text) :
 | 
			
		||||
                    renderer.link.apply(renderer, arguments);
 | 
			
		||||
        };
 | 
			
		||||
        return customRenderer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    options['in'] = options['in'] || options.i;
 | 
			
		||||
    options.out = options.out || options.o;
 | 
			
		||||
 | 
			
		||||
    marked.setOptions({
 | 
			
		||||
        renderer: new CustomRenderer(),
 | 
			
		||||
        gfm: true,
 | 
			
		||||
        tables: true,
 | 
			
		||||
        breaks: false,
 | 
			
		||||
        pedantic: false,
 | 
			
		||||
        sanitize: true,
 | 
			
		||||
        smartLists: true,
 | 
			
		||||
        smartypants: false
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Convert all markdown files.
 | 
			
		||||
    // First, pull out nomnoml diagrams.
 | 
			
		||||
    // Then, convert remaining Markdown to HTML.
 | 
			
		||||
    glob(options['in'] + "/**/*.md", {}, function (err, files) {
 | 
			
		||||
        files.forEach(function (file) {
 | 
			
		||||
            var destination = file.replace(options['in'], options.out)
 | 
			
		||||
                .replace(/md$/, "html"),
 | 
			
		||||
                destPath = path.dirname(destination),
 | 
			
		||||
                prefix = path.basename(destination).replace(/\.html$/, ""),
 | 
			
		||||
                //Determine whether TOC should be rendered for this file based
 | 
			
		||||
                //on regex provided as command line option
 | 
			
		||||
                renderTOC = file.match(options['suppress-toc'] || "") === null;
 | 
			
		||||
 | 
			
		||||
            mkdirp(destPath, function (err) {
 | 
			
		||||
                fs.createReadStream(file, { encoding: 'utf8' })
 | 
			
		||||
                    .pipe(split())
 | 
			
		||||
                    .pipe(nomnomlifier(destPath, prefix))
 | 
			
		||||
                    .pipe(gfmifier(renderTOC))
 | 
			
		||||
                    .pipe(fs.createWriteStream(destination, {
 | 
			
		||||
                        encoding: 'utf8'
 | 
			
		||||
                    }));
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Also copy over all HTML, CSS, or PNG files
 | 
			
		||||
    glob(options['in'] + "/**/*.@(html|css|png)", {}, function (err, files) {
 | 
			
		||||
        files.forEach(function (file) {
 | 
			
		||||
            var destination = file.replace(options['in'], options.out),
 | 
			
		||||
                destPath = path.dirname(destination),
 | 
			
		||||
                streamOptions = {};
 | 
			
		||||
            if (file.match(/png$/)) {
 | 
			
		||||
                streamOptions.encoding = null;
 | 
			
		||||
            } else {
 | 
			
		||||
                streamOptions.encoding = 'utf8';
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            mkdirp(destPath, function (err) {
 | 
			
		||||
                fs.createReadStream(file, streamOptions)
 | 
			
		||||
                    .pipe(fs.createWriteStream(destination, streamOptions));
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <link rel="stylesheet"
 | 
			
		||||
              href="//nasa.github.io/openmct/static/res/css/styles.css">
 | 
			
		||||
        <link rel="stylesheet"
 | 
			
		||||
              href="//nasa.github.io/openmct/static/res/css/documentation.css">
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
 | 
			
		||||
@@ -15,8 +15,8 @@
 | 
			
		||||
 | 
			
		||||
## Sections
 | 
			
		||||
 
 | 
			
		||||
 * The [API](api/) document is generated from inline documentation 
 | 
			
		||||
 using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
 | 
			
		||||
 * The [API](api/) uses inline documentation 
 | 
			
		||||
 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.
 | 
			
		||||
 | 
			
		||||
 * The [Development Process](process/) document describes the
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										151
									
								
								e2e/README.md
									
									
									
									
									
								
							
							
						
						@@ -8,7 +8,7 @@ This document is designed to capture on the What, Why, and How's of writing and
 | 
			
		||||
 | 
			
		||||
1. [Getting Started](#getting-started)
 | 
			
		||||
2. [Types of Testing](#types-of-e2e-testing)
 | 
			
		||||
3. [Architecture](#architecture)
 | 
			
		||||
3. [Architecture](#test-architecture-and-ci)
 | 
			
		||||
 | 
			
		||||
## Getting Started
 | 
			
		||||
 | 
			
		||||
@@ -89,17 +89,37 @@ Read more about [Playwright Snapshots](https://playwright.dev/docs/test-snapshot
 | 
			
		||||
#### Open MCT's implementation
 | 
			
		||||
 | 
			
		||||
- Our Snapshot tests receive a `@snapshot` tag.
 | 
			
		||||
- Snapshots need to be executed within the official Playwright container to ensure we're using the exact rendering platform in CI and locally.
 | 
			
		||||
- Snapshots need to be executed within the official Playwright container to ensure we're using the exact rendering platform in CI and locally. To do a valid comparison locally:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:[GET THIS VERSION FROM OUR CIRCLECI CONFIG FILE]-focal /bin/bash
 | 
			
		||||
// Replace {X.X.X} with the current Playwright version 
 | 
			
		||||
// from our package.json or circleCI configuration file
 | 
			
		||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
 | 
			
		||||
npm install
 | 
			
		||||
npx playwright test --config=e2e/playwright-ci.config.js --project=chrome --grep @snapshot
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### (WIP) Updating Snapshots
 | 
			
		||||
### Updating Snapshots
 | 
			
		||||
 | 
			
		||||
When the `@snapshot` tests fail, they will need to be evaluated to see if the failure is an acceptable change or
 | 
			
		||||
When the `@snapshot` tests fail, they will need to be evaluated to determine if the failure is an acceptable and desireable or an unintended regression.
 | 
			
		||||
 | 
			
		||||
To compare a snapshot, run a test and open the html report with the 'Expected' vs 'Actual' screenshot. If the actual screenshot is preferred, then the source-controlled 'Expected' snapshots will need to be updated with the following scripts.
 | 
			
		||||
 | 
			
		||||
MacOS
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
npm run test:e2e:updatesnapshots
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Linux/CI
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
// Replace {X.X.X} with the current Playwright version 
 | 
			
		||||
// from our package.json or circleCI configuration file
 | 
			
		||||
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v{X.X.X}-focal /bin/bash
 | 
			
		||||
npm install
 | 
			
		||||
npm run test:e2e:updatesnapshots
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Performance Testing
 | 
			
		||||
 | 
			
		||||
@@ -119,16 +139,18 @@ These tests are expected to become blocking and gating with assertions as we ext
 | 
			
		||||
 | 
			
		||||
Our file structure follows the type of type of testing being excercised at the e2e layer and files containing test suites which matcher application behavior or our `src` and `example` layout. This area is not well refined as we figure out what works best for closed source and downstream projects. This may change altogether if we move `e2e` to it's own npm package.
 | 
			
		||||
 | 
			
		||||
- `./helper` - contains helper functions or scripts which are leveraged directly within the testsuites. i.e. non-default plugin scripts injected into DOM
 | 
			
		||||
- `./test-data` - contains test data which is leveraged or generated in the functional, performance, or visual test suites. i.e. localStorage data
 | 
			
		||||
- `./tests/functional` - the bulk of the tests are contained within this folder to verify the functionality of open mct
 | 
			
		||||
- `./tests/functional/example/` - tests which specifically verify the example plugins
 | 
			
		||||
- `./tests/functional/plugins/` - tests which loosely test each plugin. This folder is the most likely to change. Note: some @snapshot tests are still contained within this structure
 | 
			
		||||
- `./tests/framework/` - tests which verify that our testframework functionality and assumptions will continue to work based on further refactoring or playwright version changes
 | 
			
		||||
- `./tests/performance/` - performance tests
 | 
			
		||||
- `./tests/visual/` - Visual tests
 | 
			
		||||
- `./appActions.js` - Contains common fixtures which can be leveraged by testcase authors to quickly move through the application when writing new tests.
 | 
			
		||||
- `./baseFixture.js` - Contains base fixtures which only extend default `@playwright/test` functionality. The goal is to remove these fixtures as native Playwright APIs improve.
 | 
			
		||||
|File Path|Description|
 | 
			
		||||
|:-:|-|
 | 
			
		||||
|`./helper`                    | Contains helper functions or scripts which are leveraged directly within the test suites (e.g.: non-default plugin scripts injected into the DOM)|
 | 
			
		||||
|`./test-data`                 | Contains test data which is leveraged or generated in the functional, performance, or visual test suites (e.g.: localStorage data).|
 | 
			
		||||
|`./tests/functional`          | The bulk of the tests are contained within this folder to verify the functionality of Open MCT.|
 | 
			
		||||
|`./tests/functional/example/` | Tests which specifically verify the example plugins (e.g.: Sine Wave Generator).|
 | 
			
		||||
|`./tests/functional/plugins/` | Tests which loosely test each plugin. This folder is the most likely to change. Note: some `@snapshot` tests are still contained within this structure.|
 | 
			
		||||
|`./tests/framework/`          | Tests which verify that our testing framework's functionality and assumptions will continue to work based on further refactoring or Playwright version changes (e.g.: verifying custom fixtures and appActions).|
 | 
			
		||||
|`./tests/performance/`        | Performance tests.|
 | 
			
		||||
|`./tests/visual/`             | Visual tests.|
 | 
			
		||||
|`./appActions.js`             | Contains common methods which can be leveraged by test case authors to quickly move through the application when writing new tests.|
 | 
			
		||||
|`./baseFixture.js`            | Contains base fixtures which only extend default `@playwright/test` functionality. The expectation is that these fixtures will be removed as the native Playwright API improves|
 | 
			
		||||
 | 
			
		||||
Our functional tests end in `*.e2e.spec.js`, visual tests in `*.visual.spec.js` and performance tests in `*.perf.spec.js`.
 | 
			
		||||
 | 
			
		||||
@@ -138,10 +160,12 @@ Where possible, we try to run Open MCT without modification or configuration cha
 | 
			
		||||
 | 
			
		||||
Open MCT is leveraging the [config file](https://playwright.dev/docs/test-configuration) pattern to describe the capabilities of Open MCT e2e _where_ it's run
 | 
			
		||||
 | 
			
		||||
- `./playwright-ci.config.js` - Used when running in CI or to debug CI issues locally
 | 
			
		||||
- `./playwright-local.config.js` - Used when running locally
 | 
			
		||||
- `./playwright-performance.config.js` - Used when running performance tests in CI or locally
 | 
			
		||||
- `./playwright-visual.config.js` - Used to run the visual tests in CI or locally
 | 
			
		||||
|Config File|Description|
 | 
			
		||||
|:-:|-|
 | 
			
		||||
|`./playwright-ci.config.js` | Used when running in CI or to debug CI issues locally|
 | 
			
		||||
|`./playwright-local.config.js` | Used when running locally|
 | 
			
		||||
|`./playwright-performance.config.js` | Used when running performance tests in CI or locally|
 | 
			
		||||
|`./playwright-visual.config.js` | Used to run the visual tests in CI or locally|
 | 
			
		||||
 | 
			
		||||
#### Test Tags
 | 
			
		||||
 | 
			
		||||
@@ -149,13 +173,15 @@ Test tags are a great way of organizing tests outside of a file structure. To le
 | 
			
		||||
 | 
			
		||||
Current list of test tags:
 | 
			
		||||
 | 
			
		||||
- `@ipad` - Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no Create button).
 | 
			
		||||
- `@gds` - Denotes a GDS Test Case used in the VIPER Mission.
 | 
			
		||||
- `@addInit` - Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of app.js.
 | 
			
		||||
- `@localStorage` - Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).
 | 
			
		||||
- `@snapshot` - Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.
 | 
			
		||||
- `@unstable` - A new test or test which is known to be flaky.
 | 
			
		||||
- `@2p` - Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.
 | 
			
		||||
|Test Tag|Description|
 | 
			
		||||
|:-:|-|
 | 
			
		||||
|`@ipad` | Test case or test suite is compatible with Playwright's iPad support and Open MCT's read-only mobile view (i.e. no create button).|
 | 
			
		||||
|`@gds` | Denotes a GDS Test Case used in the VIPER Mission.|
 | 
			
		||||
|`@addInit` | Initializes the browser with an injected and artificial state. Useful for loading non-default plugins. Likely will not work outside of `npm start`.|
 | 
			
		||||
|`@localStorage` | Captures or generates session storage to manipulate browser state. Useful for excluding in tests which require a persistent backend (i.e. CouchDB).|
 | 
			
		||||
|`@snapshot` | Uses Playwright's snapshot functionality to record a copy of the DOM for direct comparison. Must be run inside of the playwright container.|
 | 
			
		||||
|`@unstable` | A new test or test which is known to be flaky.|
 | 
			
		||||
|`@2p` | Indicates that multiple users are involved, or multiple tabs/pages are used. Useful for testing multi-user interactivity.|
 | 
			
		||||
 | 
			
		||||
### Continuous Integration
 | 
			
		||||
 | 
			
		||||
@@ -180,6 +206,7 @@ CircleCI
 | 
			
		||||
Github Actions / Workflow
 | 
			
		||||
 | 
			
		||||
- Full suite against all browsers/projects. Triggered with Github Label Event 'pr:e2e'
 | 
			
		||||
- CouchDB Tests. Triggered on PR Create and again with Github Label Event 'pr:e2e:couchdb'
 | 
			
		||||
- Visual Tests. Triggered with Github Label Event 'pr:visual'
 | 
			
		||||
 | 
			
		||||
#### 3. Scheduled / Batch Testing
 | 
			
		||||
@@ -211,7 +238,8 @@ At the same time, we don't want to waste CI resources on parallel runs, so we've
 | 
			
		||||
 | 
			
		||||
In order to maintain fast and reliable feedback, tests go through a promotion process. All new test cases or test suites must be labeled with the `@unstable` annotation. The Open MCT dev team runs these unstable tests in our private repos to ensure they work downstream and are reliable.
 | 
			
		||||
 | 
			
		||||
To run the stable tests, use the ```npm run test:e2e:stable``` command. To run the new and flaky tests, use the ```npm run test:e2e:unstable``` command.
 | 
			
		||||
- To run the stable tests, use the `npm run test:e2e:stable` command.
 | 
			
		||||
- To run the new and flaky tests, use the `npm run test:e2e:unstable` command.
 | 
			
		||||
 | 
			
		||||
A testcase and testsuite are to be unmarked as @unstable when:
 | 
			
		||||
 | 
			
		||||
@@ -272,18 +300,51 @@ Skipping based on browser version (Rarely used): <https://github.com/microsoft/p
 | 
			
		||||
- How to make tests robust to function in other contexts (VISTA, VIPER, etc.)
 | 
			
		||||
  - Leverage the use of `appActions.js` methods such as `createDomainObjectWithDefaults()`
 | 
			
		||||
- How to make tests faster and more resilient
 | 
			
		||||
  - When possible, navigate directly by URL
 | 
			
		||||
  - Leverage `await page.goto('./', { waitUntil: 'networkidle' });`
 | 
			
		||||
  - When possible, navigate directly by URL:
 | 
			
		||||
 | 
			
		||||
  ```javascript
 | 
			
		||||
    // 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);
 | 
			
		||||
  ```
 | 
			
		||||
 | 
			
		||||
  - Leverage `await page.goto('./', { waitUntil: 'domcontentloaded' });`
 | 
			
		||||
    - Initial navigation should _almost_ always use the `{ waitUntil: 'domcontentloaded' }` option.
 | 
			
		||||
  - Avoid repeated setup to test to test a single assertion. Write longer tests with multiple soft assertions.
 | 
			
		||||
 | 
			
		||||
### How to write a great test (TODO)
 | 
			
		||||
### How to write a great test (WIP)
 | 
			
		||||
 | 
			
		||||
- 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 (TODO)
 | 
			
		||||
 | 
			
		||||
#### How to write a great network test
 | 
			
		||||
 | 
			
		||||
- Where possible, it is best to mock out third-party network activity to ensure we are testing application behavior of Open MCT.
 | 
			
		||||
- It is best to be as specific as possible about the expected network request/response structures in creating your mocks.
 | 
			
		||||
- Make sure to only mock requests which are relevant to the specific behavior being tested.
 | 
			
		||||
- Where possible, network requests and responses should be treated in an order-agnostic manner, as the order in which certain requests/responses happen is dynamic and subject to change.
 | 
			
		||||
 | 
			
		||||
Some examples of mocking network responses in regards to CouchDB can be found in our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) test file.
 | 
			
		||||
 | 
			
		||||
### Best Practices
 | 
			
		||||
 | 
			
		||||
For now, our best practices exist as self-tested, living documentation in our [exampleTemplate.e2e.spec.js](./tests/framework/exampleTemplate.e2e.spec.js) file.
 | 
			
		||||
 | 
			
		||||
For best practices with regards to mocking network responses, see our [couchdb.e2e.spec.js](./tests/functional/couchdb.e2e.spec.js) file.
 | 
			
		||||
 | 
			
		||||
### Tips & Tricks (TODO)
 | 
			
		||||
 | 
			
		||||
The following contains a list of tips and tricks which don't exactly fit into a FAQ or Best Practices doc.
 | 
			
		||||
@@ -303,12 +364,16 @@ We leverage the following official Playwright reporters:
 | 
			
		||||
- Tracefile
 | 
			
		||||
- Screenshots
 | 
			
		||||
 | 
			
		||||
When running the tests locally with the `npm run test:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
 | 
			
		||||
When running the tests locally with the `npm run test:e2e:local` command, the html report will open automatically on failure. Inside this HTML report will be a complete summary of the finished tests. If the tests failed, you'll see embedded links to screenshot failure, execution logs, and the Tracefile.
 | 
			
		||||
 | 
			
		||||
When looking at the reports run in CI, you'll leverage this same HTML Report which is hosted either in CircleCI or Github Actions as a build artifact.
 | 
			
		||||
 | 
			
		||||
### e2e Code Coverage
 | 
			
		||||
 | 
			
		||||
Our e2e code coverage is captured and combined with our unit test coverage. For more information, please see our [code coverage documentation](../TESTING.md)
 | 
			
		||||
 | 
			
		||||
#### Generating e2e code coverage
 | 
			
		||||
 | 
			
		||||
Code coverage is collected during test execution using our custom [baseFixture](./baseFixtures.js). The raw coverage files are stored in a `.nyc_report` directory to be converted into a lcov file with the following [nyc](https://github.com/istanbuljs/nyc) command:
 | 
			
		||||
 | 
			
		||||
```npm run cov:e2e:report```
 | 
			
		||||
@@ -319,10 +384,6 @@ At this point, the nyc linecov report can be published to [codecov.io](https://a
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
### About e2e testing
 | 
			
		||||
@@ -378,3 +439,23 @@ A single e2e test in Open MCT is extended to run:
 | 
			
		||||
- Tests won't start because 'Error: <http://localhost:8080/># is already used...'
 | 
			
		||||
This error will appear when running the tests locally. Sometimes, the webserver is left in an orphaned state and needs to be cleaned up. To clear up the orphaned webserver, execute the following from your Terminal:
 | 
			
		||||
```lsof -n -i4TCP:8080 | awk '{print$2}' | tail -1 | xargs kill -9```
 | 
			
		||||
 | 
			
		||||
### Upgrading Playwright
 | 
			
		||||
 | 
			
		||||
In order to upgrade from one version of Playwright to another, the version should be updated in several places in both `openmct` and `openmct-yamcs` repos. An easy way to identify these locations is to search for the current version in all files and find/replace.
 | 
			
		||||
 | 
			
		||||
For reference, all of the locations where the version should be updated are listed below:
 | 
			
		||||
 | 
			
		||||
#### **In `openmct`:**
 | 
			
		||||
 | 
			
		||||
- `package.json`
 | 
			
		||||
  - Both packages `@playwright/test` and `playwright-core` should be updated to the same target version.
 | 
			
		||||
- `.circleci/config.yml`
 | 
			
		||||
- `.github/workflows/e2e-couchdb.yml`
 | 
			
		||||
- `.github/workflows/e2e-pr.yml`
 | 
			
		||||
 | 
			
		||||
#### **In `openmct-yamcs`:**
 | 
			
		||||
 | 
			
		||||
- `package.json`
 | 
			
		||||
  - `@playwright/test` should be updated to the target version.
 | 
			
		||||
- `.github/workflows/yamcs-quickstart-e2e.yml`
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -45,7 +45,17 @@
 | 
			
		||||
 * @property {string} url the relative url to the object (for use with `page.goto()`)
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines parameters to be used in the creation of a notification.
 | 
			
		||||
 * @typedef {Object} CreateNotificationOptions
 | 
			
		||||
 * @property {string} message the message
 | 
			
		||||
 * @property {'info' | 'alert' | 'error'} severity the severity
 | 
			
		||||
 * @property {import('../src/api/notifications/NotificationAPI').NotificationOptions} [notificationOptions] additional options
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
const Buffer = require('buffer').Buffer;
 | 
			
		||||
const genUuid = require('uuid').v4;
 | 
			
		||||
const { expect } = require('@playwright/test');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This common function creates a domain object with the default options. It is the preferred way of creating objects
 | 
			
		||||
@@ -56,24 +66,32 @@ const Buffer = require('buffer').Buffer;
 | 
			
		||||
 * @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
 | 
			
		||||
 */
 | 
			
		||||
async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine' }) {
 | 
			
		||||
    if (!name) {
 | 
			
		||||
        name = `${type}:${genUuid()}`;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const parentUrl = await getHashUrlToDomainObject(page, parent);
 | 
			
		||||
 | 
			
		||||
    // Navigate to the parent object. This is necessary to create the object
 | 
			
		||||
    // in the correct location, such as a folder, layout, or plot.
 | 
			
		||||
    await page.goto(`${parentUrl}?hideTree=true`);
 | 
			
		||||
    await page.waitForLoadState('networkidle');
 | 
			
		||||
 | 
			
		||||
    //Click the Create button
 | 
			
		||||
    await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
    // 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'
 | 
			
		||||
    if (name) {
 | 
			
		||||
        const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
        await nameInput.fill("");
 | 
			
		||||
        await nameInput.fill(name);
 | 
			
		||||
    const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
    await nameInput.fill("");
 | 
			
		||||
    await nameInput.fill(name);
 | 
			
		||||
 | 
			
		||||
    if (page.testNotes) {
 | 
			
		||||
        // Fill the "Notes" section with information about the
 | 
			
		||||
        // currently running test and its project.
 | 
			
		||||
        const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
 | 
			
		||||
        await notesInput.fill(page.testNotes);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Click OK button and wait for Navigate event
 | 
			
		||||
@@ -96,18 +114,40 @@ async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        name: name || `Unnamed ${type}`,
 | 
			
		||||
        uuid: uuid,
 | 
			
		||||
        name,
 | 
			
		||||
        uuid,
 | 
			
		||||
        url: objectUrl
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Generate a notification with the given options.
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {CreateNotificationOptions} createNotificationOptions
 | 
			
		||||
 */
 | 
			
		||||
async function createNotification(page, createNotificationOptions) {
 | 
			
		||||
    await page.evaluate((_createNotificationOptions) => {
 | 
			
		||||
        const { message, severity, options } = _createNotificationOptions;
 | 
			
		||||
        const notificationApi = window.openmct.notifications;
 | 
			
		||||
        if (severity === 'info') {
 | 
			
		||||
            notificationApi.info(message, options);
 | 
			
		||||
        } else if (severity === 'alert') {
 | 
			
		||||
            notificationApi.alert(message, options);
 | 
			
		||||
        } else {
 | 
			
		||||
            notificationApi.error(message, options);
 | 
			
		||||
        }
 | 
			
		||||
    }, createNotificationOptions);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expand an item in the tree by a given object name.
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {string} name
 | 
			
		||||
 */
 | 
			
		||||
async function expandTreePaneItemByName(page, name) {
 | 
			
		||||
    const treePane = page.locator('#tree-pane');
 | 
			
		||||
    const treePane = page.getByRole('tree', {
 | 
			
		||||
        name: 'Main Tree'
 | 
			
		||||
    });
 | 
			
		||||
    const treeItem = treePane.locator(`role=treeitem[expanded=false][name=/${name}/]`);
 | 
			
		||||
    const expandTriangle = treeItem.locator('.c-disclosure-triangle');
 | 
			
		||||
    await expandTriangle.click();
 | 
			
		||||
@@ -120,24 +160,26 @@ async function expandTreePaneItemByName(page, name) {
 | 
			
		||||
 * @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
 | 
			
		||||
 */
 | 
			
		||||
async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
 | 
			
		||||
    if (!name) {
 | 
			
		||||
        name = `Plan:${genUuid()}`;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const parentUrl = await getHashUrlToDomainObject(page, parent);
 | 
			
		||||
 | 
			
		||||
    // Navigate to the parent object. This is necessary to create the object
 | 
			
		||||
    // in the correct location, such as a folder, layout, or plot.
 | 
			
		||||
    await page.goto(`${parentUrl}?hideTree=true`);
 | 
			
		||||
 | 
			
		||||
    //Click the Create button
 | 
			
		||||
    // Click the Create button
 | 
			
		||||
    await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
    // Click 'Plan' menu option
 | 
			
		||||
    await page.click(`li:text("Plan")`);
 | 
			
		||||
 | 
			
		||||
    // Modify the name input field of the domain object to accept 'name'
 | 
			
		||||
    if (name) {
 | 
			
		||||
        const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
        await nameInput.fill("");
 | 
			
		||||
        await nameInput.fill(name);
 | 
			
		||||
    }
 | 
			
		||||
    const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
    await nameInput.fill("");
 | 
			
		||||
    await nameInput.fill(name);
 | 
			
		||||
 | 
			
		||||
    // Upload buffer from memory
 | 
			
		||||
    await page.locator('input#fileElem').setInputFiles({
 | 
			
		||||
@@ -155,7 +197,7 @@ async function createPlanFromJSON(page, { name, json, parent = 'mine' }) {
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
    // Wait until the URL is updated
 | 
			
		||||
    await page.waitForURL(`**/mine/*`);
 | 
			
		||||
    await page.waitForURL(`**/${parent}/*`);
 | 
			
		||||
    const uuid = await getFocusedObjectUuid(page);
 | 
			
		||||
    const objectUrl = await getHashUrlToDomainObject(page, uuid);
 | 
			
		||||
 | 
			
		||||
@@ -181,6 +223,30 @@ async function openObjectTreeContextMenu(page, url) {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Expands the entire object tree (every expandable tree item).
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {"Main Tree" | "Create Modal Tree"} [treeName="Main Tree"]
 | 
			
		||||
 */
 | 
			
		||||
async function expandEntireTree(page, treeName = "Main Tree") {
 | 
			
		||||
    const treeLocator = page.getByRole('tree', {
 | 
			
		||||
        name: treeName
 | 
			
		||||
    });
 | 
			
		||||
    const collapsedTreeItems = treeLocator.getByRole('treeitem', {
 | 
			
		||||
        expanded: false
 | 
			
		||||
    }).locator('span.c-disclosure-triangle.is-enabled');
 | 
			
		||||
 | 
			
		||||
    while (await collapsedTreeItems.count() > 0) {
 | 
			
		||||
        await collapsedTreeItems.nth(0).click();
 | 
			
		||||
 | 
			
		||||
        // FIXME: Replace hard wait with something event-driven.
 | 
			
		||||
        // Without the wait, this fails periodically due to a race condition
 | 
			
		||||
        // with Vue rendering (loop exits prematurely).
 | 
			
		||||
        // eslint-disable-next-line playwright/no-wait-for-timeout
 | 
			
		||||
        await page.waitForTimeout(200);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Gets the UUID of the currently focused object by parsing the current URL
 | 
			
		||||
 * and returning the last UUID in the path.
 | 
			
		||||
@@ -207,6 +273,7 @@ async function getFocusedObjectUuid(page) {
 | 
			
		||||
 * @returns {Promise<string>} the url of the object
 | 
			
		||||
 */
 | 
			
		||||
async function getHashUrlToDomainObject(page, uuid) {
 | 
			
		||||
    await page.waitForLoadState('load'); //Add some determinism
 | 
			
		||||
    const hashUrl = await page.evaluate(async (objectUuid) => {
 | 
			
		||||
        const path = await window.openmct.objects.getOriginalPath(objectUuid);
 | 
			
		||||
        let url = './#/browse/' + [...path].reverse()
 | 
			
		||||
@@ -225,15 +292,14 @@ async function getHashUrlToDomainObject(page, uuid) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @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) {
 | 
			
		||||
    // 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());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -321,16 +387,111 @@ async function setEndOffset(page, offset) {
 | 
			
		||||
    await setTimeConductorOffset(page, offset, endOffsetButton);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Selects an inspector tab based on the provided tab name
 | 
			
		||||
 *
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {String} name the name of the tab
 | 
			
		||||
 */
 | 
			
		||||
async function selectInspectorTab(page, name) {
 | 
			
		||||
    const inspectorTabs = page.getByRole('tablist');
 | 
			
		||||
    const inspectorTab = inspectorTabs.getByTitle(name);
 | 
			
		||||
    const inspectorTabClass = await inspectorTab.getAttribute('class');
 | 
			
		||||
    const isSelectedInspectorTab = inspectorTabClass.includes('is-current');
 | 
			
		||||
 | 
			
		||||
    // do not click a tab that is already selected or it will timeout your test
 | 
			
		||||
    // do to a { pointer-events: none; } on selected tabs
 | 
			
		||||
    if (!isSelectedInspectorTab) {
 | 
			
		||||
        await inspectorTab.click();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* 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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line no-undef
 | 
			
		||||
module.exports = {
 | 
			
		||||
    createDomainObjectWithDefaults,
 | 
			
		||||
    expandTreePaneItemByName,
 | 
			
		||||
    createNotification,
 | 
			
		||||
    createPlanFromJSON,
 | 
			
		||||
    openObjectTreeContextMenu,
 | 
			
		||||
    expandEntireTree,
 | 
			
		||||
    expandTreePaneItemByName,
 | 
			
		||||
    getCanvasPixels,
 | 
			
		||||
    getHashUrlToDomainObject,
 | 
			
		||||
    getFocusedObjectUuid,
 | 
			
		||||
    openObjectTreeContextMenu,
 | 
			
		||||
    setFixedTimeMode,
 | 
			
		||||
    setRealTimeMode,
 | 
			
		||||
    setStartOffset,
 | 
			
		||||
    setEndOffset
 | 
			
		||||
    setEndOffset,
 | 
			
		||||
    selectInspectorTab,
 | 
			
		||||
    waitForPlotsToRender
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* eslint-disable no-undef */
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -170,5 +170,6 @@ exports.test = base.test.extend({
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
exports.expect = expect;
 | 
			
		||||
exports.waitForAnimations = waitForAnimations;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								e2e/helper/addInitExampleUser.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,27 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
// This should be used to install the Example User
 | 
			
		||||
document.addEventListener('DOMContentLoaded', () => {
 | 
			
		||||
    const openmct = window.openmct;
 | 
			
		||||
    openmct.install(openmct.plugins.example.ExampleUser());
 | 
			
		||||
});
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										76
									
								
								e2e/helper/addInitFileInputObject.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,76 @@
 | 
			
		||||
class DomainObjectViewProvider {
 | 
			
		||||
    constructor(openmct) {
 | 
			
		||||
        this.key = 'doViewProvider';
 | 
			
		||||
        this.name = 'Domain Object View Provider';
 | 
			
		||||
        this.openmct = openmct;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    canView(domainObject) {
 | 
			
		||||
        return domainObject.type === 'imageFileInput'
 | 
			
		||||
            || domainObject.type === 'jsonFileInput';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    view(domainObject, objectPath) {
 | 
			
		||||
        let content;
 | 
			
		||||
 | 
			
		||||
        return {
 | 
			
		||||
            show: function (element) {
 | 
			
		||||
                const body = domainObject.selectFile.body;
 | 
			
		||||
                const type = typeof body;
 | 
			
		||||
 | 
			
		||||
                content = document.createElement('div');
 | 
			
		||||
                content.id = 'file-input-type';
 | 
			
		||||
                content.textContent = JSON.stringify(type);
 | 
			
		||||
                element.appendChild(content);
 | 
			
		||||
            },
 | 
			
		||||
            destroy: function (element) {
 | 
			
		||||
                element.removeChild(content);
 | 
			
		||||
                content = undefined;
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
document.addEventListener('DOMContentLoaded', () => {
 | 
			
		||||
    const openmct = window.openmct;
 | 
			
		||||
 | 
			
		||||
    openmct.types.addType('jsonFileInput', {
 | 
			
		||||
        key: 'jsonFileInput',
 | 
			
		||||
        name: "JSON File Input Object",
 | 
			
		||||
        creatable: true,
 | 
			
		||||
        form: [
 | 
			
		||||
            {
 | 
			
		||||
                name: 'Upload File',
 | 
			
		||||
                key: 'selectFile',
 | 
			
		||||
                control: 'file-input',
 | 
			
		||||
                required: true,
 | 
			
		||||
                text: 'Select File...',
 | 
			
		||||
                type: 'application/json',
 | 
			
		||||
                property: [
 | 
			
		||||
                    "selectFile"
 | 
			
		||||
                ]
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    openmct.types.addType('imageFileInput', {
 | 
			
		||||
        key: 'imageFileInput',
 | 
			
		||||
        name: "Image File Input Object",
 | 
			
		||||
        creatable: true,
 | 
			
		||||
        form: [
 | 
			
		||||
            {
 | 
			
		||||
                name: 'Upload File',
 | 
			
		||||
                key: 'selectFile',
 | 
			
		||||
                control: 'file-input',
 | 
			
		||||
                required: true,
 | 
			
		||||
                text: 'Select File...',
 | 
			
		||||
                type: 'image/*',
 | 
			
		||||
                property: [
 | 
			
		||||
                    "selectFile"
 | 
			
		||||
                ]
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    openmct.objectViews.addProvider(new DomainObjectViewProvider(openmct));
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										32
									
								
								e2e/helper/addInitNotebookWithUrls.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,32 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
// This should be used to install the re-instal default Notebook plugin with a simple url whitelist.
 | 
			
		||||
// e.g.
 | 
			
		||||
// await page.addInitScript({ path: path.join(__dirname, 'addInitNotebookWithUrls.js') });
 | 
			
		||||
const NOTEBOOK_NAME = 'Notebook';
 | 
			
		||||
const URL_WHITELIST = ['google.com'];
 | 
			
		||||
 | 
			
		||||
document.addEventListener('DOMContentLoaded', () => {
 | 
			
		||||
    const openmct = window.openmct;
 | 
			
		||||
    openmct.install(openmct.plugins.Notebook(NOTEBOOK_NAME, URL_WHITELIST));
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										27
									
								
								e2e/helper/addInitOperatorStatus.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,27 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
// This should be used to install the Operator Status
 | 
			
		||||
document.addEventListener('DOMContentLoaded', () => {
 | 
			
		||||
    const openmct = window.openmct;
 | 
			
		||||
    openmct.install(openmct.plugins.OperatorStatus());
 | 
			
		||||
});
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -58,8 +58,14 @@ async function navigateToFaultManagementWithoutExample(page) {
 | 
			
		||||
async function navigateToFaultItemInTree(page) {
 | 
			
		||||
    await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
    // Click text=Fault Management
 | 
			
		||||
    await page.click('text=Fault Management'); // this verifies the plugin has been added
 | 
			
		||||
    const faultManagementTreeItem = page.getByRole('tree', {
 | 
			
		||||
        name: "Main Tree"
 | 
			
		||||
    }).getByRole('treeitem', {
 | 
			
		||||
        name: "Fault Management"
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Navigate to "Fault Management" from the tree
 | 
			
		||||
    await faultManagementTreeItem.click();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -141,8 +147,7 @@ async function clearSearch(page) {
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function selectFaultItem(page, rowNumber) {
 | 
			
		||||
    // eslint-disable-next-line playwright/no-force-option
 | 
			
		||||
    await page.check(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`, { force: true }); // this will not work without force true, saw this may be a pw bug
 | 
			
		||||
    await page.locator(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`).check();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -20,42 +20,46 @@
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../appActions');
 | 
			
		||||
 | 
			
		||||
const NOTEBOOK_DROP_AREA = '.c-notebook__drag-area';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function enterTextEntry(page, text) {
 | 
			
		||||
    // Click .c-notebook__drag-area
 | 
			
		||||
    // Click the 'Add Notebook Entry' area
 | 
			
		||||
    await page.locator(NOTEBOOK_DROP_AREA).click();
 | 
			
		||||
 | 
			
		||||
    // enter text
 | 
			
		||||
    await page.locator('div.c-ne__text').click();
 | 
			
		||||
    await page.locator('div.c-ne__text').fill(text);
 | 
			
		||||
    await page.locator('div.c-ne__text').press('Enter');
 | 
			
		||||
    await page.locator('[aria-label="Notebook Entry"].is-selected div.c-ne__text').fill(text);
 | 
			
		||||
    await commitEntry(page);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function dragAndDropEmbed(page, myItemsFolderName) {
 | 
			
		||||
    // Click button:has-text("Create")
 | 
			
		||||
    await page.locator('button:has-text("Create")').click();
 | 
			
		||||
    // Click li:has-text("Sine Wave Generator")
 | 
			
		||||
    await page.locator('li:has-text("Sine Wave Generator")').click();
 | 
			
		||||
    // Click form[name="mctForm"] >> text=My Items
 | 
			
		||||
    await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
 | 
			
		||||
    // Click text=OK
 | 
			
		||||
    await page.locator('text=OK').click();
 | 
			
		||||
    // Click text=Open MCT My Items >> span >> nth=3
 | 
			
		||||
    await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
 | 
			
		||||
    // Click text=Unnamed CUSTOM_NAME
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation(),
 | 
			
		||||
        page.locator('text=Unnamed CUSTOM_NAME').click()
 | 
			
		||||
    ]);
 | 
			
		||||
async function dragAndDropEmbed(page, notebookObject) {
 | 
			
		||||
    // Create example telemetry object
 | 
			
		||||
    const swg = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
        type: "Sine Wave Generator"
 | 
			
		||||
    });
 | 
			
		||||
    // Navigate to notebook
 | 
			
		||||
    await page.goto(notebookObject.url);
 | 
			
		||||
    // Expand the tree to reveal the notebook
 | 
			
		||||
    await page.click('button[title="Show selected item in tree"]');
 | 
			
		||||
    // Drag and drop the SWG into the notebook
 | 
			
		||||
    await page.dragAndDrop(`text=${swg.name}`, NOTEBOOK_DROP_AREA);
 | 
			
		||||
    await commitEntry(page);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
    await page.dragAndDrop('text=UNNAMED SINE WAVE GENERATOR', NOTEBOOK_DROP_AREA);
 | 
			
		||||
/**
 | 
			
		||||
 * @private
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function commitEntry(page) {
 | 
			
		||||
    //Click the Commit Entry button
 | 
			
		||||
    await page.locator('.c-ne__save-button > button').click();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line no-undef
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										92
									
								
								e2e/helper/planningUtils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,92 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
import { expect } from '../pluginFixtures';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Asserts that the number of activities in the plan view matches the number of
 | 
			
		||||
 * activities in the plan data within the specified time bounds. Performs an assertion
 | 
			
		||||
 * for each activity in the plan data per group, using the earliest activity's
 | 
			
		||||
 * start time as the start bound and the current activity's end time as the end bound.
 | 
			
		||||
 * @param {import('@playwright/test').Page} page the page
 | 
			
		||||
 * @param {object} plan The raw plan json to assert against
 | 
			
		||||
 * @param {string} objectUrl The URL of the object to assert against (plan or gantt chart)
 | 
			
		||||
 */
 | 
			
		||||
export async function assertPlanActivities(page, plan, objectUrl) {
 | 
			
		||||
    const groups = Object.keys(plan);
 | 
			
		||||
    for (const group of groups) {
 | 
			
		||||
        for (let i = 0; i < plan[group].length; i++) {
 | 
			
		||||
            // Set the startBound to the start time of the first activity in the group
 | 
			
		||||
            const startBound = plan[group][0].start;
 | 
			
		||||
            // Set the endBound to the end time of the current activity
 | 
			
		||||
            let endBound = plan[group][i].end;
 | 
			
		||||
            if (endBound === startBound) {
 | 
			
		||||
                // Prevent oddities with setting start and end bound equal
 | 
			
		||||
                // via URL params
 | 
			
		||||
                endBound += 1;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Switch to fixed time mode with all plan events within the bounds
 | 
			
		||||
            await page.goto(`${objectUrl}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`);
 | 
			
		||||
 | 
			
		||||
            // Assert that the number of activities in the plan view matches the number of
 | 
			
		||||
            // activities in the plan data within the specified time bounds
 | 
			
		||||
            const eventCount = await page.locator('.activity-bounds').count();
 | 
			
		||||
            expect(eventCount).toEqual(Object.values(plan)
 | 
			
		||||
                .flat()
 | 
			
		||||
                .filter(event =>
 | 
			
		||||
                    activitiesWithinTimeBounds(event.start, event.end, startBound, endBound)).length);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Returns true if the activities time bounds overlap, false otherwise.
 | 
			
		||||
* @param {number} start1 the start time of the first activity
 | 
			
		||||
* @param {number} end1 the end time of the first activity
 | 
			
		||||
* @param {number} start2 the start time of the second activity
 | 
			
		||||
* @param {number} end2 the end time of the second activity
 | 
			
		||||
* @returns {boolean} true if the activities overlap, false otherwise
 | 
			
		||||
*/
 | 
			
		||||
function activitiesWithinTimeBounds(start1, end1, start2, end2) {
 | 
			
		||||
    return (start1 >= start2 && start1 <= end2)
 | 
			
		||||
         || (end1 >= start2 && end1 <= end2)
 | 
			
		||||
         || (start2 >= start1 && start2 <= end1)
 | 
			
		||||
         || (end2 >= start1 && end2 <= end1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Navigate to the plan view, switch to fixed time mode,
 | 
			
		||||
 * and set the bounds to span all activities.
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {object} planJson
 | 
			
		||||
 * @param {string} planObjectUrl
 | 
			
		||||
 */
 | 
			
		||||
export async function setBoundsToSpanAllActivities(page, planJson, planObjectUrl) {
 | 
			
		||||
    const activities = Object.values(planJson).flat();
 | 
			
		||||
    // Get the earliest start value
 | 
			
		||||
    const start = Math.min(...activities.map(activity => activity.start));
 | 
			
		||||
    // Get the latest end value
 | 
			
		||||
    const end = Math.max(...activities.map(activity => activity.end));
 | 
			
		||||
    // Set the start and end bounds to the earliest start and latest end
 | 
			
		||||
    await page.goto(`${planObjectUrl}?tc.mode=fixed&tc.startBound=${start}&tc.endBound=${end}&tc.timeSystem=utc&view=plan.view`);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -9,12 +9,12 @@ const NUM_WORKERS = 2;
 | 
			
		||||
 | 
			
		||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
 | 
			
		||||
const config = {
 | 
			
		||||
    retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with maxFailures = 5, this should ensure that flake is managed without failing the full suite
 | 
			
		||||
    retries: 2, //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
 | 
			
		||||
    testDir: 'tests',
 | 
			
		||||
    testIgnore: '**/*.perf.spec.js', //Ignore performance tests and define in playwright-perfromance.config.js
 | 
			
		||||
    timeout: 60 * 1000,
 | 
			
		||||
    webServer: {
 | 
			
		||||
        command: 'cross-env NODE_ENV=test npm run start',
 | 
			
		||||
        command: 'npm run start:coverage',
 | 
			
		||||
        url: 'http://localhost:8080/#',
 | 
			
		||||
        timeout: 200 * 1000,
 | 
			
		||||
        reuseExistingServer: false
 | 
			
		||||
@@ -73,8 +73,9 @@ const config = {
 | 
			
		||||
            open: 'never',
 | 
			
		||||
            outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
 | 
			
		||||
        }],
 | 
			
		||||
        ['junit', { outputFile: 'test-results/results.xml' }],
 | 
			
		||||
        ['github']
 | 
			
		||||
        ['junit', { outputFile: '../test-results/results.xml' }],
 | 
			
		||||
        ['github'],
 | 
			
		||||
        ['@deploysentinel/playwright']
 | 
			
		||||
    ]
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,10 +12,7 @@ const config = {
 | 
			
		||||
    testIgnore: '**/*.perf.spec.js',
 | 
			
		||||
    timeout: 30 * 1000,
 | 
			
		||||
    webServer: {
 | 
			
		||||
        env: {
 | 
			
		||||
            NODE_ENV: 'test'
 | 
			
		||||
        },
 | 
			
		||||
        command: 'npm run start',
 | 
			
		||||
        command: 'npm run start:coverage',
 | 
			
		||||
        url: 'http://localhost:8080/#',
 | 
			
		||||
        timeout: 120 * 1000,
 | 
			
		||||
        reuseExistingServer: true
 | 
			
		||||
 
 | 
			
		||||
@@ -6,12 +6,12 @@ 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
 | 
			
		||||
    retries: 1, //Only for debugging purposes for trace: 'on-first-retry'
 | 
			
		||||
    testDir: 'tests/performance/',
 | 
			
		||||
    timeout: 60 * 1000,
 | 
			
		||||
    workers: 1, //Only run in serial with 1 worker
 | 
			
		||||
    webServer: {
 | 
			
		||||
        command: 'cross-env NODE_ENV=test npm run start',
 | 
			
		||||
        command: 'npm run start', //coverage not generated
 | 
			
		||||
        url: 'http://localhost:8080/#',
 | 
			
		||||
        timeout: 200 * 1000,
 | 
			
		||||
        reuseExistingServer: !CI
 | 
			
		||||
@@ -35,8 +35,8 @@ const config = {
 | 
			
		||||
    ],
 | 
			
		||||
    reporter: [
 | 
			
		||||
        ['list'],
 | 
			
		||||
        ['junit', { outputFile: 'test-results/results.xml' }],
 | 
			
		||||
        ['json', { outputFile: 'test-results/results.json' }]
 | 
			
		||||
        ['junit', { outputFile: '../test-results/results.xml' }],
 | 
			
		||||
        ['json', { outputFile: '../test-results/results.json' }]
 | 
			
		||||
    ]
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,13 +4,13 @@
 | 
			
		||||
 | 
			
		||||
/** @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
 | 
			
		||||
    retries: 0, // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
 | 
			
		||||
    testDir: 'tests/visual',
 | 
			
		||||
    testMatch: '**/*.visual.spec.js', // only run visual tests
 | 
			
		||||
    timeout: 60 * 1000,
 | 
			
		||||
    workers: 1, //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
 | 
			
		||||
    webServer: {
 | 
			
		||||
        command: 'cross-env NODE_ENV=test npm run start',
 | 
			
		||||
        command: 'npm run start:coverage',
 | 
			
		||||
        url: 'http://localhost:8080/#',
 | 
			
		||||
        timeout: 200 * 1000,
 | 
			
		||||
        reuseExistingServer: !process.env.CI
 | 
			
		||||
@@ -31,7 +31,7 @@ const config = {
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            name: 'chrome-snow-theme',
 | 
			
		||||
            name: 'chrome-snow-theme', //Runs the same visual tests but with snow-theme enabled
 | 
			
		||||
            use: {
 | 
			
		||||
                browserName: 'chromium',
 | 
			
		||||
                theme: 'snow'
 | 
			
		||||
@@ -40,7 +40,7 @@ const config = {
 | 
			
		||||
    ],
 | 
			
		||||
    reporter: [
 | 
			
		||||
        ['list'],
 | 
			
		||||
        ['junit', { outputFile: 'test-results/results.xml' }],
 | 
			
		||||
        ['junit', { outputFile: '../test-results/results.xml' }],
 | 
			
		||||
        ['html', {
 | 
			
		||||
            open: 'on-failure',
 | 
			
		||||
            outputFolder: '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/* eslint-disable no-undef */
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -126,13 +126,21 @@ exports.test = test.extend({
 | 
			
		||||
    // This should follow in the Project's configuration. Can be set to 'snow' in playwright config.js
 | 
			
		||||
    theme: [theme, { option: true }],
 | 
			
		||||
    // eslint-disable-next-line no-shadow
 | 
			
		||||
    page: async ({ page, theme }, use) => {
 | 
			
		||||
    page: async ({ page, theme }, use, testInfo) => {
 | 
			
		||||
        // eslint-disable-next-line playwright/no-conditional-in-test
 | 
			
		||||
        if (theme === 'snow') {
 | 
			
		||||
            //inject snow theme
 | 
			
		||||
            await page.addInitScript({ path: path.join(__dirname, './helper', './useSnowTheme.js') });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Attach info about the currently running test and its project.
 | 
			
		||||
        // This will be used by appActions to fill in the created
 | 
			
		||||
        // domain object's notes.
 | 
			
		||||
        page.testNotes = [
 | 
			
		||||
            `${testInfo.titlePath.join('\n')}`,
 | 
			
		||||
            `${testInfo.project.name}`
 | 
			
		||||
        ].join('\n');
 | 
			
		||||
 | 
			
		||||
        await use(page);
 | 
			
		||||
    },
 | 
			
		||||
    myItemsFolderName: [myItemsFolderName, { option: true }],
 | 
			
		||||
@@ -140,22 +148,19 @@ exports.test = test.extend({
 | 
			
		||||
    openmctConfig: async ({ myItemsFolderName }, use) => {
 | 
			
		||||
        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;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Takes a readable stream and returns a string.
 | 
			
		||||
 * @param {ReadableStream} readable - the readable stream
 | 
			
		||||
 * @return {Promise<String>} the stringified stream
 | 
			
		||||
 */
 | 
			
		||||
exports.streamToString = async function (readable) {
 | 
			
		||||
    let result = '';
 | 
			
		||||
    for await (const chunk of readable) {
 | 
			
		||||
        result += chunk;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2207
									
								
								e2e/test-data/ExampleLayouts.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										1080
									
								
								e2e/test-data/examplePlans/ExamplePlan_Large.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										44
									
								
								e2e/test-data/examplePlans/ExamplePlan_Small1.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,44 @@
 | 
			
		||||
{
 | 
			
		||||
  "Group 1": [
 | 
			
		||||
      {
 | 
			
		||||
          "name": "Past event 1",
 | 
			
		||||
          "start": 1660320408000,
 | 
			
		||||
          "end": 1660343797000,
 | 
			
		||||
          "type": "Group 1",
 | 
			
		||||
          "color": "orange",
 | 
			
		||||
          "textColor": "white"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
          "name": "Past event 2",
 | 
			
		||||
          "start": 1660406808000,
 | 
			
		||||
          "end": 1660429160000,
 | 
			
		||||
          "type": "Group 1",
 | 
			
		||||
          "color": "orange",
 | 
			
		||||
          "textColor": "white"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
          "name": "Past event 3",
 | 
			
		||||
          "start": 1660493208000,
 | 
			
		||||
          "end": 1660503981000,
 | 
			
		||||
          "type": "Group 1",
 | 
			
		||||
          "color": "orange",
 | 
			
		||||
          "textColor": "white"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
          "name": "Past event 4",
 | 
			
		||||
          "start": 1660579608000,
 | 
			
		||||
          "end": 1660624108000,
 | 
			
		||||
          "type": "Group 1",
 | 
			
		||||
          "color": "orange",
 | 
			
		||||
          "textColor": "white"
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
          "name": "Past event 5",
 | 
			
		||||
          "start": 1660666008000,
 | 
			
		||||
          "end": 1660681529000,
 | 
			
		||||
          "type": "Group 1",
 | 
			
		||||
          "color": "orange",
 | 
			
		||||
          "textColor": "white"
 | 
			
		||||
      }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										38
									
								
								e2e/test-data/examplePlans/ExamplePlan_Small2.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -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"
 | 
			
		||||
      }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								e2e/test-data/rick.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 10 KiB  | 
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -20,12 +20,12 @@
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../baseFixtures.js');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../appActions.js');
 | 
			
		||||
const { test, expect } = require('../../pluginFixtures.js');
 | 
			
		||||
const { createDomainObjectWithDefaults, createNotification, expandEntireTree } = require('../../appActions.js');
 | 
			
		||||
 | 
			
		||||
test.describe('AppActions', () => {
 | 
			
		||||
    test('createDomainObjectsWithDefaults', async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        const e2eFolder = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
@@ -49,12 +49,12 @@ test.describe('AppActions', () => {
 | 
			
		||||
                parent: e2eFolder.uuid
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            await page.goto(timer1.url, { waitUntil: 'networkidle' });
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Timer Foo');
 | 
			
		||||
            await page.goto(timer2.url, { waitUntil: 'networkidle' });
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Timer Bar');
 | 
			
		||||
            await page.goto(timer3.url, { waitUntil: 'networkidle' });
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Timer Baz');
 | 
			
		||||
            await page.goto(timer1.url);
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer1.name);
 | 
			
		||||
            await page.goto(timer2.url);
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer2.name);
 | 
			
		||||
            await page.goto(timer3.url);
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText(timer3.name);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await test.step('Create multiple nested objects in a row', async () => {
 | 
			
		||||
@@ -73,16 +73,93 @@ test.describe('AppActions', () => {
 | 
			
		||||
                name: 'Folder Baz',
 | 
			
		||||
                parent: folder2.uuid
 | 
			
		||||
            });
 | 
			
		||||
            await page.goto(folder1.url, { waitUntil: 'networkidle' });
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Folder Foo');
 | 
			
		||||
            await page.goto(folder2.url, { waitUntil: 'networkidle' });
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Folder Bar');
 | 
			
		||||
            await page.goto(folder3.url, { waitUntil: 'networkidle' });
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText('Folder Baz');
 | 
			
		||||
            await page.goto(folder1.url);
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder1.name);
 | 
			
		||||
            await page.goto(folder2.url);
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder2.name);
 | 
			
		||||
            await page.goto(folder3.url);
 | 
			
		||||
            await expect(page.locator('.l-browse-bar__object-name')).toHaveText(folder3.name);
 | 
			
		||||
 | 
			
		||||
            expect(folder1.url).toBe(`${e2eFolder.url}/${folder1.uuid}`);
 | 
			
		||||
            expect(folder2.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}`);
 | 
			
		||||
            expect(folder3.url).toBe(`${e2eFolder.url}/${folder1.uuid}/${folder2.uuid}/${folder3.uuid}`);
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    test("createNotification", async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        await createNotification(page, {
 | 
			
		||||
            message: 'Test info notification',
 | 
			
		||||
            severity: 'info'
 | 
			
		||||
        });
 | 
			
		||||
        await expect(page.locator('.c-message-banner__message')).toHaveText('Test info notification');
 | 
			
		||||
        await expect(page.locator('.c-message-banner')).toHaveClass(/info/);
 | 
			
		||||
        await page.locator('[aria-label="Dismiss"]').click();
 | 
			
		||||
        await createNotification(page, {
 | 
			
		||||
            message: 'Test alert notification',
 | 
			
		||||
            severity: 'alert'
 | 
			
		||||
        });
 | 
			
		||||
        await expect(page.locator('.c-message-banner__message')).toHaveText('Test alert notification');
 | 
			
		||||
        await expect(page.locator('.c-message-banner')).toHaveClass(/alert/);
 | 
			
		||||
        await page.locator('[aria-label="Dismiss"]').click();
 | 
			
		||||
        await createNotification(page, {
 | 
			
		||||
            message: 'Test error notification',
 | 
			
		||||
            severity: 'error'
 | 
			
		||||
        });
 | 
			
		||||
        await expect(page.locator('.c-message-banner__message')).toHaveText('Test error notification');
 | 
			
		||||
        await expect(page.locator('.c-message-banner')).toHaveClass(/error/);
 | 
			
		||||
        await page.locator('[aria-label="Dismiss"]').click();
 | 
			
		||||
    });
 | 
			
		||||
    test('expandEntireTree', async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        const rootFolder = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder'
 | 
			
		||||
        });
 | 
			
		||||
        const folder1 = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
            parent: rootFolder.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Clock',
 | 
			
		||||
            parent: folder1.uuid
 | 
			
		||||
        });
 | 
			
		||||
        const folder2 = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
            parent: folder1.uuid
 | 
			
		||||
        });
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
            parent: folder1.uuid
 | 
			
		||||
        });
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Display Layout',
 | 
			
		||||
            parent: folder2.uuid
 | 
			
		||||
        });
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
            parent: folder2.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto('./#/browse/mine');
 | 
			
		||||
        await expandEntireTree(page);
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: "Main Tree"
 | 
			
		||||
        });
 | 
			
		||||
        const treePaneCollapsedItems = treePane.getByRole('treeitem', { expanded: false });
 | 
			
		||||
        expect(await treePaneCollapsedItems.count()).toBe(0);
 | 
			
		||||
 | 
			
		||||
        await page.goto('./#/browse/mine');
 | 
			
		||||
        //Click the Create button
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        // Click the object specified by 'type'
 | 
			
		||||
        await page.click(`li[role='menuitem']:text("Clock")`);
 | 
			
		||||
        await expandEntireTree(page, "Create Modal Tree");
 | 
			
		||||
        const locatorTree = page.getByRole("tree", {
 | 
			
		||||
            name: "Create Modal Tree"
 | 
			
		||||
        });
 | 
			
		||||
        const locatorTreeCollapsedItems = locatorTree.locator('role=treeitem[expanded=false]');
 | 
			
		||||
        expect(await locatorTreeCollapsedItems.count()).toBe(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
/*
 | 
			
		||||
This test suite is dedicated to testing our use of the playwright framework as it
 | 
			
		||||
relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions made in our dev environment
 | 
			
		||||
(app.js and ./e2e/webpack-dev-middleware.js)
 | 
			
		||||
(`npm start` and ./e2e/webpack-dev-middleware.js)
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test } = require('../../baseFixtures.js');
 | 
			
		||||
@@ -32,7 +32,7 @@ test.describe('baseFixtures tests', () => {
 | 
			
		||||
    test('Verify that tests fail if console.error is thrown', async ({ page }) => {
 | 
			
		||||
        test.fail();
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Verify that ../fixtures.js detects console log errors
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
@@ -43,7 +43,7 @@ test.describe('baseFixtures tests', () => {
 | 
			
		||||
    });
 | 
			
		||||
    test('Verify that tests pass if console.warn is thrown', async ({ page }) => {
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Verify that ../fixtures.js detects console log errors
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -45,7 +45,7 @@
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
// Structure: Some standard Imports. Please update the required pathing.
 | 
			
		||||
const { test, expect } = require('../../baseFixtures');
 | 
			
		||||
const { test, expect } = require('../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../appActions');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -63,7 +63,7 @@ test.describe('Renaming Timer Object', () => {
 | 
			
		||||
    let timer;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // Open a browser, navigate to the main page, and wait until all network events to resolve
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // We provide some helper functions in appActions like `createDomainObjectWithDefaults()`.
 | 
			
		||||
        // This example will create a Timer object with default properties, under the root folder:
 | 
			
		||||
@@ -144,5 +144,5 @@ async function renameTimerFrom3DotMenu(page, timerUrl, newNameForTimer) {
 | 
			
		||||
    await page.locator('text=Properties Title Notes >> input[type="text"]').fill(newNameForTimer);
 | 
			
		||||
 | 
			
		||||
    // Click Ok button to Save
 | 
			
		||||
    await page.locator('text=OK').click();
 | 
			
		||||
    await page.locator('button:has-text("OK")').click();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -36,21 +36,21 @@ const { test, expect } = require('../../pluginFixtures.js');
 | 
			
		||||
 | 
			
		||||
test('Generate Visual Test Data @localStorage', async ({ page, context }) => {
 | 
			
		||||
    //Go to baseURL
 | 
			
		||||
    await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
    await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    const overlayPlot = await createDomainObjectWithDefaults(page, { type: 'Overlay Plot' });
 | 
			
		||||
 | 
			
		||||
    // click create button
 | 
			
		||||
    await page.locator('button:has-text("Create")').click();
 | 
			
		||||
 | 
			
		||||
    // add sine wave generator with defaults
 | 
			
		||||
    await page.locator('li:has-text("Sine Wave Generator")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
 | 
			
		||||
 | 
			
		||||
    //Add a 5000 ms Delay
 | 
			
		||||
    await page.locator('[aria-label="Loading Delay \\(ms\\)"]').fill('5000');
 | 
			
		||||
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation(),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
@@ -58,7 +58,7 @@ test('Generate Visual Test Data @localStorage', async ({ page, context }) => {
 | 
			
		||||
    // focus the overlay plot
 | 
			
		||||
    await page.goto(overlayPlot.url);
 | 
			
		||||
 | 
			
		||||
    await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Overlay Plot');
 | 
			
		||||
    await expect(page.locator('.l-browse-bar__object-name')).toContainText(overlayPlot.name);
 | 
			
		||||
    //Save localStorage for future test execution
 | 
			
		||||
    await context.storageState({ path: './e2e/test-data/VisualTestData_storage.json' });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -30,7 +30,7 @@ test.describe('recycled_local_storage @localStorage', () => {
 | 
			
		||||
    //We may want to do some additional level of verification of this file. For now, we just verify that it exists and can be used in a test suite.
 | 
			
		||||
    test.use({ storageState: './e2e/test-data/recycled_local_storage.json' });
 | 
			
		||||
    test('Can use recycled_local_storage file', async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -29,7 +29,7 @@ const { test, expect } = require('../../baseFixtures.js');
 | 
			
		||||
test.describe('Branding tests', () => {
 | 
			
		||||
    test('About Modal launches with basic branding properties', async ({ page }) => {
 | 
			
		||||
        // Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Click About button
 | 
			
		||||
        await page.click('.l-shell__app-logo');
 | 
			
		||||
@@ -47,7 +47,7 @@ test.describe('Branding tests', () => {
 | 
			
		||||
    });
 | 
			
		||||
    test('Verify Links in About Modal @2p', async ({ page }) => {
 | 
			
		||||
        // Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Click About button
 | 
			
		||||
        await page.click('.l-shell__app-logo');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -25,9 +25,9 @@
 | 
			
		||||
*
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../baseFixtures');
 | 
			
		||||
const { test, expect } = require('../../pluginFixtures');
 | 
			
		||||
 | 
			
		||||
test.describe("CouchDB Status Indicator @couchdb", () => {
 | 
			
		||||
test.describe("CouchDB Status Indicator with mocked responses @couchdb", () => {
 | 
			
		||||
    test.use({ failOnConsoleError: false });
 | 
			
		||||
    //TODO BeforeAll Verify CouchDB Connectivity with APIContext
 | 
			
		||||
    test('Shows green if connected', async ({ page }) => {
 | 
			
		||||
@@ -71,38 +71,41 @@ test.describe("CouchDB Status Indicator @couchdb", () => {
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe("CouchDB initialization @couchdb", () => {
 | 
			
		||||
test.describe("CouchDB initialization with mocked responses @couchdb", () => {
 | 
			
		||||
    test.use({ failOnConsoleError: false });
 | 
			
		||||
    test("'My Items' folder is created if it doesn't exist", async ({ page }) => {
 | 
			
		||||
        // Store any relevant PUT requests that happen on the page
 | 
			
		||||
        const createMineFolderRequests = [];
 | 
			
		||||
        page.on('request', req => {
 | 
			
		||||
            // eslint-disable-next-line playwright/no-conditional-in-test
 | 
			
		||||
            if (req.method() === 'PUT' && req.url().endsWith('openmct/mine')) {
 | 
			
		||||
                createMineFolderRequests.push(req);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        const mockedMissingObjectResponsefromCouchDB = {
 | 
			
		||||
            status: 404,
 | 
			
		||||
            contentType: 'application/json',
 | 
			
		||||
            body: JSON.stringify({})
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // Override the first request to GET openmct/mine to return a 404
 | 
			
		||||
        await page.route('**/openmct/mine', route => {
 | 
			
		||||
            route.fulfill({
 | 
			
		||||
                status: 404,
 | 
			
		||||
                contentType: 'application/json',
 | 
			
		||||
                body: JSON.stringify({})
 | 
			
		||||
            });
 | 
			
		||||
        // Override the first request to GET openmct/mine to return a 404.
 | 
			
		||||
        // This simulates the case of starting Open MCT with a fresh database
 | 
			
		||||
        // and no "My Items" folder created yet.
 | 
			
		||||
        await page.route('**/mine', route => {
 | 
			
		||||
            route.fulfill(mockedMissingObjectResponsefromCouchDB);
 | 
			
		||||
        }, { times: 1 });
 | 
			
		||||
 | 
			
		||||
        // Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        // Set up promise to verify that a PUT request to create "My Items"
 | 
			
		||||
        // folder was made.
 | 
			
		||||
        const putMineFolderRequest = page.waitForRequest(req =>
 | 
			
		||||
            req.url().endsWith('/mine')
 | 
			
		||||
            && req.method() === 'PUT');
 | 
			
		||||
 | 
			
		||||
        // Verify that error banner is displayed
 | 
			
		||||
        const bannerMessage = await page.locator('.c-message-banner__message').innerText();
 | 
			
		||||
        expect(bannerMessage).toEqual('Failed to retrieve object mine');
 | 
			
		||||
        // Set up promise to verify that a GET request to retrieve "My Items"
 | 
			
		||||
        // folder was made.
 | 
			
		||||
        const getMineFolderRequest = page.waitForRequest(req =>
 | 
			
		||||
            req.url().endsWith('/mine')
 | 
			
		||||
            && req.method() === 'GET');
 | 
			
		||||
 | 
			
		||||
        // Verify that a PUT request to create "My Items" folder was made
 | 
			
		||||
        expect.poll(() => createMineFolderRequests.length, {
 | 
			
		||||
            message: 'Verify that PUT request to create "mine" folder was made',
 | 
			
		||||
            timeout: 1000
 | 
			
		||||
        }).toBeGreaterThanOrEqual(1);
 | 
			
		||||
        // Go to baseURL.
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Wait for both requests to resolve.
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            putMineFolderRequest,
 | 
			
		||||
            getMineFolderRequest
 | 
			
		||||
        ]);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -24,13 +24,13 @@
 | 
			
		||||
This test suite is dedicated to tests which verify the basic operations surrounding the example event generator.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../baseFixtures');
 | 
			
		||||
const { test, expect } = require('../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('Example Event Generator CRUD Operations', () => {
 | 
			
		||||
    test('Can create a Test Event Generator and it results in the table View', async ({ page }) => {
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Create a name for the object
 | 
			
		||||
        const newObjectName = 'Test Event Generator';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -32,7 +32,7 @@ test.describe('Sine Wave Generator', () => {
 | 
			
		||||
        test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
 | 
			
		||||
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Click the Create button
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
@@ -96,7 +96,7 @@ test.describe('Sine Wave Generator', () => {
 | 
			
		||||
        //Click text=OK
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation(),
 | 
			
		||||
            page.click('text=OK')
 | 
			
		||||
            page.click('button:has-text("OK")')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Verify that the Sine Wave Generator is displayed and correct
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -24,15 +24,19 @@
 | 
			
		||||
This test suite is dedicated to tests which verify form functionality in isolation
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../baseFixtures');
 | 
			
		||||
const { test, expect } = require('../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../appActions');
 | 
			
		||||
const genUuid = require('uuid').v4;
 | 
			
		||||
const path = require('path');
 | 
			
		||||
 | 
			
		||||
const TEST_FOLDER = 'test folder';
 | 
			
		||||
const jsonFilePath = 'e2e/test-data/ExampleLayouts.json';
 | 
			
		||||
const imageFilePath = 'e2e/test-data/rick.jpg';
 | 
			
		||||
 | 
			
		||||
test.describe('Form Validation Behavior', () => {
 | 
			
		||||
    test('Required Field indicators appear if title is empty and can be corrected', async ({ page }) => {
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
        await page.click(':nth-match(:text("Folder"), 2)');
 | 
			
		||||
@@ -43,7 +47,7 @@ test.describe('Form Validation Behavior', () => {
 | 
			
		||||
        await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
 | 
			
		||||
 | 
			
		||||
        //Required Field Form Validation
 | 
			
		||||
        await expect(page.locator('text=OK')).toBeDisabled();
 | 
			
		||||
        await expect(page.locator('button:has-text("OK")')).toBeDisabled();
 | 
			
		||||
        await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
 | 
			
		||||
 | 
			
		||||
        //Correct Form Validation for missing title and trigger validation with 'Tab'
 | 
			
		||||
@@ -52,13 +56,13 @@ test.describe('Form Validation Behavior', () => {
 | 
			
		||||
        await page.press('text=Properties Title Notes >> input[type="text"]', 'Tab');
 | 
			
		||||
 | 
			
		||||
        //Required Field Form Validation is corrected
 | 
			
		||||
        await expect(page.locator('text=OK')).toBeEnabled();
 | 
			
		||||
        await expect(page.locator('button:has-text("OK")')).toBeEnabled();
 | 
			
		||||
        await expect(page.locator('.c-form-row__state-indicator').first()).not.toHaveClass(/invalid/);
 | 
			
		||||
 | 
			
		||||
        //Finish Creating Domain Object
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation(),
 | 
			
		||||
            page.click('text=OK')
 | 
			
		||||
            page.click('button:has-text("OK")')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        //Verify that the Domain Object has been created with the corrected title property
 | 
			
		||||
@@ -66,6 +70,41 @@ test.describe('Form Validation Behavior', () => {
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Form File Input Behavior', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // eslint-disable-next-line no-undef
 | 
			
		||||
        await page.addInitScript({ path: path.join(__dirname, '../../helper', 'addInitFileInputObject.js') });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can select a JSON file type', async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: ' Create ' }).click();
 | 
			
		||||
        await page.getByRole('menuitem', { name: 'JSON File Input Object' }).click();
 | 
			
		||||
 | 
			
		||||
        await page.setInputFiles('#fileElem', jsonFilePath);
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: 'Save' }).click();
 | 
			
		||||
 | 
			
		||||
        const type = await page.locator('#file-input-type').textContent();
 | 
			
		||||
        await expect(type).toBe(`"string"`);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can select an image file type', async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: ' Create ' }).click();
 | 
			
		||||
        await page.getByRole('menuitem', { name: 'Image File Input Object' }).click();
 | 
			
		||||
 | 
			
		||||
        await page.setInputFiles('#fileElem', imageFilePath);
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: 'Save' }).click();
 | 
			
		||||
 | 
			
		||||
        const type = await page.locator('#file-input-type').textContent();
 | 
			
		||||
        await expect(type).toBe(`"object"`);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Persistence operations @addInit', () => {
 | 
			
		||||
    // add non persistable root item
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
@@ -78,7 +117,7 @@ test.describe('Persistence operations @addInit', () => {
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/4323'
 | 
			
		||||
        });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
@@ -91,6 +130,151 @@ test.describe('Persistence operations @addInit', () => {
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Persistence operations @couchdb', () => {
 | 
			
		||||
    test.use({ failOnConsoleError: false });
 | 
			
		||||
    test('Editing object properties should generate a single persistence operation', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5616'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create a new 'Clock' object with default settings
 | 
			
		||||
        const clock = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Clock'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Count all persistence operations (PUT requests) for this specific object
 | 
			
		||||
        let putRequestCount = 0;
 | 
			
		||||
        page.on('request', req => {
 | 
			
		||||
            if (req.method() === 'PUT' && req.url().endsWith(clock.uuid)) {
 | 
			
		||||
                putRequestCount += 1;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Open the edit form for the clock object
 | 
			
		||||
        await page.click('button[title="More options"]');
 | 
			
		||||
        await page.click('li[title="Edit properties of this object."]');
 | 
			
		||||
 | 
			
		||||
        // Modify the display format from default 12hr -> 24hr and click 'Save'
 | 
			
		||||
        await page.locator('select[aria-label="12 or 24 hour clock"]').selectOption({ value: 'clock24' });
 | 
			
		||||
        await page.click('button[aria-label="Save"]');
 | 
			
		||||
 | 
			
		||||
        await expect.poll(() => putRequestCount, {
 | 
			
		||||
            message: 'Verify a single PUT request was made to persist the object',
 | 
			
		||||
            timeout: 1000
 | 
			
		||||
        }).toEqual(1);
 | 
			
		||||
    });
 | 
			
		||||
    test('Can create an object after a conflict error @couchdb @2p', async ({ page, openmctConfig }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5982'
 | 
			
		||||
        });
 | 
			
		||||
        const { myItemsFolderName } = openmctConfig;
 | 
			
		||||
        // Instantiate a second page/tab
 | 
			
		||||
        const page2 = await page.context().newPage();
 | 
			
		||||
 | 
			
		||||
        // Both pages: Go to baseURL
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.goto('./', { waitUntil: 'networkidle' }),
 | 
			
		||||
            page2.goto('./', { waitUntil: 'networkidle' })
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        //Slow down the test a bit
 | 
			
		||||
        await expect(page.getByRole('treeitem', { name: `  ${myItemsFolderName}` })).toBeVisible();
 | 
			
		||||
        await expect(page2.getByRole('treeitem', { name: `  ${myItemsFolderName}` })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Both pages: Click the Create button
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.click('button:has-text("Create")'),
 | 
			
		||||
            page2.click('button:has-text("Create")')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Both pages: Click "Clock" in the Create menu
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.click(`li[role='menuitem']:text("Clock")`),
 | 
			
		||||
            page2.click(`li[role='menuitem']:text("Clock")`)
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Generate unique names for both objects
 | 
			
		||||
        const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
        const nameInput2 = page2.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
 | 
			
		||||
        // Both pages: Fill in the 'Name' form field.
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            nameInput.fill(""),
 | 
			
		||||
            nameInput.fill(`Clock:${genUuid()}`),
 | 
			
		||||
            nameInput2.fill(""),
 | 
			
		||||
            nameInput2.fill(`Clock:${genUuid()}`)
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Both pages: Fill the "Notes" section with information about the
 | 
			
		||||
        // currently running test and its project.
 | 
			
		||||
        const testNotes = page.testNotes;
 | 
			
		||||
        const notesInput = page.locator('form[name="mctForm"] #notes-textarea');
 | 
			
		||||
        const notesInput2 = page2.locator('form[name="mctForm"] #notes-textarea');
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            notesInput.fill(testNotes),
 | 
			
		||||
            notesInput2.fill(testNotes)
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Page 2: Click "OK" to create the domain object and wait for navigation.
 | 
			
		||||
        // This will update the composition of the parent folder, setting the
 | 
			
		||||
        // conditions for a conflict error from the first page.
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page2.waitForLoadState(),
 | 
			
		||||
            page2.click('[aria-label="Save"]'),
 | 
			
		||||
            // Wait for Save Banner to appear
 | 
			
		||||
            page2.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Close Page 2, we're done with it.
 | 
			
		||||
        await page2.close();
 | 
			
		||||
 | 
			
		||||
        // Page 1: Click "OK" to create the domain object and wait for navigation.
 | 
			
		||||
        // This will trigger a conflict error upon attempting to update
 | 
			
		||||
        // the composition of the parent folder.
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForLoadState(),
 | 
			
		||||
            page.click('[aria-label="Save"]'),
 | 
			
		||||
            // Wait for Save Banner to appear
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Page 1: Verify that the conflict has occurred and an error notification is displayed.
 | 
			
		||||
        await expect(page.locator('.c-message-banner__message', {
 | 
			
		||||
            hasText: "Conflict detected while saving mine"
 | 
			
		||||
        })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Page 1: Start logging console errors from this point on
 | 
			
		||||
        let errors = [];
 | 
			
		||||
        page.on('console', (msg) => {
 | 
			
		||||
            if (msg.type() === 'error') {
 | 
			
		||||
                errors.push(msg.text());
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Page 1: Try to create a clock with the page that received the conflict.
 | 
			
		||||
        const clockAfterConflict = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Clock'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Page 1: Wait for save progress dialog to appear/disappear
 | 
			
		||||
        await page.locator('.c-message-banner__message', {
 | 
			
		||||
            hasText: 'Do not navigate away from this page or close this browser tab while this message is displayed.',
 | 
			
		||||
            state: 'visible'
 | 
			
		||||
        }).waitFor({ state: 'hidden' });
 | 
			
		||||
 | 
			
		||||
        // Page 1: Navigate to 'My Items' and verify that the second clock was created
 | 
			
		||||
        await page.goto('./#/browse/mine');
 | 
			
		||||
        await expect(page.locator(`.c-grid-item__name[title="${clockAfterConflict.name}"]`)).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Verify no console errors occurred
 | 
			
		||||
        expect(errors).toHaveLength(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Form Correctness by Object Type', () => {
 | 
			
		||||
    test.fixme('Verify correct behavior of number object (SWG)', async ({page}) => {});
 | 
			
		||||
    test.fixme('Verify correct behavior of number object Timer', async ({page}) => {});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -36,7 +36,7 @@ test.describe('Persistence operations @addInit', () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Non-persistable objects should not show persistence related actions', async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        await page.locator('text=Persistence Testing').first().click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -43,48 +43,80 @@ test.describe('Move & link item tests', () => {
 | 
			
		||||
            name: 'Child Folder',
 | 
			
		||||
            parent: parentFolder.uuid
 | 
			
		||||
        });
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
        const grandchildFolder = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
            name: 'Grandchild Folder',
 | 
			
		||||
            parent: childFolder.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Attempt to move parent to its own grandparent
 | 
			
		||||
        await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
 | 
			
		||||
        await page.locator('.c-disclosure-triangle >> nth=0').click();
 | 
			
		||||
        await page.locator('button[title="Show selected item in tree"]').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator(`a:has-text("Parent Folder") >> nth=0`).click({
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        await treePane.getByRole('treeitem', {
 | 
			
		||||
            name: 'Parent Folder'
 | 
			
		||||
        }).click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.locator('li.icon-move').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=0').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
 | 
			
		||||
        await page.getByRole('menuitem', {
 | 
			
		||||
            name: /Move/
 | 
			
		||||
        }).click();
 | 
			
		||||
 | 
			
		||||
        const createModalTree = page.getByRole('tree', {
 | 
			
		||||
            name: "Create Modal Tree"
 | 
			
		||||
        });
 | 
			
		||||
        const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: myItemsFolderName
 | 
			
		||||
        });
 | 
			
		||||
        await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await myItemsLocatorTreeItem.click();
 | 
			
		||||
 | 
			
		||||
        const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: parentFolder.name
 | 
			
		||||
        });
 | 
			
		||||
        await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await parentFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=1').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Child Folder').click();
 | 
			
		||||
 | 
			
		||||
        const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(childFolder.name)
 | 
			
		||||
        });
 | 
			
		||||
        await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await childFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=2').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Grandchild Folder').click();
 | 
			
		||||
 | 
			
		||||
        const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: grandchildFolder.name
 | 
			
		||||
        });
 | 
			
		||||
        await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await grandchildFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
 | 
			
		||||
 | 
			
		||||
        await parentFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('[aria-label="Cancel"]').click();
 | 
			
		||||
 | 
			
		||||
        // Move Child Folder from Parent Folder to My Items
 | 
			
		||||
        await page.locator('.c-disclosure-triangle >> nth=0').click();
 | 
			
		||||
        await page.locator('.c-disclosure-triangle >> nth=1').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator(`a:has-text("Child Folder") >> nth=0`).click({
 | 
			
		||||
        await treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(childFolder.name)
 | 
			
		||||
        }).click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
        });
 | 
			
		||||
        await page.locator('li.icon-move').click();
 | 
			
		||||
        await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
 | 
			
		||||
        await page.getByRole('menuitem', {
 | 
			
		||||
            name: /Move/
 | 
			
		||||
        }).click();
 | 
			
		||||
        await myItemsLocatorTreeItem.click();
 | 
			
		||||
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        await page.locator('[aria-label="Save"]').click();
 | 
			
		||||
        const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: myItemsFolderName
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Expect that Child Folder is in My Items, the root folder
 | 
			
		||||
        expect(page.locator(`text=${myItemsFolderName} >> nth=0:has(text=Child Folder)`)).toBeTruthy();
 | 
			
		||||
        expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
 | 
			
		||||
    });
 | 
			
		||||
    test('Create a basic object and verify that it cannot be moved to telemetry object without Composition Provider', async ({ page, openmctConfig }) => {
 | 
			
		||||
        const { myItemsFolderName } = openmctConfig;
 | 
			
		||||
@@ -95,11 +127,11 @@ test.describe('Move & link item tests', () => {
 | 
			
		||||
        // Create Telemetry Table
 | 
			
		||||
        let telemetryTable = 'Test Telemetry Table';
 | 
			
		||||
        await page.locator('button:has-text("Create")').click();
 | 
			
		||||
        await page.locator('li:has-text("Telemetry Table")').click();
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Telemetry Table")').click();
 | 
			
		||||
        await page.locator('text=Properties Title Notes >> input[type="text"]').click();
 | 
			
		||||
        await page.locator('text=Properties Title Notes >> input[type="text"]').fill(telemetryTable);
 | 
			
		||||
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        // Finish editing and save Telemetry Table
 | 
			
		||||
        await page.locator('.c-button--menu.c-button--major.icon-save').click();
 | 
			
		||||
@@ -108,19 +140,19 @@ test.describe('Move & link item tests', () => {
 | 
			
		||||
        // Create New Folder Basic Domain Object
 | 
			
		||||
        let folder = 'Test Folder';
 | 
			
		||||
        await page.locator('button:has-text("Create")').click();
 | 
			
		||||
        await page.locator('li:has-text("Folder")').click();
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Folder")').click();
 | 
			
		||||
        await page.locator('text=Properties Title Notes >> input[type="text"]').click();
 | 
			
		||||
        await page.locator('text=Properties Title Notes >> input[type="text"]').fill(folder);
 | 
			
		||||
 | 
			
		||||
        // See if it's possible to put the folder in the Telemetry object during creation (Soft Assert)
 | 
			
		||||
        await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
 | 
			
		||||
        let okButton = await page.locator('button.c-button.c-button--major:has-text("OK")');
 | 
			
		||||
        let okButton = page.locator('button.c-button.c-button--major:has-text("OK")');
 | 
			
		||||
        let okButtonStateDisabled = await okButton.isDisabled();
 | 
			
		||||
        expect.soft(okButtonStateDisabled).toBeTruthy();
 | 
			
		||||
 | 
			
		||||
        // Continue test regardless of assertion and create it in My Items
 | 
			
		||||
        await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        // Open My Items
 | 
			
		||||
        await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
 | 
			
		||||
@@ -138,7 +170,7 @@ test.describe('Move & link item tests', () => {
 | 
			
		||||
        // See if it's possible to put the folder in the Telemetry object after creation
 | 
			
		||||
        await page.locator(`text=Location Open MCT ${myItemsFolderName} >> span`).nth(3).click();
 | 
			
		||||
        await page.locator(`form[name="mctForm"] >> text=${telemetryTable}`).click();
 | 
			
		||||
        let okButton2 = await page.locator('button.c-button.c-button--major:has-text("OK")');
 | 
			
		||||
        let okButton2 = page.locator('button.c-button.c-button--major:has-text("OK")');
 | 
			
		||||
        let okButtonStateDisabled2 = await okButton2.isDisabled();
 | 
			
		||||
        expect(okButtonStateDisabled2).toBeTruthy();
 | 
			
		||||
    });
 | 
			
		||||
@@ -158,48 +190,80 @@ test.describe('Move & link item tests', () => {
 | 
			
		||||
            name: 'Child Folder',
 | 
			
		||||
            parent: parentFolder.uuid
 | 
			
		||||
        });
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
        const grandchildFolder = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Folder',
 | 
			
		||||
            name: 'Grandchild Folder',
 | 
			
		||||
            parent: childFolder.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Attempt to link parent to its own grandparent
 | 
			
		||||
        await page.locator(`text=Open MCT ${myItemsFolderName} >> span`).nth(3).click();
 | 
			
		||||
        await page.locator('.c-disclosure-triangle >> nth=0').click();
 | 
			
		||||
        // Attempt to move parent to its own grandparent
 | 
			
		||||
        await page.locator('button[title="Show selected item in tree"]').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator(`a:has-text("Parent Folder") >> nth=0`).click({
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        await treePane.getByRole('treeitem', {
 | 
			
		||||
            name: 'Parent Folder'
 | 
			
		||||
        }).click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.locator('li.icon-link').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=0').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
 | 
			
		||||
        await page.getByRole('menuitem', {
 | 
			
		||||
            name: /Move/
 | 
			
		||||
        }).click();
 | 
			
		||||
 | 
			
		||||
        const createModalTree = page.getByRole('tree', {
 | 
			
		||||
            name: "Create Modal Tree"
 | 
			
		||||
        });
 | 
			
		||||
        const myItemsLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: myItemsFolderName
 | 
			
		||||
        });
 | 
			
		||||
        await myItemsLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await myItemsLocatorTreeItem.click();
 | 
			
		||||
 | 
			
		||||
        const parentFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: parentFolder.name
 | 
			
		||||
        });
 | 
			
		||||
        await parentFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await parentFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=1').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Child Folder').click();
 | 
			
		||||
 | 
			
		||||
        const childFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(childFolder.name)
 | 
			
		||||
        });
 | 
			
		||||
        await childFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await childFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> .c-disclosure-triangle >> nth=2').click();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Grandchild Folder').click();
 | 
			
		||||
 | 
			
		||||
        const grandchildFolderLocatorTreeItem = createModalTree.getByRole('treeitem', {
 | 
			
		||||
            name: grandchildFolder.name
 | 
			
		||||
        });
 | 
			
		||||
        await grandchildFolderLocatorTreeItem.locator('.c-disclosure-triangle').click();
 | 
			
		||||
        await grandchildFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('form[name="mctForm"] >> text=Parent Folder').click();
 | 
			
		||||
 | 
			
		||||
        await parentFolderLocatorTreeItem.click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Save"]')).toBeDisabled();
 | 
			
		||||
        await page.locator('[aria-label="Cancel"]').click();
 | 
			
		||||
 | 
			
		||||
        // Link Child Folder from Parent Folder to My Items
 | 
			
		||||
        await page.locator('.c-disclosure-triangle >> nth=0').click();
 | 
			
		||||
        await page.locator('.c-disclosure-triangle >> nth=1').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator(`a:has-text("Child Folder") >> nth=0`).click({
 | 
			
		||||
        // Move Child Folder from Parent Folder to My Items
 | 
			
		||||
        await treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(childFolder.name)
 | 
			
		||||
        }).click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
        });
 | 
			
		||||
        await page.locator('li.icon-link').click();
 | 
			
		||||
        await page.locator(`form[name="mctForm"] >> text=${myItemsFolderName}`).click();
 | 
			
		||||
        await page.getByRole('menuitem', {
 | 
			
		||||
            name: /Link/
 | 
			
		||||
        }).click();
 | 
			
		||||
        await myItemsLocatorTreeItem.click();
 | 
			
		||||
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        await page.locator('[aria-label="Save"]').click();
 | 
			
		||||
        const myItemsPaneTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: myItemsFolderName
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Expect that Child Folder is in My Items, the root folder
 | 
			
		||||
        expect(page.locator(`text=${myItemsFolderName} >> nth=0:has(text=Child Folder)`)).toBeTruthy();
 | 
			
		||||
        expect(myItemsPaneTreeItem.locator('nth=0:has(text=Child Folder)')).toBeTruthy();
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										112
									
								
								e2e/tests/functional/notification.e2e.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,112 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This test suite is dedicated to tests which verify Open MCT's Notification functionality
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { createDomainObjectWithDefaults, createNotification } = require('../../appActions');
 | 
			
		||||
const { test, expect } = require('../../pluginFixtures');
 | 
			
		||||
 | 
			
		||||
test.describe('Notifications List', () => {
 | 
			
		||||
    test('Notifications can be dismissed individually', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/6122'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create an error notification with the message "Error message"
 | 
			
		||||
        await createNotification(page, {
 | 
			
		||||
            severity: 'error',
 | 
			
		||||
            message: 'Error message'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Create an alert notification with the message "Alert message"
 | 
			
		||||
        await createNotification(page, {
 | 
			
		||||
            severity: 'alert',
 | 
			
		||||
            message: 'Alert message'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Verify that there is a button with aria-label "Review 2 Notifications"
 | 
			
		||||
        expect(await page.locator('button[aria-label="Review 2 Notifications"]').count()).toBe(1);
 | 
			
		||||
 | 
			
		||||
        // Click on button with aria-label "Review 2 Notifications"
 | 
			
		||||
        await page.click('button[aria-label="Review 2 Notifications"]');
 | 
			
		||||
 | 
			
		||||
        // Click on button with aria-label="Dismiss notification of Error message"
 | 
			
		||||
        await page.click('button[aria-label="Dismiss notification of Error message"]');
 | 
			
		||||
 | 
			
		||||
        // Verify there is no a notification (listitem) with the text "Error message" since it was dismissed
 | 
			
		||||
        expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).not.toContain('Error message');
 | 
			
		||||
 | 
			
		||||
        // Verify there is still a notification (listitem) with the text "Alert message"
 | 
			
		||||
        expect(await page.locator('div[role="dialog"] div[role="listitem"]').innerText()).toContain('Alert message');
 | 
			
		||||
 | 
			
		||||
        // Click on button with aria-label="Dismiss notification of Alert message"
 | 
			
		||||
        await page.click('button[aria-label="Dismiss notification of Alert message"]');
 | 
			
		||||
 | 
			
		||||
        // Verify that there is no dialog since the notification overlay was closed automatically after all notifications were dismissed
 | 
			
		||||
        expect(await page.locator('div[role="dialog"]').count()).toBe(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Notification Overlay', () => {
 | 
			
		||||
    test('Closing notification list after notification banner disappeared does not cause it to open automatically', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/6130'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create a new Display Layout object
 | 
			
		||||
        await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
 | 
			
		||||
 | 
			
		||||
        // Click on the button "Review 1 Notification"
 | 
			
		||||
        await page.click('button[aria-label="Review 1 Notification"]');
 | 
			
		||||
 | 
			
		||||
        // Verify that Notification List is open
 | 
			
		||||
        expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
 | 
			
		||||
 | 
			
		||||
        // Wait until there is no Notification Banner
 | 
			
		||||
        await page.waitForSelector('div[role="alert"]', { state: 'detached'});
 | 
			
		||||
 | 
			
		||||
        // Click on the "Close" button of the Notification List
 | 
			
		||||
        await page.click('button[aria-label="Close"]');
 | 
			
		||||
 | 
			
		||||
        // On the Display Layout object, click on the "Edit" button
 | 
			
		||||
        await page.click('button[title="Edit"]');
 | 
			
		||||
 | 
			
		||||
        // Click on the "Save" button
 | 
			
		||||
        await page.click('button[title="Save"]');
 | 
			
		||||
 | 
			
		||||
        // Click on the "Save and Finish Editing" option
 | 
			
		||||
        await page.click('li[title="Save and Finish Editing"]');
 | 
			
		||||
 | 
			
		||||
        // Verify that Notification List is NOT open
 | 
			
		||||
        expect(await page.locator('div[role="dialog"]').isVisible()).toBe(false);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										85
									
								
								e2e/tests/functional/planning/ganttChart.e2e.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,85 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
const { test, expect } = require('../../../pluginFixtures');
 | 
			
		||||
const { createPlanFromJSON, createDomainObjectWithDefaults, selectInspectorTab } = require('../../../appActions');
 | 
			
		||||
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
 | 
			
		||||
const testPlan2 = require('../../../test-data/examplePlans/ExamplePlan_Small2.json');
 | 
			
		||||
const { assertPlanActivities, setBoundsToSpanAllActivities } = require('../../../helper/planningUtils');
 | 
			
		||||
const { getPreciseDuration } = require('../../../../src/utils/duration');
 | 
			
		||||
 | 
			
		||||
test.describe("Gantt Chart", () => {
 | 
			
		||||
    let ganttChart;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        ganttChart = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Gantt Chart'
 | 
			
		||||
        });
 | 
			
		||||
        await createPlanFromJSON(page, {
 | 
			
		||||
            json: testPlan1,
 | 
			
		||||
            parent: ganttChart.uuid
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test("Displays all plan events", async ({ page }) => {
 | 
			
		||||
        await page.goto(ganttChart.url);
 | 
			
		||||
 | 
			
		||||
        await assertPlanActivities(page, testPlan1, ganttChart.url);
 | 
			
		||||
    });
 | 
			
		||||
    test("Replaces a plan with a new plan", async ({ page }) => {
 | 
			
		||||
        await assertPlanActivities(page, testPlan1, ganttChart.url);
 | 
			
		||||
        await createPlanFromJSON(page, {
 | 
			
		||||
            json: testPlan2,
 | 
			
		||||
            parent: ganttChart.uuid
 | 
			
		||||
        });
 | 
			
		||||
        const replaceModal = page.getByRole('dialog').filter({ hasText: "This action will replace the current Plan. Do you want to continue?" });
 | 
			
		||||
        await expect(replaceModal).toBeVisible();
 | 
			
		||||
        await page.getByRole('button', { name: 'OK' }).click();
 | 
			
		||||
 | 
			
		||||
        await assertPlanActivities(page, testPlan2, ganttChart.url);
 | 
			
		||||
    });
 | 
			
		||||
    test("Can select a single activity and display its details in the inspector", async ({ page }) => {
 | 
			
		||||
        test.slow();
 | 
			
		||||
        await page.goto(ganttChart.url);
 | 
			
		||||
 | 
			
		||||
        await setBoundsToSpanAllActivities(page, testPlan1, ganttChart.url);
 | 
			
		||||
 | 
			
		||||
        const activities = Object.values(testPlan1).flat();
 | 
			
		||||
        const activity = activities[0];
 | 
			
		||||
        await page.locator('g').filter({ hasText: new RegExp(activity.name) }).click();
 | 
			
		||||
        await selectInspectorTab(page, 'Activity');
 | 
			
		||||
 | 
			
		||||
        const startDateTime = await page.locator('.c-inspect-properties__label:has-text("Start DateTime")+.c-inspect-properties__value').innerText();
 | 
			
		||||
        const endDateTime = await page.locator('.c-inspect-properties__label:has-text("End DateTime")+.c-inspect-properties__value').innerText();
 | 
			
		||||
        const duration = await page.locator('.c-inspect-properties__label:has-text("duration")+.c-inspect-properties__value').innerText();
 | 
			
		||||
 | 
			
		||||
        const expectedStartDate = new Date(activity.start).toISOString();
 | 
			
		||||
        const actualStartDate = new Date(startDateTime).toISOString();
 | 
			
		||||
        const expectedEndDate = new Date(activity.end).toISOString();
 | 
			
		||||
        const actualEndDate = new Date(endDateTime).toISOString();
 | 
			
		||||
        const expectedDuration = getPreciseDuration(activity.end - activity.start);
 | 
			
		||||
        const actualDuration = duration;
 | 
			
		||||
 | 
			
		||||
        expect(expectedStartDate).toEqual(actualStartDate);
 | 
			
		||||
        expect(expectedEndDate).toEqual(actualEndDate);
 | 
			
		||||
        expect(expectedDuration).toEqual(actualDuration);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -19,69 +19,21 @@
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
const { test, expect } = require('../../../pluginFixtures');
 | 
			
		||||
const { test } = require('../../../pluginFixtures');
 | 
			
		||||
const { createPlanFromJSON } = require('../../../appActions');
 | 
			
		||||
 | 
			
		||||
const testPlan = {
 | 
			
		||||
    "TEST_GROUP": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Past event 1",
 | 
			
		||||
            "start": 1660320408000,
 | 
			
		||||
            "end": 1660343797000,
 | 
			
		||||
            "type": "TEST-GROUP",
 | 
			
		||||
            "color": "orange",
 | 
			
		||||
            "textColor": "white"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Past event 2",
 | 
			
		||||
            "start": 1660406808000,
 | 
			
		||||
            "end": 1660429160000,
 | 
			
		||||
            "type": "TEST-GROUP",
 | 
			
		||||
            "color": "orange",
 | 
			
		||||
            "textColor": "white"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Past event 3",
 | 
			
		||||
            "start": 1660493208000,
 | 
			
		||||
            "end": 1660503981000,
 | 
			
		||||
            "type": "TEST-GROUP",
 | 
			
		||||
            "color": "orange",
 | 
			
		||||
            "textColor": "white"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Past event 4",
 | 
			
		||||
            "start": 1660579608000,
 | 
			
		||||
            "end": 1660624108000,
 | 
			
		||||
            "type": "TEST-GROUP",
 | 
			
		||||
            "color": "orange",
 | 
			
		||||
            "textColor": "white"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "Past event 5",
 | 
			
		||||
            "start": 1660666008000,
 | 
			
		||||
            "end": 1660681529000,
 | 
			
		||||
            "type": "TEST-GROUP",
 | 
			
		||||
            "color": "orange",
 | 
			
		||||
            "textColor": "white"
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
};
 | 
			
		||||
const testPlan1 = require('../../../test-data/examplePlans/ExamplePlan_Small1.json');
 | 
			
		||||
const { assertPlanActivities } = require('../../../helper/planningUtils');
 | 
			
		||||
 | 
			
		||||
test.describe("Plan", () => {
 | 
			
		||||
    test("Create a Plan and display all plan events @unstable", async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
        const plan = await createPlanFromJSON(page, {
 | 
			
		||||
            name: 'Test Plan',
 | 
			
		||||
            json: testPlan
 | 
			
		||||
    let plan;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        plan = await createPlanFromJSON(page, {
 | 
			
		||||
            json: testPlan1
 | 
			
		||||
        });
 | 
			
		||||
        const startBound = testPlan.TEST_GROUP[0].start;
 | 
			
		||||
        const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
        // Switch to fixed time mode with all plan events within the bounds
 | 
			
		||||
        await page.goto(`${plan.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=plan.view`);
 | 
			
		||||
        const eventCount = await page.locator('.activity-bounds').count();
 | 
			
		||||
        expect(eventCount).toEqual(testPlan.TEST_GROUP.length);
 | 
			
		||||
    test("Displays all plan events", async ({ page }) => {
 | 
			
		||||
        await assertPlanActivities(page, testPlan1, plan.url);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -80,7 +80,7 @@ test.describe("Time Strip", () => {
 | 
			
		||||
        const activityBounds = page.locator('.activity-bounds');
 | 
			
		||||
 | 
			
		||||
        // Goto baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        const timestrip = await test.step("Create a Time Strip", async () => {
 | 
			
		||||
            const createdTimeStrip = await createDomainObjectWithDefaults(page, { type: 'Time Strip' });
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -34,7 +34,7 @@ test.describe('Clock Generator CRUD Operations', () => {
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/4878'
 | 
			
		||||
        });
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Click the Create button
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -37,14 +37,14 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
 | 
			
		||||
        //TODO: This needs to be refactored
 | 
			
		||||
        const context = await browser.newContext();
 | 
			
		||||
        const page = await context.newPage();
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        await page.locator('li:has-text("Condition Set")').click();
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Condition Set")').click();
 | 
			
		||||
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation(),
 | 
			
		||||
            page.click('text=OK')
 | 
			
		||||
            page.click('button:has-text("OK")')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        //Save localStorage for future test execution
 | 
			
		||||
@@ -52,10 +52,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
 | 
			
		||||
 | 
			
		||||
        //Set object identifier from url
 | 
			
		||||
        conditionSetUrl = page.url();
 | 
			
		||||
        console.log('conditionSetUrl ' + conditionSetUrl);
 | 
			
		||||
 | 
			
		||||
        getConditionSetIdentifierFromUrl = conditionSetUrl.split('/').pop().split('?')[0];
 | 
			
		||||
        console.debug('getConditionSetIdentifierFromUrl ' + getConditionSetIdentifierFromUrl);
 | 
			
		||||
        console.debug(`getConditionSetIdentifierFromUrl: ${getConditionSetIdentifierFromUrl}`);
 | 
			
		||||
        await page.close();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -98,8 +97,8 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
 | 
			
		||||
        await page.locator('text=Conditions View Snapshot >> button').nth(3).click();
 | 
			
		||||
 | 
			
		||||
        //Edit Condition Set Name from main view
 | 
			
		||||
        await page.locator('text=Unnamed Condition Set').first().fill('Renamed Condition Set');
 | 
			
		||||
        await page.locator('text=Renamed Condition Set').first().press('Enter');
 | 
			
		||||
        await page.locator('.l-browse-bar__object-name').filter({ hasText: 'Unnamed Condition Set' }).first().fill('Renamed Condition Set');
 | 
			
		||||
        await page.locator('.l-browse-bar__object-name').filter({ hasText: 'Renamed Condition Set' }).first().press('Enter');
 | 
			
		||||
        // Click Save Button
 | 
			
		||||
        await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1).click();
 | 
			
		||||
        // Click Save and Finish Editing Option
 | 
			
		||||
@@ -149,7 +148,7 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
 | 
			
		||||
    });
 | 
			
		||||
    test('condition set object can be deleted by Search Tree Actions menu on @localStorage', async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Assertions on loaded Condition Set in main view. This is a stateful transition step after page.goto()
 | 
			
		||||
        await expect(page.locator('a:has-text("Unnamed Condition Set Condition Set") >> nth=0')).toBeVisible();
 | 
			
		||||
@@ -163,9 +162,9 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
 | 
			
		||||
        // Click hamburger button
 | 
			
		||||
        await page.locator('[title="More options"]').click();
 | 
			
		||||
 | 
			
		||||
        // Click text=Remove
 | 
			
		||||
        await page.locator('text=Remove').click();
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        // Click 'Remove' and press OK
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Remove")').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        //Expect Unnamed Condition Set to be removed in Main View
 | 
			
		||||
        const numberOfConditionSetsAtEnd = await page.locator('a:has-text("Unnamed Condition Set Condition Set")').count();
 | 
			
		||||
@@ -181,10 +180,11 @@ test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Basic Condition Set Use', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // Open a browser, navigate to the main page, and wait until all network events to resolve
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    });
 | 
			
		||||
    test('Can add a condition', async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
        // Create a new condition set
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Condition Set',
 | 
			
		||||
@@ -199,4 +199,127 @@ test.describe('Basic Condition Set Use', () => {
 | 
			
		||||
        const numOfUnnamedConditions = await page.locator('text=Unnamed Condition').count();
 | 
			
		||||
        expect(numOfUnnamedConditions).toEqual(1);
 | 
			
		||||
    });
 | 
			
		||||
    test('ConditionSet should display appropriate view options', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5924'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: "Alpha Sine Wave Generator"
 | 
			
		||||
        });
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: "Beta Sine Wave Generator"
 | 
			
		||||
        });
 | 
			
		||||
        const conditionSet1 = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Condition Set',
 | 
			
		||||
            name: "Test Condition Set"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Change the object to edit mode
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.goto(conditionSet1.url);
 | 
			
		||||
        page.click('button[title="Show selected item in tree"]');
 | 
			
		||||
        // Add the Alpha & Beta Sine Wave Generator to the Condition Set and save changes
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const alphaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Alpha Sine Wave Generator"});
 | 
			
		||||
        const betaGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Beta Sine Wave Generator"});
 | 
			
		||||
        const conditionCollection = page.locator('#conditionCollection');
 | 
			
		||||
 | 
			
		||||
        await alphaGeneratorTreeItem.dragTo(conditionCollection);
 | 
			
		||||
        await betaGeneratorTreeItem.dragTo(conditionCollection);
 | 
			
		||||
 | 
			
		||||
        const saveButtonLocator = page.locator('button[title="Save"]');
 | 
			
		||||
        await saveButtonLocator.click();
 | 
			
		||||
        await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
 | 
			
		||||
        await page.click('button[title="Change the current view"]');
 | 
			
		||||
 | 
			
		||||
        await expect(page.getByRole('menuitem', { name: /Lad Table/ })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('menuitem', { name: /Conditions View/ })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('menuitem', { name: /Plot/ })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('menuitem', { name: /Telemetry Table/ })).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
    test('ConditionSet should output blank instead of the default value', async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        //Click the Create button
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        // Click the object specified by 'type'
 | 
			
		||||
        await page.click(`li[role='menuitem']:text("Sine Wave Generator")`);
 | 
			
		||||
        await page.getByRole('spinbutton', { name: 'Loading Delay (ms)' }).fill('8000');
 | 
			
		||||
        const nameInput = page.locator('form[name="mctForm"] .first input[type="text"]');
 | 
			
		||||
        await nameInput.fill("Delayed Sine Wave Generator");
 | 
			
		||||
 | 
			
		||||
        // Click OK button and wait for Navigate event
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForLoadState(),
 | 
			
		||||
            page.click('[aria-label="Save"]'),
 | 
			
		||||
            // Wait for Save Banner to appear
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Create a new condition set
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Condition Set',
 | 
			
		||||
            name: "Test Blank Output of Condition Set"
 | 
			
		||||
        });
 | 
			
		||||
        // Change the object to edit mode
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
 | 
			
		||||
        // Click Add Condition button twice
 | 
			
		||||
        await page.locator('#addCondition').click();
 | 
			
		||||
        await page.locator('#addCondition').click();
 | 
			
		||||
        await page.locator('#conditionCollection').getByRole('textbox').nth(0).fill('First Condition');
 | 
			
		||||
        await page.locator('#conditionCollection').getByRole('textbox').nth(1).fill('Second Condition');
 | 
			
		||||
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Condition Set and save changes
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { name: "Delayed Sine Wave Generator"});
 | 
			
		||||
        const conditionCollection = await page.locator('#conditionCollection');
 | 
			
		||||
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(conditionCollection);
 | 
			
		||||
 | 
			
		||||
        const firstCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=0');
 | 
			
		||||
        firstCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' });
 | 
			
		||||
 | 
			
		||||
        const secondCriterionTelemetry = await page.locator('[aria-label="Criterion Telemetry Selection"] >> nth=1');
 | 
			
		||||
        secondCriterionTelemetry.selectOption({ label: 'Delayed Sine Wave Generator' });
 | 
			
		||||
 | 
			
		||||
        const firstCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=0');
 | 
			
		||||
        firstCriterionMetadata.selectOption({ label: 'Sine' });
 | 
			
		||||
 | 
			
		||||
        const secondCriterionMetadata = await page.locator('[aria-label="Criterion Metadata Selection"] >> nth=1');
 | 
			
		||||
        secondCriterionMetadata.selectOption({ label: 'Sine' });
 | 
			
		||||
 | 
			
		||||
        const firstCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=0');
 | 
			
		||||
        firstCriterionComparison.selectOption({ label: 'is greater than or equal to' });
 | 
			
		||||
 | 
			
		||||
        const secondCriterionComparison = await page.locator('[aria-label="Criterion Comparison Selection"] >> nth=1');
 | 
			
		||||
        secondCriterionComparison.selectOption({ label: 'is less than' });
 | 
			
		||||
 | 
			
		||||
        const firstCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=0');
 | 
			
		||||
        await firstCriterionInput.fill("0");
 | 
			
		||||
 | 
			
		||||
        const secondCriterionInput = await page.locator('[aria-label="Criterion Input"] >> nth=1');
 | 
			
		||||
        await secondCriterionInput.fill("0");
 | 
			
		||||
 | 
			
		||||
        const saveButtonLocator = page.locator('button[title="Save"]');
 | 
			
		||||
        await saveButtonLocator.click();
 | 
			
		||||
        await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
 | 
			
		||||
 | 
			
		||||
        const outputValue = await page.locator('[aria-label="Current Output Value"]');
 | 
			
		||||
        await expect(outputValue).toHaveText('---');
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -23,16 +23,16 @@
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults, setStartOffset, setFixedTimeMode, setRealTimeMode } = require('../../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
test.describe('Display Layout', () => {
 | 
			
		||||
    /** @type {import('../../../../appActions').CreatedObjectInfo} */
 | 
			
		||||
    let sineWaveObject;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        await setRealTimeMode(page);
 | 
			
		||||
 | 
			
		||||
        // Create Sine Wave Generator
 | 
			
		||||
        sineWaveObject = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: "Test Sine Wave Generator"
 | 
			
		||||
            type: 'Sine Wave Generator'
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in real time', async ({ page }) => {
 | 
			
		||||
@@ -47,7 +47,14 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Display Layout and save changes
 | 
			
		||||
        await page.dragAndDrop('text=Test Sine Wave Generator', '.l-layout__grid-holder');
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        const layoutGridHolder = page.locator('.l-layout__grid-holder');
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
 | 
			
		||||
@@ -55,12 +62,12 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        // On getting data, check if the value found in the  Display Layout is the most recent value
 | 
			
		||||
        // from the Sine Wave Generator
 | 
			
		||||
        const getTelemValuePromise = await subscribeToTelemetry(page, sineWaveObject.uuid);
 | 
			
		||||
        const formattedTelemetryValue = await getTelemValuePromise;
 | 
			
		||||
        const formattedTelemetryValue = getTelemValuePromise;
 | 
			
		||||
        const displayLayoutValuePromise = await page.waitForSelector(`text="${formattedTelemetryValue}"`);
 | 
			
		||||
        const displayLayoutValue = await displayLayoutValuePromise.textContent();
 | 
			
		||||
        const trimmedDisplayValue = displayLayoutValue.trim();
 | 
			
		||||
 | 
			
		||||
        await expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
 | 
			
		||||
        expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
 | 
			
		||||
    });
 | 
			
		||||
    test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in fixed time', async ({ page }) => {
 | 
			
		||||
        // Create a Display Layout
 | 
			
		||||
@@ -74,7 +81,14 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Display Layout and save changes
 | 
			
		||||
        await page.dragAndDrop('text=Test Sine Wave Generator', '.l-layout__grid-holder');
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        const layoutGridHolder = page.locator('.l-layout__grid-holder');
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
 | 
			
		||||
@@ -86,12 +100,12 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
 | 
			
		||||
        // On getting data, check if the value found in the Display Layout is the most recent value
 | 
			
		||||
        // from the Sine Wave Generator
 | 
			
		||||
        const formattedTelemetryValue = await getTelemValuePromise;
 | 
			
		||||
        const formattedTelemetryValue = getTelemValuePromise;
 | 
			
		||||
        const displayLayoutValuePromise = await page.waitForSelector(`text="${formattedTelemetryValue}"`);
 | 
			
		||||
        const displayLayoutValue = await displayLayoutValuePromise.textContent();
 | 
			
		||||
        const trimmedDisplayValue = displayLayoutValue.trim();
 | 
			
		||||
 | 
			
		||||
        await expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
 | 
			
		||||
        expect(trimmedDisplayValue).toBe(formattedTelemetryValue);
 | 
			
		||||
    });
 | 
			
		||||
    test('items in a display layout can be removed with object tree context menu when viewing the display layout', async ({ page }) => {
 | 
			
		||||
        // Create a Display Layout
 | 
			
		||||
@@ -105,7 +119,14 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Display Layout and save changes
 | 
			
		||||
        await page.dragAndDrop('text=Test Sine Wave Generator', '.l-layout__grid-holder');
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        const layoutGridHolder = page.locator('.l-layout__grid-holder');
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
 | 
			
		||||
@@ -115,19 +136,22 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
 | 
			
		||||
 | 
			
		||||
        // Bring up context menu and remove
 | 
			
		||||
        await page.locator('.c-tree__item.is-alias .c-tree__item__name:text("Test Sine Wave Generator")').first().click({ button: 'right' });
 | 
			
		||||
        await page.locator('text=Remove').click();
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        await sineWaveGeneratorTreeItem.nth(1).click({ button: 'right' });
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Remove")').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        // delete
 | 
			
		||||
 | 
			
		||||
        expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
 | 
			
		||||
        expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
 | 
			
		||||
    });
 | 
			
		||||
    test('items in a display layout can be removed with object tree context menu when viewing another item', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/3117'
 | 
			
		||||
        });
 | 
			
		||||
        // Create a Display Layout
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Display Layout',
 | 
			
		||||
            name: "Test Display Layout"
 | 
			
		||||
        const displayLayout = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Display Layout'
 | 
			
		||||
        });
 | 
			
		||||
        // Edit Display Layout
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
@@ -135,7 +159,14 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Display Layout and save changes
 | 
			
		||||
        await page.dragAndDrop('text=Test Sine Wave Generator', '.l-layout__grid-holder');
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        const layoutGridHolder = page.locator('.l-layout__grid-holder');
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(layoutGridHolder);
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
 | 
			
		||||
@@ -144,18 +175,18 @@ test.describe('Testing Display Layout @unstable', () => {
 | 
			
		||||
        // Expand the Display Layout so we can remove the sine wave generator
 | 
			
		||||
        await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
 | 
			
		||||
 | 
			
		||||
        // Click the original Sine Wave Generator to navigate away from the Display Layout
 | 
			
		||||
        await page.locator('.c-tree__item .c-tree__item__name:text("Test Sine Wave Generator")').click();
 | 
			
		||||
        // Go to the original Sine Wave Generator to navigate away from the Display Layout
 | 
			
		||||
        await page.goto(sineWaveObject.url);
 | 
			
		||||
 | 
			
		||||
        // Bring up context menu and remove
 | 
			
		||||
        await page.locator('.c-tree__item.is-alias .c-tree__item__name:text("Test Sine Wave Generator")').click({ button: 'right' });
 | 
			
		||||
        await page.locator('text=Remove').click();
 | 
			
		||||
        await page.locator('text=OK').click();
 | 
			
		||||
        await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Remove")').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        // navigate back to the display layout to confirm it has been removed
 | 
			
		||||
        await page.locator('.c-tree__item .c-tree__item__name:text("Test Display Layout")').click();
 | 
			
		||||
        await page.goto(displayLayout.url);
 | 
			
		||||
 | 
			
		||||
        expect.soft(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
 | 
			
		||||
        expect(await page.locator('.l-layout .l-layout__frame').count()).toEqual(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -22,6 +22,7 @@
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const utils = require('../../../../helper/faultUtils');
 | 
			
		||||
const { selectInspectorTab } = require('../../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('The Fault Management Plugin using example faults', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
@@ -38,6 +39,7 @@ test.describe('The Fault Management Plugin using example faults', () => {
 | 
			
		||||
    test('When selecting a fault, it has an "is-selected" class and it\'s information shows in the inspector @unstable', async ({ page }) => {
 | 
			
		||||
        await utils.selectFaultItem(page, 1);
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Fault Management Configuration');
 | 
			
		||||
        const selectedFaultName = await page.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname').textContent();
 | 
			
		||||
        const inspectorFaultNameCount = await page.locator(`.c-inspector__properties >> :text("${selectedFaultName}")`).count();
 | 
			
		||||
 | 
			
		||||
@@ -52,6 +54,7 @@ test.describe('The Fault Management Plugin using example faults', () => {
 | 
			
		||||
        const selectedRows = page.locator('.c-fault-mgmt__list.is-selected .c-fault-mgmt__list-faultname');
 | 
			
		||||
        expect.soft(await selectedRows.count()).toEqual(2);
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Fault Management Configuration');
 | 
			
		||||
        const firstSelectedFaultName = await selectedRows.nth(0).textContent();
 | 
			
		||||
        const secondSelectedFaultName = await selectedRows.nth(1).textContent();
 | 
			
		||||
        const firstNameInInspectorCount = await page.locator(`.c-inspector__properties >> :text("${firstSelectedFaultName}")`).count();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -23,27 +23,35 @@
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('Testing Flexible Layout @unstable', () => {
 | 
			
		||||
test.describe('Flexible Layout', () => {
 | 
			
		||||
    let sineWaveObject;
 | 
			
		||||
    let clockObject;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create Sine Wave Generator
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: "Test Sine Wave Generator"
 | 
			
		||||
        sineWaveObject = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Create Clock Object
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Clock',
 | 
			
		||||
            name: "Test Clock"
 | 
			
		||||
        clockObject = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Clock'
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    test('panes have the appropriate draggable attribute while in Edit and Browse modes', async ({ page }) => {
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        const clockTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(clockObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        // Create a Flexible Layout
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Flexible Layout',
 | 
			
		||||
            name: "Test Flexible Layout"
 | 
			
		||||
            type: 'Flexible Layout'
 | 
			
		||||
        });
 | 
			
		||||
        // Edit Flexible Layout
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
@@ -51,16 +59,95 @@ test.describe('Testing Flexible Layout @unstable', () => {
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
 | 
			
		||||
        // Add the Sine Wave Generator and Clock to the Flexible Layout
 | 
			
		||||
        await page.dragAndDrop('text=Test Sine Wave Generator', '.c-fl__container.is-empty');
 | 
			
		||||
        await page.dragAndDrop('text=Test Clock', '.c-fl__container.is-empty');
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
 | 
			
		||||
        await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty'));
 | 
			
		||||
        // Check that panes can be dragged while Flexible Layout is in Edit mode
 | 
			
		||||
        let dragWrapper = await page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
 | 
			
		||||
        let dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
 | 
			
		||||
        await expect(dragWrapper).toHaveAttribute('draggable', 'true');
 | 
			
		||||
        // Save Flexible Layout
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
        // Check that panes are not draggable while Flexible Layout is in Browse mode
 | 
			
		||||
        dragWrapper = await page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
 | 
			
		||||
        dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first();
 | 
			
		||||
        await expect(dragWrapper).toHaveAttribute('draggable', 'false');
 | 
			
		||||
    });
 | 
			
		||||
    test('items in a flexible layout can be removed with object tree context menu when viewing the flexible layout', async ({ page }) => {
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
        // Create a Display Layout
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Flexible Layout'
 | 
			
		||||
        });
 | 
			
		||||
        // Edit Flexible Layout
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Flexible Layout and save changes
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
 | 
			
		||||
        expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
 | 
			
		||||
 | 
			
		||||
        // Expand the Flexible Layout so we can remove the sine wave generator
 | 
			
		||||
        await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
 | 
			
		||||
 | 
			
		||||
        // Bring up context menu and remove
 | 
			
		||||
        await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Remove")').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        // Verify that the item has been removed from the layout
 | 
			
		||||
        expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
 | 
			
		||||
    });
 | 
			
		||||
    test('items in a flexible layout can be removed with object tree context menu when viewing another item', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/3117'
 | 
			
		||||
        });
 | 
			
		||||
        const treePane = page.getByRole('tree', {
 | 
			
		||||
            name: 'Main Tree'
 | 
			
		||||
        });
 | 
			
		||||
        const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', {
 | 
			
		||||
            name: new RegExp(sineWaveObject.name)
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Create a Flexible Layout
 | 
			
		||||
        const flexibleLayout = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Flexible Layout'
 | 
			
		||||
        });
 | 
			
		||||
        // Edit Flexible Layout
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
 | 
			
		||||
        // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
 | 
			
		||||
        // Add the Sine Wave Generator to the Flexible Layout and save changes
 | 
			
		||||
        await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first());
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
 | 
			
		||||
        expect.soft(await page.locator('.c-fl-container__frame').count()).toEqual(1);
 | 
			
		||||
 | 
			
		||||
        // Expand the Flexible Layout so we can remove the sine wave generator
 | 
			
		||||
        await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click();
 | 
			
		||||
 | 
			
		||||
        // Go to the original Sine Wave Generator to navigate away from the Flexible Layout
 | 
			
		||||
        await page.goto(sineWaveObject.url);
 | 
			
		||||
 | 
			
		||||
        // Bring up context menu and remove
 | 
			
		||||
        await sineWaveGeneratorTreeItem.first().click({ button: 'right' });
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Remove")').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
 | 
			
		||||
        // navigate back to the display layout to confirm it has been removed
 | 
			
		||||
        await page.goto(flexibleLayout.url);
 | 
			
		||||
 | 
			
		||||
        // Verify that the item has been removed from the layout
 | 
			
		||||
        expect(await page.locator('.c-fl-container__frame').count()).toEqual(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										124
									
								
								e2e/tests/functional/plugins/gauge/gauge.e2e.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,124 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
* This test suite is dedicated to testing the Gauge component.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const uuid = require('uuid').v4;
 | 
			
		||||
 | 
			
		||||
test.describe('Gauge', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // Open a browser, navigate to the main page, and wait until all networkevents to resolve
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can add and remove telemetry sources @unstable', async ({ page }) => {
 | 
			
		||||
        // Create the gauge with defaults
 | 
			
		||||
        const gauge = await createDomainObjectWithDefaults(page, { type: 'Gauge' });
 | 
			
		||||
        const editButtonLocator = page.locator('button[title="Edit"]');
 | 
			
		||||
        const saveButtonLocator = page.locator('button[title="Save"]');
 | 
			
		||||
 | 
			
		||||
        // Create a sine wave generator within the gauge
 | 
			
		||||
        const swg1 = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: `swg-${uuid()}`,
 | 
			
		||||
            parent: gauge.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Navigate to the gauge and verify that
 | 
			
		||||
        // the SWG appears in the elements pool
 | 
			
		||||
        await page.goto(gauge.url);
 | 
			
		||||
        await editButtonLocator.click();
 | 
			
		||||
        await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeVisible();
 | 
			
		||||
        await saveButtonLocator.click();
 | 
			
		||||
        await page.locator('li[title="Save and Finish Editing"]').click();
 | 
			
		||||
 | 
			
		||||
        // Create another sine wave generator within the gauge
 | 
			
		||||
        const swg2 = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: `swg-${uuid()}`,
 | 
			
		||||
            parent: gauge.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Verify that the 'Replace telemetry source' modal appears and accept it
 | 
			
		||||
        await expect.soft(page.locator('text=This action will replace the current telemetry source. Do you want to continue?')).toBeVisible();
 | 
			
		||||
        await page.click('text=Ok');
 | 
			
		||||
 | 
			
		||||
        // Navigate to the gauge and verify that the new SWG
 | 
			
		||||
        // appears in the elements pool and the old one is gone
 | 
			
		||||
        await page.goto(gauge.url);
 | 
			
		||||
        await editButtonLocator.click();
 | 
			
		||||
        await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg1.name}`)).toBeHidden();
 | 
			
		||||
        await expect.soft(page.locator(`#inspector-elements-tree >> text=${swg2.name}`)).toBeVisible();
 | 
			
		||||
        await saveButtonLocator.click();
 | 
			
		||||
 | 
			
		||||
        // Right click on the new SWG in the elements pool and delete it
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swg2.name}`).click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
        });
 | 
			
		||||
        await page.locator('li[title="Remove this object from its containing object."]').click();
 | 
			
		||||
 | 
			
		||||
        // Verify that the 'Remove object' confirmation modal appears and accept it
 | 
			
		||||
        await expect.soft(page.locator('text=Warning! This action will remove this object. Are you sure you want to continue?')).toBeVisible();
 | 
			
		||||
        await page.click('text=Ok');
 | 
			
		||||
 | 
			
		||||
        // Verify that the elements pool shows no elements
 | 
			
		||||
        await expect(page.locator('text="No contained elements"')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
    test('Can create a non-default Gauge', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5356'
 | 
			
		||||
        });
 | 
			
		||||
        //Click the Create button
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        // Click the object specified by 'type'
 | 
			
		||||
        await page.click(`li[role='menuitem']:text("Gauge")`);
 | 
			
		||||
        // FIXME: We need better selectors for these custom form controls
 | 
			
		||||
        const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
 | 
			
		||||
        await displayCurrentValueSwitch.setChecked(false);
 | 
			
		||||
        await page.click('button[aria-label="Save"]');
 | 
			
		||||
 | 
			
		||||
        // TODO: Verify changes in the UI
 | 
			
		||||
    });
 | 
			
		||||
    test('Can edit a single Gauge-specific property', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5985'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Create the gauge with defaults
 | 
			
		||||
        await createDomainObjectWithDefaults(page, { type: 'Gauge' });
 | 
			
		||||
        await page.click('button[title="More options"]');
 | 
			
		||||
        await page.click('li[role="menuitem"]:has-text("Edit Properties")');
 | 
			
		||||
        // FIXME: We need better selectors for these custom form controls
 | 
			
		||||
        const displayCurrentValueSwitch = page.locator('.c-toggle-switch__slider >> nth=0');
 | 
			
		||||
        await displayCurrentValueSwitch.setChecked(false);
 | 
			
		||||
        await page.click('button[aria-label="Save"]');
 | 
			
		||||
 | 
			
		||||
        // TODO: Verify changes in the UI
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -25,25 +25,25 @@ This test suite is dedicated to tests which verify the basic operations surround
 | 
			
		||||
but only assume that example imagery is present.
 | 
			
		||||
*/
 | 
			
		||||
/* globals process */
 | 
			
		||||
const { v4: uuid } = require('uuid');
 | 
			
		||||
const { waitForAnimations } = require('../../../../baseFixtures');
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const backgroundImageSelector = '.c-imagery__main-image__background-image';
 | 
			
		||||
const panHotkey = process.platform === 'linux' ? ['Control', 'Alt'] : ['Alt'];
 | 
			
		||||
const expectedAltText = process.platform === 'linux' ? 'Ctrl+Alt drag to pan' : 'Alt drag to pan';
 | 
			
		||||
const panHotkey = process.platform === 'linux' ? ['Shift', 'Alt'] : ['Alt'];
 | 
			
		||||
const expectedAltText = process.platform === 'linux' ? 'Shift+Alt drag to pan' : 'Alt drag to pan';
 | 
			
		||||
const thumbnailUrlParamsRegexp = /\?w=100&h=100/;
 | 
			
		||||
 | 
			
		||||
//The following block of tests verifies the basic functionality of example imagery and serves as a template for Imagery objects embedded in other objects.
 | 
			
		||||
test.describe('Example Imagery Object', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create a default 'Example Imagery' object
 | 
			
		||||
        await createDomainObjectWithDefaults(page, { type: 'Example Imagery' });
 | 
			
		||||
        const exampleImagery = await createDomainObjectWithDefaults(page, { type: 'Example Imagery' });
 | 
			
		||||
 | 
			
		||||
        // Verify that the created object is focused
 | 
			
		||||
        await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Example Imagery');
 | 
			
		||||
        await expect(page.locator('.l-browse-bar__object-name')).toContainText(exampleImagery.name);
 | 
			
		||||
        await page.locator(backgroundImageSelector).hover({trial: true});
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -178,7 +178,7 @@ test.describe('Example Imagery in Display Layout', () => {
 | 
			
		||||
    let displayLayout;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        displayLayout = await createDomainObjectWithDefaults(page, { type: 'Display Layout' });
 | 
			
		||||
        await page.goto(displayLayout.url);
 | 
			
		||||
@@ -188,7 +188,7 @@ test.describe('Example Imagery in Display Layout', () => {
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        // Click text=Example Imagery
 | 
			
		||||
        await page.click('text=Example Imagery');
 | 
			
		||||
        await page.click('li[role="menuitem"]:has-text("Example Imagery")');
 | 
			
		||||
 | 
			
		||||
        // Clear and set Image load delay to minimum value
 | 
			
		||||
        await page.locator('input[type="number"]').fill('');
 | 
			
		||||
@@ -197,7 +197,7 @@ test.describe('Example Imagery in Display Layout', () => {
 | 
			
		||||
        // Click text=OK
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation({waitUntil: 'networkidle'}),
 | 
			
		||||
            page.click('text=OK'),
 | 
			
		||||
            page.click('button:has-text("OK")'),
 | 
			
		||||
            //Wait for Save Banner to appear
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
@@ -207,6 +207,58 @@ test.describe('Example Imagery in Display Layout', () => {
 | 
			
		||||
        await page.goto(displayLayout.url);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('View Large action pauses imagery when in realtime and returns to realtime', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/3647'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Click time conductor mode button
 | 
			
		||||
        await page.locator('.c-mode-button').click();
 | 
			
		||||
 | 
			
		||||
        // set realtime mode
 | 
			
		||||
        await page.locator('[data-testid="conductor-modeOption-realtime"]').click();
 | 
			
		||||
 | 
			
		||||
        // pause/play button
 | 
			
		||||
        const pausePlayButton = await page.locator('.c-button.pause-play');
 | 
			
		||||
 | 
			
		||||
        await expect.soft(pausePlayButton).not.toHaveClass(/is-paused/);
 | 
			
		||||
 | 
			
		||||
        // Open context menu and click view large menu item
 | 
			
		||||
        await page.locator('button[title="View menu items"]').click();
 | 
			
		||||
        await page.locator('li[title="View Large"]').click();
 | 
			
		||||
        await expect(pausePlayButton).toHaveClass(/is-paused/);
 | 
			
		||||
 | 
			
		||||
        await page.locator('[aria-label="Close"]').click();
 | 
			
		||||
        await expect.soft(pausePlayButton).not.toHaveClass(/is-paused/);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('View Large action leaves keeps realtime mode paused', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/3647'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Click time conductor mode button
 | 
			
		||||
        await page.locator('.c-mode-button').click();
 | 
			
		||||
 | 
			
		||||
        // set realtime mode
 | 
			
		||||
        await page.locator('[data-testid="conductor-modeOption-realtime"]').click();
 | 
			
		||||
 | 
			
		||||
        // pause/play button
 | 
			
		||||
        const pausePlayButton = await page.locator('.c-button.pause-play');
 | 
			
		||||
        await pausePlayButton.click();
 | 
			
		||||
        await expect.soft(pausePlayButton).toHaveClass(/is-paused/);
 | 
			
		||||
 | 
			
		||||
        // Open context menu and click view large menu item
 | 
			
		||||
        await page.locator('button[title="View menu items"]').click();
 | 
			
		||||
        await page.locator('li[title="View Large"]').click();
 | 
			
		||||
        await expect(pausePlayButton).toHaveClass(/is-paused/);
 | 
			
		||||
 | 
			
		||||
        await page.locator('[aria-label="Close"]').click();
 | 
			
		||||
        await expect.soft(pausePlayButton).toHaveClass(/is-paused/);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Imagery View operations @unstable', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
@@ -265,7 +317,7 @@ test.describe('Example Imagery in Display Layout', () => {
 | 
			
		||||
test.describe('Example Imagery in Flexible layout', () => {
 | 
			
		||||
    let flexibleLayout;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        flexibleLayout = await createDomainObjectWithDefaults(page, { type: 'Flexible Layout' });
 | 
			
		||||
        await page.goto(flexibleLayout.url);
 | 
			
		||||
@@ -275,7 +327,7 @@ test.describe('Example Imagery in Flexible layout', () => {
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        // Click text=Example Imagery
 | 
			
		||||
        await page.click('text=Example Imagery');
 | 
			
		||||
        await page.click('li[role="menuitem"]:has-text("Example Imagery")');
 | 
			
		||||
 | 
			
		||||
        // Clear and set Image load delay to minimum value
 | 
			
		||||
        await page.locator('input[type="number"]').fill('');
 | 
			
		||||
@@ -284,7 +336,7 @@ test.describe('Example Imagery in Flexible layout', () => {
 | 
			
		||||
        // Click text=OK
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation({waitUntil: 'networkidle'}),
 | 
			
		||||
            page.click('text=OK'),
 | 
			
		||||
            page.click('button:has-text("OK")'),
 | 
			
		||||
            //Wait for Save Banner to appear
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
@@ -307,7 +359,7 @@ test.describe('Example Imagery in Flexible layout', () => {
 | 
			
		||||
test.describe('Example Imagery in Tabs View', () => {
 | 
			
		||||
    let tabsView;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        tabsView = await createDomainObjectWithDefaults(page, { type: 'Tabs View' });
 | 
			
		||||
        await page.goto(tabsView.url);
 | 
			
		||||
@@ -317,7 +369,7 @@ test.describe('Example Imagery in Tabs View', () => {
 | 
			
		||||
        await page.click('button:has-text("Create")');
 | 
			
		||||
 | 
			
		||||
        // Click text=Example Imagery
 | 
			
		||||
        await page.click('text=Example Imagery');
 | 
			
		||||
        await page.click('li[role="menuitem"]:has-text("Example Imagery")');
 | 
			
		||||
 | 
			
		||||
        // Clear and set Image load delay to minimum value
 | 
			
		||||
        await page.locator('input[type="number"]').fill('');
 | 
			
		||||
@@ -326,7 +378,7 @@ test.describe('Example Imagery in Tabs View', () => {
 | 
			
		||||
        // Click text=OK
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation({waitUntil: 'networkidle'}),
 | 
			
		||||
            page.click('text=OK'),
 | 
			
		||||
            page.click('button:has-text("OK")'),
 | 
			
		||||
            //Wait for Save Banner to appear
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
@@ -343,15 +395,13 @@ test.describe('Example Imagery in Tabs View', () => {
 | 
			
		||||
test.describe('Example Imagery in Time Strip', () => {
 | 
			
		||||
    let timeStripObject;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        timeStripObject = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Time Strip',
 | 
			
		||||
            name: 'Time Strip'.concat(' ', uuid())
 | 
			
		||||
            type: 'Time Strip'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Example Imagery',
 | 
			
		||||
            name: 'Example Imagery'.concat(' ', uuid()),
 | 
			
		||||
            parent: timeStripObject.uuid
 | 
			
		||||
        });
 | 
			
		||||
        // Navigate to timestrip
 | 
			
		||||
@@ -362,17 +412,28 @@ test.describe('Example Imagery in Time Strip', () => {
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5632'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Hover over the timestrip to reveal a thumbnail image
 | 
			
		||||
        await page.locator('.c-imagery-tsv-container').hover();
 | 
			
		||||
        // get url of the hovered image
 | 
			
		||||
        const hoveredImg = page.locator('.c-imagery-tsv div.c-imagery-tsv__image-wrapper:hover img');
 | 
			
		||||
        const hoveredImgSrc = await hoveredImg.getAttribute('src');
 | 
			
		||||
        expect(hoveredImgSrc).toBeTruthy();
 | 
			
		||||
 | 
			
		||||
        // Get the img src of the hovered image thumbnail
 | 
			
		||||
        const hoveredThumbnailImg = page.locator('.c-imagery-tsv div.c-imagery-tsv__image-wrapper:hover img');
 | 
			
		||||
        const hoveredThumbnailImgSrc = await hoveredThumbnailImg.getAttribute('src');
 | 
			
		||||
 | 
			
		||||
        // Verify that imagery timestrip view uses the thumbnailUrl as img src for thumbnails
 | 
			
		||||
        expect(hoveredThumbnailImgSrc).toBeTruthy();
 | 
			
		||||
        expect(hoveredThumbnailImgSrc).toMatch(thumbnailUrlParamsRegexp);
 | 
			
		||||
 | 
			
		||||
        // Click on the hovered thumbnail to open "View Large" view
 | 
			
		||||
        await page.locator('.c-imagery-tsv-container').click();
 | 
			
		||||
        // get image of view large container
 | 
			
		||||
 | 
			
		||||
        // Get the img src of the large view image
 | 
			
		||||
        const viewLargeImg = page.locator('img.c-imagery__main-image__image');
 | 
			
		||||
        const viewLargeImgSrc = await viewLargeImg.getAttribute('src');
 | 
			
		||||
        expect(viewLargeImgSrc).toBeTruthy();
 | 
			
		||||
        expect(viewLargeImgSrc).toEqual(hoveredImgSrc);
 | 
			
		||||
 | 
			
		||||
        // Verify that the image in the large view is the same as the hovered thumbnail
 | 
			
		||||
        expect(viewLargeImgSrc).toEqual(hoveredThumbnailImgSrc.split('?')[0]);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -389,6 +450,12 @@ test.describe('Example Imagery in Time Strip', () => {
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function performImageryViewOperationsAndAssert(page) {
 | 
			
		||||
    // Verify that imagery thumbnails use a thumbnail url
 | 
			
		||||
    const thumbnailImages = page.locator('.c-thumb__image');
 | 
			
		||||
    const mainImage = page.locator('.c-imagery__main-image__image');
 | 
			
		||||
    await expect(thumbnailImages.first()).toHaveAttribute('src', thumbnailUrlParamsRegexp);
 | 
			
		||||
    await expect(mainImage).not.toHaveAttribute('src', thumbnailUrlParamsRegexp);
 | 
			
		||||
 | 
			
		||||
    // Click previous image button
 | 
			
		||||
    const previousImageButton = page.locator('.c-nav--prev');
 | 
			
		||||
    await previousImageButton.click();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -21,12 +21,125 @@
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults, setStartOffset, setFixedTimeMode, setRealTimeMode } = require('../../../../appActions');
 | 
			
		||||
const { createDomainObjectWithDefaults, setStartOffset, setFixedTimeMode, setRealTimeMode, selectInspectorTab } = require('../../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('Testing LAD table configuration', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create LAD table
 | 
			
		||||
        const ladTable = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'LAD Table',
 | 
			
		||||
            name: "Test LAD Table"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Create Sine Wave Generator
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Sine Wave Generator',
 | 
			
		||||
            name: "Test Sine Wave Generator",
 | 
			
		||||
            parent: ladTable.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto(ladTable.url);
 | 
			
		||||
    });
 | 
			
		||||
    test('in edit mode, LAD Tables provide ability to hide columns', async ({ page }) => {
 | 
			
		||||
        // Edit LAD table
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
 | 
			
		||||
        // // Expand the 'My Items' folder in the left tree
 | 
			
		||||
        // await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click();
 | 
			
		||||
        // // Add the Sine Wave Generator to the LAD table and save changes
 | 
			
		||||
        // await page.dragAndDrop('role=treeitem[name=/Test Sine Wave Generator/]', '.c-lad-table-wrapper');
 | 
			
		||||
        // select configuration tab in inspector
 | 
			
		||||
        await selectInspectorTab(page, 'LAD Table Configuration');
 | 
			
		||||
 | 
			
		||||
        // make sure headers are visible initially
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // hide timestamp column
 | 
			
		||||
        await page.getByLabel('Timestamp').uncheck();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // hide units & type column
 | 
			
		||||
        await page.getByLabel('Units').uncheck();
 | 
			
		||||
        await page.getByLabel('Type').uncheck();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
 | 
			
		||||
 | 
			
		||||
        // save and reload and verify they columns are still hidden
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
        await page.reload();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
 | 
			
		||||
 | 
			
		||||
        // Edit LAD table
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
        await selectInspectorTab(page, 'LAD Table Configuration');
 | 
			
		||||
 | 
			
		||||
        // show timestamp column
 | 
			
		||||
        await page.getByLabel('Timestamp').check();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // save and reload and make sure only timestamp is still visible
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
        await page.reload();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeHidden();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Edit LAD table
 | 
			
		||||
        await page.locator('[title="Edit"]').click();
 | 
			
		||||
        await selectInspectorTab(page, 'LAD Table Configuration');
 | 
			
		||||
 | 
			
		||||
        // show units and type columns
 | 
			
		||||
        await page.getByLabel('Units').check();
 | 
			
		||||
        await page.getByLabel('Type').check();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // save and reload and make sure all columns are still visible
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('text=Save and Finish Editing').click();
 | 
			
		||||
        await page.reload();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Units' })).toBeVisible();
 | 
			
		||||
        await expect(page.getByRole('cell', { name: 'Type' })).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('LAD Tables don\'t allow selection of rows but does show context click menus', async ({ page }) => {
 | 
			
		||||
        const cell = await page.locator('.js-first-data');
 | 
			
		||||
        const userSelectable = await cell.evaluate((el) => {
 | 
			
		||||
            return window.getComputedStyle(el).getPropertyValue('user-select');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        expect(userSelectable).toBe('none');
 | 
			
		||||
        // Right-click on the LAD table row
 | 
			
		||||
        await cell.click({
 | 
			
		||||
            button: 'right'
 | 
			
		||||
        });
 | 
			
		||||
        const menuOptions = page.locator('.c-menu ul');
 | 
			
		||||
        await expect.soft(menuOptions).toContainText('View Full Datum');
 | 
			
		||||
        await expect.soft(menuOptions).toContainText('View Historical Data');
 | 
			
		||||
        await expect.soft(menuOptions).toContainText('Remove');
 | 
			
		||||
        // await page.locator('li[title="Remove this object from its containing object."]').click();
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Testing LAD table @unstable', () => {
 | 
			
		||||
    let sineWaveObject;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
        await setRealTimeMode(page);
 | 
			
		||||
 | 
			
		||||
        // Create Sine Wave Generator
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -24,11 +24,12 @@
 | 
			
		||||
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
// FIXME: Remove this eslint exception once tests are implemented
 | 
			
		||||
// eslint-disable-next-line no-unused-vars
 | 
			
		||||
const { test, expect } = require('../../../../baseFixtures');
 | 
			
		||||
const { expandTreePaneItemByName, createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const { test, expect, streamToString } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const nbUtils = require('../../../../helper/notebookUtils');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
 | 
			
		||||
const NOTEBOOK_NAME = 'Notebook';
 | 
			
		||||
 | 
			
		||||
test.describe('Notebook CRUD Operations', () => {
 | 
			
		||||
    test.fixme('Can create a Notebook Object', async ({ page }) => {
 | 
			
		||||
@@ -71,12 +72,11 @@ test.describe('Notebook section tests', () => {
 | 
			
		||||
    //The following test cases are associated with Notebook Sections
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Notebook',
 | 
			
		||||
            name: "Test Notebook"
 | 
			
		||||
            type: NOTEBOOK_NAME
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    test('Default and new sections are automatically named Unnamed Section with Unnamed Page', async ({ page }) => {
 | 
			
		||||
@@ -133,12 +133,11 @@ test.describe('Notebook page tests', () => {
 | 
			
		||||
    //The following test cases are associated with Notebook Pages
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Notebook',
 | 
			
		||||
            name: "Test Notebook"
 | 
			
		||||
            type: NOTEBOOK_NAME
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    //Test will need to be implemented after a refactor in #5713
 | 
			
		||||
@@ -199,6 +198,36 @@ test.describe('Notebook page tests', () => {
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Notebook export tests', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: NOTEBOOK_NAME
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    test('can export notebook as text', async ({ page }) => {
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `Foo bar entry`);
 | 
			
		||||
        // Click on 3 Dot Menu
 | 
			
		||||
        await page.locator('button[title="More options"]').click();
 | 
			
		||||
        const downloadPromise = page.waitForEvent('download');
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('menuitem', { name: /Export Notebook as Text/ }).click();
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: 'Save' }).click();
 | 
			
		||||
        const download = await downloadPromise;
 | 
			
		||||
        const readStream = await download.createReadStream();
 | 
			
		||||
        const exportedText = await streamToString(readStream);
 | 
			
		||||
        expect(exportedText).toContain('Foo bar entry');
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('can export multiple notebook entries as text ', async ({ page }) => {});
 | 
			
		||||
    test.fixme('can export all notebook entry metdata', async ({ page }) => {});
 | 
			
		||||
    test.fixme('can export all notebook tags', async ({ page }) => {});
 | 
			
		||||
    test.fixme('can export all notebook snapshots', async ({ page }) => {});
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Notebook search tests', () => {
 | 
			
		||||
    test.fixme('Can search for a single result', async ({ page }) => {});
 | 
			
		||||
    test.fixme('Can search for many results', async ({ page }) => {});
 | 
			
		||||
@@ -209,127 +238,199 @@ test.describe('Notebook search tests', () => {
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Notebook entry tests', () => {
 | 
			
		||||
    test.fixme('When a new entry is created, it should be focused', async ({ page }) => {});
 | 
			
		||||
    // Create Notebook with URL Whitelist
 | 
			
		||||
    let notebookObject;
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // eslint-disable-next-line no-undef
 | 
			
		||||
        await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitNotebookWithUrls.js') });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        notebookObject = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: NOTEBOOK_NAME
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    test('When a new entry is created, it should be focused and selected', async ({ page }) => {
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Click .c-notebook__drag-area
 | 
			
		||||
        await page.locator('.c-notebook__drag-area').click();
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry Input"]')).toBeVisible();
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry"]')).toHaveClass(/is-selected/);
 | 
			
		||||
    });
 | 
			
		||||
    test('When an object is dropped into a notebook, a new entry is created and it should be focused @unstable', async ({ page }) => {
 | 
			
		||||
        await page.goto('./#/browse/mine', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        const notebook = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Notebook',
 | 
			
		||||
            name: "Embed Test Notebook"
 | 
			
		||||
        });
 | 
			
		||||
        // Create Overlay Plot
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Overlay Plot',
 | 
			
		||||
            name: "Dropped Overlay Plot"
 | 
			
		||||
        const overlayPlot = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Overlay Plot'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await expandTreePaneItemByName(page, 'My Items');
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        await page.goto(notebook.url);
 | 
			
		||||
        await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', '.c-notebook__drag-area');
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await page.dragAndDrop(`role=treeitem[name=/${overlayPlot.name}/]`, '.c-notebook__drag-area');
 | 
			
		||||
 | 
			
		||||
        const embed = page.locator('.c-ne__embed__link');
 | 
			
		||||
        const embedName = await embed.textContent();
 | 
			
		||||
 | 
			
		||||
        await expect(embed).toHaveClass(/icon-plot-overlay/);
 | 
			
		||||
        expect(embedName).toBe('Dropped Overlay Plot');
 | 
			
		||||
        expect(embedName).toBe(overlayPlot.name);
 | 
			
		||||
    });
 | 
			
		||||
    test('When an object is dropped into a notebooks existing entry, it should be focused @unstable', async ({ page }) => {
 | 
			
		||||
        await page.goto('./#/browse/mine', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        const notebook = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Notebook',
 | 
			
		||||
            name: "Embed Test Notebook"
 | 
			
		||||
        });
 | 
			
		||||
        // Create Overlay Plot
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Overlay Plot',
 | 
			
		||||
            name: "Dropped Overlay Plot"
 | 
			
		||||
        const overlayPlot = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Overlay Plot'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await expandTreePaneItemByName(page, 'My Items');
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        await page.goto(notebook.url);
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Entry to drop into');
 | 
			
		||||
        await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', 'text=Entry to drop into');
 | 
			
		||||
        await page.dragAndDrop(`role=treeitem[name=/${overlayPlot.name}/]`, 'text=Entry to drop into');
 | 
			
		||||
 | 
			
		||||
        const existingEntry = page.locator('.c-ne__content', { has: page.locator('text="Entry to drop into"') });
 | 
			
		||||
        const embed = existingEntry.locator('.c-ne__embed__link');
 | 
			
		||||
        const embedName = await embed.textContent();
 | 
			
		||||
 | 
			
		||||
        await expect(embed).toHaveClass(/icon-plot-overlay/);
 | 
			
		||||
        expect(embedName).toBe('Dropped Overlay Plot');
 | 
			
		||||
        expect(embedName).toBe(overlayPlot.name);
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('new entries persist through navigation events without save', async ({ page }) => {});
 | 
			
		||||
    test.fixme('previous and new entries can be deleted', async ({ page }) => {});
 | 
			
		||||
});
 | 
			
		||||
    test('previous and new entries can be deleted', async ({ page }) => {
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
test.describe('Snapshot Menu tests', () => {
 | 
			
		||||
    test.fixme('When no default notebook is selected, Snapshot Menu dropdown should only have a single option', async ({ page }) => {
 | 
			
		||||
        // There should be no default notebook
 | 
			
		||||
        // Clear default notebook if exists using `localStorage.setItem('notebook-storage', null);`
 | 
			
		||||
        // refresh page
 | 
			
		||||
        // Click on 'Notebook Snaphot Menu'
 | 
			
		||||
        // 'save to Notebook Snapshots' should be only option there
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'First Entry');
 | 
			
		||||
        await page.hover('text="First Entry"');
 | 
			
		||||
        await page.click('button[title="Delete this entry"]');
 | 
			
		||||
        await page.getByRole('button', { name: 'Ok' }).filter({ hasText: 'Ok' }).click();
 | 
			
		||||
        await expect(page.locator('text="First Entry"')).toBeHidden();
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Another First Entry');
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Second Entry');
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Third Entry');
 | 
			
		||||
        await page.hover('[aria-label="Notebook Entry"] >> nth=2');
 | 
			
		||||
        await page.click('button[title="Delete this entry"] >> nth=2');
 | 
			
		||||
        await page.getByRole('button', { name: 'Ok' }).filter({ hasText: 'Ok' }).click();
 | 
			
		||||
        await expect(page.locator('text="Third Entry"')).toBeHidden();
 | 
			
		||||
        await expect(page.locator('text="Another First Entry"')).toBeVisible();
 | 
			
		||||
        await expect(page.locator('text="Second Entry"')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('When default notebook is updated selected, Snapshot Menu dropdown should list it as the newest option', async ({ page }) => {
 | 
			
		||||
        // Create 2a notebooks
 | 
			
		||||
        // Set Notebook A as Default
 | 
			
		||||
        // Open Snapshot Menu and note that Notebook A is listed
 | 
			
		||||
        // Close Snapshot Menu
 | 
			
		||||
        // Set Default Notebook to Notebook B
 | 
			
		||||
        // Open Snapshot Notebook and note that Notebook B is listed
 | 
			
		||||
        // Select Default Notebook Option and verify that Snapshot is added to Notebook B
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Can add Snapshots via Snapshot Menu and details are correct', async ({ page }) => {
 | 
			
		||||
        //Note this should be a visual test, too
 | 
			
		||||
        // Create Telemetry object
 | 
			
		||||
        // Create A notebook with many pages and sections.
 | 
			
		||||
        // Set page and section defaults to be between first and last of many. i.e. 3 of 5
 | 
			
		||||
        // Navigate to Telemetry object
 | 
			
		||||
        // Select Default Notebook Option and verify that Snapshot is added to Notebook A
 | 
			
		||||
        // Verify Snapshot Details appear correctly
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Snapshots adjust time conductor', async ({ page }) => {
 | 
			
		||||
        // Create Telemetry object
 | 
			
		||||
        // Set Telemetry object's timeconductor to Fixed time with Start and Endtimes are recorded
 | 
			
		||||
        // Embed Telemetry object into notebook
 | 
			
		||||
        // Set Time Conductor to Local clock
 | 
			
		||||
        // Click into embedded telemetry object and verify object appears with same fixed time from record
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
    test('when a valid link is entered into a notebook entry, it becomes clickable when viewing', async ({ page }) => {
 | 
			
		||||
        const TEST_LINK = 'http://www.google.com';
 | 
			
		||||
 | 
			
		||||
test.describe('Snapshot Container tests', () => {
 | 
			
		||||
    test.fixme('5 Snapshots can be added to a container', async ({ page }) => {});
 | 
			
		||||
    test.fixme('5 Snapshots can be added to a container and Deleted with Delete All action', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot can be Deleted from Container', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot can be Previewed from Container', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot Container can be open and closed', async ({ page }) => {});
 | 
			
		||||
    test.fixme('Can add object to Snapshot container and pull into notebook and create a new entry', async ({ page }) => {
 | 
			
		||||
        //Create Notebook
 | 
			
		||||
        //Create Telemetry Object
 | 
			
		||||
        //From Telemetry Object, use 'save to Notebook Snapshots'
 | 
			
		||||
        //Snapshots indicator should blink, click on it to view snapshots
 | 
			
		||||
        //Navigate to Notebook
 | 
			
		||||
        //Drag and Drop onto droppable area for new entry
 | 
			
		||||
        //New Entry created with given snapshot added
 | 
			
		||||
        //Snapshot removed from container?
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);
 | 
			
		||||
 | 
			
		||||
        const validLink = page.locator(`a[href="${TEST_LINK}"]`);
 | 
			
		||||
 | 
			
		||||
        // Start waiting for popup before clicking. Note no await.
 | 
			
		||||
        const popupPromise = page.waitForEvent('popup');
 | 
			
		||||
 | 
			
		||||
        await validLink.click();
 | 
			
		||||
        const popup = await popupPromise;
 | 
			
		||||
 | 
			
		||||
        // Wait for the popup to load.
 | 
			
		||||
        await popup.waitForLoadState();
 | 
			
		||||
        expect.soft(popup.url()).toContain('www.google.com');
 | 
			
		||||
 | 
			
		||||
        expect(await validLink.count()).toBe(1);
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Can add object to Snapshot container and pull into notebook and existing entry', async ({ page }) => {
 | 
			
		||||
        //Create Notebook
 | 
			
		||||
        //Create Telemetry Object
 | 
			
		||||
        //From Telemetry Object, use 'save to Notebook Snapshots'
 | 
			
		||||
        //Snapshots indicator should blink, click on it to view snapshots
 | 
			
		||||
        //Navigate to Notebook
 | 
			
		||||
        //Drag and Drop into exiting entry
 | 
			
		||||
        //Existing Entry updated with given snapshot
 | 
			
		||||
        //Snapshot removed from container?
 | 
			
		||||
    test('when an invalid link is entered into a notebook entry, it does not become clickable when viewing', async ({ page }) => {
 | 
			
		||||
        const TEST_LINK = 'www.google.com';
 | 
			
		||||
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);
 | 
			
		||||
 | 
			
		||||
        const invalidLink = page.locator(`a[href="${TEST_LINK}"]`);
 | 
			
		||||
 | 
			
		||||
        expect(await invalidLink.count()).toBe(0);
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Verify Embedded options for PNG, JPG, and Annotate work correctly', async ({ page }) => {
 | 
			
		||||
        //Add snapshot to container
 | 
			
		||||
        //Verify PNG, JPG, and Annotate buttons work correctly
 | 
			
		||||
    test('when a link is entered, but it is not in the whitelisted urls, it does not become clickable when viewing', async ({ page }) => {
 | 
			
		||||
        const TEST_LINK = 'http://www.bing.com';
 | 
			
		||||
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `This should NOT be a link: ${TEST_LINK} is it?`);
 | 
			
		||||
 | 
			
		||||
        const invalidLink = page.locator(`a[href="${TEST_LINK}"]`);
 | 
			
		||||
 | 
			
		||||
        expect(await invalidLink.count()).toBe(0);
 | 
			
		||||
    });
 | 
			
		||||
    test('when a valid link with a subdomain and a valid domain in the whitelisted urls is entered into a notebook entry, it becomes clickable when viewing', async ({ page }) => {
 | 
			
		||||
        const INVALID_TEST_LINK = 'http://bing.google.com';
 | 
			
		||||
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `This should be a link: ${INVALID_TEST_LINK} is it?`);
 | 
			
		||||
 | 
			
		||||
        const validLink = page.locator(`a[href="${INVALID_TEST_LINK}"]`);
 | 
			
		||||
 | 
			
		||||
        expect(await validLink.count()).toBe(1);
 | 
			
		||||
    });
 | 
			
		||||
    test('when a valid secure link is entered into a notebook entry, it becomes clickable when viewing', async ({ page }) => {
 | 
			
		||||
        const TEST_LINK = 'https://www.google.com';
 | 
			
		||||
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `This should be a link: ${TEST_LINK} is it?`);
 | 
			
		||||
 | 
			
		||||
        const validLink = page.locator(`a[href="${TEST_LINK}"]`);
 | 
			
		||||
 | 
			
		||||
        // Start waiting for popup before clicking. Note no await.
 | 
			
		||||
        const popupPromise = page.waitForEvent('popup');
 | 
			
		||||
 | 
			
		||||
        await validLink.click();
 | 
			
		||||
        const popup = await popupPromise;
 | 
			
		||||
 | 
			
		||||
        // Wait for the popup to load.
 | 
			
		||||
        await popup.waitForLoadState();
 | 
			
		||||
        expect.soft(popup.url()).toContain('www.google.com');
 | 
			
		||||
 | 
			
		||||
        expect(await validLink.count()).toBe(1);
 | 
			
		||||
    });
 | 
			
		||||
    test('when a nefarious link is entered into a notebook entry, it is sanitized when viewing', async ({ page }) => {
 | 
			
		||||
        const TEST_LINK = 'http://www.google.com?bad=';
 | 
			
		||||
        const TEST_LINK_BAD = `http://www.google.com?bad=<script>alert('gimme your cookies')</script>`;
 | 
			
		||||
 | 
			
		||||
        // Navigate to the notebook object
 | 
			
		||||
        await page.goto(notebookObject.url);
 | 
			
		||||
 | 
			
		||||
        // Reveal the notebook in the tree
 | 
			
		||||
        await page.getByTitle('Show selected item in tree').click();
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `This should be a link, BUT not a bad link: ${TEST_LINK_BAD} is it?`);
 | 
			
		||||
 | 
			
		||||
        const sanitizedLink = page.locator(`a[href="${TEST_LINK}"]`);
 | 
			
		||||
        const unsanitizedLink = page.locator(`a[href="${TEST_LINK_BAD}"]`);
 | 
			
		||||
 | 
			
		||||
        expect.soft(await sanitizedLink.count()).toBe(1);
 | 
			
		||||
        expect(await unsanitizedLink.count()).toBe(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,134 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
// const { expandTreePaneItemByName, createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
// const nbUtils = require('../../../../helper/notebookUtils');
 | 
			
		||||
 | 
			
		||||
test.describe('Snapshot Menu tests', () => {
 | 
			
		||||
    test.fixme('When no default notebook is selected, Snapshot Menu dropdown should only have a single option', async ({ page }) => {
 | 
			
		||||
        // There should be no default notebook
 | 
			
		||||
        // Clear default notebook if exists using `localStorage.setItem('notebook-storage', null);`
 | 
			
		||||
        // refresh page
 | 
			
		||||
        // Click on 'Notebook Snaphot Menu'
 | 
			
		||||
        // 'save to Notebook Snapshots' should be only option there
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('When default notebook is updated selected, Snapshot Menu dropdown should list it as the newest option', async ({ page }) => {
 | 
			
		||||
        // Create 2a notebooks
 | 
			
		||||
        // Set Notebook A as Default
 | 
			
		||||
        // Open Snapshot Menu and note that Notebook A is listed
 | 
			
		||||
        // Close Snapshot Menu
 | 
			
		||||
        // Set Default Notebook to Notebook B
 | 
			
		||||
        // Open Snapshot Notebook and note that Notebook B is listed
 | 
			
		||||
        // Select Default Notebook Option and verify that Snapshot is added to Notebook B
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Can add Snapshots via Snapshot Menu and details are correct', async ({ page }) => {
 | 
			
		||||
        //Note this should be a visual test, too
 | 
			
		||||
        // Create Telemetry object
 | 
			
		||||
        // Create A notebook with many pages and sections.
 | 
			
		||||
        // Set page and section defaults to be between first and last of many. i.e. 3 of 5
 | 
			
		||||
        // Navigate to Telemetry object
 | 
			
		||||
        // Select Default Notebook Option and verify that Snapshot is added to Notebook A
 | 
			
		||||
        // Verify Snapshot Details appear correctly
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Snapshots adjust time conductor', async ({ page }) => {
 | 
			
		||||
        // Create Telemetry object
 | 
			
		||||
        // Set Telemetry object's timeconductor to Fixed time with Start and Endtimes are recorded
 | 
			
		||||
        // Embed Telemetry object into notebook
 | 
			
		||||
        // Set Time Conductor to Local clock
 | 
			
		||||
        // Click into embedded telemetry object and verify object appears with same fixed time from record
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('Snapshot Container tests', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        // const notebook = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
        //     type: 'Notebook',
 | 
			
		||||
        //     name: "Test Notebook"
 | 
			
		||||
        // });
 | 
			
		||||
        // // Create Overlay Plot
 | 
			
		||||
        // const snapShotObject = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
        //     type: 'Overlay Plot',
 | 
			
		||||
        //     name: "Dropped Overlay Plot"
 | 
			
		||||
        // });
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: ' Snapshot ' }).click();
 | 
			
		||||
        await page.getByRole('menuitem', { name: ' Save to Notebook Snapshots' }).click();
 | 
			
		||||
        await page.getByRole('button', { name: 'Show' }).click();
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('5 Snapshots can be added to a container', async ({ page }) => {});
 | 
			
		||||
    test.fixme('5 Snapshots can be added to a container and Deleted with Delete All action', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot can be Deleted from Container with 3 dot action menu', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot can be Viewed, Annotated, display deleted, and saved from Container with 3 dot action menu', async ({ page }) => {
 | 
			
		||||
        await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
 | 
			
		||||
        await page.getByRole('menuitem', { name: ' View Snapshot' }).click();
 | 
			
		||||
        await expect(page.locator('.c-overlay__outer')).toBeVisible();
 | 
			
		||||
        await page.getByTitle('Annotate').click();
 | 
			
		||||
        await expect(page.locator('#snap-annotation-canvas')).toBeVisible();
 | 
			
		||||
        await page.getByRole('button', { name: '' }).click();
 | 
			
		||||
        // await expect(page.locator('#snap-annotation-canvas')).not.toBeVisible();
 | 
			
		||||
        await page.getByRole('button', { name: 'Save' }).click();
 | 
			
		||||
        await page.getByRole('button', { name: 'Done' }).click();
 | 
			
		||||
        //await expect(await page.locator)
 | 
			
		||||
    });
 | 
			
		||||
    test('A snapshot can be Quick Viewed from Container with 3 dot action menu', async ({ page }) => {
 | 
			
		||||
        await page.locator('.c-snapshot.c-ne__embed').first().getByTitle('More options').click();
 | 
			
		||||
        await page.getByRole('menuitem', { name: 'Quick View' }).click();
 | 
			
		||||
        await expect(page.locator('.c-overlay__outer')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('A snapshot can be Navigated To from Container with 3 dot action menu', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot can be Navigated To Item in Time from Container with 3 dot action menu', async ({ page }) => {});
 | 
			
		||||
    test.fixme('A snapshot Container can be open and closed', async ({ page }) => {});
 | 
			
		||||
    test.fixme('Can add object to Snapshot container and pull into notebook and create a new entry', async ({ page }) => {
 | 
			
		||||
        //Create Notebook
 | 
			
		||||
        //Create Telemetry Object
 | 
			
		||||
        //From Telemetry Object, use 'save to Notebook Snapshots'
 | 
			
		||||
        //Snapshots indicator should blink, click on it to view snapshots
 | 
			
		||||
        //Navigate to Notebook
 | 
			
		||||
        //Drag and Drop onto droppable area for new entry
 | 
			
		||||
        //New Entry created with given snapshot added
 | 
			
		||||
        //Snapshot removed from container?
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Can add object to Snapshot container and pull into notebook and existing entry', async ({ page }) => {
 | 
			
		||||
        //Create Notebook
 | 
			
		||||
        //Create Telemetry Object
 | 
			
		||||
        //From Telemetry Object, use 'save to Notebook Snapshots'
 | 
			
		||||
        //Snapshots indicator should blink, click on it to view snapshots
 | 
			
		||||
        //Navigate to Notebook
 | 
			
		||||
        //Drag and Drop into exiting entry
 | 
			
		||||
        //Existing Entry updated with given snapshot
 | 
			
		||||
        //Snapshot removed from container?
 | 
			
		||||
    });
 | 
			
		||||
    test.fixme('Verify Embedded options for PNG, JPG, and Annotate work correctly', async ({ page }) => {
 | 
			
		||||
        //Add snapshot to container
 | 
			
		||||
        //Verify PNG, JPG, and Annotate buttons work correctly
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
@@ -0,0 +1,243 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This test suite is dedicated to tests which verify the basic operations surrounding Notebooks with CouchDB.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const nbUtils = require('../../../../helper/notebookUtils');
 | 
			
		||||
 | 
			
		||||
test.describe('Notebook Tests with CouchDB @couchdb', () => {
 | 
			
		||||
    let testNotebook;
 | 
			
		||||
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Navigate to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Create Notebook
 | 
			
		||||
        testNotebook = await createDomainObjectWithDefaults(page, {type: 'Notebook' });
 | 
			
		||||
        await page.goto(testNotebook.url, { waitUntil: 'networkidle'});
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Inspect Notebook Entry Network Requests', async ({ page }) => {
 | 
			
		||||
        //Ensure we're on the annotations Tab in the inspector
 | 
			
		||||
        await page.getByText('Annotations').click();
 | 
			
		||||
        // Expand sidebar
 | 
			
		||||
        await page.locator('.c-notebook__toggle-nav-button').click();
 | 
			
		||||
 | 
			
		||||
        // Collect all request events to count and assert after notebook action
 | 
			
		||||
        let notebookElementsRequests = [];
 | 
			
		||||
        page.on('request', (request) => notebookElementsRequests.push(request));
 | 
			
		||||
 | 
			
		||||
        //Clicking Add Page generates
 | 
			
		||||
        let [notebookUrlRequest, allDocsRequest] = await Promise.all([
 | 
			
		||||
            // Waits for the next request with the specified url
 | 
			
		||||
            page.waitForRequest(`**/openmct/${testNotebook.uuid}`),
 | 
			
		||||
            page.waitForRequest('**/openmct/_all_docs?include_docs=true'),
 | 
			
		||||
            // Triggers the request
 | 
			
		||||
            page.click('[aria-label="Add Page"]')
 | 
			
		||||
        ]);
 | 
			
		||||
        // Ensures that there are no other network requests
 | 
			
		||||
        await page.waitForLoadState('networkidle');
 | 
			
		||||
 | 
			
		||||
        // Assert that only two requests are made
 | 
			
		||||
        // Network Requests are:
 | 
			
		||||
        // 1) The actual POST to create the page
 | 
			
		||||
        // 2) The shared worker event from 👆 request
 | 
			
		||||
        expect(notebookElementsRequests.length).toBe(2);
 | 
			
		||||
 | 
			
		||||
        // Assert on request object
 | 
			
		||||
        expect(notebookUrlRequest.postDataJSON().metadata.name).toBe(testNotebook.name);
 | 
			
		||||
        expect(notebookUrlRequest.postDataJSON().model.persisted).toBeGreaterThanOrEqual(notebookUrlRequest.postDataJSON().model.modified);
 | 
			
		||||
        expect(allDocsRequest.postDataJSON().keys).toContain(testNotebook.uuid);
 | 
			
		||||
 | 
			
		||||
        // Add an entry
 | 
			
		||||
        // Network Requests are:
 | 
			
		||||
        // 1) The actual POST to create the entry
 | 
			
		||||
        // 2) The shared worker event from 👆 POST request
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'First Entry');
 | 
			
		||||
        await page.waitForLoadState('networkidle');
 | 
			
		||||
        expect(notebookElementsRequests.length).toBeLessThanOrEqual(2);
 | 
			
		||||
 | 
			
		||||
        // Add some tags
 | 
			
		||||
        // Network Requests are for each tag creation are:
 | 
			
		||||
        // 1) Getting the original path of the parent object
 | 
			
		||||
        // 2) Getting the original path of the grandparent object (recursive call)
 | 
			
		||||
        // 3) Creating the annotation/tag object
 | 
			
		||||
        // 4) The shared worker event from 👆 POST request
 | 
			
		||||
        // 5) Mutate notebook domain object's annotationModified property
 | 
			
		||||
        // 6) The shared worker event from 👆 POST request
 | 
			
		||||
        // 7) Notebooks fetching new annotations due to annotationModified changed
 | 
			
		||||
        // 8) The update of the notebook domain's object's modified property
 | 
			
		||||
        // 9) The shared worker event from 👆 POST request
 | 
			
		||||
        // 10) Entry is timestamped
 | 
			
		||||
        // 11) The shared worker event from 👆 POST request
 | 
			
		||||
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Driving');
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(11);
 | 
			
		||||
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Drilling');
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(11);
 | 
			
		||||
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Science');
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(11);
 | 
			
		||||
 | 
			
		||||
        // Delete all the tags
 | 
			
		||||
        // Network requests are:
 | 
			
		||||
        // 1) Send POST to mutate _delete property to true on annotation with tag
 | 
			
		||||
        // 2) The shared worker event from 👆 POST request
 | 
			
		||||
        // 3) Timestamp update on entry
 | 
			
		||||
        // 4) The shared worker event from 👆 POST request
 | 
			
		||||
        // This happens for 3 tags so 12 requests
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await removeTagAndAwaitNetwork(page, 'Driving');
 | 
			
		||||
        await removeTagAndAwaitNetwork(page, 'Drilling');
 | 
			
		||||
        await removeTagAndAwaitNetwork(page, 'Science');
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(12);
 | 
			
		||||
 | 
			
		||||
        // Add two more pages
 | 
			
		||||
        await page.click('[aria-label="Add Page"]');
 | 
			
		||||
        await page.click('[aria-label="Add Page"]');
 | 
			
		||||
 | 
			
		||||
        // Add three entries
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'First Entry');
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Second Entry');
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Third Entry');
 | 
			
		||||
 | 
			
		||||
        // Add three tags
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Science');
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Drilling');
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Driving');
 | 
			
		||||
 | 
			
		||||
        // Add a fourth entry
 | 
			
		||||
        // Network requests are:
 | 
			
		||||
        // 1) Send POST to add new entry
 | 
			
		||||
        // 2) The shared worker event from 👆 POST request
 | 
			
		||||
        // 3) Timestamp update on entry
 | 
			
		||||
        // 4) The shared worker event from 👆 POST request
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Fourth Entry');
 | 
			
		||||
        page.waitForLoadState('networkidle');
 | 
			
		||||
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
 | 
			
		||||
 | 
			
		||||
        // Add a fifth entry
 | 
			
		||||
        // Network requests are:
 | 
			
		||||
        // 1) Send POST to add new entry
 | 
			
		||||
        // 2) The shared worker event from 👆 POST request
 | 
			
		||||
        // 3) Timestamp update on entry
 | 
			
		||||
        // 4) The shared worker event from 👆 POST request
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Fifth Entry');
 | 
			
		||||
        page.waitForLoadState('networkidle');
 | 
			
		||||
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
 | 
			
		||||
 | 
			
		||||
        // Add a sixth entry
 | 
			
		||||
        // 1) Send POST to add new entry
 | 
			
		||||
        // 2) The shared worker event from 👆 POST request
 | 
			
		||||
        // 3) Timestamp update on entry
 | 
			
		||||
        // 4) The shared worker event from 👆 POST request
 | 
			
		||||
        notebookElementsRequests = [];
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'Sixth Entry');
 | 
			
		||||
        page.waitForLoadState('networkidle');
 | 
			
		||||
 | 
			
		||||
        expect(filterNonFetchRequests(notebookElementsRequests).length).toBeLessThanOrEqual(4);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Search tests', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/akhenry/openmct-yamcs/issues/69'
 | 
			
		||||
        });
 | 
			
		||||
        await page.getByText('Annotations').click();
 | 
			
		||||
        await nbUtils.enterTextEntry(page, 'First Entry');
 | 
			
		||||
 | 
			
		||||
        // Add three tags
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Science');
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Drilling');
 | 
			
		||||
        await addTagAndAwaitNetwork(page, 'Driving');
 | 
			
		||||
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
        //Partial match for "Science" should only return Science
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]').first()).toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]').first()).not.toContainText("Driving");
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]').first()).not.toContainText("Drilling");
 | 
			
		||||
 | 
			
		||||
        //Searching for a tag which does not exist should return an empty result
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
 | 
			
		||||
        await expect(page.locator('text=No results found')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// Try to reduce indeterminism of browser requests by only returning fetch requests.
 | 
			
		||||
// Filter out preflight CORS, fetching stylesheets, page icons, etc. that can occur during tests
 | 
			
		||||
function filterNonFetchRequests(requests) {
 | 
			
		||||
    return requests.filter(request => {
 | 
			
		||||
        return (request.resourceType() === 'fetch');
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Add a tag to a notebook entry by providing a tagName.
 | 
			
		||||
 * Reduces indeterminism by waiting until all necessary requests are completed.
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {string} tagName
 | 
			
		||||
 */
 | 
			
		||||
async function addTagAndAwaitNetwork(page, tagName) {
 | 
			
		||||
    await page.hover(`button:has-text("Add Tag")`);
 | 
			
		||||
    await page.locator(`button:has-text("Add Tag")`).click();
 | 
			
		||||
    await page.locator('[placeholder="Type to select tag"]').click();
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        // Waits for the next request with the specified url
 | 
			
		||||
        page.waitForRequest('**/openmct/_all_docs?include_docs=true'),
 | 
			
		||||
        // Triggers the request
 | 
			
		||||
        page.locator(`[aria-label="Autocomplete Options"] >> text=${tagName}`).click(),
 | 
			
		||||
        expect(page.locator(`[aria-label="Tag"]:has-text("${tagName}")`)).toBeVisible()
 | 
			
		||||
    ]);
 | 
			
		||||
    await page.waitForLoadState('networkidle');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Remove a tag to a notebook entry by providing a tagName.
 | 
			
		||||
 * Reduces indeterminism by waiting until all necessary requests are completed.
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {string} tagName
 | 
			
		||||
 */
 | 
			
		||||
async function removeTagAndAwaitNetwork(page, tagName) {
 | 
			
		||||
    await page.hover(`[aria-label="Tag"]:has-text("${tagName}")`);
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.locator(`[aria-label="Remove tag ${tagName}"]`).click(),
 | 
			
		||||
        //With this pattern, we're awaiting the response but asserting on the request payload.
 | 
			
		||||
        page.waitForResponse(resp => resp.request().postData().includes(`"_deleted":true`) && resp.status() === 201)
 | 
			
		||||
    ]);
 | 
			
		||||
    await expect(page.locator(`[aria-label="Tag"]:has-text("${tagName}")`)).toBeHidden();
 | 
			
		||||
    await page.waitForLoadState('networkidle');
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { test, expect, streamToString } = require('../../../../pluginFixtures');
 | 
			
		||||
const { openObjectTreeContextMenu, createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
const nbUtils = require('../../../../helper/notebookUtils');
 | 
			
		||||
@@ -36,27 +36,27 @@ test.describe('Restricted Notebook', () => {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can be renamed @addInit', async ({ page }) => {
 | 
			
		||||
        await expect(page.locator('.l-browse-bar__object-name')).toContainText(`Unnamed ${CUSTOM_NAME}`);
 | 
			
		||||
        await expect(page.locator('.l-browse-bar__object-name')).toContainText(`${notebook.name}`);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can be deleted if there are no locked pages @addInit', async ({ page, openmctConfig }) => {
 | 
			
		||||
    test('Can be deleted if there are no locked pages @addInit', async ({ page }) => {
 | 
			
		||||
        await openObjectTreeContextMenu(page, notebook.url);
 | 
			
		||||
 | 
			
		||||
        const menuOptions = page.locator('.c-menu ul');
 | 
			
		||||
        await expect.soft(menuOptions).toContainText('Remove');
 | 
			
		||||
 | 
			
		||||
        const restrictedNotebookTreeObject = page.locator(`a:has-text("Unnamed ${CUSTOM_NAME}")`);
 | 
			
		||||
        const restrictedNotebookTreeObject = page.locator(`a:has-text("${notebook.name}")`);
 | 
			
		||||
 | 
			
		||||
        // notebook tree object exists
 | 
			
		||||
        expect.soft(await restrictedNotebookTreeObject.count()).toEqual(1);
 | 
			
		||||
 | 
			
		||||
        // Click Remove Text
 | 
			
		||||
        await page.locator('text=Remove').click();
 | 
			
		||||
        await page.locator('li[role="menuitem"]:has-text("Remove")').click();
 | 
			
		||||
 | 
			
		||||
        // Click 'OK' on confirmation window and wait for save banner to appear
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation(),
 | 
			
		||||
            page.locator('text=OK').click(),
 | 
			
		||||
            page.locator('button:has-text("OK")').click(),
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
@@ -134,7 +134,7 @@ test.describe('Restricted Notebook with at least one entry and with the page loc
 | 
			
		||||
        // Click text=Ok
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation(),
 | 
			
		||||
            page.locator('text=Ok').click()
 | 
			
		||||
            page.locator('button:has-text("OK")').click()
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // deleted page, should no longer exist
 | 
			
		||||
@@ -145,15 +145,14 @@ test.describe('Restricted Notebook with at least one entry and with the page loc
 | 
			
		||||
 | 
			
		||||
test.describe('Restricted Notebook with a page locked and with an embed @addInit', () => {
 | 
			
		||||
 | 
			
		||||
    test.beforeEach(async ({ page, openmctConfig }) => {
 | 
			
		||||
        const { myItemsFolderName } = openmctConfig;
 | 
			
		||||
        await startAndAddRestrictedNotebookObject(page);
 | 
			
		||||
        await nbUtils.dragAndDropEmbed(page, myItemsFolderName);
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        const notebook = await startAndAddRestrictedNotebookObject(page);
 | 
			
		||||
        await nbUtils.dragAndDropEmbed(page, notebook);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Allows embeds to be deleted if page unlocked @addInit', async ({ page }) => {
 | 
			
		||||
        // Click .c-ne__embed__name .c-popup-menu-button
 | 
			
		||||
        await page.locator('.c-ne__embed__name .c-popup-menu-button').click(); // embed popup menu
 | 
			
		||||
        await page.locator('.c-ne__embed__name .c-icon-button').click(); // embed popup menu
 | 
			
		||||
 | 
			
		||||
        const embedMenu = page.locator('body >> .c-menu');
 | 
			
		||||
        await expect(embedMenu).toContainText('Remove This Embed');
 | 
			
		||||
@@ -162,7 +161,7 @@ test.describe('Restricted Notebook with a page locked and with an embed @addInit
 | 
			
		||||
    test('Disallows embeds to be deleted if page locked @addInit', async ({ page }) => {
 | 
			
		||||
        await lockPage(page);
 | 
			
		||||
        // Click .c-ne__embed__name .c-popup-menu-button
 | 
			
		||||
        await page.locator('.c-ne__embed__name .c-popup-menu-button').click(); // embed popup menu
 | 
			
		||||
        await page.locator('.c-ne__embed__name .c-icon-button').click(); // embed popup menu
 | 
			
		||||
 | 
			
		||||
        const embedMenu = page.locator('body >> .c-menu');
 | 
			
		||||
        await expect(embedMenu).not.toContainText('Remove This Embed');
 | 
			
		||||
@@ -170,13 +169,40 @@ test.describe('Restricted Notebook with a page locked and with an embed @addInit
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('can export restricted notebook as text', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await startAndAddRestrictedNotebookObject(page);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('basic functionality ', async ({ page }) => {
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `Foo bar entry`);
 | 
			
		||||
        // Click on 3 Dot Menu
 | 
			
		||||
        await page.locator('button[title="More options"]').click();
 | 
			
		||||
        const downloadPromise = page.waitForEvent('download');
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('menuitem', { name: /Export Notebook as Text/ }).click();
 | 
			
		||||
 | 
			
		||||
        await page.getByRole('button', { name: 'Save' }).click();
 | 
			
		||||
        const download = await downloadPromise;
 | 
			
		||||
        const readStream = await download.createReadStream();
 | 
			
		||||
        const exportedText = await streamToString(readStream);
 | 
			
		||||
        expect(exportedText).toContain('Foo bar entry');
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test.fixme('can export multiple notebook entries as text ', async ({ page }) => {});
 | 
			
		||||
    test.fixme('can export all notebook entry metdata', async ({ page }) => {});
 | 
			
		||||
    test.fixme('can export all notebook tags', async ({ page }) => {});
 | 
			
		||||
    test.fixme('can export all notebook snapshots', async ({ page }) => {});
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function startAndAddRestrictedNotebookObject(page) {
 | 
			
		||||
    // eslint-disable-next-line no-undef
 | 
			
		||||
    await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitRestrictedNotebook.js') });
 | 
			
		||||
    await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
    await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
    return createDomainObjectWithDefaults(page, { type: CUSTOM_NAME });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -21,11 +21,12 @@
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
This test suite is dedicated to tests which verify form functionality.
 | 
			
		||||
This test suite is dedicated to tests which verify notebook tag functionality.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
const { createDomainObjectWithDefaults, selectInspectorTab } = require('../../../../appActions');
 | 
			
		||||
const nbUtils = require('../../../../helper/notebookUtils');
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  * Creates a notebook object and adds an entry.
 | 
			
		||||
@@ -33,18 +34,13 @@ const { createDomainObjectWithDefaults } = require('../../../../appActions');
 | 
			
		||||
  * @param {number} [iterations = 1] - the number of entries to create
 | 
			
		||||
  */
 | 
			
		||||
async function createNotebookAndEntry(page, iterations = 1) {
 | 
			
		||||
    //Go to baseURL
 | 
			
		||||
    await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
    createDomainObjectWithDefaults(page, { type: 'Notebook' });
 | 
			
		||||
    const notebook = createDomainObjectWithDefaults(page, { type: 'Notebook' });
 | 
			
		||||
 | 
			
		||||
    for (let iteration = 0; iteration < iterations; iteration++) {
 | 
			
		||||
        // Click text=To start a new entry, click here or drag and drop any object
 | 
			
		||||
        await page.locator('text=To start a new entry, click here or drag and drop any object').click();
 | 
			
		||||
        const entryLocator = `[aria-label="Notebook Entry Input"] >> nth = ${iteration}`;
 | 
			
		||||
        await page.locator(entryLocator).click();
 | 
			
		||||
        await page.locator(entryLocator).fill(`Entry ${iteration}`);
 | 
			
		||||
        await nbUtils.enterTextEntry(page, `Entry ${iteration}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return notebook;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -53,13 +49,15 @@ async function createNotebookAndEntry(page, iterations = 1) {
 | 
			
		||||
  * @param {number} [iterations = 1] - the number of entries (and tags) to create
 | 
			
		||||
  */
 | 
			
		||||
async function createNotebookEntryAndTags(page, iterations = 1) {
 | 
			
		||||
    await createNotebookAndEntry(page, iterations);
 | 
			
		||||
    const notebook = await createNotebookAndEntry(page, iterations);
 | 
			
		||||
    await selectInspectorTab(page, 'Annotations');
 | 
			
		||||
 | 
			
		||||
    for (let iteration = 0; iteration < iterations; iteration++) {
 | 
			
		||||
        // Hover and click "Add Tag" button
 | 
			
		||||
        // Hover is needed here to "slow down" the actions while running in headless mode
 | 
			
		||||
        await page.hover(`button:has-text("Add Tag") >> nth = ${iteration}`);
 | 
			
		||||
        await page.locator(`button:has-text("Add Tag") >> nth = ${iteration}`).click();
 | 
			
		||||
        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();
 | 
			
		||||
@@ -68,23 +66,29 @@ async function createNotebookEntryAndTags(page, iterations = 1) {
 | 
			
		||||
 | 
			
		||||
        // 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") >> nth = ${iteration}`);
 | 
			
		||||
        await page.locator(`button:has-text("Add Tag") >> 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 "Science" tag
 | 
			
		||||
        await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return notebook;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
test.describe('Tagging in Notebooks @addInit', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    });
 | 
			
		||||
    test('Can load tags', async ({ page }) => {
 | 
			
		||||
 | 
			
		||||
        await createNotebookAndEntry(page);
 | 
			
		||||
        // Click text=To start a new entry, click here or drag and drop any object
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Annotations');
 | 
			
		||||
 | 
			
		||||
        await page.locator('button:has-text("Add Tag")').click();
 | 
			
		||||
 | 
			
		||||
        // Click [placeholder="Type to select tag"]
 | 
			
		||||
        await page.locator('[placeholder="Type to select tag"]').click();
 | 
			
		||||
 | 
			
		||||
        await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText("Science");
 | 
			
		||||
@@ -97,63 +101,121 @@ test.describe('Tagging in Notebooks @addInit', () => {
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText("Driving");
 | 
			
		||||
 | 
			
		||||
        // Click button:has-text("Add Tag")
 | 
			
		||||
        await page.locator('button:has-text("Add Tag")').click();
 | 
			
		||||
        // Click [placeholder="Type to select tag"]
 | 
			
		||||
        await page.locator('[placeholder="Type to select tag"]').click();
 | 
			
		||||
 | 
			
		||||
        await expect(page.locator('[aria-label="Autocomplete Options"]')).not.toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Autocomplete Options"]')).not.toContainText("Driving");
 | 
			
		||||
        await expect(page.locator('[aria-label="Autocomplete Options"]')).toContainText("Drilling");
 | 
			
		||||
    });
 | 
			
		||||
    test('Can search for tags', async ({ page }) => {
 | 
			
		||||
        await createNotebookEntryAndTags(page);
 | 
			
		||||
        // Click [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
    test('Can add tags with blank entry', async ({ page }) => {
 | 
			
		||||
        await createDomainObjectWithDefaults(page, { type: 'Notebook' });
 | 
			
		||||
        await selectInspectorTab(page, 'Annotations');
 | 
			
		||||
 | 
			
		||||
        await nbUtils.enterTextEntry(page, '');
 | 
			
		||||
        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();
 | 
			
		||||
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText("Driving");
 | 
			
		||||
    });
 | 
			
		||||
    test('Can cancel adding tags', async ({ page }) => {
 | 
			
		||||
        await createNotebookAndEntry(page);
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Annotations');
 | 
			
		||||
 | 
			
		||||
        // Test canceling adding a tag after we click "Type to select tag"
 | 
			
		||||
        await page.locator('button:has-text("Add Tag")').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator('[placeholder="Type to select tag"]').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
 | 
			
		||||
        await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Test canceling adding a tag after we just click "Add Tag"
 | 
			
		||||
        await page.locator('button:has-text("Add Tag")').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
 | 
			
		||||
        await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
    test('Can search for tags and preview works properly', async ({ page }) => {
 | 
			
		||||
        await createNotebookEntryAndTags(page);
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
        // Fill [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sc');
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toContainText("Driving");
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
 | 
			
		||||
 | 
			
		||||
        // Click [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
        // Fill [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toContainText("Driving");
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
 | 
			
		||||
 | 
			
		||||
        // Click [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
        // Fill [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toBeHidden();
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toBeHidden();
 | 
			
		||||
        await expect(page.locator('text=No results found')).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: 'Display Layout'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // Go back into edit mode for the display layout
 | 
			
		||||
        await page.locator('button[title="Edit"]').click();
 | 
			
		||||
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).toContainText("Science");
 | 
			
		||||
        await page.getByText('Entry 0').click();
 | 
			
		||||
        await expect(page.locator('.js-preview-window')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can delete tags', async ({ page }) => {
 | 
			
		||||
        await createNotebookEntryAndTags(page);
 | 
			
		||||
        await page.locator('[aria-label="Notebook Entries"]').click();
 | 
			
		||||
        // Delete Driving
 | 
			
		||||
        await page.hover('.c-tag__label:has-text("Driving")');
 | 
			
		||||
        await page.locator('.c-tag__label:has-text("Driving") ~ .c-completed-tag-deletion').click();
 | 
			
		||||
        await page.hover('[aria-label="Tag"]:has-text("Driving")');
 | 
			
		||||
        await page.locator('[aria-label="Remove tag Driving"]').click();
 | 
			
		||||
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry"]')).toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Notebook Entry"]')).not.toContainText("Driving");
 | 
			
		||||
        await expect(page.locator('[aria-label="Tags Inspector"]')).toContainText("Science");
 | 
			
		||||
        await expect(page.locator('[aria-label="Tags Inspector"]')).not.toContainText("Driving");
 | 
			
		||||
 | 
			
		||||
        // Fill [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sc');
 | 
			
		||||
        await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can delete entries without tags', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/5823'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await createNotebookEntryAndTags(page);
 | 
			
		||||
 | 
			
		||||
        await page.locator('text=To start a new entry, click here or drag and drop any object').click();
 | 
			
		||||
        const entryLocator = `[aria-label="Notebook Entry Input"] >> nth = 1`;
 | 
			
		||||
        await page.locator(entryLocator).click();
 | 
			
		||||
        await page.locator(entryLocator).fill(`An entry without tags`);
 | 
			
		||||
        await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').press('Enter');
 | 
			
		||||
 | 
			
		||||
        await page.hover('[aria-label="Notebook Entry Input"] >> nth=1');
 | 
			
		||||
        await page.locator('button[title="Delete this entry"]').last().click();
 | 
			
		||||
        await expect(page.locator('text=This action will permanently delete this entry. Do you wish to continue?')).toBeVisible();
 | 
			
		||||
        await page.locator('button:has-text("Ok")').click();
 | 
			
		||||
        await expect(page.locator('text=This action will permanently delete this entry. Do you wish to continue?')).toBeHidden();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Can delete objects with tags and neither return in search', async ({ page }) => {
 | 
			
		||||
        await createNotebookEntryAndTags(page);
 | 
			
		||||
        // Delete Notebook
 | 
			
		||||
        await page.locator('button[title="More options"]').click();
 | 
			
		||||
        await page.locator('li[title="Remove this object from its containing object."]').click();
 | 
			
		||||
        await page.locator('button:has-text("OK")').click();
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Fill [aria-label="OpenMCT Search"] input[type="search"]
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Unnamed');
 | 
			
		||||
        await expect(page.locator('text=No results found')).toBeVisible();
 | 
			
		||||
        await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('sci');
 | 
			
		||||
@@ -163,30 +225,13 @@ test.describe('Tagging in Notebooks @addInit', () => {
 | 
			
		||||
    });
 | 
			
		||||
    test('Tags persist across reload', async ({ page }) => {
 | 
			
		||||
        //Go to baseURL
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
 | 
			
		||||
        await createDomainObjectWithDefaults(page, { type: 'Clock' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        const ITERATIONS = 4;
 | 
			
		||||
        await createNotebookEntryAndTags(page, ITERATIONS);
 | 
			
		||||
 | 
			
		||||
        for (let iteration = 0; iteration < ITERATIONS; iteration++) {
 | 
			
		||||
            const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
 | 
			
		||||
            await expect(page.locator(entryLocator)).toContainText("Science");
 | 
			
		||||
            await expect(page.locator(entryLocator)).toContainText("Driving");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.waitForNavigation(),
 | 
			
		||||
            page.goto('./#/browse/mine?hideTree=false'),
 | 
			
		||||
            page.click('.c-disclosure-triangle')
 | 
			
		||||
        ]);
 | 
			
		||||
        // Click Unnamed Clock
 | 
			
		||||
        await page.click('text="Unnamed Clock"');
 | 
			
		||||
 | 
			
		||||
        // Click Unnamed Notebook
 | 
			
		||||
        await page.click('text="Unnamed Notebook"');
 | 
			
		||||
        const notebook = await createNotebookEntryAndTags(page, ITERATIONS);
 | 
			
		||||
        await page.goto(notebook.url);
 | 
			
		||||
 | 
			
		||||
        // Verify tags are present
 | 
			
		||||
        for (let iteration = 0; iteration < ITERATIONS; iteration++) {
 | 
			
		||||
            const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
 | 
			
		||||
            await expect(page.locator(entryLocator)).toContainText("Science");
 | 
			
		||||
@@ -194,19 +239,33 @@ test.describe('Tagging in Notebooks @addInit', () => {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        //Reload Page
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.reload(),
 | 
			
		||||
            page.waitForLoadState('networkidle')
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        // Click Unnamed Notebook
 | 
			
		||||
        await page.click('text="Unnamed Notebook"');
 | 
			
		||||
        await page.reload({ waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        // Verify tags persist across reload
 | 
			
		||||
        for (let iteration = 0; iteration < ITERATIONS; iteration++) {
 | 
			
		||||
            const entryLocator = `[aria-label="Notebook Entry"] >> nth = ${iteration}`;
 | 
			
		||||
            await expect(page.locator(entryLocator)).toContainText("Science");
 | 
			
		||||
            await expect(page.locator(entryLocator)).toContainText("Driving");
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    test('Can cancel adding a tag', async ({ page }) => {
 | 
			
		||||
        await createNotebookAndEntry(page);
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Annotations');
 | 
			
		||||
 | 
			
		||||
        // Click on the "Add Tag" button
 | 
			
		||||
        await page.locator('button:has-text("Add Tag")').click();
 | 
			
		||||
 | 
			
		||||
        // Click inside the AutoComplete field
 | 
			
		||||
        await page.locator('[placeholder="Type to select tag"]').click();
 | 
			
		||||
 | 
			
		||||
        // Click on the "Tags" header (simulating a click outside the autocomplete)
 | 
			
		||||
        await page.locator('div.c-inspect-properties__header:has-text("Tags")').click();
 | 
			
		||||
 | 
			
		||||
        // Verify there is a button with text "Add Tag"
 | 
			
		||||
        await expect(page.locator('button:has-text("Add Tag")')).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Verify the AutoComplete field is hidden
 | 
			
		||||
        await expect(page.locator('[placeholder="Type to select tag"]')).toBeHidden();
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,156 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
* This test suite is dedicated to testing the operator status plugin.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const path = require('path');
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
Precondition: Inject Example User, Operator Status Plugins
 | 
			
		||||
Verify that user 1 sees updates from user/role 2 (Not possible without openmct-yamcs implementation)
 | 
			
		||||
 | 
			
		||||
Clear Role Status of single user test
 | 
			
		||||
STUB (test.fixme) Rolling through each
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
test.describe('Operator Status', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        // FIXME: determine if plugins will be added to index.html or need to be injected
 | 
			
		||||
        // eslint-disable-next-line no-undef
 | 
			
		||||
        await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitExampleUser.js')});
 | 
			
		||||
        // eslint-disable-next-line no-undef
 | 
			
		||||
        await page.addInitScript({ path: path.join(__dirname, '../../../../helper/', 'addInitOperatorStatus.js')});
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // verify that operator status is visible
 | 
			
		||||
    test('operator status is visible and expands when clicked', async ({ page }) => {
 | 
			
		||||
        await expect(page.locator('div[title="Set my operator status"]')).toBeVisible();
 | 
			
		||||
        await page.locator('div[title="Set my operator status"]').click();
 | 
			
		||||
 | 
			
		||||
        // expect default status to be 'GO'
 | 
			
		||||
        await expect(page.locator('.c-status-poll-panel')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('poll question indicator remains when blank poll set', async ({ page }) => {
 | 
			
		||||
        await expect(page.locator('div[title="Set the current poll question"]')).toBeVisible();
 | 
			
		||||
        await page.locator('div[title="Set the current poll question"]').click();
 | 
			
		||||
        // set to blank
 | 
			
		||||
        await page.getByRole('button', { name: 'Update' }).click();
 | 
			
		||||
 | 
			
		||||
        // should still be visible
 | 
			
		||||
        await expect(page.locator('div[title="Set the current poll question"]')).toBeVisible();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Verify that user 1 sees updates from user/role 2 (Not possible without openmct-yamcs implementation)
 | 
			
		||||
    test('operator status table reflects answered values', async ({ page }) => {
 | 
			
		||||
        // user navigates to operator status poll
 | 
			
		||||
        const statusPollIndicator = page.locator('div[title="Set my operator status"]');
 | 
			
		||||
        await statusPollIndicator.click();
 | 
			
		||||
 | 
			
		||||
        // get user role value
 | 
			
		||||
        const userRole = page.locator('.c-status-poll-panel__user-role');
 | 
			
		||||
        const userRoleText = await userRole.innerText();
 | 
			
		||||
 | 
			
		||||
        // get selected status value
 | 
			
		||||
        const selectStatus = page.locator('select[name="setStatus"]');
 | 
			
		||||
        await selectStatus.selectOption({ index: 1});
 | 
			
		||||
        const initialStatusValue = await selectStatus.inputValue();
 | 
			
		||||
 | 
			
		||||
        // open manage status poll
 | 
			
		||||
        const manageStatusPollIndicator = page.locator('div[title="Set the current poll question"]');
 | 
			
		||||
        await manageStatusPollIndicator.click();
 | 
			
		||||
        // parse the table row values
 | 
			
		||||
        const row = page.locator(`tr:has-text("${userRoleText}")`);
 | 
			
		||||
        const rowValues = await row.innerText();
 | 
			
		||||
        const rowValuesArr = rowValues.split('\t');
 | 
			
		||||
        const COLUMN_STATUS_INDEX = 1;
 | 
			
		||||
        // check initial set value matches status table
 | 
			
		||||
        expect(rowValuesArr[COLUMN_STATUS_INDEX].toLowerCase())
 | 
			
		||||
            .toEqual(initialStatusValue.toLowerCase());
 | 
			
		||||
 | 
			
		||||
        // change user status
 | 
			
		||||
        await statusPollIndicator.click();
 | 
			
		||||
        // FIXME: might want to grab a dynamic option instead of arbitrary
 | 
			
		||||
        await page.locator('select[name="setStatus"]').selectOption({ index: 2});
 | 
			
		||||
        const updatedStatusValue = await selectStatus.inputValue();
 | 
			
		||||
        // verify user status is reflected in table
 | 
			
		||||
        await manageStatusPollIndicator.click();
 | 
			
		||||
 | 
			
		||||
        const updatedRow = page.locator(`tr:has-text("${userRoleText}")`);
 | 
			
		||||
        const updatedRowValues = await updatedRow.innerText();
 | 
			
		||||
        const updatedRowValuesArr = updatedRowValues.split('\t');
 | 
			
		||||
 | 
			
		||||
        expect(updatedRowValuesArr[COLUMN_STATUS_INDEX].toLowerCase())
 | 
			
		||||
            .toEqual(updatedStatusValue.toLowerCase());
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('clear poll button removes poll responses', async ({ page }) => {
 | 
			
		||||
        // user navigates to operator status poll
 | 
			
		||||
        const statusPollIndicator = page.locator('div[title="Set my operator status"]');
 | 
			
		||||
        await statusPollIndicator.click();
 | 
			
		||||
 | 
			
		||||
        // get user role value
 | 
			
		||||
        const userRole = page.locator('.c-status-poll-panel__user-role');
 | 
			
		||||
        const userRoleText = await userRole.innerText();
 | 
			
		||||
 | 
			
		||||
        // get selected status value
 | 
			
		||||
        const selectStatus = page.locator('select[name="setStatus"]');
 | 
			
		||||
        // FIXME: might want to grab a dynamic option instead of arbitrary
 | 
			
		||||
        await selectStatus.selectOption({ index: 1});
 | 
			
		||||
        const initialStatusValue = await selectStatus.inputValue();
 | 
			
		||||
 | 
			
		||||
        // open manage status poll
 | 
			
		||||
        const manageStatusPollIndicator = page.locator('div[title="Set the current poll question"]');
 | 
			
		||||
        await manageStatusPollIndicator.click();
 | 
			
		||||
        // parse the table row values
 | 
			
		||||
        const row = page.locator(`tr:has-text("${userRoleText}")`);
 | 
			
		||||
        const rowValues = await row.innerText();
 | 
			
		||||
        const rowValuesArr = rowValues.split('\t');
 | 
			
		||||
        const COLUMN_STATUS_INDEX = 1;
 | 
			
		||||
        // check initial set value matches status table
 | 
			
		||||
        expect(rowValuesArr[COLUMN_STATUS_INDEX].toLowerCase())
 | 
			
		||||
            .toEqual(initialStatusValue.toLowerCase());
 | 
			
		||||
 | 
			
		||||
        // clear the poll
 | 
			
		||||
        await page.locator('button[title="Clear the previous poll question"]').click();
 | 
			
		||||
 | 
			
		||||
        const updatedRow = page.locator(`tr:has-text("${userRoleText}")`);
 | 
			
		||||
        const updatedRowValues = await updatedRow.innerText();
 | 
			
		||||
        const updatedRowValuesArr = updatedRowValues.split('\t');
 | 
			
		||||
        const UNSET_VALUE_LABEL = 'Not set';
 | 
			
		||||
        expect(updatedRowValuesArr[COLUMN_STATUS_INDEX])
 | 
			
		||||
            .toEqual(UNSET_VALUE_LABEL);
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test.fixme('iterate through all possible response values', async ({ page }) => {
 | 
			
		||||
        // test all possible respone values for the poll
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -24,6 +24,7 @@
 | 
			
		||||
Testsuite for plot autoscale.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { selectInspectorTab } = require('../../../../appActions');
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
test.use({
 | 
			
		||||
    viewport: {
 | 
			
		||||
@@ -32,14 +33,14 @@ test.use({
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
test.describe('ExportAsJSON', () => {
 | 
			
		||||
test.describe('Autoscale', () => {
 | 
			
		||||
    test('User can set autoscale with a valid range @snapshot', async ({ page, openmctConfig }) => {
 | 
			
		||||
        const { myItemsFolderName } = openmctConfig;
 | 
			
		||||
 | 
			
		||||
        //This is necessary due to the size of the test suite.
 | 
			
		||||
        test.slow();
 | 
			
		||||
 | 
			
		||||
        await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
        await setTimeRange(page);
 | 
			
		||||
 | 
			
		||||
@@ -47,16 +48,34 @@ test.describe('ExportAsJSON', () => {
 | 
			
		||||
 | 
			
		||||
        await testYTicks(page, ['-1.00', '-0.50', '0.00', '0.50', '1.00']);
 | 
			
		||||
 | 
			
		||||
        // enter edit mode
 | 
			
		||||
        await page.click('button[title="Edit"]');
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Config');
 | 
			
		||||
        await turnOffAutoscale(page);
 | 
			
		||||
 | 
			
		||||
        // Make sure that after turning off autoscale, the user selected range values start at the same values the plot had prior.
 | 
			
		||||
        await testYTicks(page, ['-1.00', '-0.50', '0.00', '0.50', '1.00']);
 | 
			
		||||
        await setUserDefinedMinAndMax(page, '-2', '2');
 | 
			
		||||
 | 
			
		||||
        // save
 | 
			
		||||
        await page.click('button[title="Save"]');
 | 
			
		||||
        await Promise.all([
 | 
			
		||||
            page.locator('li[title = "Save and Finish Editing"]').click(),
 | 
			
		||||
            //Wait for Save Banner to appear
 | 
			
		||||
            page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
        ]);
 | 
			
		||||
        //Wait until Save Banner is gone
 | 
			
		||||
        await page.locator('.c-message-banner__close-button').click();
 | 
			
		||||
        await page.waitForSelector('.c-message-banner__message', { state: 'detached'});
 | 
			
		||||
 | 
			
		||||
        // Make sure that after turning off autoscale, the user entered range values are reflexted in the ticks.
 | 
			
		||||
        await testYTicks(page, ['-2.00', '-1.50', '-1.00', '-0.50', '0.00', '0.50', '1.00', '1.50', '2.00']);
 | 
			
		||||
 | 
			
		||||
        const canvas = page.locator('canvas').nth(1);
 | 
			
		||||
 | 
			
		||||
        await canvas.hover({trial: true});
 | 
			
		||||
        await expect(page.locator('.js-series-data-loaded')).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        expect(await canvas.screenshot()).toMatchSnapshot('autoscale-canvas-prepan.png', { animations: 'disabled' });
 | 
			
		||||
        expect.soft(await canvas.screenshot()).toMatchSnapshot('autoscale-canvas-prepan.png', { animations: 'disabled' });
 | 
			
		||||
 | 
			
		||||
        //Alt Drag Start
 | 
			
		||||
        await page.keyboard.down('Alt');
 | 
			
		||||
@@ -76,11 +95,12 @@ test.describe('ExportAsJSON', () => {
 | 
			
		||||
        await page.keyboard.up('Alt');
 | 
			
		||||
 | 
			
		||||
        // Ensure the drag worked.
 | 
			
		||||
        await testYTicks(page, ['0.00', '0.50', '1.00', '1.50', '2.00']);
 | 
			
		||||
        await testYTicks(page, ['0.00', '0.50', '1.00', '1.50', '2.00', '2.50', '3.00', '3.50']);
 | 
			
		||||
 | 
			
		||||
        //Wait for canvas to stablize.
 | 
			
		||||
        await canvas.hover({trial: true});
 | 
			
		||||
 | 
			
		||||
        expect(await canvas.screenshot()).toMatchSnapshot('autoscale-canvas-panned.png', { animations: 'disabled' });
 | 
			
		||||
        expect.soft(await canvas.screenshot()).toMatchSnapshot('autoscale-canvas-panned.png', { animations: 'disabled' });
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -110,10 +130,10 @@ async function createSinewaveOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
    await page.locator('button:has-text("Create")').click();
 | 
			
		||||
 | 
			
		||||
    // add overlay plot with defaults
 | 
			
		||||
    await page.locator('li:has-text("Overlay Plot")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Overlay Plot")').click();
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation(),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear1
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
@@ -129,10 +149,10 @@ async function createSinewaveOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
    await page.locator('button:has-text("Create")').click();
 | 
			
		||||
 | 
			
		||||
    // add sine wave generator with defaults
 | 
			
		||||
    await page.locator('li:has-text("Sine Wave Generator")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation(),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear1
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
@@ -152,22 +172,20 @@ async function createSinewaveOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function turnOffAutoscale(page) {
 | 
			
		||||
    // enter edit mode
 | 
			
		||||
    await page.locator('text=Unnamed Overlay Plot Snapshot >> button').nth(3).click();
 | 
			
		||||
 | 
			
		||||
    // uncheck autoscale
 | 
			
		||||
    await page.locator('text=Y Axis Label Log mode Auto scale Padding >> input[type="checkbox"] >> nth=1').uncheck();
 | 
			
		||||
    await page.getByRole('checkbox', { name: 'Auto scale' }).uncheck();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
    // save
 | 
			
		||||
    await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1).click();
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.locator('text=Save and Finish Editing').click(),
 | 
			
		||||
        //Wait for Save Banner to appear
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
    //Wait until Save Banner is gone
 | 
			
		||||
    await page.locator('.c-message-banner__close-button').click();
 | 
			
		||||
    await page.waitForSelector('.c-message-banner__message', { state: 'detached'});
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 * @param {string} min
 | 
			
		||||
 * @param {string} max
 | 
			
		||||
 */
 | 
			
		||||
async function setUserDefinedMinAndMax(page, min, max) {
 | 
			
		||||
    // set minimum value
 | 
			
		||||
    await page.getByRole('spinbutton').first().fill(min);
 | 
			
		||||
    // set maximum value
 | 
			
		||||
    await page.getByRole('spinbutton').nth(1).fill(max);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -179,7 +197,7 @@ async function testYTicks(page, values) {
 | 
			
		||||
    let promises = [yTicks.count().then(c => expect(c).toBe(values.length))];
 | 
			
		||||
 | 
			
		||||
    for (let i = 0, l = values.length; i < l; i += 1) {
 | 
			
		||||
        promises.push(expect(yTicks.nth(i)).toHaveText(values[i])); // eslint-disable-line
 | 
			
		||||
        promises.push(expect.soft(yTicks.nth(i)).toHaveText(values[i])); // eslint-disable-line
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    await Promise.all(promises);
 | 
			
		||||
 
 | 
			
		||||
| 
		 Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 18 KiB  | 
| 
		 After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 17 KiB  | 
| 
		 Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 21 KiB  | 
| 
		 After Width: | Height: | Size: 19 KiB  | 
| 
		 Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB  | 
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -26,6 +26,8 @@ necessarily be used for reference when writing new tests in this area.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { selectInspectorTab } = require('../../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('Log plot tests', () => {
 | 
			
		||||
    test('Log Plot ticks are functionally correct in regular and log mode and after refresh', async ({ page, openmctConfig }) => {
 | 
			
		||||
        const { myItemsFolderName } = openmctConfig;
 | 
			
		||||
@@ -36,6 +38,7 @@ test.describe('Log plot tests', () => {
 | 
			
		||||
        await makeOverlayPlot(page, myItemsFolderName);
 | 
			
		||||
        await testRegularTicks(page);
 | 
			
		||||
        await enableEditMode(page);
 | 
			
		||||
        await selectInspectorTab(page, 'Config');
 | 
			
		||||
        await enableLogMode(page);
 | 
			
		||||
        await testLogTicks(page);
 | 
			
		||||
        await disableLogMode(page);
 | 
			
		||||
@@ -73,7 +76,7 @@ test.describe('Log plot tests', () => {
 | 
			
		||||
 */
 | 
			
		||||
async function makeOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
    // fresh page with time range from 2022-03-29 22:00:00.000Z to 2022-03-29 22:00:30.000Z
 | 
			
		||||
    await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
    await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
    // Set a specific time range for consistency, otherwise it will change
 | 
			
		||||
    // on every test to a range based on the current time.
 | 
			
		||||
@@ -88,10 +91,10 @@ async function makeOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
    // create overlay plot
 | 
			
		||||
 | 
			
		||||
    await page.locator('button.c-create-button').click();
 | 
			
		||||
    await page.locator('li:has-text("Overlay Plot")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Overlay Plot")').click();
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation({ waitUntil: 'networkidle'}),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
@@ -106,7 +109,7 @@ async function makeOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
    // create a sinewave generator
 | 
			
		||||
 | 
			
		||||
    await page.locator('button.c-create-button').click();
 | 
			
		||||
    await page.locator('li:has-text("Sine Wave Generator")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
 | 
			
		||||
 | 
			
		||||
    // set amplitude to 6, offset 4, period 2
 | 
			
		||||
 | 
			
		||||
@@ -123,7 +126,7 @@ async function makeOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation({ waitUntil: 'networkidle'}),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
@@ -144,7 +147,7 @@ async function makeOverlayPlot(page, myItemsFolderName) {
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function testRegularTicks(page) {
 | 
			
		||||
    const yTicks = await page.locator('.gl-plot-y-tick-label');
 | 
			
		||||
    const yTicks = page.locator('.gl-plot-y-tick-label');
 | 
			
		||||
    expect(await yTicks.count()).toBe(7);
 | 
			
		||||
    await expect(yTicks.nth(0)).toHaveText('-2');
 | 
			
		||||
    await expect(yTicks.nth(1)).toHaveText('0');
 | 
			
		||||
@@ -159,36 +162,17 @@ async function testRegularTicks(page) {
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function testLogTicks(page) {
 | 
			
		||||
    const yTicks = await page.locator('.gl-plot-y-tick-label');
 | 
			
		||||
    expect(await yTicks.count()).toBe(28);
 | 
			
		||||
    const yTicks = page.locator('.gl-plot-y-tick-label');
 | 
			
		||||
    expect(await yTicks.count()).toBe(9);
 | 
			
		||||
    await expect(yTicks.nth(0)).toHaveText('-2.98');
 | 
			
		||||
    await expect(yTicks.nth(1)).toHaveText('-2.50');
 | 
			
		||||
    await expect(yTicks.nth(2)).toHaveText('-2.00');
 | 
			
		||||
    await expect(yTicks.nth(3)).toHaveText('-1.51');
 | 
			
		||||
    await expect(yTicks.nth(4)).toHaveText('-1.20');
 | 
			
		||||
    await expect(yTicks.nth(5)).toHaveText('-1.00');
 | 
			
		||||
    await expect(yTicks.nth(6)).toHaveText('-0.80');
 | 
			
		||||
    await expect(yTicks.nth(7)).toHaveText('-0.58');
 | 
			
		||||
    await expect(yTicks.nth(8)).toHaveText('-0.40');
 | 
			
		||||
    await expect(yTicks.nth(9)).toHaveText('-0.20');
 | 
			
		||||
    await expect(yTicks.nth(10)).toHaveText('-0.00');
 | 
			
		||||
    await expect(yTicks.nth(11)).toHaveText('0.20');
 | 
			
		||||
    await expect(yTicks.nth(12)).toHaveText('0.40');
 | 
			
		||||
    await expect(yTicks.nth(13)).toHaveText('0.58');
 | 
			
		||||
    await expect(yTicks.nth(14)).toHaveText('0.80');
 | 
			
		||||
    await expect(yTicks.nth(15)).toHaveText('1.00');
 | 
			
		||||
    await expect(yTicks.nth(16)).toHaveText('1.20');
 | 
			
		||||
    await expect(yTicks.nth(17)).toHaveText('1.51');
 | 
			
		||||
    await expect(yTicks.nth(18)).toHaveText('2.00');
 | 
			
		||||
    await expect(yTicks.nth(19)).toHaveText('2.50');
 | 
			
		||||
    await expect(yTicks.nth(20)).toHaveText('2.98');
 | 
			
		||||
    await expect(yTicks.nth(21)).toHaveText('3.50');
 | 
			
		||||
    await expect(yTicks.nth(22)).toHaveText('4.00');
 | 
			
		||||
    await expect(yTicks.nth(23)).toHaveText('4.50');
 | 
			
		||||
    await expect(yTicks.nth(24)).toHaveText('5.31');
 | 
			
		||||
    await expect(yTicks.nth(25)).toHaveText('7.00');
 | 
			
		||||
    await expect(yTicks.nth(26)).toHaveText('8.00');
 | 
			
		||||
    await expect(yTicks.nth(27)).toHaveText('9.00');
 | 
			
		||||
    await expect(yTicks.nth(1)).toHaveText('-1.51');
 | 
			
		||||
    await expect(yTicks.nth(2)).toHaveText('-0.58');
 | 
			
		||||
    await expect(yTicks.nth(3)).toHaveText('-0.00');
 | 
			
		||||
    await expect(yTicks.nth(4)).toHaveText('0.58');
 | 
			
		||||
    await expect(yTicks.nth(5)).toHaveText('1.51');
 | 
			
		||||
    await expect(yTicks.nth(6)).toHaveText('2.98');
 | 
			
		||||
    await expect(yTicks.nth(7)).toHaveText('5.31');
 | 
			
		||||
    await expect(yTicks.nth(8)).toHaveText('9.00');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -196,24 +180,24 @@ async function testLogTicks(page) {
 | 
			
		||||
 */
 | 
			
		||||
async function enableEditMode(page) {
 | 
			
		||||
    // turn on edit mode
 | 
			
		||||
    await page.locator('text=Unnamed Overlay Plot Snapshot >> button').nth(3).click();
 | 
			
		||||
    await expect(await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1)).toBeVisible();
 | 
			
		||||
    await page.getByRole('button', { name: 'Edit' }).click();
 | 
			
		||||
    await expect(page.getByRole('button', { name: 'Save' })).toBeVisible();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function enableLogMode(page) {
 | 
			
		||||
    // turn on log mode
 | 
			
		||||
    await page.locator('text=Y Axis Label Log mode Auto scale Padding >> input[type="checkbox"]').first().check();
 | 
			
		||||
    await expect(page.getByRole('checkbox', { name: 'Log mode' })).not.toBeChecked();
 | 
			
		||||
    await page.getByRole('checkbox', { name: 'Log mode' }).check();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function disableLogMode(page) {
 | 
			
		||||
    // turn off log mode
 | 
			
		||||
    await page.locator('text=Y Axis Label Log mode Auto scale Padding >> input[type="checkbox"]').first().uncheck();
 | 
			
		||||
    await expect(page.getByRole('checkbox', { name: 'Log mode' })).toBeChecked();
 | 
			
		||||
    await page.getByRole('checkbox', { name: 'Log mode' }).uncheck();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2022, United States Government
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
@@ -84,15 +84,15 @@ test.describe('Handle missing object for plots', () => {
 | 
			
		||||
 */
 | 
			
		||||
async function makeStackedPlot(page, myItemsFolderName) {
 | 
			
		||||
    // fresh page with time range from 2022-03-29 22:00:00.000Z to 2022-03-29 22:00:30.000Z
 | 
			
		||||
    await page.goto('./', { waitUntil: 'networkidle' });
 | 
			
		||||
    await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
 | 
			
		||||
    // create stacked plot
 | 
			
		||||
    await page.locator('button.c-create-button').click();
 | 
			
		||||
    await page.locator('li:has-text("Stacked Plot")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Stacked Plot")').click();
 | 
			
		||||
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation({ waitUntil: 'networkidle'}),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
@@ -146,11 +146,11 @@ async function saveStackedPlot(page) {
 | 
			
		||||
async function createSineWaveGenerator(page) {
 | 
			
		||||
    //Create sine wave generator
 | 
			
		||||
    await page.locator('button.c-create-button').click();
 | 
			
		||||
    await page.locator('li:has-text("Sine Wave Generator")').click();
 | 
			
		||||
    await page.locator('li[role="menuitem"]:has-text("Sine Wave Generator")').click();
 | 
			
		||||
 | 
			
		||||
    await Promise.all([
 | 
			
		||||
        page.waitForNavigation({ waitUntil: 'networkidle'}),
 | 
			
		||||
        page.locator('text=OK').click(),
 | 
			
		||||
        page.locator('button:has-text("OK")').click(),
 | 
			
		||||
        //Wait for Save Banner to appear
 | 
			
		||||
        page.waitForSelector('.c-message-banner__message')
 | 
			
		||||
    ]);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										241
									
								
								e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						@@ -0,0 +1,241 @@
 | 
			
		||||
/*****************************************************************************
 | 
			
		||||
 * Open MCT, Copyright (c) 2014-2023, United States Government
 | 
			
		||||
 * as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 * Administration. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 | 
			
		||||
 * "License"); you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 * http://www.apache.org/licenses/LICENSE-2.0.
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 | 
			
		||||
 * License for the specific language governing permissions and limitations
 | 
			
		||||
 * under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * Open MCT includes source code licensed under additional open source
 | 
			
		||||
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 | 
			
		||||
 * this source code distribution or the Licensing information page available
 | 
			
		||||
 * at runtime from the About dialog for additional information.
 | 
			
		||||
 *****************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
Tests to verify log plot functionality. Note this test suite if very much under active development and should not
 | 
			
		||||
necessarily be used for reference when writing new tests in this area.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
const { test, expect } = require('../../../../pluginFixtures');
 | 
			
		||||
const { createDomainObjectWithDefaults, getCanvasPixels, selectInspectorTab, waitForPlotsToRender } = require('../../../../appActions');
 | 
			
		||||
 | 
			
		||||
test.describe('Overlay Plot', () => {
 | 
			
		||||
    test.beforeEach(async ({ page }) => {
 | 
			
		||||
        await page.goto('./', { waitUntil: 'domcontentloaded' });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Plot legend color is in sync with plot series color', async ({ page }) => {
 | 
			
		||||
        const overlayPlot = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Overlay Plot"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto(overlayPlot.url);
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Config');
 | 
			
		||||
 | 
			
		||||
        // navigate to plot series color palette
 | 
			
		||||
        await page.click('.l-browse-bar__actions__edit');
 | 
			
		||||
        await page.locator('li.c-tree__item.menus-to-left .c-disclosure-triangle').click();
 | 
			
		||||
        await page.locator('.c-click-swatch--menu').click();
 | 
			
		||||
        await page.locator('.c-palette__item[style="background: rgb(255, 166, 61);"]').click();
 | 
			
		||||
        // gets color for swatch located in legend
 | 
			
		||||
        const seriesColorSwatch = page.locator('.gl-plot-label > .plot-series-color-swatch');
 | 
			
		||||
        await expect(seriesColorSwatch).toHaveCSS('background-color', 'rgb(255, 166, 61)');
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Limit lines persist when series is moved to another Y Axis and on refresh', async ({ page }) => {
 | 
			
		||||
        test.info().annotations.push({
 | 
			
		||||
            type: 'issue',
 | 
			
		||||
            description: 'https://github.com/nasa/openmct/issues/6338'
 | 
			
		||||
        });
 | 
			
		||||
        // Create an Overlay Plot with a default SWG
 | 
			
		||||
        const overlayPlot = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Overlay Plot"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        const swgA = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto(overlayPlot.url);
 | 
			
		||||
 | 
			
		||||
        // Assert that no limit lines are shown by default
 | 
			
		||||
        await page.waitForSelector('.js-limit-area', { state: 'attached' });
 | 
			
		||||
        expect(await page.locator('.c-plot-limit-line').count()).toBe(0);
 | 
			
		||||
 | 
			
		||||
        // Enter edit mode
 | 
			
		||||
        await page.click('button[title="Edit"]');
 | 
			
		||||
 | 
			
		||||
        // Expand the "Sine Wave Generator" plot series options and enable limit lines
 | 
			
		||||
        await selectInspectorTab(page, 'Config');
 | 
			
		||||
        await page.getByRole('list', { name: 'Plot Series Properties' }).locator('span').first().click();
 | 
			
		||||
        await page.getByRole('list', { name: 'Plot Series Properties' }).locator('[title="Display limit lines"]~div input').check();
 | 
			
		||||
 | 
			
		||||
        await assertLimitLinesExistAndAreVisible(page);
 | 
			
		||||
 | 
			
		||||
        // Save (exit edit mode)
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('li[title="Save and Finish Editing"]').click();
 | 
			
		||||
 | 
			
		||||
        await assertLimitLinesExistAndAreVisible(page);
 | 
			
		||||
 | 
			
		||||
        await page.reload();
 | 
			
		||||
 | 
			
		||||
        await assertLimitLinesExistAndAreVisible(page);
 | 
			
		||||
 | 
			
		||||
        // Enter edit mode
 | 
			
		||||
        await page.click('button[title="Edit"]');
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Elements');
 | 
			
		||||
 | 
			
		||||
        // Drag Sine Wave Generator series from Y Axis 1 into Y Axis 2
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).dragTo(page.locator('[aria-label="Element Item Group Y Axis 2"]'));
 | 
			
		||||
 | 
			
		||||
        await assertLimitLinesExistAndAreVisible(page);
 | 
			
		||||
 | 
			
		||||
        // Save (exit edit mode)
 | 
			
		||||
        await page.locator('button[title="Save"]').click();
 | 
			
		||||
        await page.locator('li[title="Save and Finish Editing"]').click();
 | 
			
		||||
 | 
			
		||||
        await assertLimitLinesExistAndAreVisible(page);
 | 
			
		||||
 | 
			
		||||
        await page.reload();
 | 
			
		||||
 | 
			
		||||
        await assertLimitLinesExistAndAreVisible(page);
 | 
			
		||||
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('The elements pool supports dragging series into multiple y-axis buckets', async ({ page }) => {
 | 
			
		||||
        const overlayPlot = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Overlay Plot"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        const swgA = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
        const swgB = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
        const swgC = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
        const swgD = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
        const swgE = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto(overlayPlot.url);
 | 
			
		||||
        await page.click('button[title="Edit"]');
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Elements');
 | 
			
		||||
 | 
			
		||||
        // Drag swg a, c, e into Y Axis 2
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).dragTo(page.locator('[aria-label="Element Item Group Y Axis 2"]'));
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swgC.name}`).dragTo(page.locator('[aria-label="Element Item Group Y Axis 2"]'));
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swgE.name}`).dragTo(page.locator('[aria-label="Element Item Group Y Axis 2"]'));
 | 
			
		||||
 | 
			
		||||
        // Assert that Y Axis 1 and Y Axis 2 property groups are visible only
 | 
			
		||||
        await selectInspectorTab(page, 'Config');
 | 
			
		||||
 | 
			
		||||
        const yAxis1PropertyGroup = page.locator('[aria-label="Y Axis Properties"]');
 | 
			
		||||
        const yAxis2PropertyGroup = page.locator('[aria-label="Y Axis 2 Properties"]');
 | 
			
		||||
        const yAxis3PropertyGroup = page.locator('[aria-label="Y Axis 3 Properties"]');
 | 
			
		||||
 | 
			
		||||
        await expect(yAxis1PropertyGroup).toBeVisible();
 | 
			
		||||
        await expect(yAxis2PropertyGroup).toBeVisible();
 | 
			
		||||
        await expect(yAxis3PropertyGroup).toBeHidden();
 | 
			
		||||
 | 
			
		||||
        const yAxis1Group = page.getByLabel("Y Axis 1");
 | 
			
		||||
        const yAxis2Group = page.getByLabel("Y Axis 2");
 | 
			
		||||
        const yAxis3Group = page.getByLabel("Y Axis 3");
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Elements');
 | 
			
		||||
 | 
			
		||||
        // Drag swg b into Y Axis 3
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swgB.name}`).dragTo(page.locator('[aria-label="Element Item Group Y Axis 3"]'));
 | 
			
		||||
 | 
			
		||||
        // Assert that all Y Axis property groups are visible
 | 
			
		||||
        await selectInspectorTab(page, 'Config');
 | 
			
		||||
 | 
			
		||||
        await expect(yAxis1PropertyGroup).toBeVisible();
 | 
			
		||||
        await expect(yAxis2PropertyGroup).toBeVisible();
 | 
			
		||||
        await expect(yAxis3PropertyGroup).toBeVisible();
 | 
			
		||||
 | 
			
		||||
        // Verify that the elements are in the correct buckets and in the correct order
 | 
			
		||||
        await selectInspectorTab(page, 'Elements');
 | 
			
		||||
 | 
			
		||||
        expect(yAxis1Group.getByRole('listitem', { name: swgD.name })).toBeTruthy();
 | 
			
		||||
        expect(yAxis1Group.getByRole('listitem').nth(0).getByText(swgD.name)).toBeTruthy();
 | 
			
		||||
        expect(yAxis2Group.getByRole('listitem', { name: swgE.name })).toBeTruthy();
 | 
			
		||||
        expect(yAxis2Group.getByRole('listitem').nth(0).getByText(swgE.name)).toBeTruthy();
 | 
			
		||||
        expect(yAxis2Group.getByRole('listitem', { name: swgC.name })).toBeTruthy();
 | 
			
		||||
        expect(yAxis2Group.getByRole('listitem').nth(1).getByText(swgC.name)).toBeTruthy();
 | 
			
		||||
        expect(yAxis2Group.getByRole('listitem', { name: swgA.name })).toBeTruthy();
 | 
			
		||||
        expect(yAxis2Group.getByRole('listitem').nth(2).getByText(swgA.name)).toBeTruthy();
 | 
			
		||||
        expect(yAxis3Group.getByRole('listitem', { name: swgB.name })).toBeTruthy();
 | 
			
		||||
        expect(yAxis3Group.getByRole('listitem').nth(0).getByText(swgB.name)).toBeTruthy();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    test('Clicking on an item in the elements pool brings up the plot preview with data points', async ({ page }) => {
 | 
			
		||||
        const overlayPlot = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Overlay Plot"
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        const swgA = await createDomainObjectWithDefaults(page, {
 | 
			
		||||
            type: "Sine Wave Generator",
 | 
			
		||||
            parent: overlayPlot.uuid
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        await page.goto(overlayPlot.url);
 | 
			
		||||
        // Wait for plot series data to load and be drawn
 | 
			
		||||
        await waitForPlotsToRender(page);
 | 
			
		||||
        await page.click('button[title="Edit"]');
 | 
			
		||||
 | 
			
		||||
        await selectInspectorTab(page, 'Elements');
 | 
			
		||||
 | 
			
		||||
        await page.locator(`#inspector-elements-tree >> text=${swgA.name}`).click();
 | 
			
		||||
 | 
			
		||||
        const plotPixels = await getCanvasPixels(page, '.js-overlay canvas');
 | 
			
		||||
        const plotPixelSize = plotPixels.length;
 | 
			
		||||
        expect(plotPixelSize).toBeGreaterThan(0);
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Asserts that limit lines exist and are visible
 | 
			
		||||
 * @param {import('@playwright/test').Page} page
 | 
			
		||||
 */
 | 
			
		||||
async function assertLimitLinesExistAndAreVisible(page) {
 | 
			
		||||
    // Wait for plot series data to load
 | 
			
		||||
    await waitForPlotsToRender(page);
 | 
			
		||||
    // Wait for limit lines to be created
 | 
			
		||||
    await page.waitForSelector('.js-limit-area', { state: 'attached' });
 | 
			
		||||
    const limitLineCount = await page.locator('.c-plot-limit-line').count();
 | 
			
		||||
    // There should be 10 limit lines created by default
 | 
			
		||||
    expect(await page.locator('.c-plot-limit-line').count()).toBe(10);
 | 
			
		||||
    for (let i = 0; i < limitLineCount; i++) {
 | 
			
		||||
        await expect(page.locator('.c-plot-limit-line').nth(i)).toBeVisible();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||