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
Is it possible to translate actor provided steps? #184
Comments
Sure! Actually I love the idea. Probably it won't be as meaningful as Cucumber scenarios (it is still JavaScript, anyway), but this mapping looks like a really good idea. To be honset, I had a plan to integrate Cucumber scenarios for high-level business expectations, they could also be used for translations. I think this can be implemented patching Step should be able to make different properties for helper method and step name itself: constructor(helper, name) {
this.name = name;
this.helperMethod = name;
}
// inside run() we change to helperMethod
result = this.helper[this.helperMethod].apply(this.helper, this.args); then we can easily change step name:
as for module.exports = function (obj) {
obj = obj || {};
let helpers = container.helpers();
Object.keys(helpers)
.map(function (key) { return helpers[key];})
.forEach((helper) => {
methodsOfObject(helper, 'Helper')
.filter((method) => {
return method !== 'constructor' && method[0] !== '_';})
.forEach((action) => {
obj[action] = function () {
let args = arguments;
recorder.addStep(let step = new Step(helper, action), args);
// here we change the step name:
step.name = corresponding.mapping.name; // taken from some config....
return recorder.promise();
};
});
});
return obj;
}; If you have an idea how to pass and where to store such mappings (probably somwhere in codecept.json), you can update the code in a way I proposed and submit a pull request. |
just submitted a pull request for this #189 |
Implemented in #189 |
Threre is a channel where i would ask few questions about codecept to you?
I work as a System Analyst in the major Governament IT Company in Brasil, called SERPRO. Actually i'm working as a consultant in web frontend technologies (at this time AngularJS, Angular 2 [both Javascript and Typescript]) and yesterday casually i found the codecept project and quickly tried it and liked so much.
I would like to use the navigation helper methods in Brazillian Portuguese, so this tests scenarios will serve as our stories documentation too.
I just came out with this setup:
1 - In the codecept.json file i include a step file like this:
And in the steps_file i created proxy methods in portuguese just calling the corresponding methods:
There is some path into the codeceptjs to achieve the translation of all the helpers methods codecept already provides?
I was wondering if an approach like define a mapping json and run some generator to build the steps would be a good way of doing this.
What do you think?
The text was updated successfully, but these errors were encountered: