I'm going to be using this in a TypeScript app. It'd be convenient if the types for this library came with it and were updated alongside source.
Alternately, I can just put them in https://github.com/DefinitelyTyped/DefinitelyTyped/. Thoughts?
I would like to have it in repository, if you could submit a PR to add it to expect-puppeteer it would be awesome.
I am not a TypeScript user that's why the library is not yet TypeScript friendly. I count on you for that!
If you're not a TypeScript user it'd probably be easier to put them into DT - that way the automated systems there can take care of update procedures & getting reviewers involved. I'll tag you in a PR. Thanks!
@JoshuaKGoldberg OK, good for me.
Both PRs completed! Types should be available within an hour or three under:
http://npmjs.com/package/@types/expect-puppeteer
http://npmjs.com/package/@types/jest-environment-puppeteer
Thanks! If you want to avoid conflict, you can use expectPuppeteer and expect to have the correct type, see #26.
@JoshuaKGoldberg I think the definition for toMatchElement() is wrong.
Currently:
toMatchElement(selector: string, value: string, options?: ExpectTimingActions): Promise<void>;
Should be:
toMatchElement(selector: string, options?: ExpectToClickOptions): Promise<void>;
so can be used like this:
await expect(page).toMatchElement('e2e-attribute-basic .single', { text: 'Single' });
At the moment it always passes the test.
@tja4472 yes toMatchElement(selector: string, options?: ExpectToClickOptions): Promise<void>; is actually the correct signature.
Good catch, whoops. If you file an issue on DefinitelyTyped we can resolve it there.
Most helpful comment
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24726
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/24729