start e2e testing

This commit is contained in:
Scott Bell 2024-12-17 12:31:35 +01:00
parent 36d31973fe
commit 72ff0bced6
3 changed files with 64 additions and 3 deletions

View File

@ -0,0 +1,62 @@
/*****************************************************************************
* 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.
*****************************************************************************/
import { createDomainObjectWithDefaults } from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';
test.describe('Event Timeline View', () => {
let eventTimelineView;
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
});
await createDomainObjectWithDefaults(page, {
type: 'Event Message Generator',
parent: eventTimelineView.uuid
});
await createDomainObjectWithDefaults(page, {
type: 'Event Message Generator with Acknowledge',
parent: eventTimelineView.uuid
});
});
test('Ensure we can build a Time Strip', async ({ page }) => {
await page.goto(eventTimelineView.url);
await page
.getByLabel(eventTimelineView.name)
.getByLabel(/PROGRAM ALARM/)
.click();
await page.getByText('Event', { exact: true }).click({ force: true });
await expect(page.getByText('LMP: 350 feet, down at 4. - [')).toBeVisible();
});
});

View File

@ -34,8 +34,7 @@ class EventTelemetryProvider {
generateData(firstObservedTime, count, startTime, duration, name) {
const millisecondsSinceStart = startTime - firstObservedTime;
const randomFewSeconds = Math.floor(Math.random() * 1000);
const utc = startTime + count + randomFewSeconds * duration;
const utc = startTime + count * duration;
const ind = count % messages.length;
const message = messages[ind] + ' - [' + millisecondsSinceStart + ']';
// pick a random severity level + 1 for an undefined level so we can do nominal

View File

@ -417,7 +417,6 @@ export default {
createEventWrapper(event) {
const id = `${ID_PREFIX}${event.time}`;
const eventWrapper = document.createElement('div');
eventWrapper.ariaLabel = id;
eventWrapper.setAttribute('id', id);
eventWrapper.classList.add(EVENT_WRAPPER_CLASS);
eventWrapper.style.left = `${this.xScale(event.time)}px`;
@ -425,6 +424,7 @@ export default {
eventTickElement.classList.add('c-events-tsv__event-handle');
if (this.titleKey) {
const textToShow = event[this.titleKey];
eventWrapper.ariaLabel = textToShow;
eventWrapper.addEventListener('mouseover', () => {
this.showToolTip(textToShow, eventTickElement);
});