Skip to content

Commit 631dd12

Browse files
committed
fix: align puppeteer extend fn names
1 parent f6a350b commit 631dd12

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const browser = await puppeteer.launch()
2323
const page = await browser.newPage()
2424

2525
// Grab ElementHandle for document, this convenience method added by pptr-testing-library/extend
26-
const $document = await page.document()
26+
const $document = await page.getDocument()
2727

2828
// query methods are added to prototype of ElementHandle
2929
const $form = await document.getByTestId('my-form')

lib/extend.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {extendObjectWithTestingUtils, getDocument} from '.'
44
const Page = require('puppeteer/lib/Page.js') // tslint:disable-line
55
const ElementHandle = require('puppeteer/lib/ElementHandle.js') // tslint:disable-line
66

7-
Page.prototype.document = getDocument
7+
Page.prototype.getDocument = getDocument
88

99
extendObjectWithTestingUtils(ElementHandle.prototype)
1010

1111
/* tslint:disable */
1212
declare module 'puppeteer' {
1313
interface Page {
14-
document(): Promise<ElementHandle>
14+
getDocument(): Promise<ElementHandle>
1515
}
1616

1717
interface ElementHandle {

test/extend.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('lib/extend.ts', () => {
1414
})
1515

1616
it('should extend puppeteer ElementHandle', async () => {
17-
document = await page.document()
17+
document = await page.getDocument()
1818
expect(typeof document.queryAllByAltText).toBe('function')
1919
})
2020

0 commit comments

Comments
 (0)