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(core): include scenario object in engine hooks #2158

Conversation

bernardobridge
Copy link
Contributor

@bernardobridge bernardobridge commented Sep 21, 2023

Why

Addresses #932

It's useful for test authors to have access to the current scenario being ran for multiple reasons, one of them being the use case explained in that issue.

Given the following function:

function myBeforeScenarioHandler(context, ee, next) {
    console.log(context.scenario)
    next();
};

All of the chosen scenario is available in context.scenario.


Note: removed unrelated index.js from tests that was no longer being used after test change in another PR.

@@ -167,7 +167,7 @@ HttpEngine.prototype.createScenario = function (scenarioSpec, ee) {
});
});

return self.compile(tasks, scenarioSpec.flow, ee);
return self.compile(tasks, scenarioSpec, ee);
Copy link
Contributor Author

@bernardobridge bernardobridge Sep 21, 2023

Choose a reason for hiding this comment

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

compile function was being passed scenarioSpec.flow but not doing anything with it, therefore the change here doesn't really impact anything, and we can now use the whole object.

@bernardobridge bernardobridge requested a review from a team September 21, 2023 12:54
@bernardobridge bernardobridge changed the title feat(http): include scenario object in http engine hooks feat(core): include scenario object in engine hooks Oct 12, 2023
@bernardobridge bernardobridge merged commit 5b355f8 into main Oct 18, 2023
6 checks passed
@bernardobridge bernardobridge deleted the bernardobridge/art-1360-feature-include-scenario-object-in-hooks-for-http-engine branch October 18, 2023 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant