2017-08-11 47 views
0

我无法在量角器中运行测试。我是一名初学者,我正在努力学习。如果有人帮助我,我将不胜感激。量角器登录页面并测试端到端导航

Conf.js

// An example configuration file. 
exports.config = { 
    directConnect: true, 

    // Capabilities to be passed to the webdriver instance. 
    capabilities: { 
    'browserName': 'chrome' 
    }, 

    // Framework to use. Jasmine is recommended. 
    framework: 'jasmine', 

    // Spec patterns are relative to the current working directory when 
    // protractor is called. 

    specs: [ 
    'Login_spec.js', 
    // 'editprofile_spec.js', 
    ], 

    // Options to be passed to Jasmine. 
    jasmineNodeOpts: { 
    defaultTimeoutInterval: 80000 
    } 
}; 

Spec.js

describe('angularjs homepage', function() { 
     it('should be able to login',function() { 
     browser.get('http://www.jnbmusic.com/player/#/login'); 
     element(by.model('username')).sendKeys('[email protected]'); 
     element(by.model('password')).sendKeys('jack1234'); 
    }); 
    element(by.css('[ng-click="login()"]')).click(); 
    }); 

,但我得到的错误,

Error: Error while waiting for Protractor to sync with the page: "window.angular is undefined. This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping. See http://git.io/v4gXM for details" 

Any one please help me 
+0

检查NG-应用属性。如果它不在标记中。确定放置ng-app的标签的css定位器策略。并在conf.js文件中提及该css值为“rootElement:ccvalue” –

回答

0

尝试移动在conf.js文件jasmine2。

exports.config = { 
    directConnect: true, 

    // Capabilities to be passed to the webdriver instance. 
    capabilities: { 
    'browserName': 'chrome' 
    }, 

    // Framework to use. Jasmine is recommended. 
    framework: 'jasmine2', 

    // Spec patterns are relative to the current working directory when 
    // protractor is called. 

    specs: [ 
    'Login_spec.js', 
    // 'editprofile_spec.js', 
    ], 

    // Options to be passed to Jasmine. 
    jasmineNodeOpts: { 
    defaultTimeoutInterval: 80000 
    } 
}; 
0

因为您的网站是非Angular应用程序。 您只能使用browser.driver访问webdriver的实例:在和标签

browser.driver.get('http://www.jnbmusic.com/player/#/login'); 
+0

该网站实际上是角度:) –

相关问题