Tag: 测量

如果元素包含值,如何退出量angular器中的testing用例

我一直在量angular器上写一套testing,差不多完成了。 我很难搞清楚如何做相当普通的事情。 我希望能够检查一个文本框是否包含一个值,如果是,退出testing用例失败。 (如果文本框包含一个值,我知道testing用例不可能传递) 我目前正在尝试这样的事情: tasksPage.generalInformationDateOfBirthTextbox.getAttribute('value').then(function(attr){ //attr contains the correct value in the textbox here but how do I return it to parent scope so I can exit the test case? console.log("attr length is " + attr.length); expect(attr.length).toBe(0); },function(err){ console.log("An error was caught while evaluating Date of Birth text value: " + err); }); 期望声明失败,因为我期望它,但testing用例继续下去,这似乎是预期的行为。 […]