Reputation: 1691
Im new to e2e testing. i'd like to give it a try with http://codecept.io/angular/
Since i started my app with https://github.com/AngularClass/angular2-webpack-starter Protractor/Jasmine is already working.
From what i've understand, codecept is working on top of protractor. i've installed it correctly but when i launch a simple test i have a failed error.
here's my codecept.json :
{
"tests": "src/app/*_test.js",
"timeout": 10000,
"output": "./output",
"helpers": {
"Protractor": {
"url": "http://localhost:3000/",
"driver": "hosted",
"browser": "chrome",
"rootElement": "body"
}
},
"include": {
"I": "./steps_file.js"
},
"bootstrap": false,
"mocha": {},
"name": "front"
}
And here is my test :
Feature('MyApp');
Scenario('First Test', (I) => {
I.amOnPage('/#/home');
});
This is the error log:
MyApp --
First Test
• I am on page "/#/home"
✖ FAILED in undefinedms
✖ "after each" hook: finialize codeceptjs in 0ms
-- FAILURES:
1) MyApp: First Test:
Uncaught Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
Any help ?
Upvotes: 0
Views: 955
Reputation: 398
You can run Protractor in direct mode - this skips the webdriver/selenium server and connects the Protractor helper directly to the browser.
You need to configure Protractor using 'direct' mode like so: The 'directConnect' value gets passed on to Protractor itself, so it also uses direct mode.
"helpers": {
"Protractor": {
"url": "http://localhost:3000/",
"driver": "direct",
"directConnect": true,
"browser": "chrome",
"rootElement": "body",
"useAllAngular2AppRoots": true
}
},
Upvotes: 0
Reputation: 1691
As answered here Unable to run Protractor - ECONNREFUSED connect ECONNREFUSED:
webdriver-manager update
webdriver-manager start --standalone
and this is my codecept.json :
{
"tests": "src/app/*_test.js",
"timeout": 10000,
"output": "./output",
"helpers": {
"Protractor": {
"url": "http://localhost:3000/",
"driver": "hosted",
"browser": "chrome",
"rootElement": "body",
"useAllAngular2AppRoots": true
}
},
"include": {
"I": "./steps_file.js"
},
"bootstrap": false,
"mocha": {},
"name": "front"
}
Note the "useAllAngular2AppRoots": true
Upvotes: 1