content in project.po.ts ->
newProjectButton() {
return element(by.id('new-project'));
}
newProjectButtonText() {
return this.newProjectButton().getText();
}
contents in spec file ->
describe('Projects', function () {
let page: RMLProjectsPage;
page = new RMLProjectsPage();
it('should create new project and its first workspace', () => {
page.navigateToProjectsPage();
expect(page.newProjectButtonText()).toEqual('New Project');
...
The test runs and a login test passes prior to this test. However, after it successfully navigates to projects page, it cannot find the new-project button. error is Failed: No element found using locator: By(css selector, *[id="new-project"])
Now if I put browser.ignoreSynchronization = true; after page construction , it finds that button, but it makes other query in a reactive form to fail. In an angular app we should not do browser.ignoreSynchronization = true; right? What am I missing here ...?
答案 0 :(得分:1)
browser.ignoreSynchronization = true;
已被弃用,尝试browser.waitForAngularEnabled(false);
。
要回答您的问题,如果您做出browser.waitForAngularEnabled(true);
,则要求量角器等待所有http请求完成。如果您的应用程序有连续的网络呼叫,那么browser.waitForAngularEnabled(false);
就会出现。
注意:如果您使用的是browser.waitForAngularEnabled(false);
,则必须使用显式等待。
希望答案能帮助您。