Reputation: 3161
I'm working at an Angular (v.4) project and using Protractor I bumped into this issue
From the terminal:
I/launcher - Running 1 instances of WebDriver
I/hosted - Using the selenium server at http://localhost:4444/wd/hub Started No specs found Finished in 0.003 seconds
I/launcher - 0 instance(s) of WebDriver still running [17:06:38] I/launcher - chrome #01 passed
It runs the browser which get closed quickly, and it doesn't run (find) any spec.
protractor.conf.js:
require('ts-node/register');
var helpers = require('./helpers');
exports.config = {
baseUrl: 'http://localhost:3000/',
// use `npm run e2e`
specs: [
helpers.root('test/e2e/**/**.e2e.ts'),
helpers.root('test/e2e/**/*.e2e.ts')
],
exclude: [],
framework: 'jasmine2',
allScriptsTimeout: 110000,
jasmineNodeOpts: {
showTiming: true,
showColors: true,
isVerbose: false,
includeStackTrace: false,
defaultTimeoutInterval: 400000
},
directConnect: true,
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ["--headless", "--disable-gpu", "--window-size=800x600"]
}
},
onPrepare: function () {
browser.ignoreSynchronization = true;
},
/**
* Angular 2 configuration
*
* useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
* `rootEl`
*/
useAllAngular2AppRoots: true
};
Folder structure
-/App
|--/config
|--protractor.conf.js
|--helpers.js
|--(all webpack files)
|--(other stuff)
|--/node_modules
|--/src
|--/test
|--/e2e
|-mytest.e2e.ts
|--/features
|--/mockBackend
|--/pages
|-mypage.page.ts
|--config.js
package.json
"cucumber": "^2",
"cucumber-html-reporter": "^3.0.4",
"cucumber-snippets-tsflow": "^1.0.2",
"cucumber-tsflow": "^2.2.0",
"protractor": "^5.1.2",
"protractor-cucumber-framework": "^3",
"protractor-snapshot": "^1.2.0",
Upvotes: 0
Views: 1238
Reputation: 1422
I Just recognized you probably execute npm run e2e
as start command, indicating you're using angular-cli or similar to run protractor. Therefore there could be issues in the run-command rather than in the path definition. As far as I could see there were some changes/issues in the way, protractor got started, i.e. here.
I suggest to try these:
capabilities: { ... }
-part as this is offered by protractor. Maybe one of the angular-cli-configuration expects the there and not as a separate partprotractor protractor.conf.js
(from the official protractor site) instead of npm run e2e
to verify/falsify if the problem is within angular-cli
or within protractor
.Upvotes: 1
Reputation: 1422
Any path starts from where protractor.conf.js
is stored (so you start in the config-folder). Given the provided folder structure, I'll start with the normal path:
// use `npm run e2e`
specs: [
//one level up, then below test/e2e/ all files ending with '.e2e.ts'
// '../test/e2e/**/**.e2e.ts', //if *.ts is a file, no need for double **
'../test/e2e/**/*.e2e.ts'
],
exclude: [],
in case **.e2e.ts
represents a folder and not a file your path should end /**e2e.ts/*.js
(or whatever file-ending you chose for the test-file itself).
Also your helpers.js
-file you should get as var helpers = require('./helpers.js');
And as I can't see, what's behind this.root
I can't provide something for helpers.root()
Further could you want to use TestSuites or you might want to build a helper function, in which you can start from base-directory instead of relative-path to conf.js. Check out these links:
baseDir instead of relative path.
Hope I could help.
Upvotes: 0