2024-12-17 12:31:35 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
|
|
|
* as represented by the Administrator of the National Aeronautics and Space
|
|
|
|
* Administration. All rights reserved.
|
|
|
|
*
|
|
|
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
* Open MCT includes source code licensed under additional open source
|
|
|
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
|
|
* this source code distribution or the Licensing information page available
|
|
|
|
* at runtime from the About dialog for additional information.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2024-12-17 13:44:49 +01:00
|
|
|
import { createDomainObjectWithDefaults, setTimeConductorBounds } from '../../../../appActions.js';
|
2024-12-17 12:31:35 +01:00
|
|
|
import { expect, test } from '../../../../pluginFixtures.js';
|
|
|
|
|
|
|
|
test.describe('Event Timeline View', () => {
|
|
|
|
let eventTimelineView;
|
2024-12-17 13:44:49 +01:00
|
|
|
let eventGenerator1;
|
2024-12-17 12:31:35 +01:00
|
|
|
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
|
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
|
|
|
|
|
|
|
eventTimelineView = await createDomainObjectWithDefaults(page, {
|
|
|
|
type: 'Time Strip'
|
|
|
|
});
|
|
|
|
|
|
|
|
await createDomainObjectWithDefaults(page, {
|
|
|
|
type: 'Sine Wave Generator',
|
|
|
|
parent: eventTimelineView.uuid
|
|
|
|
});
|
|
|
|
|
2024-12-17 13:44:49 +01:00
|
|
|
eventGenerator1 = await createDomainObjectWithDefaults(page, {
|
2024-12-17 12:31:35 +01:00
|
|
|
type: 'Event Message Generator',
|
|
|
|
parent: eventTimelineView.uuid
|
|
|
|
});
|
|
|
|
|
|
|
|
await createDomainObjectWithDefaults(page, {
|
|
|
|
type: 'Event Message Generator with Acknowledge',
|
|
|
|
parent: eventTimelineView.uuid
|
|
|
|
});
|
2024-12-17 13:44:49 +01:00
|
|
|
|
|
|
|
await setTimeConductorBounds(page, {
|
|
|
|
startDate: '2024-01-01',
|
|
|
|
endDate: '2024-01-01',
|
|
|
|
startTime: '01:01:00',
|
|
|
|
endTime: '01:04:00'
|
|
|
|
});
|
2024-12-17 12:31:35 +01:00
|
|
|
});
|
|
|
|
|
2024-12-17 13:44:49 +01:00
|
|
|
test('Ensure we can build a Time Strip with event', async ({ page }) => {
|
2024-12-17 12:31:35 +01:00
|
|
|
await page.goto(eventTimelineView.url);
|
2024-12-17 13:44:49 +01:00
|
|
|
|
|
|
|
// click on an event
|
2024-12-17 12:31:35 +01:00
|
|
|
await page
|
|
|
|
.getByLabel(eventTimelineView.name)
|
|
|
|
.getByLabel(/PROGRAM ALARM/)
|
|
|
|
.click();
|
|
|
|
|
2024-12-17 13:44:49 +01:00
|
|
|
// click on the event inspector tab
|
|
|
|
await page.getByRole('tab', { name: 'Event' }).click();
|
|
|
|
|
|
|
|
// ensure the event inspector has the the same event
|
|
|
|
await expect(page.getByText(/PROGRAM ALARM/)).toBeVisible();
|
|
|
|
|
|
|
|
// count the event lines
|
|
|
|
const eventWrappersContainer = page.locator('.c-events-tsv__container');
|
|
|
|
const eventWrappers = eventWrappersContainer.locator('.c-events-tsv__event-wrapper');
|
|
|
|
const expectedEventWrappersCount = 25;
|
|
|
|
await expect(eventWrappers).toHaveCount(expectedEventWrappersCount);
|
|
|
|
|
|
|
|
// click on another event
|
|
|
|
await page
|
|
|
|
.getByLabel(eventTimelineView.name)
|
|
|
|
.getByLabel(/pegged/)
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// ensure the tooltip shows up
|
|
|
|
await expect(
|
|
|
|
page.getByRole('tooltip').getByText(/pegged on horizontal velocity/)
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
// and that event appears in the inspector
|
|
|
|
await expect(
|
|
|
|
page.getByLabel('Inspector Views').getByText(/pegged on horizontal velocity/)
|
|
|
|
).toBeVisible();
|
|
|
|
|
|
|
|
// turn on extended lines
|
|
|
|
await page
|
|
|
|
.getByLabel(eventTimelineView.name)
|
|
|
|
.getByRole('button', {
|
|
|
|
name: `Toggle extended event lines overlay for ${eventGenerator1.name}`
|
|
|
|
})
|
|
|
|
.click();
|
|
|
|
|
|
|
|
// count the extended lines
|
|
|
|
const overlayLinesContainer = page.locator('.c-timeline__overlay-lines');
|
|
|
|
const extendedLines = overlayLinesContainer.locator('.c-timeline__extended-line');
|
|
|
|
const expectedCount = 25;
|
|
|
|
await expect(extendedLines).toHaveCount(expectedCount);
|
2024-12-17 12:31:35 +01:00
|
|
|
});
|
|
|
|
});
|