Here are the tools I’m using:
- Ubuntu G5 3.13.0-48-powerpc64-smp
- Node.js v0.10.38
- Zombie version 3.1.0 (released on 2015-03-15)
- Jasmine-node 1.14.3
Below is my test script, sample_zombie_spec.js
:
var Browser, assertion, testBrowser, testUrl, expectedTitle;
assertion = require('assert');
Browser = require('zombie');
var targetUrl = "https://google.com";
var expectedPageTitle = "Google";
testUrl = targetUrl;
expectedTitle = expectedPageTitle;
testBrowser = new Browser();
describe('homepage', function() {
describe('title check', function() {
it('should display the correct title', function(done) {
testBrowser.visit(testUrl).then(function() {
assertion.equal(testBrowser.text('title'), expectedTitle);
done();
}).catch(function(error) {
console.log('Error during execution: ', error);
done(error);
});
});
});
});
This script is located in the spec/
directory, so I executed:
jasmine-node spec/
The output revealed:
F
Failures:
1) homepage title check should display the correct title
Message:
TypeError: Object [object Promise] has no method 'catch'
Stacktrace:
TypeError: Object [object Promise] has no method 'catch'
at null.<anonymous> (/path/to/sample_zombie_spec.js:21:12)
I also attempted this code on a different system:
Tools for the second system:
- Darwin 14.3.0
- io.js v1.8.1
- Zombie version 4.0.7 (released on 2015-04-10)
- Jasmine-node 1.14.3
I got similar failure results:
F
Failures:
1) homepage title check should display the correct title
Message:
TypeError: undefined is not a function
Stacktrace:
TypeError: undefined is not a function
at null.<anonymous> (/path/to/sample_zombie_spec.js:21:12)
I have tried various URLs including localhost, but nothing seems to work. Since I’m new to JavaScript, Node.js, io.js, Zombie, and Jasmine, I’m mostly following documentation and community advice. Any help would be greatly appreciated, as I feel I might be missing something very basic. Thank you!