Skip to content

Commit bfd0ab4

Browse files
authored
chore(e2e-tests): add waitForAnimations for document results (#7210)
1 parent 547f2e7 commit bfd0ab4

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

packages/compass-crud/src/components/table-view/document-table-view.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ class DocumentTableView extends React.Component<DocumentTableViewProps> {
10041004
'document-table-view-container',
10051005
this.props.darkMode && 'document-table-view-container-darkmode'
10061006
)}
1007+
data-testid="document-list"
10071008
>
10081009
<div className={cx('ag-parent', this.props.className)}>
10091010
<BreadcrumbComponent

packages/compass-crud/src/components/virtualized-document-json-view.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const VirtualizedDocumentJsonView: React.FC<
111111
renderItem={renderItem}
112112
estimateItemInitialHeight={estimateDocumentInitialHeight}
113113
rowGap={spacing[200]}
114+
dataTestId="document-list"
114115
itemDataTestId="document-json-item"
115116
// Keeping the overscanCount low here helps us avoid scroll dangling
116117
// issues

packages/compass-e2e-tests/helpers/commands/run-find.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,15 @@ export async function runFind(
2626
const resultId = await browser.getQueryId(tabName);
2727
return resultId !== initialResultId;
2828
});
29+
30+
if (
31+
tabName === 'Documents' &&
32+
(await browser.$(Selectors.DocumentList).isDisplayed())
33+
) {
34+
// Wait for animations to finish on the document page.
35+
// Because we're virtualizing the list on crud, the query results may
36+
// change after the resultId has changed.
37+
await browser.waitForAnimations(Selectors.DocumentList);
38+
}
2939
}
3040
}

packages/compass-e2e-tests/helpers/selectors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ export const ImportFileOption =
603603
export const DocumentListEntry = '[data-testid="editable-document"]';
604604
export const DocumentJSONEntry = '[data-testid="document-json-item"]';
605605
export const DocumentExpandButton = '[data-testid="expand-document-button"]';
606+
export const DocumentList =
607+
'[data-testid="document-list"] [data-testid="virtual-list-inner-container"]';
606608
export const SelectJSONView = '[data-testid="toolbar-view-json"]';
607609
export const SelectTableView = '[data-testid="toolbar-view-table"]';
608610
export const SelectListView = '[data-testid="toolbar-view-list"]';

0 commit comments

Comments
 (0)