mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 07:16:39 +00:00
fix(e2e): Stabilize ITC tests (#6933)
* fix(ITC): initialize ITC in `created()` hook * fix(e2e): stabilize ITC tests * docs: add JSDocs * refactor: lint:fix * test(e2e): add comment and assertion * refactor: lint:fix
This commit is contained in:
parent
6c92e31036
commit
f21685e216
@ -480,8 +480,18 @@ async function setEndOffset(page, offset) {
|
|||||||
await setTimeConductorOffset(page, offset);
|
await setTimeConductorOffset(page, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the time conductor bounds in fixed time mode
|
||||||
|
*
|
||||||
|
* NOTE: Unless explicitly testing the Time Conductor itself, it is advised to instead
|
||||||
|
* navigate directly to the object with the desired time bounds using `navigateToObjectWithFixedTimeBounds()`.
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
async function setTimeConductorBounds(page, startDate, endDate) {
|
async function setTimeConductorBounds(page, startDate, endDate) {
|
||||||
// Bring up the time conductor popup
|
// Bring up the time conductor popup
|
||||||
|
expect(await page.locator('.l-shell__time-conductor.c-compact-tc').count()).toBe(1);
|
||||||
await page.click('.l-shell__time-conductor.c-compact-tc');
|
await page.click('.l-shell__time-conductor.c-compact-tc');
|
||||||
|
|
||||||
await setTimeBounds(page, startDate, endDate);
|
await setTimeBounds(page, startDate, endDate);
|
||||||
@ -489,20 +499,31 @@ async function setTimeConductorBounds(page, startDate, endDate) {
|
|||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the independent time conductor bounds in fixed time mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
async function setIndependentTimeConductorBounds(page, startDate, endDate) {
|
async function setIndependentTimeConductorBounds(page, startDate, endDate) {
|
||||||
// Activate Independent Time Conductor in Fixed Time Mode
|
// Activate Independent Time Conductor in Fixed Time Mode
|
||||||
await page.getByRole('switch').click();
|
await page.getByRole('switch').click();
|
||||||
|
|
||||||
// Bring up the time conductor popup
|
// Bring up the time conductor popup
|
||||||
await page.click('.c-conductor-holder--compact .c-compact-tc');
|
await page.click('.c-conductor-holder--compact .c-compact-tc');
|
||||||
|
await expect(page.locator('.itc-popout')).toBeInViewport();
|
||||||
await expect(page.locator('.itc-popout')).toBeVisible();
|
|
||||||
|
|
||||||
await setTimeBounds(page, startDate, endDate);
|
await setTimeBounds(page, startDate, endDate);
|
||||||
|
|
||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the bounds of the visible conductor in fixed time mode
|
||||||
|
* @param {import('@playwright/test').Page} page
|
||||||
|
* @param {string} startDate
|
||||||
|
* @param {string} endDate
|
||||||
|
*/
|
||||||
async function setTimeBounds(page, startDate, endDate) {
|
async function setTimeBounds(page, startDate, endDate) {
|
||||||
if (startDate) {
|
if (startDate) {
|
||||||
// Fill start time
|
// Fill start time
|
||||||
|
@ -91,8 +91,10 @@ test.describe('Plot Tagging', () => {
|
|||||||
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
await expect(page.getByText('No tags to display for this item')).toBeVisible();
|
||||||
|
|
||||||
const canvas = page.locator('canvas').nth(1);
|
const canvas = page.locator('canvas').nth(1);
|
||||||
|
|
||||||
//Wait for canvas to stabilize.
|
//Wait for canvas to stabilize.
|
||||||
|
await waitForPlotsToRender(page);
|
||||||
|
|
||||||
|
await expect(canvas).toBeInViewport();
|
||||||
await canvas.hover({ trial: true });
|
await canvas.hover({ trial: true });
|
||||||
|
|
||||||
// click on the tagged plot point
|
// click on the tagged plot point
|
||||||
|
@ -194,7 +194,7 @@ export default {
|
|||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
created() {
|
||||||
this.initialize();
|
this.initialize();
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
|
Loading…
Reference in New Issue
Block a user