test: use locator assertion for body text

This commit is contained in:
Daniel Roe 2024-03-16 13:38:29 -07:00
parent 9b5bffbbb4
commit 3d77e267d8
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -411,6 +411,7 @@ describe('pages', () => {
it('/wrapper-expose/page', async () => { it('/wrapper-expose/page', async () => {
const { page, pageErrors, consoleLogs } = await renderPage('/wrapper-expose/page') const { page, pageErrors, consoleLogs } = await renderPage('/wrapper-expose/page')
await page.waitForLoadState('networkidle')
await page.locator('#log-foo').click() await page.locator('#log-foo').click()
expect(consoleLogs.at(-1)?.text).toBe('bar') expect(consoleLogs.at(-1)?.text).toBe('bar')
// change page // change page
@ -2497,9 +2498,8 @@ describe('teleports', () => {
describe('Node.js compatibility for client-side', () => { describe('Node.js compatibility for client-side', () => {
it('should work', async () => { it('should work', async () => {
const { page } = await renderPage('/node-compat') const { page } = await renderPage('/node-compat')
const html = await page.innerHTML('body') await page.locator('body').getByText('Nuxt is Awesome!').waitFor()
expect(html).toContain('Nuxt is Awesome!') expect(await page.innerHTML('body')).toContain('CWD: [available]')
expect(html).toContain('CWD: [available]')
await page.close() await page.close()
}) })
}) })