javascript - Angular Protractor: No specs found - Stack Overflow

While investigating protractor I got the following issue:When I ran the following code, it didn't

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
Add a ment  | 

1 Answer 1

Reset to default 3

Your 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

相关推荐

  • javascript - Angular Protractor: No specs found - Stack Overflow

    While investigating protractor I got the following issue:When I ran the following code, it didn't

    6小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信