Reputation: 1123
I'm trying to run some e2e tests using protractor
and phantomjs
.
When I run the test I get the error:
- Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
The test is:
import { browser, element, by } from 'protractor';
describe('example test', () => {
it('stupid test', () => {
console.log('in test');
expect(true).toBe(true);
});
});
Any idea what the problem is ? any help is welcomed :)
Upvotes: 5
Views: 3189
Reputation: 1408
you are missing callback in your test
return expect(true).toBe(true);
(or)
call callback()
when all your steps are completed like
it('stupid test', (callback) => {
console.log('in test');
expect(true).toBe(true);
callback();
});
(or)
it('stupid test', (done) => {
console.log('in test');
expect(true).toBe(true);
done();
});
Upvotes: -1
Reputation: 97
For me (using karma), the specified port in the Karma config file did not match up with the specified port in the protractor config file.
exports.config = {
...,
baseUrl: 'http://localhost:9876/',//<--This port should match the port in your Karma (test runner) config file
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 3000,
print: function() {}
}
This answer seemed obvious after I found it, but the ports had gotten changed in source control and the fix wasn't immediately apparent.
Upvotes: 1