mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 08:03:49 +00:00
add some basic object path label tests
This commit is contained in:
@ -28,12 +28,19 @@ test.describe('Comps', () => {
|
|||||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Basic Functionality Works', async ({ page }) => {
|
test('Basic Functionality Works', async ({ page, openmctConfig }) => {
|
||||||
|
const folder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
|
||||||
// Create the comps with defaults
|
// Create the comps with defaults
|
||||||
const comp = await createDomainObjectWithDefaults(page, { type: 'Derived Telemetry' });
|
const comp = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Derived Telemetry',
|
||||||
|
parent: folder.uuid
|
||||||
|
});
|
||||||
|
|
||||||
// Create a sine wave generator within the comp
|
// Create a sine wave generator within the comp
|
||||||
await createDomainObjectWithDefaults(page, {
|
const sineWaveGenerator1 = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Sine Wave Generator',
|
type: 'Sine Wave Generator',
|
||||||
parent: comp.uuid
|
parent: comp.uuid
|
||||||
});
|
});
|
||||||
@ -65,12 +72,22 @@ test.describe('Comps', () => {
|
|||||||
// should be a number
|
// should be a number
|
||||||
expect(parseFloat(testValue)).not.toBeNaN();
|
expect(parseFloat(testValue)).not.toBeNaN();
|
||||||
|
|
||||||
|
// Check that object path is correct
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
let objectPath = await page.getByLabel(`${sineWaveGenerator1.name} Object Path`).textContent();
|
||||||
|
const expectedObjectPath = `/${myItemsFolderName}/${folder.name}/${comp.name}/${sineWaveGenerator1.name}`;
|
||||||
|
expect(objectPath).toBe(expectedObjectPath);
|
||||||
|
|
||||||
// Check that the comps are saved
|
// Check that the comps are saved
|
||||||
await page.getByLabel('Save').click();
|
await page.getByLabel('Save').click();
|
||||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||||
const expression = await page.getByLabel('Expression', { exact: true }).textContent();
|
const expression = await page.getByLabel('Expression', { exact: true }).textContent();
|
||||||
expect(expression).toBe('b*2');
|
expect(expression).toBe('b*2');
|
||||||
|
|
||||||
|
// Check that object path is still correct after save
|
||||||
|
objectPath = await page.getByLabel(`${sineWaveGenerator1.name} Object Path`).textContent();
|
||||||
|
expect(objectPath).toBe(expectedObjectPath);
|
||||||
|
|
||||||
// Check that comps work after being saved
|
// Check that comps work after being saved
|
||||||
testValue = await page.getByLabel('Current Output Value').textContent();
|
testValue = await page.getByLabel('Current Output Value').textContent();
|
||||||
expect(testValue).not.toBe('10');
|
expect(testValue).not.toBe('10');
|
||||||
|
@ -71,7 +71,10 @@
|
|||||||
/>
|
/>
|
||||||
<div v-else class="--em">{{ parameter.name }}</div>
|
<div v-else class="--em">{{ parameter.name }}</div>
|
||||||
<span class="c-test-datum__string">=</span>
|
<span class="c-test-datum__string">=</span>
|
||||||
<span class="c-comps__path-and-field">
|
<span
|
||||||
|
class="c-comps__path-and-field"
|
||||||
|
:aria-label="`Reference ${parameter.name} Object Path`"
|
||||||
|
>
|
||||||
<ObjectPathString
|
<ObjectPathString
|
||||||
:domain-object="compsManager.getTelemetryObjectForParameter(parameter.keyString)"
|
:domain-object="compsManager.getTelemetryObjectForParameter(parameter.keyString)"
|
||||||
:show-object-itself="true"
|
:show-object-itself="true"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<div
|
<div
|
||||||
v-if="orderedPath.length"
|
v-if="orderedPath.length"
|
||||||
class="c-object-path-string"
|
class="c-object-path-string"
|
||||||
:aria-label="`${domainObject.name}`"
|
:aria-label="`${domainObject.name} Object Path`"
|
||||||
role="navigation"
|
role="navigation"
|
||||||
>
|
>
|
||||||
{{ orderedPathStr }}
|
{{ orderedPathStr }}
|
||||||
@ -32,8 +32,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import ObjectLabel from './ObjectLabel.vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
inject: ['openmct'],
|
inject: ['openmct'],
|
||||||
props: {
|
props: {
|
||||||
@ -115,7 +113,6 @@ export default {
|
|||||||
|
|
||||||
this.orderedPath.forEach((pathObject) => {
|
this.orderedPath.forEach((pathObject) => {
|
||||||
this.orderedPathStr = this.orderedPathStr.concat('/').concat(pathObject.domainObject.name);
|
this.orderedPathStr = this.orderedPathStr.concat('/').concat(pathObject.domainObject.name);
|
||||||
// this.addNameListenerFor(pathObject.domainObject);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user