2017-08-11 52 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

該網站實際上是角度:) –

相關問題