Codeceptjs: "I.amInPath is not a function" on using FileSystem helper

Created on 13 Feb 2018  Â·  4Comments  Â·  Source: codeceptjs/CodeceptJS

What are you trying to achieve?

Just to use FileSystem helper

What do you get instead?

Error

Provide console output if related. Use --verbose mode for more details.

mduuude@mduuude-OptiPlex-3040:~/WorkSpace/rpp-tests$ npm run test --verbose
npm info it worked if it ends with ok
npm verb cli [ '/home/mduuude/.nvm/versions/node/v8.9.4/bin/node',
npm verb cli   '/home/mduuude/.nvm/versions/node/v8.9.4/bin/npm',
npm verb cli   'run',
npm verb cli   'test',
npm verb cli   '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'pretest', 'test', 'posttest' ]
npm info lifecycle [email protected]~pretest: [email protected]
npm info lifecycle [email protected]~test: [email protected]

> [email protected] test /home/mduuude/WorkSpace/rpp-tests
> codeceptjs run

CodeceptJS v1.1.1
Using test root "/home/mduuude/WorkSpace/rpp-tests"

Files --
 ✖ test something in 137ms

-- FAILURES:

  1) Files
       test something:
     I.amInPath is not a function

  Run with --verbose flag to see NodeJS stacktrace


  FAIL  | 0 passed, 1 failed   // 872ms
npm verb lifecycle [email protected]~test: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~test: PATH: /home/mduuude/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/mduuude/WorkSpace/rpp-tests/node_modules/.bin:/home/mduuude/.nvm/versions/node/v8.9.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin
npm verb lifecycle [email protected]~test: CWD: /home/mduuude/WorkSpace/rpp-tests
npm info lifecycle [email protected]~test: Failed to exec test script
npm verb stack Error: [email protected] test: `codeceptjs run`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/home/mduuude/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at EventEmitter.emit (events.js:214:7)
npm verb stack     at ChildProcess.<anonymous> (/home/mduuude/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack     at emitTwo (events.js:126:13)
npm verb stack     at ChildProcess.emit (events.js:214:7)
npm verb stack     at maybeClose (internal/child_process.js:925:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
npm verb pkgid [email protected]
npm verb cwd /home/mduuude/WorkSpace/rpp-tests
npm verb Linux 4.4.0-104-generic
npm verb argv "/home/mduuude/.nvm/versions/node/v8.9.4/bin/node" "/home/mduuude/.nvm/versions/node/v8.9.4/bin/npm" "run" "test" "--verbose"
npm verb node v8.9.4
npm verb npm  v5.6.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `codeceptjs run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/mduuude/.npm/_logs/2018-02-13T13_36_49_988Z-debug.log

Provide test source code if related

Feature('Files');

Scenario.only('test something', (I) => {
    I.amInPath('./');
});

Details

  • CodeceptJS version: v1.1.1
  • NodeJS Version: v8.9.4
  • Operating System: ubuntu 14.04 LTS
  • WebDriverIO
  • Configuration file:
{
  "output": "./output",
  "helpers": {
    "WebDriverIO": {
      "url": "https://test.com/",
      "driver": "hosted",
      "browser": "chrome",
      "rootElement": "html",
      "windowSize": "1360x768"
    },
  },
  "include": {
    "I": "./steps/steps_file.js",
  },
  "mocha": {},
  "bootstrap": false,
  "teardown": null,
  "hooks": [],
  "tests": "./tests/*/*_test.js",
  "timeout": 10000,
  "name": "tests"
}

Most helpful comment

Just to use FileSystem helper

But you are not using it according to configuration!

Please remove WebDriverIO from your config and add "FileSystem"

  "helpers": {
    "FileSystem": {}

All 4 comments

Just to use FileSystem helper

But you are not using it according to configuration!

Please remove WebDriverIO from your config and add "FileSystem"

  "helpers": {
    "FileSystem": {}

Sorry for the stupid question)

@DavertMik I just saw this post and am relatively new to codeceptjs myself. Can't we have both WebDriver and FileSystem in the helpers in the conf file? In fact, my understanding is that we may add any helper that we need to that list. Isn't that so?

Sure we can use WebDriver and FileSystem together

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neil-s picture neil-s  Â·  3Comments

foobarth picture foobarth  Â·  4Comments

DenisChulkov picture DenisChulkov  Â·  4Comments

wahengchang picture wahengchang  Â·  4Comments

DavertMik picture DavertMik  Â·  3Comments