Reputation: 444
i've got problem with protractor tests, it always throws a message:
[10:11:22] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
[10:11:22] I/launcher - Running 1 instances of WebDriver
Started
No specs found
Finished in 0.001 seconds
[10:11:24] I/launcher - 0 instance(s) of WebDriver still running
[10:11:24] I/launcher - firefox #01 passed
http-server stopped.
Config file is fine, it reads the e2e file. There is the config file:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseURL: 'http://localhost:3000/',
capabilities: {
'browserName': 'firefox'
},
specs: ['e2e-spec.ts'],
jasmineNodeOpts: {
showColors: true
}
};
My e2e file:
// app.e2e-spec.ts
import { Registration } from './registrationPage';
import {browser} from "protractor";
describe('e2e-spec.ts', function() {
let page: Registration;
let header = 'Welcome!';
page = new Registration();
let result = page.getHeader();
it('should display heading saying Welcome!', () => {
page.navigateTo().then(function () {
console.log('Start test 1: automatic redirection of index');
expect(result).toEqual(header);
});
});
});
I dont know what to do, it doesn't matter what I put into e2e file, it opens browser, close it and throws all the time same message, I use npm run e2e
Upvotes: 1
Views: 1348
Reputation: 373
It's very simple:
specs: [
'./e2e/**/*.e2e-spec.ts'
]
That mean it will run all test cases (.e2e-spec.ts) in e2e folder.
Upvotes: 0
Reputation: 111
Try using suites:
/*let suites = {
e2e: "./*e2e-spec.ts"
};*/
//Bruteforce to find the path
let suites = {
e2e2: "../**/*spec.ts"
};
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
baseURL: 'http://localhost:3000/',
capabilities: {
'browserName': 'firefox'
},
suites: suites,
jasmineNodeOpts: {
showColors: true
}
};
Maybe you should look into Page Object Dessign pattern:
let RegistrationPage = require('./registrationPage');
describe('e2e-spec.ts', function() {
let page = new RegistrationPage();
let result = page.getHeader();
let header = 'Welcome!';
it('should display heading saying Welcome!', () => {
page.navigateTo().then(function () {
console.log('Start test 1: automatic redirection of index');
expect(result).toEqual(header);
});
});
});
Upvotes: 1