由于没有使用angular 2 App SPA调用异步回调,因此量角器测试超时

时间:2017-02-24 17:00:48

标签: angular protractor jasmine2.0

我们正在使用angular cli构建SPA,我们要验证登录页面上的控件(用户名,密码和登录名),但在登录/重定向到另一个组件后我收到错误消息

  

"错误:超时 - 在超时内未调用异步回调   由jasmine.DEFAULT_TIMEOUT_INTERVAL指定。"

用于执行任何操作,例如单击注销按钮或验证用户标签。我们只有一个app.com.html,可以使用another.com.html重定向

这是我的示例规范代码

beforeAll(() => {
loginPage = new LoginPage();
loginPage.navigateTo();
expect(browser.getCurrentUrl()).toMatch('/');
loginPage.login(testData.validAgentID, testData.validDeviceID);
browser.waitForAngular();
userPage = new UserPage();
// browser.angularAppRoot('sp-app');
});
beforeEach(() => {
//
});
it('should be able to see Logout button at the bottom', function (done) {
expect(userPage.getLogoutButton().getText()).toEqual('logout'); Failing
done();
});

it('should be able to see Logout button at the bottom', () => {
expect(userPage.getLogoutButton().getText()).toEqual('logout'); Failing
});

it('should be able to see Logout button at the bottom', () => {
userPage.getLogoutButton().getText().then((txt)=> {
expect(txt).toEqual('logout');   Failing
});
});

beforeAll(() => {
loginPage = new LoginPage();
loginPage.navigateTo();
expect(browser.getCurrentUrl()).toMatch('/');
browser.waitForAngular();
userPage = new UserPage();
// browser.angularAppRoot('sp-app');
});
beforeEach(() => {
//
});
it('should be able to verify title', () => {
expect(userPage.getTitle.getText()).toEqual('My App');   This is working fine
});

Tried all possible options to make my verification 

"@angular/cli": "^1.0.0-beta.32.3",
"@angular/compiler-cli": "^2.3.1",
"@types/jasmine": "^2.5.38",
"@types/jasminewd2": "^2.0.1",
"protractor": "^5.1.1",

0 个答案:

没有答案