Jest-puppeteer: TypeError: expect(...).toClick is not a function

Created on 3 May 2018  路  2Comments  路  Source: smooth-code/jest-puppeteer

I get the above error when I try and click on an element in a page.

screen shot 2018-05-03 at 8 19 19 am

I have added the following config to my package json as instructed:
screen shot 2018-05-03 at 8 20 11 am

I then wrote the following tests:
screen shot 2018-05-03 at 8 21 05 am

The first one passes so I'm set up properly, does anyone know why the toClick function is failing?

Most helpful comment

It looks like expectPuppeteer is not working, it could be because you are using dom-testing-library/extend-expect. I propose you to use expect-puppeteer as standalone.

import expectPuppeteer from 'expect-puppeteer'

expectPuppeteer(page).toClick(...)

All 2 comments

It looks like expectPuppeteer is not working, it could be because you are using dom-testing-library/extend-expect. I propose you to use expect-puppeteer as standalone.

import expectPuppeteer from 'expect-puppeteer'

expectPuppeteer(page).toClick(...)

works like a charm. Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Greg-oliver99 picture Greg-oliver99  路  4Comments

undrafted picture undrafted  路  4Comments

dptoot picture dptoot  路  4Comments

songguohfut picture songguohfut  路  6Comments

paperbackdragon picture paperbackdragon  路  4Comments