Fix and re-enable disabled unit test suites (#6990)

* fix: register event listeners etc in `created()` hook

* fix: initialize `stalenessSubscription` before composition load and in `created()` hook

* refactor(test): make `openmct` const

* refactor: update overlayPlot spec to Vue 3 and fix tests

* refactor: fix eslint errors

* refactor: move initialization steps to `created()` hook

* test: re-enable and fix stackedPlot test suite

* fix: `hideTree=true` hides the tree again

* fix: add back in check on mount

* test: fix Layout tests

* fix: BarGraph test

* fix: plot inspector tests

* fix: reenable grand search tests

* fix: inspectorStyles test suite

* fix: re-enable most timeline tests

* fix: no need to hideTree in appactions

* fix: re-enable more tests

* test: re-enable more tests

* test: re-enable most plot tests

* chore: `lint:fix`

* test: re-enable timelist suite

* fix(#7016): timers count down or up to a target date

* test: add regression tests to cover disabled unit tests

* refactor: lint:fix

* refactor: no need for momentjs here

* fix: timerAction missed refactor

* fix: ensure timestamp is always UTC string

* test: use role selectors

* docs: add instructions for clock override in e2e

* docs: update

* Update readme

* lint

* spelling fixes

---------

Co-authored-by: Scott Bell <scott@traclabs.com>
Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
Jesse Mazzella
2023-09-05 01:53:03 -07:00
committed by GitHub
parent 9f7b3b9225
commit 0be106f29e
26 changed files with 573 additions and 382 deletions

View File

@@ -20,6 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import mount from 'utils/mount';
import { createOpenMct, resetApplicationState } from 'utils/testing';
import Vue from 'vue';
@@ -27,7 +28,7 @@ import ExampleTagsPlugin from '../../../../example/exampleTags/plugin';
import DisplayLayoutPlugin from '../../../plugins/displayLayout/plugin';
import GrandSearch from './GrandSearch.vue';
xdescribe('GrandSearch', () => {
describe('GrandSearch', () => {
let openmct;
let grandSearchComponent;
let viewContainer;
@@ -42,6 +43,7 @@ xdescribe('GrandSearch', () => {
let originalRouterPath;
let mockNewObject;
let mockObjectProvider;
let _destroy;
beforeEach((done) => {
openmct = createOpenMct();
@@ -186,16 +188,22 @@ xdescribe('GrandSearch', () => {
document.body.appendChild(parent);
viewContainer = document.createElement('div');
parent.append(viewContainer);
grandSearchComponent = new Vue({
el: viewContainer,
components: {
GrandSearch
const { vNode, destroy } = mount(
{
components: {
GrandSearch
},
provide: {
openmct
},
template: '<GrandSearch/>'
},
provide: {
openmct
},
template: '<GrandSearch/>'
}).$mount();
{
element: viewContainer
}
);
grandSearchComponent = vNode.componentInstance;
_destroy = destroy;
await Vue.nextTick();
done();
});
@@ -205,8 +213,7 @@ xdescribe('GrandSearch', () => {
afterEach(() => {
openmct.objects.inMemorySearchProvider.worker = sharedWorkerToRestore;
openmct.router.path = originalRouterPath;
grandSearchComponent.$destroy();
document.body.removeChild(parent);
_destroy();
return resetApplicationState(openmct);
});
@@ -278,7 +285,7 @@ xdescribe('GrandSearch', () => {
it('should preview object search results in edit mode if object clicked', async () => {
await grandSearchComponent.$children[0].searchEverything('Folder');
grandSearchComponent._provided.openmct.router.path = [mockDisplayLayout];
grandSearchComponent.$children[0].openmct.router.path = [mockDisplayLayout];
await Vue.nextTick();
const searchResults = document.querySelectorAll('[name="Test Folder"]');
expect(searchResults.length).toBe(1);
@@ -290,7 +297,7 @@ xdescribe('GrandSearch', () => {
it('should preview annotation search results in edit mode if annotation clicked', async () => {
await grandSearchComponent.$children[0].searchEverything('Dri');
grandSearchComponent._provided.openmct.router.path = [mockDisplayLayout];
grandSearchComponent.$children[0].openmct.router.path = [mockDisplayLayout];
await Vue.nextTick();
const annotationResults = document.querySelectorAll('[aria-label="Search Result"]');
expect(annotationResults.length).toBe(1);