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

fix: missing methods from I actor #3703

Merged
merged 2 commits into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/command/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ module.exports = function() {
}
`;

const defaultActorTs = `// in this file you can append custom step methods to 'I' object

export = function() {
return actor({

// Define custom steps here, use 'this' to access default methods of I.
// It is recommended to place a general 'login' function here.

});
}
`;

module.exports = function (initPath) {
const testsPath = getTestRoot(initPath);

Expand Down Expand Up @@ -188,7 +200,7 @@ module.exports = function (initPath) {
// create steps file by default
// no extra step file for typescript (as it doesn't match TS conventions)
const stepFile = `./steps_file.${extension}`;
fs.writeFileSync(path.join(testsPath, stepFile), defaultActor);
fs.writeFileSync(path.join(testsPath, stepFile), extension === 'ts' ? defaultActorTs : defaultActor);
config.include.I = isTypeScript === true ? './steps_file' : stepFile;
print(`Steps file created at ${stepFile}`);

Expand Down