Skip to content

[Feature] Command events/hooks #1654

@dialupdev

Description

@dialupdev

Hi there. First of all v0.12 is looking really great. Thank you for all the work you've been doing!

The feature I'm interested in is events or hooks that indicate that a command is starting or finishing. Ideally the command name and arguments would be exposed.

My use case: I'm writing end-to-end tests, and I want to display a command log via stdout for faster debugging (ignore the [object Object] part).
Screen Shot 2020-04-03 at 12 21 43 PM

I have gotten this to work by monkey-patching my page instance and decorating some built-in methods like this.

const method = page.click;

page.click = (...args: any[]) => {
  return commandLogger.log(page, () => method.apply(page, args), 'click', args);
};

But it would be nice to have a cleaner way of accomplishing this. :) Let me know what you think!

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