Skip to content

Commit 1fc0817

Browse files
committed
Add helper
1 parent a471f37 commit 1fc0817

6 files changed

+21
-18
lines changed

CustomHelper.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class CustomHelper extends Helper {
2+
printMessage(msg: string) {
3+
console.log(msg)
4+
}
5+
}
6+
7+
export = CustomHelper

Typescript_Example_test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ Feature('Typescript Example');
22

33
Scenario('test something', (I) => {
44
I.amOnPage('/')
5+
I.printMessage('Oops')
56
});

codecept.conf.js

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ exports.config = {
1313
url: 'http://tinkoff.ru',
1414
show: false,
1515
windowSize: '1200x900'
16+
},
17+
CustomHelper: {
18+
require: './CustomHelper.ts'
1619
}
1720
},
1821
bootstrap: null,

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"author": "Vorobeyko <sashavorobey95@gmail.com>",
66
"license": "MIT",
77
"scripts": {
8-
"run:tests": "codeceptjs run"
8+
"run:tests": "codeceptjs run",
9+
"def": "codeceptjs def"
910
},
1011
"dependencies": {
1112
"codeceptjs": "^2.6.3",

steps.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/// <reference types='codeceptjs' />
2-
2+
type CustomHelper = import('./CustomHelper');
33

44
declare namespace CodeceptJS {
55
interface SupportObject { I: CodeceptJS.I }
66
interface CallbackOrder { [0]: CodeceptJS.I }
7-
interface Methods extends CodeceptJS.Puppeteer {}
7+
interface Methods extends CodeceptJS.Puppeteer, CustomHelper {}
88
interface I extends WithTranslation<Methods> {}
99
namespace Translation {
1010
interface Actions {}

tsconfig.json

+6-15
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,13 @@
33
"files": true
44
},
55
"compilerOptions": {
6-
"allowSyntheticDefaultImports": true,
6+
"target": "es2018",
7+
"lib": ["es2018"],
78
"esModuleInterop": true,
8-
"target": "ES2018",
9-
"lib": ["ES2018", "dom"],
10-
"rootDir": "./",
11-
"baseUrl": "./",
12-
"moduleResolution": "Node",
13-
"module": "CommonJS",
14-
"noUnusedLocals": true,
15-
"noUnusedParameters": true,
16-
"sourceMap": true,
17-
"jsx": "react",
18-
"declaration": true,
19-
"resolveJsonModule": true,
9+
"module": "commonjs",
2010
"strictNullChecks": true,
21-
"importHelpers": true,
22-
"noImplicitAny": true
11+
"noImplicitAny": true,
12+
"noUnusedLocals": false,
13+
"noUnusedParameters": false,
2314
},
2415
}

0 commit comments

Comments
 (0)