Skip to content

Commit b54da1b

Browse files
committed
fix(tests): update ObjectGrid tests to use getAllByText for multiple elements
1 parent 8302eef commit b54da1b

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

apps/console/src/__tests__/ObjectGrid.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ describe('ObjectGrid MSW Integration', () => {
4242

4343
// Wait for data to load
4444
await waitFor(() => {
45-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
45+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
4646
}, { timeout: 10000 });
4747

48-
expect(screen.getByText('alice@objectstack.com')).toBeInTheDocument();
48+
expect(screen.getAllByText('alice@objectstack.com')[0]).toBeInTheDocument();
4949
// expect(screen.getByText('ObjectStack HQ')).toBeInTheDocument();
5050
});
5151

@@ -62,11 +62,11 @@ describe('ObjectGrid MSW Integration', () => {
6262
);
6363

6464
await waitFor(() => {
65-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
65+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
6666
}, { timeout: 10000 });
6767

6868
// Check that all specified columns are rendered
69-
expect(screen.getByText('415-555-1001')).toBeInTheDocument();
69+
expect(screen.getAllByText('415-555-1001')[0]).toBeInTheDocument();
7070
// expect(screen.getByText('ObjectStack HQ')).toBeInTheDocument();
7171
expect(screen.getAllByText('Active')[0]).toBeInTheDocument();
7272
});
@@ -139,7 +139,7 @@ describe('ObjectGrid MSW Integration', () => {
139139
);
140140

141141
await waitFor(() => {
142-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
142+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
143143
}, { timeout: 10000 });
144144

145145
// Note: Row selection UI depends on the actual grid implementation
@@ -163,7 +163,7 @@ describe('ObjectGrid MSW Integration', () => {
163163
);
164164

165165
await waitFor(() => {
166-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
166+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
167167
}, { timeout: 10000 });
168168

169169
// Look for edit buttons (implementation-specific)
@@ -187,7 +187,7 @@ describe('ObjectGrid MSW Integration', () => {
187187
);
188188

189189
await waitFor(() => {
190-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
190+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
191191
}, { timeout: 10000 });
192192

193193
// Look for delete buttons (implementation-specific)
@@ -211,7 +211,7 @@ describe('ObjectGrid MSW Integration', () => {
211211
// Check for loading indicator (implementation-specific)
212212
// The grid should eventually show data
213213
await waitFor(() => {
214-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
214+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
215215
}, { timeout: 10000 });
216216
});
217217

@@ -228,9 +228,9 @@ describe('ObjectGrid MSW Integration', () => {
228228
);
229229

230230
await waitFor(() => {
231-
expect(screen.getByText('Alice Johnson')).toBeInTheDocument();
232-
expect(screen.getByText('Bob Smith')).toBeInTheDocument();
233-
expect(screen.getByText('Charlie Brown')).toBeInTheDocument();
231+
expect(screen.getAllByText('Alice Johnson')[0]).toBeInTheDocument();
232+
expect(screen.getAllByText('Bob Smith')[0]).toBeInTheDocument();
233+
expect(screen.getAllByText('Charlie Brown')[0]).toBeInTheDocument();
234234
}, { timeout: 10000 });
235235
});
236236
});

0 commit comments

Comments
 (0)