-
Notifications
You must be signed in to change notification settings - Fork 32
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
test: add e2e tests to context menu #1571
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1571 +/- ##
=======================================
Coverage 46.74% 46.74%
=======================================
Files 583 583
Lines 36262 36262
Branches 9072 9072
=======================================
Hits 16951 16951
Misses 19259 19259
Partials 52 52
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why the double context menu and advanced filter are failing... advanced filter looks like it may have gotten stuck to the bottom and then scrolled to the bottom of the grid somehow? Shouldn't happen if you're updating a filter, it should reset to the top...
And the double context menu, maybe just rebase off latest main?
Yea it was pretty funky. There were two errors coming from the tests
|
#1477 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull the changes out for the isStuckToBottom fix #1477 into a separate PR and merge that first.
tests/context-menu.spec.ts-snapshots/advanced-filters-2-chromium-linux.png
Outdated
Show resolved
Hide resolved
tests/context-menu.spec.ts-snapshots/advanced-filters-3-webkit-linux.png
Outdated
Show resolved
Hide resolved
Release notes https://github.com/deephaven/web-client-ui/releases/tag/v0.52.0 # [0.52.0](deephaven/web-client-ui@v0.51.0...v0.52.0) (2023-10-27) ### Bug Fixes * stuck to bottom on filter clear ([#1579](deephaven/web-client-ui#1579)) ([ef52749](deephaven/web-client-ui@ef52749)), closes [#1477](deephaven/web-client-ui#1477) [#1571](deephaven/web-client-ui#1571) [#1571](deephaven/web-client-ui#1571) * Theming - switched from ?inline to ?raw css imports ([#1600](deephaven/web-client-ui#1600)) ([f6d0874](deephaven/web-client-ui@f6d0874)), closes [#1599](deephaven/web-client-ui#1599) ### BREAKING CHANGES * Theme css imports were switched from `?inline` to `?raw`. Not likely that we have any consumers yet, but this would impact webpack config. Co-authored-by: deephaven-internal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, some suggestions for possible cleanup/renaming of methods.
async function openAdvancedFilters(page: Page) { | ||
await page | ||
.locator('.iris-grid .grid-wrapper') | ||
.click({ button: 'right', position: { x: 20, y: 20 } }); | ||
await page.getByRole('button', { name: 'Advanced Filters' }).click(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method does open advanced filters, but it just seems to be doing just the first column of the first grid (e.g. you can't pass in a specific column or even a specific grid to open the advanced filter on). I'd rather be more specific with the name of the function (e.g. openFirstAdvancedFilters
), or allow passing in the grid locator and an optional offset, e.g.:
/**
* Open advanced filters for a grid.
* @param gridLocator Locator to specify which grid to open the advanced filters on
* @param xOffset Offset of the column to open advanced filters for. Defaults to the first column.
*/
async function openAdvancedFilters(gridLocator: Locator, xOffset = 20)
...
}
async function moveMouseAwayFromTable(page: Page) { | ||
await page.mouse.move(0, 0); | ||
await page.mouse.click(0, 0); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly with this method - you're using it to move the mouse away from the table, but the actual function is just trying to reset the mouse position and focus. I'd probably do something like:
async function resetMousePosition(page: Page, resetFocus = true) {
await page.mouse.move(0, 0);
if (resetFocus) {
await page.mouse.click(0, 0);
}
}
await page.goto(''); | ||
|
||
const consoleInput = page.locator('.console-input'); | ||
|
||
const command = makeTableCommand(tableName, TableTypes.AllTypes); | ||
|
||
await pasteInMonaco(consoleInput, command); | ||
await page.keyboard.press('Enter'); | ||
|
||
// Wait for the panel to show | ||
await expect(page.locator('.iris-grid-panel')).toHaveCount(1); | ||
|
||
// Wait until it's done loading | ||
await expect(page.locator('.iris-grid-panel .loading-spinner')).toHaveCount( | ||
0 | ||
); | ||
|
||
// Model is loaded, need to make sure table data is also loaded | ||
await waitForLoadingDone(page); | ||
|
||
const tableOperationsMenu = page.locator( | ||
'data-testid=btn-iris-grid-settings-button-table' | ||
); | ||
await tableOperationsMenu.click(); | ||
|
||
// Wait for Table Options menu to show | ||
await expect(page.locator('.table-sidebar')).toHaveCount(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly the same setup as in table-operations.spec.ts
. We could refactor this into a utility method used by both, but I think in this case I would rather just move these table specific context menu tests to table-operations.spec.ts
(since we're really testing the table operations here, we're just accessing them from the context menu).
Closes #1379
Note: Wait for #1579 to merge first before merging this in