finishing up main views tests and updating some providers to fix errors

This commit is contained in:
Jamie V 2025-02-20 16:07:55 -08:00
parent efd7369a10
commit a207e97203
4 changed files with 42 additions and 14 deletions

View File

@ -1,3 +1,5 @@
/* eslint-disable playwright/no-conditional-in-test */
/* eslint-disable playwright/no-conditional-expect */
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2024, United States Government
* as represented by the Administrator of the National Aeronautics and Space
@ -96,7 +98,7 @@ const viewsTabsMatrix = {
},
'Overlay Plot': {
Browse: ['Properties', 'Config', 'Annotations'],
Edit: ['Config', 'Elements', 'Styles', 'Properties']
Edit: ['Config', 'Elements', 'Styles', 'Filters', 'Properties']
},
'Scatter Plot': {
Browse: ['Properties', 'Config', 'Elements'],
@ -106,7 +108,7 @@ const viewsTabsMatrix = {
Browse: ['Properties', 'Annotations']
},
'Stacked Plot': {
Browse: ['Properties', 'Config', 'Annotations'],
Browse: ['Properties', 'Config', 'Annotations', 'Elements'],
Edit: ['Config', 'Elements', 'Styles', 'Properties']
},
'Tabs View': {
@ -115,7 +117,7 @@ const viewsTabsMatrix = {
},
'Telemetry Table': {
Browse: ['Properties', 'Config', 'Elements'],
Edit: ['Config', 'Elements', 'Styles', 'Properties']
Edit: ['Config', 'Elements', 'Styles', 'Filters', 'Properties']
},
'Time List': {
Browse: ['Properties', 'Config', 'Elements'],
@ -178,7 +180,7 @@ const viewsTabsMatrix = {
// }
// };
test.describe.only('Inspector tests', () => {
test.describe('Inspector tests', () => {
test.beforeEach(async ({ page }) => {
await page.goto('./', { waitUntil: 'domcontentloaded' });
});
@ -237,17 +239,31 @@ test.describe.only('Inspector tests', () => {
);
await page.goto(objectInfo.url);
// add object if necessary
// eslint-disable-next-line playwright/no-conditional-in-test
if (!noCompositionViews.includes(view)) {
// add object
}
// verify correct number of tabs for browse mode
expect(await page.getByRole('tab').count()).toBe(Object.keys(viewConfig.Browse).length);
// verify correct order of tabs for browse mode
for (const [index, value] of Object.entries(viewConfig.Browse)) {
const tab = page.getByRole('tab').nth(index);
await expect(tab).toHaveText(value);
}
// enter Edit if necessary
// check that the tabs are visible
// check that the tabs are in the correct order
if (viewConfig.Edit) {
await page.getByLabel('Edit Object').click();
// verify correct number of tabs for edit mode
expect(await page.getByRole('tab').count()).toBe(Object.keys(viewConfig.Edit).length);
// verify correct order of tabs for edit mode
for (const [index, value] of Object.entries(viewConfig.Edit)) {
const tab = page.getByRole('tab').nth(index);
await expect(tab).toHaveText(value);
}
await page.getByLabel('Save').first().click();
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
}
}
});
});

View File

@ -52,6 +52,7 @@ export default function AnnotationsViewProvider(openmct) {
const selectionContext = selection?.[0]?.[0]?.context;
const domainObject = selectionContext?.item;
const isNotebookEntry = selectionContext?.type === 'notebook-entry-selection';
const isConditionSet = domainObject?.type === 'conditionSet';
return {
show: function (element) {
@ -75,7 +76,15 @@ export default function AnnotationsViewProvider(openmct) {
_destroy = destroy;
},
priority: function () {
return isNotebookEntry ? openmct.priority.HIGH + 1 : openmct.priority.DEFAULT;
if (isNotebookEntry) {
return openmct.priority.HIGH + 1;
}
if (isConditionSet) {
return openmct.priority.LOW;
}
return openmct.priority.DEFAULT;
},
destroy: function () {
if (_destroy) {

View File

@ -58,7 +58,7 @@ export default function PropertiesViewProvider(openmct) {
_destroy = destroy;
},
priority: function () {
return openmct.editor.isEditing() ? openmct.priority.LOW : openmct.priority.HIGH;
return openmct.editor.isEditing() ? openmct.priority.LOW : openmct.priority.HIGH + 2;
},
destroy: function () {
if (_destroy) {

View File

@ -38,6 +38,9 @@ const NON_STYLABLE_TYPES = [
'notebook',
'restricted-notebook',
'summary-widget',
'time-strip',
'timelist',
'timer',
'webPage'
];