Skip to content

Conversation

kobenguyent
Copy link
Collaborator

Motivation/Description of the PR

🛩️ Features

  • [Puppeteer] Added commands to check network traffics
    • startRecordingTraffic
    • grabRecordedNetworkTraffics
    • flushNetworkTraffics
    • stopRecordingTraffic
    • seeTraffic
    • dontSeeTraffic

Examples:

// recording traffics and verify the traffic
  I.startRecordingTraffic();
  I.amOnPage('https://codecept.io/');
  I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' });
// check the traffic with advanced params
  I.amOnPage('https://openai.com/blog/chatgpt');
  I.startRecordingTraffic();
  I.seeTraffic({
    name: 'sentry event',
    url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
    parameters: {
      width: '1919',
      height: '1138',
    },
  });

Applicable helpers:

  • Playwright
  • WebDriver
  • Puppeteer

Type of change

  • 📋 Documentation changes/updates
  • 🔨 Markdown files fix - not related to source code

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)

Copy link
Contributor

@DavertMik DavertMik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no plural for traffic and share

so better to rename "networkTraffics" => network

"shares" => "share"

but maybe we don't need this share?
it is already shared

@@ -0,0 +1,123 @@
const assert = require('assert');
const { isInTraffic, createAdvancedTestResults, getTrafficDump } = require('../utils');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need shares folder for that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are the same pieces of code that appeared in 3 helpers. So I wanna move them to a shared folder which is better than copy/paste the same code in 3 helpers.

@kobenguyent kobenguyent requested a review from DavertMik March 19, 2024 04:44
@kobenguyent kobenguyent merged commit c44ce74 into 3.x Mar 23, 2024
@kobenguyent kobenguyent deleted the feat-grab-network-traffics-ppt branch March 23, 2024 06:37
@kobenguyent kobenguyent mentioned this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants