Router test fix (#3973)

* removed DEPRECATION warnings
* test fixes
* added spec reporter to debug failing tests  and fixed couple specs
* disabled failFast to see all failing tests
* disabled fail test and  change timeoutInterval to 5000
* removed unused debounce import

Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
Nikhil
2021-10-21 16:55:34 -07:00
committed by GitHub
parent c269e089da
commit 4f8cba160d
26 changed files with 173 additions and 254 deletions

View File

@ -39,10 +39,13 @@ describe("The Compass component", () => {
sunAngle: 30
};
let propsData = {
containerWidth: 600,
containerHeight: 600,
naturalAspectRatio: 0.9,
image: imageDatum
image: imageDatum,
sizedImageDimensions: {
width: 100,
height: 100
},
compassRoseSizingClasses: '--rose-small --rose-min'
};
app = new Vue({
@ -51,13 +54,13 @@ describe("The Compass component", () => {
return propsData;
},
template: `<Compass
:container-width="containerWidth"
:container-height="containerHeight"
:compass-rose-sizing-classes="compassRoseSizingClasses"
:image="image"
:natural-aspect-ratio="naturalAspectRatio"
:image="image" />`
:sized-image-dimensions="sizedImageDimensions"
/>`
});
instance = app.$mount();
});
afterAll(() => {

View File

@ -220,7 +220,7 @@ describe("The Imagery View Layouts", () => {
});
spyOn(openmct.telemetry, 'request').and.returnValue(Promise.resolve([]));
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve(imageryObject));
originalRouterPath = openmct.router.path;
@ -370,18 +370,15 @@ describe("The Imagery View Layouts", () => {
});
});
xit("should show that an image is not new", (done) => {
it("should show that an image is not new", (done) => {
const target = imageTelemetry[2].url;
parent.querySelectorAll(`img[src='${target}']`)[0].click();
Vue.nextTick(() => {
// used in code, need to wait to the 500ms here too
setTimeout(() => {
const imageIsNew = isNew(parent);
const imageIsNew = isNew(parent);
expect(imageIsNew).toBeFalse();
done();
}, REFRESH_CSS_MS);
expect(imageIsNew).toBeFalse();
done();
});
});

View File

@ -96,6 +96,9 @@ export function setDefaultNotebookPageId(pageId) {
export function validateNotebookStorageObject() {
const notebookStorage = getDefaultNotebook();
if (!notebookStorage) {
return true;
}
let valid = false;
if (notebookStorage) {

View File

@ -34,7 +34,7 @@ describe('the plugin', () => {
let countFramesPromise;
beforeEach((done) => {
openmct = createOpenMct(false);
openmct = createOpenMct();
element = document.createElement('div');
child = document.createElement('div');

View File

@ -49,7 +49,7 @@ describe('the plugin', () => {
filter: {},
disableObserve: true
};
openmct = createOpenMct(false);
openmct = createOpenMct();
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
mockIdentifierService = jasmine.createSpyObj(

View File

@ -36,7 +36,15 @@ describe('the plugin', function () {
appHolder.style.width = '640px';
appHolder.style.height = '480px';
openmct = createOpenMct();
const timeSystemOptions = {
timeSystemKey: 'utc',
bounds: {
start: 1597160002854,
end: 1597181232854
}
};
openmct = createOpenMct(timeSystemOptions);
openmct.install(new PlanPlugin());
planDefinition = openmct.types.get('plan').definition;
@ -48,7 +56,6 @@ describe('the plugin', function () {
child.style.width = '640px';
child.style.height = '480px';
element.appendChild(child);
openmct.on('start', done);
openmct.start(appHolder);
});
@ -72,7 +79,6 @@ describe('the plugin', function () {
});
describe('the plan view', () => {
it('provides a plan view', () => {
const testViewObject = {
id: "test-object",
@ -83,7 +89,6 @@ describe('the plugin', function () {
let planView = applicableViews.find((viewProvider) => viewProvider.key === 'plan.view');
expect(planView).toBeDefined();
});
});
describe('the plan view displays activities', () => {
@ -155,12 +160,22 @@ describe('the plugin', function () {
expect(labelEl.innerHTML).toEqual('TEST-GROUP');
});
it('displays the activities and their labels', () => {
const rectEls = element.querySelectorAll('.c-plan__contents rect');
expect(rectEls.length).toEqual(2);
const textEls = element.querySelectorAll('.c-plan__contents text');
expect(textEls.length).toEqual(3);
it('displays the activities and their labels', (done) => {
const bounds = {
start: 1597160002854,
end: 1597181232854
};
openmct.time.bounds(bounds);
Vue.nextTick(() => {
const rectEls = element.querySelectorAll('.c-plan__contents rect');
expect(rectEls.length).toEqual(2);
const textEls = element.querySelectorAll('.c-plan__contents text');
expect(textEls.length).toEqual(3);
done();
});
});
});
});

View File

@ -79,7 +79,15 @@ describe("the plugin", function () {
];
cleanupFirst = [];
openmct = createOpenMct();
const timeSystem = {
timeSystemKey: 'utc',
bounds: {
start: 0,
end: 4
}
};
openmct = createOpenMct(timeSystem);
telemetryPromise = new Promise((resolve) => {
telemetryPromiseResolve = resolve;
@ -146,11 +154,6 @@ describe("the plugin", function () {
disconnect() {}
});
openmct.time.timeSystem("utc", {
start: 0,
end: 4
});
openmct.types.addType("test-object", {
creatable: true
});
@ -165,11 +168,6 @@ describe("the plugin", function () {
});
afterEach((done) => {
openmct.time.timeSystem('utc', {
start: 0,
end: 1
});
// Needs to be in a timeout because plots use a bunch of setTimeouts, some of which can resolve during or after
// teardown, which causes problems
// This is hacky, we should find a better approach here.
@ -418,12 +416,23 @@ describe("the plugin", function () {
expect(legend.length).toBe(6);
});
it("Renders X-axis ticks for the telemetry object", () => {
let xAxisElement = element.querySelectorAll(".gl-plot-axis-area.gl-plot-x .gl-plot-tick-wrapper");
expect(xAxisElement.length).toBe(1);
it("Renders X-axis ticks for the telemetry object", (done) => {
const configId = openmct.objects.makeKeyString(testTelemetryObject.identifier);
const config = configStore.get(configId);
config.xAxis.set('displayRange', {
min: 0,
max: 4
});
let ticks = xAxisElement[0].querySelectorAll(".gl-plot-tick");
expect(ticks.length).toBe(5);
Vue.nextTick(() => {
let xAxisElement = element.querySelectorAll(".gl-plot-axis-area.gl-plot-x .gl-plot-tick-wrapper");
expect(xAxisElement.length).toBe(1);
let ticks = xAxisElement[0].querySelectorAll(".gl-plot-tick");
expect(ticks.length).toBe(5);
done();
});
});
it("Renders Y-axis options for the telemetry object", () => {
@ -780,12 +789,21 @@ describe("the plugin", function () {
expect(legend.length).toBe(6);
});
xit("Renders X-axis ticks for the telemetry object", () => {
it("Renders X-axis ticks for the telemetry object", (done) => {
let xAxisElement = element.querySelectorAll(".gl-plot-axis-area.gl-plot-x .gl-plot-tick-wrapper");
expect(xAxisElement.length).toBe(1);
let ticks = xAxisElement[0].querySelectorAll(".gl-plot-tick");
expect(ticks.length).toBe(5);
config.xAxis.set('displayRange', {
min: 0,
max: 4
});
Vue.nextTick(() => {
let ticks = xAxisElement[0].querySelectorAll(".gl-plot-tick");
expect(ticks.length).toBe(5);
done();
});
});
it("Renders Y-axis ticks for the telemetry object", (done) => {

View File

@ -528,7 +528,6 @@ export default {
if (!this.updatingView) {
this.updatingView = true;
requestAnimationFrame(() => {
let start = 0;
let end = VISIBLE_ROW_COUNT;
let tableRows = this.table.tableRows.getRows();

View File

@ -222,9 +222,13 @@ describe("the plugin", () => {
openmct.router.path = originalRouterPath;
});
it("Renders a row for every telemetry datum returned", () => {
it("Renders a row for every telemetry datum returned", (done) => {
let rows = element.querySelectorAll('table.c-telemetry-table__body tr');
expect(rows.length).toBe(3);
Vue.nextTick(() => {
expect(rows.length).toBe(3);
done();
});
});
it("Renders a column for every item in telemetry metadata", () => {

View File

@ -51,7 +51,15 @@ describe('the plugin', function () {
}
];
openmct = createOpenMct();
const timeSystem = {
timeSystemKey: 'utc',
bounds: {
start: 1597160002854,
end: 1597181232854
}
};
openmct = createOpenMct(timeSystem);
openmct.install(new TimelinePlugin());
objectDef = openmct.types.get('time-strip').definition;
@ -64,11 +72,6 @@ describe('the plugin', function () {
child.style.height = '480px';
element.appendChild(child);
openmct.time.timeSystem('utc', {
start: 1597160002854,
end: 1597181232854
});
openmct.on('start', done);
openmct.startHeadless();
});
@ -88,7 +91,6 @@ describe('the plugin', function () {
});
describe('the time-strip object', () => {
it('is creatable', () => {
expect(objectDef.creatable).toEqual(mockObject.creatable);
});