Reputation: 589
I am trying to automate an Angular 4 application. When I run "protractor config.js"
CASE 1: When I have format option in my config.ts file to something like this:
format: ['json:../reporting/results.json']
I get an error message:
Unhandled rejection Error: ENOENT: no such file or directory, open 'C:\MyWorkspace\ProtractorProjects\protractor-cucumber-sample\test\config\MyWorkspace\ProtractorProjects\protractor-cucumber-sample\node_modules\protractor-cucumber-framework\lib\resultsCapturer.js:.will-be-removed-after-cucumber-runs.tmp'
at Error (native)
Process finished with exit code 100
Empty test suite.
All I understand is that it is unable to reach "resultsCapturer.js". As config.js file's relative path is getting added and I am not sure how to fix this.
CASE 2: When I change format option to:
format: ['pretty']
I get an error:
Unhandled rejection Error: Cannot find module 'C:\MyWorkspace\protractor-cucumber-sample\test\config\pretty'
at Function.Module._resolveFilename (module.js:469:15)
Checked this doc but could not help me to fix the issue
Below are my project details:
node version: v6.10.3
protractor version: 5.1.2
config.ts:
import { Config } from 'protractor';
export let config: Config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ["../features/*.feature"],
framework: 'custom',
frameworkPath: require.resolve('node_modules/protractor-cucumber-framework'),
baseUrl: "http://localhost:4200/",
cucumberOpts: {
compiler: "ts:ts-node/register",
strict: true,
format: ['json:../reporting/results.json'],
require: ['../steps/*.js'],
tags: '@smoke'
}
}
package.json:
{
"name": "protractor-cucumber-sample",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"@types/jasmine": "^2.5.53",
"body-parser": "~1.17.1",
"cookie-parser": "~1.4.3",
"debug": "~2.6.3",
"express": "~4.15.2",
"jade": "~1.11.0",
"morgan": "~1.8.1",
"serve-favicon": "~2.4.2"
},
"devDependencies": {
"@types/chai": "^4.0.3",
"@types/cucumber": "^2.0.3",
"@types/mkdirp": "^0.5.0",
"chai": "^4.1.1",
"chai-as-promised": "^7.1.1",
"cucumber": "^3.0.0",
"cucumber-html-reporter": "^2.0.3",
"jasmine": "^2.7.0",
"jasminewd2": "^2.1.0",
"protractor-cucumber-framework": "^4.0.2",
"ts-node": "^3.3.0",
"typescript": "^2.4.2"
}
}
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": false,
"sourceMap": true,
"typeRoots": [
"./node_modules/@types/"
],
"lib": ["es2015"],
"strict": true
},
"compileOnSave": true,
"exclude": [
"node_modules/*",
"**/*-aot.ts"
]
}
Please let me know If I need to produce additional info which helps you to address this issue.
Also please suggest if this is not the right forum to post this question or in case you know other forums where this question can be posted.
Thanks in advance.
Upvotes: 0
Views: 1933
Reputation: 5231
Case 1: The reason you are getting the No such file or directory error is because your directory reporting/results.json does not exist. Cucumber does not create directories internally , you have to create the reporting
directory. It would certainly work.
Case 2: By looking at your package.json you are using cucumber 3.0, cucumber has removed pretty format since the latest cucumber 3.0 release. Please check the official cucumber changelog for details. You can no longer use it , better switch to other formatting options- cucumber formats or downgrade your cucumber version.
Upvotes: 1