Skip to content

Getting error when trying to pass in a matcher function #66

Description

@clicktime-michael

When calling the following code on windows and Mac, using different node versions, including v16:

import puppeteer from 'puppeteer';
import 'pptr-testing-library/extend';

it('should be titled correctly', async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('https://Google.com');
    
    const $document = await page.getDocument();
    const $email = await $document.getAllByText(() => true);
    
    expect(true).toBeTruthy();
  });

We get the following Error:

Evaluation failed: Error: It looks like undefined was passed instead of a matcher. Did you do something like getByText(undefined)?

      at assertNotNullOrUndefined2 (__puppeteer_evaluation_script__:2632:17)
      at matches2 (__puppeteer_evaluation_script__:2653:9)
      at __puppeteer_evaluation_script__:15045:152
          at Array.filter (<anonymous>)
      at queryAllByText3 (__puppeteer_evaluation_script__:15045:135)
      at __puppeteer_evaluation_script__:14733:23
      at Object.getAllByText (__puppeteer_evaluation_script__:14765:21)
      at anonymous (__puppeteer_evaluation_script__:19475:31)
      at ExecutionContext._evaluateInternal (node_modules/puppeteer/src/common/ExecutionContext.ts:273:13)

We had a more complex matcher, but even just passing in () => true throws the same error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions