Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remote Clock] Wait for first tick and recalculate historical request bounds #5433

Merged
merged 26 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7f6274a
finshed updated to ES6 class
jvigliotta Jun 17, 2022
f9886d9
added request intercept functionality to telemetry api, added a reque…
jvigliotta Jun 17, 2022
4d38d82
added in git error handling so I can build viper locally
jvigliotta Jun 17, 2022
9fedb79
fix typo
jvigliotta Jun 17, 2022
c54f459
da bug n
jvigliotta Jun 17, 2022
24aae5b
da bug n
jvigliotta Jun 17, 2022
ccc134a
da bug n
jvigliotta Jun 17, 2022
1af963a
Merge branch 'release/2.0.5' into telemetry-request-interceptor
jvigliotta Jun 24, 2022
b9bafbe
modifying the interceptor loop
jvigliotta Jun 24, 2022
6f1bb75
modifying request to use await to better track what IS GOING ON
jvigliotta Jun 24, 2022
252e0a3
Merge branch 'release/2.0.5' into telemetry-request-interceptor
ozyx Jul 1, 2022
52e8486
Recalculate bounds if remote-clock not ready
ozyx Jul 1, 2022
9e0e773
teeny tiny lint fix
ozyx Jul 5, 2022
ee5c307
code review comments
ozyx Jul 6, 2022
f66a93e
Fix TelemetryAPI tests
ozyx Jul 6, 2022
7873fbc
Merge branch 'release/2.0.5' into telemetry-request-interceptor
ozyx Jul 6, 2022
158bfae
Fix a bunch of tests
ozyx Jul 6, 2022
a697960
Verify new bounds in e2e instead of unit tests
ozyx Jul 7, 2022
3c5aaec
I accidentally the wrong test
ozyx Jul 7, 2022
72ee1da
Merge branch 'release/2.0.5' into telemetry-request-interceptor
ozyx Jul 7, 2022
f29341b
update test title
ozyx Jul 7, 2022
64b4b35
Merge branch 'release/2.0.5' into telemetry-request-interceptor
akhenry Jul 7, 2022
8da039a
Ensure all arguments make it to the provider
ozyx Jul 7, 2022
da56412
add remoteClock e2e test stub
ozyx Jul 7, 2022
03d59b3
Merge branch 'release/2.0.5' into telemetry-request-interceptor
ozyx Jul 7, 2022
45afaed
Merge branch 'release/2.0.5' into telemetry-request-interceptor
akhenry Jul 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix a bunch of tests
  • Loading branch information
ozyx committed Jul 6, 2022
commit 158bfaeb37ac94935e86979462a776e536060d9f
142 changes: 61 additions & 81 deletions src/plugins/imagery/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,39 +373,30 @@ describe("The Imagery View Layouts", () => {
return Vue.nextTick();
});

it("on mount should show the the most recent image", () => {
it("on mount should show the the most recent image", async () => {
//Looks like we need Vue.nextTick here so that computed properties settle down
return Vue.nextTick(() => {
const imageInfo = getImageInfo(parent);

expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 1].timeId)).not.toEqual(-1);
});
await Vue.nextTick();
const imageInfo = getImageInfo(parent);
expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 1].timeId)).not.toEqual(-1);
});

it("on mount should show the any image layers", (done) => {
it("on mount should show the any image layers", async () => {
//Looks like we need Vue.nextTick here so that computed properties settle down
Vue.nextTick().then(() => {
Vue.nextTick(() => {
const layerEls = parent.querySelectorAll('.js-layer-image');
console.log(layerEls);
expect(layerEls.length).toEqual(1);
done();
});
});
await Vue.nextTick();
const layerEls = parent.querySelectorAll('.js-layer-image');
console.log(layerEls);
expect(layerEls.length).toEqual(1);
});

it("should show the clicked thumbnail as the main image", (done) => {
it("should show the clicked thumbnail as the main image", async () => {
//Looks like we need Vue.nextTick here so that computed properties settle down
Vue.nextTick(() => {
const target = imageTelemetry[5].url;
parent.querySelectorAll(`img[src='${target}']`)[0].click();
Vue.nextTick(() => {
const imageInfo = getImageInfo(parent);
await Vue.nextTick();
const target = imageTelemetry[5].url;
parent.querySelectorAll(`img[src='${target}']`)[0].click();
await Vue.nextTick();
const imageInfo = getImageInfo(parent);

expect(imageInfo.url.indexOf(imageTelemetry[5].timeId)).not.toEqual(-1);
done();
});
});
expect(imageInfo.url.indexOf(imageTelemetry[5].timeId)).not.toEqual(-1);
});

xit("should show that an image is new", (done) => {
Expand All @@ -424,71 +415,60 @@ describe("The Imagery View Layouts", () => {
});
});

it("should show that an image is not new", (done) => {
Vue.nextTick(() => {
const target = imageTelemetry[4].url;
parent.querySelectorAll(`img[src='${target}']`)[0].click();
it("should show that an image is not new", async () => {
await Vue.nextTick();
const target = imageTelemetry[4].url;
parent.querySelectorAll(`img[src='${target}']`)[0].click();

Vue.nextTick(() => {
const imageIsNew = isNew(parent);
await Vue.nextTick();
const imageIsNew = isNew(parent);

expect(imageIsNew).toBeFalse();
done();
});
});
expect(imageIsNew).toBeFalse();
});

it("should navigate via arrow keys", (done) => {
Vue.nextTick(() => {
let keyOpts = {
element: parent.querySelector('.c-imagery'),
key: 'ArrowLeft',
keyCode: 37,
type: 'keyup'
};

simulateKeyEvent(keyOpts);
it("should navigate via arrow keys", async () => {
await Vue.nextTick();
const keyOpts = {
element: parent.querySelector('.c-imagery'),
key: 'ArrowLeft',
keyCode: 37,
type: 'keyup'
};

Vue.nextTick(() => {
const imageInfo = getImageInfo(parent);
simulateKeyEvent(keyOpts);

expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 2].timeId)).not.toEqual(-1);
done();
});
});
await Vue.nextTick();
const imageInfo = getImageInfo(parent);
expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 2].timeId)).not.toEqual(-1);
});

it("should navigate via numerous arrow keys", (done) => {
Vue.nextTick(() => {
let element = parent.querySelector('.c-imagery');
let type = 'keyup';
let leftKeyOpts = {
element,
type,
key: 'ArrowLeft',
keyCode: 37
};
let rightKeyOpts = {
element,
type,
key: 'ArrowRight',
keyCode: 39
};

// left thrice
simulateKeyEvent(leftKeyOpts);
simulateKeyEvent(leftKeyOpts);
simulateKeyEvent(leftKeyOpts);
// right once
simulateKeyEvent(rightKeyOpts);

Vue.nextTick(() => {
const imageInfo = getImageInfo(parent);
it("should navigate via numerous arrow keys", async () => {
await Vue.nextTick();
const element = parent.querySelector('.c-imagery');
const type = 'keyup';
const leftKeyOpts = {
element,
type,
key: 'ArrowLeft',
keyCode: 37
};
const rightKeyOpts = {
element,
type,
key: 'ArrowRight',
keyCode: 39
};

// left thrice
simulateKeyEvent(leftKeyOpts);
simulateKeyEvent(leftKeyOpts);
simulateKeyEvent(leftKeyOpts);
// right once
simulateKeyEvent(rightKeyOpts);

expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 3].timeId)).not.toEqual(-1);
done();
});
});
await Vue.nextTick();
const imageInfo = getImageInfo(parent);
expect(imageInfo.url.indexOf(imageTelemetry[COUNT - 3].timeId)).not.toEqual(-1);
});
it ('shows an auto scroll button when scroll to left', (done) => {
Vue.nextTick(() => {
Expand Down
98 changes: 36 additions & 62 deletions src/plugins/telemetryTable/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe("the plugin", () => {
let tableInstance;
let mockClock;

beforeEach(() => {
beforeEach(async () => {
openmct.time.timeSystem('utc', {
start: 0,
end: 4
Expand Down Expand Up @@ -210,16 +210,8 @@ describe("the plugin", () => {
'some-other-key': 'some-other-value 3'
}
];
let telemetryPromiseResolve;
let telemetryPromise = new Promise((resolve) => {
telemetryPromiseResolve = resolve;
});

historicalProvider.request = () => {
telemetryPromiseResolve(testTelemetry);

return telemetryPromise;
};
historicalProvider.request = () => Promise.resolve(testTelemetry);

openmct.router.path = [testTelemetryObject];

Expand All @@ -230,7 +222,7 @@ describe("the plugin", () => {

tableInstance = tableView.getTable();

return telemetryPromise.then(() => Vue.nextTick());
await Vue.nextTick();
});

afterEach(() => {
Expand All @@ -255,13 +247,10 @@ describe("the plugin", () => {

});

it("Renders a row for every telemetry datum returned", (done) => {
it("Renders a row for every telemetry datum returned", async () => {
let rows = element.querySelectorAll('table.c-telemetry-table__body tr');
Vue.nextTick(() => {
expect(rows.length).toBe(3);

done();
});
await Vue.nextTick();
expect(rows.length).toBe(3);
});

it("Renders a column for every item in telemetry metadata", () => {
Expand All @@ -273,7 +262,7 @@ describe("the plugin", () => {
expect(headers[3].innerText).toBe('Another attribute');
});

it("Supports column reordering via drag and drop", () => {
it("Supports column reordering via drag and drop", async () => {
let columns = element.querySelectorAll('tr.c-telemetry-table__headers__labels th');
let fromColumn = columns[0];
let toColumn = columns[1];
Expand All @@ -292,54 +281,43 @@ describe("the plugin", () => {
toColumn.dispatchEvent(dragOverEvent);
toColumn.dispatchEvent(dropEvent);

return Vue.nextTick().then(() => {
columns = element.querySelectorAll('tr.c-telemetry-table__headers__labels th');
let firstColumn = columns[0];
let secondColumn = columns[1];
let firstColumnText = firstColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
let secondColumnText = secondColumn.querySelector('span.c-telemetry-table__headers__label').innerText;

expect(fromColumnText).not.toEqual(firstColumnText);
expect(fromColumnText).toEqual(secondColumnText);
expect(toColumnText).not.toEqual(secondColumnText);
expect(toColumnText).toEqual(firstColumnText);
});
await Vue.nextTick();
columns = element.querySelectorAll('tr.c-telemetry-table__headers__labels th');
let firstColumn = columns[0];
let secondColumn = columns[1];
let firstColumnText = firstColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
let secondColumnText = secondColumn.querySelector('span.c-telemetry-table__headers__label').innerText;
expect(fromColumnText).not.toEqual(firstColumnText);
expect(fromColumnText).toEqual(secondColumnText);
expect(toColumnText).not.toEqual(secondColumnText);
expect(toColumnText).toEqual(firstColumnText);
});

it("Supports filtering telemetry by regular text search", () => {
it("Supports filtering telemetry by regular text search", async () => {
tableInstance.tableRows.setColumnFilter("some-key", "1");
await Vue.nextTick();
let filteredRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');

return Vue.nextTick().then(() => {
let filteredRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');

expect(filteredRowElements.length).toEqual(1);

tableInstance.tableRows.setColumnFilter("some-key", "");

return Vue.nextTick().then(() => {
let allRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');
expect(filteredRowElements.length).toEqual(1);
tableInstance.tableRows.setColumnFilter("some-key", "");
await Vue.nextTick();

expect(allRowElements.length).toEqual(3);
});
});
let allRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');
expect(allRowElements.length).toEqual(3);
});

it("Supports filtering using Regex", () => {
it("Supports filtering using Regex", async () => {
tableInstance.tableRows.setColumnRegexFilter("some-key", "^some-value$");
await Vue.nextTick();
let filteredRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');

return Vue.nextTick().then(() => {
let filteredRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');

expect(filteredRowElements.length).toEqual(0);

tableInstance.tableRows.setColumnRegexFilter("some-key", "^some-value");
expect(filteredRowElements.length).toEqual(0);

return Vue.nextTick().then(() => {
let allRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');
tableInstance.tableRows.setColumnRegexFilter("some-key", "^some-value");
await Vue.nextTick();
let allRowElements = element.querySelectorAll('table.c-telemetry-table__body tr');

expect(allRowElements.length).toEqual(3);
});
});
expect(allRowElements.length).toEqual(3);
});

it("displays the correct number of column headers when the configuration is mutated", async () => {
Expand Down Expand Up @@ -402,15 +380,14 @@ describe("the plugin", () => {
expect(element.querySelector('div.c-table.is-paused')).not.toBeNull();

const currentBounds = openmct.time.bounds();

await Vue.nextTick();
const newBounds = {
start: currentBounds.start,
end: currentBounds.end - 3
};

// Manually change the time bounds
openmct.time.bounds(newBounds);

await Vue.nextTick();

// Verify table is no longer paused
Expand All @@ -428,19 +405,18 @@ describe("the plugin", () => {

// Pause by button
viewContext.togglePauseByButton();

await Vue.nextTick();

// Verify table is paused
expect(element.querySelector('div.c-table.is-paused')).not.toBeNull();

const currentBounds = openmct.time.bounds();
await Vue.nextTick();

const newBounds = {
start: currentBounds.start,
end: currentBounds.end - 3
end: currentBounds.end - 1
};

// Manually change the time bounds
openmct.time.bounds(newBounds);

Expand All @@ -449,8 +425,6 @@ describe("the plugin", () => {
// Verify table is no longer paused
expect(element.querySelector('div.c-table.is-paused')).toBeNull();

await Vue.nextTick();

// Verify table displays the correct number of rows within the new bounds
const tableRows = element.querySelectorAll('table.c-telemetry-table__body > tbody > tr');
expect(tableRows.length).toEqual(2);
Expand Down