Skip to content

Commit

Permalink
Merge pull request #2520 from department-of-veterans-affairs/column-o…
Browse files Browse the repository at this point in the history
…rder-test

End to end testing: Report Builder column order
  • Loading branch information
Pelentan authored Aug 16, 2024
2 parents 3a94323 + f6f2d3b commit 836a830
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
8 changes: 5 additions & 3 deletions x-test/end2end/tests/lifecycleSimpleTravel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ test('navigate to Workflow Editor and create a travel workflow', async ({ page }
await page.getByRole('button', { name: 'Save' }).click();

// wait for async request to finish saving
await expect(page.getByRole('button', { name: 'Save' })).not.toBeVisible();
await expect(page.locator('a').filter({ hasText: uniqueText })).toBeVisible();

// Workaround: Since the drag handles can overlap sometimes (maybe due to async rendering
// in the jsPlumb library?), we'll move the requestor step out of the way first.
// TODO: fix the workflow editor since end-users might have the same issue
await expect(page.getByLabel('workflow step: Requestor', { exact: true })).toBeInViewport();
await page.getByLabel('workflow step: Requestor', { exact: true }).hover();
await expect(page.getByLabel('workflow step: Step 1')).not.toBeInViewport();
// Workaround: Set specific position because the workflow step's drag handle overlaps with the connector's handle
await page.getByLabel('workflow step: Requestor', { exact: true }).hover({position: {x: 16, y: 16}});
await page.mouse.down();
await page.mouse.move(0, 150);
await page.mouse.move(250, 400);
await page.mouse.up();

await page.getByRole('button', { name: 'New Step' }).click();
Expand Down
31 changes: 31 additions & 0 deletions x-test/end2end/tests/reportBuilder.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { test, expect } from '@playwright/test';

// When the underlying issue is fixed, we should expect this test to pass.
// Tests should be tagged with an associated ticket or PR reference
test.fail('column order is maintained after modifying the search filter', {tag: '@issue:LEAF-4482'}, async ({ page }, testInfo) => {
await page.goto('https://host.docker.internal/Test_Request_Portal/?a=reports&v=3&query=N4IgLgpgTgtgziAXAbVASwCZJBghmXEAGhDQDsM0BjfAeygEkARbAVmJFoAdo6psAPBxj4qAC2wBOAAyyOAc3wRsAQQByLAL5F0WRDggAbCJCwluvMPWwBeYaImJpJRZFUaQmgLokAVrXIEFB8QOHowJGBtEHkTJnxCFBAAFg4ARjSOdhDDNBg0CMQ02WcQXPywAHkAM2q4EyRpTSA%3D%3D&indicators=NobwRAlgdgJhDGBDALgewE4EkAiYBcYyEyANgKZgA0YUiAthQVWAM4bL4AMAvpeNHCRosuAgBZmtBvjABZAK4kiAAhLQyy5GQAeHam3Qc8ARl79YCFBhwzjxyfUatoAc3Kr1mnXtbt8AJjNICyFrUTAAVgdpAgA5eQZ0BGYDIwBmbgBdIA%3D%3D&sort=N4Ig1gpgniBcIFYQBoQHsBOATCG4hwGcBjEAXyA%3D');

await expect(page.getByLabel('Sort by Numeric')).toBeInViewport();
await expect(page.locator('th').nth(4)).toContainText('Numeric');
// Screenshot the original state
let screenshot = await page.screenshot();
await testInfo.attach('screenshot', { body: screenshot, contentType: 'image/png' });

await page.getByRole('button', { name: 'Modify Search' }).click();
await page.getByLabel('text', { exact: true }).click();
await page.getByLabel('text', { exact: true }).fill('8000');
await page.getByRole('button', { name: 'Next Step' }).click();
await expect(page.getByText('Develop search filter')).not.toBeInViewport();

await page.getByRole('button', { name: 'Generate Report' }).click();
await expect(page.getByText('Select Data Columns')).not.toBeInViewport();
// this is not necessary, but it makes the screenshot look cleaner
await expect(page.getByRole('button', { name: 'Generate Report' })).not.toBeInViewport();

await expect(page.getByLabel('Sort by Numeric')).toBeInViewport();
// Screenshot the new state. The column order should be the same.
screenshot = await page.screenshot();
await testInfo.attach('screenshot', { body: screenshot, contentType: 'image/png' });

await expect(page.locator('th').nth(4)).toContainText('Numeric');
});

0 comments on commit 836a830

Please sign in to comment.