Skip to content

Commit

Permalink
Only load annotations in fixed time mode or frozen (#6866)
Browse files Browse the repository at this point in the history
* fix annotations load to not happen on start

* remove range checking per annotated point

* back to local variable

* reduce tagging size to improve reliability of test

* remove .only

* remove .only

* reduce hz rate for functional test and keep high frequency test in performance

* remove console.debugs

* this test runs pretty fast now

* fix network request tests to match new behavior
  • Loading branch information
scottbell authored Aug 3, 2023
1 parent 676bb81 commit ee6ca11
Show file tree
Hide file tree
Showing 6 changed files with 350 additions and 61 deletions.
13 changes: 12 additions & 1 deletion e2e/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* @property {string} type the type of domain object to create (e.g.: "Sine Wave Generator").
* @property {string} [name] the desired name of the created domain object.
* @property {string | import('../src/api/objects/ObjectAPI').Identifier} [parent] the Identifier or uuid of the parent object.
* @property {Object<string, string>} [customParameters] any additional parameters to be passed to the domain object's form. E.g. '[aria-label="Data Rate (hz)"]': {'0.1'}
*/

/**
Expand Down Expand Up @@ -65,7 +66,10 @@ const { expect } = require('@playwright/test');
* @param {CreateObjectOptions} options
* @returns {Promise<CreatedObjectInfo>} An object containing information about the newly created domain object.
*/
async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine' }) {
async function createDomainObjectWithDefaults(
page,
{ type, name, parent = 'mine', customParameters = {} }
) {
if (!name) {
name = `${type}:${genUuid()}`;
}
Expand Down Expand Up @@ -94,6 +98,13 @@ async function createDomainObjectWithDefaults(page, { type, name, parent = 'mine
await notesInput.fill(page.testNotes);
}

// If there are any further parameters, fill them in
for (const [key, value] of Object.entries(customParameters)) {
const input = page.locator(`form[name="mctForm"] ${key}`);
await input.fill('');
await input.fill(value);
}

// Click OK button and wait for Navigate event
await Promise.all([
page.waitForLoadState(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ test.describe('Display Layout', () => {
test('When multiple plots are contained in a layout, we only ask for annotations once @couchdb', async ({
page
}) => {
await setFixedTimeMode(page);
// Create another Sine Wave Generator
const anotherSineWaveObject = await createDomainObjectWithDefaults(page, {
type: 'Sine Wave Generator'
Expand Down Expand Up @@ -316,10 +317,20 @@ test.describe('Display Layout', () => {

// wait for annotations requests to be batched and requested
await page.waitForLoadState('networkidle');

// Network requests for the composite telemetry with multiple items should be:
// 1. a single batched request for annotations
expect(networkRequests.length).toBe(1);

await setRealTimeMode(page);
networkRequests = [];

await page.reload();

// wait for annotations to not load (if we have any, we've got a problem)
await page.waitForLoadState('networkidle');

// In real time mode, we don't fetch annotations at all
expect(networkRequests.length).toBe(0);
});
});

Expand Down
44 changes: 26 additions & 18 deletions e2e/tests/functional/plugins/plot/tagging.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {
waitForPlotsToRender
} = require('../../../../appActions');

test.describe.fixme('Plot Tagging', () => {
test.describe('Plot Tagging', () => {
/**
* Given a canvas and a set of points, tags the points on the canvas.
* @param {import('@playwright/test').Page} page
Expand All @@ -41,7 +41,7 @@ test.describe.fixme('Plot Tagging', () => {
* @param {Number} yEnd a telemetry item with a plot
* @returns {Promise}
*/
async function createTags({ page, canvas, xEnd, yEnd }) {
async function createTags({ page, canvas, xEnd = 700, yEnd = 480 }) {
await canvas.hover({ trial: true });

//Alt+Shift Drag Start to select some points to tag
Expand Down Expand Up @@ -97,8 +97,8 @@ test.describe.fixme('Plot Tagging', () => {
// click on the tagged plot point
await canvas.click({
position: {
x: 325,
y: 377
x: 100,
y: 100
}
});

Expand Down Expand Up @@ -171,8 +171,6 @@ test.describe.fixme('Plot Tagging', () => {
type: 'issue',
description: 'https://github.com/nasa/openmct/issues/6822'
});
//Test.slow decorator is currently broken. Needs to be fixed in https://github.com/nasa/openmct/issues/5374
test.slow();

const overlayPlot = await createDomainObjectWithDefaults(page, {
type: 'Overlay Plot'
Expand All @@ -181,13 +179,19 @@ test.describe.fixme('Plot Tagging', () => {
const alphaSineWave = await createDomainObjectWithDefaults(page, {
type: 'Sine Wave Generator',
name: 'Alpha Sine Wave',
parent: overlayPlot.uuid
parent: overlayPlot.uuid,
customParameters: {
'[aria-label="Data Rate (hz)"]': '0.01'
}
});

await createDomainObjectWithDefaults(page, {
type: 'Sine Wave Generator',
name: 'Beta Sine Wave',
parent: overlayPlot.uuid
parent: overlayPlot.uuid,
customParameters: {
'[aria-label="Data Rate (hz)"]': '0.02'
}
});

await page.goto(overlayPlot.url);
Expand All @@ -200,9 +204,7 @@ test.describe.fixme('Plot Tagging', () => {

await createTags({
page,
canvas,
xEnd: 700,
yEnd: 480
canvas
});

await setFixedTimeMode(page);
Expand Down Expand Up @@ -232,15 +234,15 @@ test.describe.fixme('Plot Tagging', () => {

test('Tags work with Plot View of telemetry items', async ({ page }) => {
await createDomainObjectWithDefaults(page, {
type: 'Sine Wave Generator'
type: 'Sine Wave Generator',
customParameters: {
'[aria-label="Data Rate (hz)"]': '0.01'
}
});

const canvas = page.locator('canvas').nth(1);
await createTags({
page,
canvas,
xEnd: 700,
yEnd: 480
canvas
});
await basicTagsTests(page);
});
Expand All @@ -253,13 +255,19 @@ test.describe.fixme('Plot Tagging', () => {
const alphaSineWave = await createDomainObjectWithDefaults(page, {
type: 'Sine Wave Generator',
name: 'Alpha Sine Wave',
parent: stackedPlot.uuid
parent: stackedPlot.uuid,
customParameters: {
'[aria-label="Data Rate (hz)"]': '0.01'
}
});

await createDomainObjectWithDefaults(page, {
type: 'Sine Wave Generator',
name: 'Beta Sine Wave',
parent: stackedPlot.uuid
parent: stackedPlot.uuid,
customParameters: {
'[aria-label="Data Rate (hz)"]': '0.02'
}
});

await page.goto(stackedPlot.url);
Expand Down
Loading

0 comments on commit ee6ca11

Please sign in to comment.