Skip to content

Commit

Permalink
Fix timeout in browser test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubno committed Oct 18, 2024
1 parent b550137 commit 9d5cf98
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/js-sdk/tests/runtimes/browser/run.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect, test } from 'vitest'
import { page } from '@vitest/browser/context'
import { render } from 'vitest-browser-react'
import React from 'react'
import { useEffect, useState } from 'react'
Expand All @@ -24,10 +23,12 @@ function E2BTest() {
test(
'browser test',
async () => {
render(<E2BTest />)
const { getByText } = render(<E2BTest />)
await waitFor(
() => expect.element(page.getByText('Hello World')).toBeVisible(),
{ timeout: 10000 }
() => expect.element(getByText('Hello World')).toBeInTheDocument(),

Check failure on line 28 in packages/js-sdk/tests/runtimes/browser/run.test.tsx

View workflow job for this annotation

GitHub Actions / JS SDK Tests / Build and test SDK

tests/runtimes/browser/run.test.tsx > browser test

Error: Matcher did not succeed in 1000ms Ignored nodes: comments, script, style <html lang="en" > <head> <meta charset="UTF-8" /> <link href="/__vitest__/favicon.svg" rel="icon" type="image/svg+xml" /> <meta content="width=device-width, initial-scale=1.0" name="viewport" /> <title> Vitest Browser Tester </title> <link crossorigin="" href="/__vitest_browser__/preload-helper-D-WYp1PK.js" rel="modulepreload" /> </head> <body> <div> <div /> </div> </body> </html>... ❯ waitFor.timeout tests/runtimes/browser/run.test.tsx:28:53 Caused by: Caused by: VitestBrowserElementError: Cannot find element with locator: locator('body').getByText('Hello World') <body> <div> <div /> </div> </body>
{
timeout: 10_000,
}
)
},
{ timeout: 20000 }
Expand Down

0 comments on commit 9d5cf98

Please sign in to comment.