Skip to content

Commit 9c7e63c

Browse files
test: fix element refetch test using Puppeteer
When using Puppeteer to drive the browser it adds extra attributes to identify the element. This breaks the test for refetching elements as we are checking the stringified elements are the same, however the element identifier added by Puppeteer has changed. Check that the refetched element has the correct text instead.
1 parent 55faab4 commit 9c7e63c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/async/queries.e2e.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,11 @@ describe('queries', () => {
164164
const {getByText} = setupBrowser(browser)
165165

166166
const button = await getByText('Unique Button Text')
167+
const refetchedButton = await refetchElement(button, 'click')
167168

168-
expect(JSON.stringify(button)).toBe(
169-
JSON.stringify(await refetchElement(button, 'click')),
169+
expect(refetchedButton).not.toBeNull()
170+
expect(await refetchedButton.getText()).toBe(
171+
'Unique Button Text',
170172
)
171173
})
172174

0 commit comments

Comments
 (0)