While investigating protractor I got the following issue:
When I ran the following code, it didn't find any specs... so the tests do not run
describe('My app', function() {
console.log('Starting test suite "GUEST"');
browser.get('')
.then(function () {
it('Should automatically redirect', function() {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
The redirection has been done correctly, but the output is:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.10.217:50382/wd/hub
Starting test suite "GUEST"
Started
No specs found
Finished in 0.004 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
I think protractor runs through the file and finds the end before the .then promise callback function is executed and doesn't find any expects.
I might be doing it all wrong... but it seemed like the way to do it
While investigating protractor I got the following issue:
When I ran the following code, it didn't find any specs... so the tests do not run
describe('My app', function() {
console.log('Starting test suite "GUEST"');
browser.get('')
.then(function () {
it('Should automatically redirect', function() {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
The redirection has been done correctly, but the output is:
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.10.217:50382/wd/hub
Starting test suite "GUEST"
Started
No specs found
Finished in 0.004 seconds
Shutting down selenium standalone server.
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 passed
I think protractor runs through the file and finds the end before the .then promise callback function is executed and doesn't find any expects.
I might be doing it all wrong... but it seemed like the way to do it
Share Improve this question asked Jun 3, 2015 at 9:30 ArninjaArninja 7451 gold badge12 silver badges24 bronze badges 1- you have to run conf.js file and in that, you have to write spec section: something like this : exports.config = { seleniumAddress: 'localhost:4444/wd/hub', specs: ['test.js']} – binariedMe Commented Jun 3, 2015 at 9:32
1 Answer
Reset to default 3Your test is wrapped in a promise that gets resolved after the phase of registering the tests. It should be:
describe('My app', function() {
console.log('Starting test suite "GUEST"');
it('Should automatically redirect', function() {
browser.get('')
.then(function () {
console.log('Start test 1: automatic redirection of index');
expect(browser.getLocationAbsUrl()).toMatch("/test");
});
});
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745306885a4621763.html
评论列表(0条)