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

[Bug]: console events relies on non-specified property #11816

Closed
2 tasks
sadym-chromium opened this issue Feb 2, 2024 · 2 comments
Closed
2 tasks

[Bug]: console events relies on non-specified property #11816

sadym-chromium opened this issue Feb 2, 2024 · 2 comments

Comments

@sadym-chromium
Copy link
Collaborator

sadym-chromium commented Feb 2, 2024

Minimal, reproducible example

it('should report console logs', async () => {
    const {page} = await getTestState();

    const [message] = await Promise.all([
      waitEvent(page, 'console'),
      page.evaluate(() => {
        return new Worker(`data:text/javascript,console.log(1)`);
      }),
    ]);
    expect(message.text()).toBe('1');
    expect(message.location()).toEqual({
      url: '',
      lineNumber: 0,
      columnNumber: 8,
    });
  });

Error string

TimeoutError: Waiting for console event timed out.

Bug behavior

  • Flaky
  • PDF

Background

When using BiDi, Puppeteer checks if the log.entryAdded event relates to the given page based on source.context property. It is not always correct, as script.source can be null for workers. Instead, the realm property should be used to check if the event relates to one of the page's associated realms.

Currently, there is a temporary solution in Chromium BiDi used to overcome this Puppeteer limitation, but this solution diverges from the specification.

Expectation

If no log.entryAdded:params.source.context is provided, as specified in the BiDi spec, emit the log events from workers on the related page.

Reality

If no log.entryAdded:params.source.context is provided, as specified in the BiDi spec, the log events from workers are omitted. This leads to [worker.spec] Workers should report console logs and [worker.spec] Workers should report errors tests failures.

Puppeteer configuration file (if used)

No response

Puppeteer version

21.10.0

Node version

v18.18.1

Package manager

npm

Package manager version

9.8.1

Operating system

macOS

Copy link

github-actions bot commented Feb 2, 2024

This issue was not reproducible. Please check that your example runs locally and the following:

  • Ensure the script does not rely on dependencies outside of puppeteer and puppeteer-core.
  • Ensure the error string is just the error message.
    • Bad:

      Error: something went wrong
        at Object.<anonymous> (/Users/username/repository/script.js:2:1)
        at Module._compile (node:internal/modules/cjs/loader:1159:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
        at Module.load (node:internal/modules/cjs/loader:1037:32)
        at Module._load (node:internal/modules/cjs/loader:878:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
        at node:internal/main/run_main_module:23:47
    • Good: Error: something went wrong.

  • Ensure your configuration file (if applicable) is valid.
  • If the issue is flaky (does not reproduce all the time), make sure 'Flaky' is checked.
  • If the issue is not expected to error, make sure to write 'no error'.

Once the above checks are satisfied, please edit your issue with the changes and we will
try to reproduce the bug again.


Analyzer run

@jrandolf-2
Copy link
Contributor

Looks resolved.

@jrandolf-2 jrandolf-2 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants