Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is puppeteer fully working: a simple test throws a bug? #3341

Closed
charnould opened this issue Jun 17, 2023 · 1 comment · Fixed by #3394 · May be fixed by Neo00007/bun#5
Closed

is puppeteer fully working: a simple test throws a bug? #3341

charnould opened this issue Jun 17, 2023 · 1 comment · Fixed by #3394 · May be fixed by Neo00007/bun#5
Labels
bug Something isn't working

Comments

@charnould
Copy link

charnould commented Jun 17, 2023

What version of Bun is running?

0.6.9

What platform is your computer?

Darwin 22.3.0 arm64 arm

What steps can reproduce the bug?

Hello,
Thanks for making Bun
I'm a newbie with Puppeteer but I try to use it to run my E2E tests.
According to Bun blog, puppeteer should work since 0.6.7.

However, running this simple test:

import { beforeEach, afterEach, describe, afterAll, expect, it } from 'bun:test'
import puppeteer from 'puppeteer'

describe('A test', async () => {

  const browser = await puppeteer.launch({ defaultViewport: null, headless: false })

  const page = await browser.newPage()

  beforeEach(async () => await page.goto('http://localhost:3000'))
  afterEach(async () => await page.close())
  afterAll(async () => await browser.close())

  it('should learn puppeteer', async () => {

    console.log(page.url())                  // it works (log: http://localhost:3000/)

    const source = await page.content();
    console.log(source)                     // it works

    page
      .click('input[type="submit"]')
      .then(() => console.log('got it'))
      .catch((e) => console.log(e))        // it throws

    console.log('this line is logged')     // this line is logged
    expect(1).toBe(1)                      // this test pass
  })
})

...throws an error (see below)

Nota: My webpage (http://localhost:3000) do include somewhere: <input type="submit" value="Login">

Do you have any clue? And is it Bun-related?
Thanks

What is the expected behavior?

No bug should be return (?)

What do you see instead?

34 |     /**
35 |      * @internal
36 |      */
37 |     constructor(message) {
38 |         super(message);
39 |         this.name = this.constructor.name;
                ^
TargetCloseError: Protocol error (Runtime.callFunctionOn): Target closed
 code: "undefined"

      at /Users/charnould/GitHub/malro/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js:39:13

Additional information

Stack Overflow issue

@charnould charnould added the bug Something isn't working label Jun 17, 2023
@charnould charnould changed the title is puppeteer fully working: a simple test throwing a bug ? is puppeteer fully working: a simple test throws a bug ? Jun 17, 2023
@charnould charnould changed the title is puppeteer fully working: a simple test throws a bug ? is puppeteer fully working: a simple test throws a bug? Jun 17, 2023
@charnould
Copy link
Author

Thanks! 👍
I've updated Stack Overflow accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant