1

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

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

对于任何类型的操作,例如单击注销按钮或验证用户标签。我们只有一个带有重定向的 app.com.htmlanother.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",
4

0 回答 0