Skip to content

Commit 4de4d0f

Browse files
committed
chore(e2e-tests): add waitForAnimations for document results
1 parent 2f4577b commit 4de4d0f

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
@@ -1005,6 +1005,7 @@ class DocumentTableView extends React.Component<DocumentTableViewProps> {
10051005
'document-table-view-container',
10061006
this.props.darkMode && 'document-table-view-container-darkmode'
10071007
)}
1008+
data-testid="document-list"
10081009
>
10091010
<div className={cx('ag-parent', this.props.className)}>
10101011
<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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,16 @@ export async function runFind(
2626
const resultId = await browser.getQueryId(tabName);
2727
return resultId !== initialResultId;
2828
});
29+
30+
// Wait for animations to finish on the documents or schema page.
31+
// Because we're virtualizing the list on crud, the query results may
32+
// change after the resultId has changed.
33+
if (tabName === 'Documents') {
34+
await browser.waitForAnimations(Selectors.DocumentList);
35+
} else if (tabName === 'Schema') {
36+
/* not virtualized */
37+
} else {
38+
throw new Error(`Unknown tab name ${tabName}`);
39+
}
2940
}
3041
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ 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 = '[data-testid="document-list"]';
606607
export const SelectJSONView = '[data-testid="toolbar-view-json"]';
607608
export const SelectTableView = '[data-testid="toolbar-view-table"]';
608609
export const SelectListView = '[data-testid="toolbar-view-list"]';

0 commit comments

Comments
 (0)