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

feat(skip-execution): add support to display system logs #957

Draft
wants to merge 7 commits into
base: feat/skip-request
Choose a base branch
from

Conversation

vedkribhu
Copy link
Contributor

@vedkribhu vedkribhu commented Oct 3, 2023

Stacked on top of https://github.com/postmanlabs/postman-sandbox/pull/942/files

System logs will be displayed on postman app console with special highlight, they should be used when you want to inform user that some action was taken from script.

@codecov-commenter
Copy link

Codecov Report

Merging #957 (d0a926f) into feat/skip-request (ebb2342) will not change coverage.
The diff coverage is n/a.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@                Coverage Diff                 @@
##           feat/skip-request     #957   +/-   ##
==================================================
  Coverage              60.78%   60.78%           
==================================================
  Files                     12       12           
  Lines                    561      561           
  Branches                 135      135           
==================================================
  Hits                     341      341           
  Misses                   220      220           
Flag Coverage Δ
unit 60.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

* @param {'skip_request'} type - this is used to identify the message type in postman-app
* @param {...any} args - any other information like request name to be used to generate console message
*/
function dispatchSystemMessage (console, type, ...args) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't think if this should be part of this module. Maybe a helper?

timers,
(
new PostmanAPI(execution, function (request, callback) {
var eventId = timers.setEvent(callback);

dispatchEvent(bridge, execution, executionRequestEventName, options.cursor, id, eventId, request);
}, /* onStopExecution = */ function () {
// Dispatch event to display system message on console informing user that the request
// execution was skipped from script
dispatchSystemMessage(postmanConsole, 'skip_request', _.get(execution, 'legacy._itemName'));
Copy link
Member

Choose a reason for hiding this comment

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

Why dispatch a system type console event? Why not a "execution_stopped" or such event? Every client can then interpret it and use it however they want to.

Also, "system" type log is not supported in Console interface either.

Copy link
Member

Choose a reason for hiding this comment

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

This can also be a part of any existing events like item event with some indication that the execution was stopped from script.

@vedkribhu vedkribhu force-pushed the feat/skip-request branch 8 times, most recently from abcb20c to bf0e253 Compare October 16, 2023 04:48
@vedkribhu vedkribhu marked this pull request as draft October 16, 2023 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants