Skip to content
New issue

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

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

Already on GitHub? # to your account

feat(ppt): websocket messages #4264

Merged
merged 3 commits into from
Mar 21, 2024
Merged

feat(ppt): websocket messages #4264

merged 3 commits into from
Mar 21, 2024

Conversation

kobenguyent
Copy link
Collaborator

Motivation/Description of the PR

  • feat(Puppeteer): recording WS messages

Recording WS messages:

      await I.startRecordingWebSocketMessages();
      await I.amOnPage('https://websocketstest.com/');
      I.waitForText('Work for You!');
      const wsMessages = I.grabWebSocketMessages();
      expect(wsMessages.length).to.greaterThan(0);

flushing WS messages:

      await I.startRecordingWebSocketMessages();
      I.amOnPage('https://websocketstest.com/');
      I.waitForText('Work for You!');
      I.flushWebSocketMessages();
      const wsMessages = I.grabWebSocketMessages();
      expect(wsMessages.length).to.equal(0);

Applicable helpers:

  • Puppeteer

Type of change

  • 🚀 New functionality

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@kobenguyent kobenguyent merged commit 46b8bc5 into 3.x Mar 21, 2024
13 checks passed
@kobenguyent kobenguyent deleted the ws-messages-ppt branch March 21, 2024 05:27
@kobenguyent kobenguyent mentioned this pull request Apr 2, 2024
@mirao
Copy link
Contributor

mirao commented Oct 3, 2024

I've just used the feature and noticed that await I.grabWebSocketMessages() returns a string instead of an array 🐛 .
It seems to be caused by this code that incorrectly adds a string message instead of pushing it to the array?

_logWebsocketMessages(message) {
this.webSocketMessages += message;
}

@kobenguyent
Copy link
Collaborator Author

Oh that's originally an issue since it's implemented in playwright. But I guess no much usage since. But thanks! Will fix it.

#3789

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants