Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Telemetry Tables] e2e Test to make sure changing sort order in limited mode makes another request #488

Merged
merged 7 commits into from
Nov 5, 2024
24 changes: 24 additions & 0 deletions tests/e2e/yamcs/telemetryTables.e2e.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,30 @@ test.describe("Telemetry Tables tests @yamcs", () => {
await expect(page.getByRole('button', { name: 'SHOW LIMITED' })).toBeVisible();
});

test('Changing sort order in limited mode triggers a new request', async ({ page }) => {
// Set up request promise for an events request in descending order
const eventRequestOrderDescending = page.waitForRequest(/.*\/api\/.*\/events.*order=desc$/);

// Navigate to the Events table
await page.getByLabel('Navigate to Events yamcs.').click();
Copy link
Collaborator

@unlikelyzero unlikelyzero Nov 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works, but the following would be better

await page.goto(./events, { waitUntil: 'networkidle' }) 

await page.waitForLoadState('networkidle');
jvigliotta marked this conversation as resolved.
Show resolved Hide resolved

// Wait for and verify that the request was made
await expect(eventRequestOrderDescending).resolves.toBeTruthy();

// Assert that the 'SHOW UNLIMITED' button is visible (we are in limited mode)
await expect(page.getByRole('button', { name: 'SHOW UNLIMITED' })).toBeVisible();

// Set up request promise before clicking to change sort order
const eventRequestOrderAscending = page.waitForRequest(/.*\/api\/.*\/events.*order=asc$/);

// flip sort order
await page.locator('thead div').filter({ hasText: 'Generation Time' }).click();

// Wait for and verify that the request was made
await expect(eventRequestOrderAscending).resolves.toBeTruthy();
});

test('Telemetry tables are sorted in desc order correctly', async ({ page }) => {
await setRealTimeMode(page);

Expand Down
Loading