GithubHelp home page GithubHelp logo

Comments (8)

baurine avatar baurine commented on May 18, 2024 1

When I use expect-puppeteer with typescript by import expect from 'expect-puppeteer', the expect() method only accepts the Page or ElementHandle type parameter, other types will report error, so how I use puppeteer-expect and native expect both:

import ppExpect from 'expect-puppeteer'

...
    await ppExpect(page).toClick(...)
    expect('test').toBe('test')

from jest-puppeteer.

gregberge avatar gregberge commented on May 18, 2024

I expected this kind of problem. I think we can find a workaround for that. Actually the problem will only occur on ElementHandle and Page instances.

Two workarounds before the fix:

await expect(page).toMatchElement('input') // This will wait for element to be displayed

// or
const elementHandle = await page.$('input')
expect(elementHandle === null).toBe(false)

from jest-puppeteer.

Mstrodl avatar Mstrodl commented on May 18, 2024

@neoziro The issue is that I need to use the elements elsewhere in the test. So far the only workaround I've found uses another bug which is that promises don't get resolved by expect-puppeteer:

await expect(Promise.resolve(elementHandle)).resolves.not.toBe(null);

But again, that's a bit of a hack

from jest-puppeteer.

gregberge avatar gregberge commented on May 18, 2024

OK, please be patient, I will work on this bug as soon as possible. It will be fixed before the end of week.

from jest-puppeteer.

gillesdemey avatar gillesdemey commented on May 18, 2024

I'm using [email protected] and I'm getting the following exception when running a standard assertion:

expect(response.status()).toBe(200)

The exception thrown:

Error: 200 is not supported

from jest-puppeteer.

parasvora avatar parasvora commented on May 18, 2024

I am facing this issue while trying to compare 2 strings.
expect('test').toContainEquals('Test');

It is throwing error:
test is not supported

@neoziro Any idea on this?

from jest-puppeteer.

gregberge avatar gregberge commented on May 18, 2024

I think toContainEquals doesn't exist, either in Jest or in Puppeteer Expect.

You probably want toContainEqual and it only works with object. Nothing related with this project.

from jest-puppeteer.

parasvora avatar parasvora commented on May 18, 2024

@neoziro Sorry, it was a typing error, I did used
expect('test').toContainEqual('Test');

I am getting same error for below codes as well,
expect('test').toBe('Test');
expect('test').toMatch('Test');

from jest-puppeteer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.