Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/extend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,23 @@ describe('lib/extend.ts', () => {
expect(text).toEqual(['Hello h1', 'Hello h2', 'Hello h3'])
})

it('should handle the queryAll* methods with a selector', async () => {
const elements = await document.queryAllByText(/Hello/, {selector: 'h2'})
expect(elements).toHaveLength(1)

const text = await page.evaluate(el => el.textContent, elements[0])

expect(text).toEqual('Hello h2')
})

it('should handle the getBy* methods with a selector', async () => {
const element = await document.getByText(/Hello/, {selector: 'h2'})

const text = await page.evaluate(el => el.textContent, element)

expect(text).toEqual('Hello h2')
})

it('should scope results to element', async () => {
const scope = await document.$('#scoped')
const element = await scope!.queryByText(/Hello/)
Expand Down