-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Freewind
committed
Jan 4, 2015
1 parent
631fa46
commit af7ffe2
Showing
2 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
layout: post | ||
id: 2820 | ||
alias: ??? | ||
tags: ??? | ||
date: 2014-12-10 11:44:36 | ||
title: ??? | ||
--- | ||
|
||
在做Angular项目时,我们积累了一些使用protractor写测试的经验。 | ||
|
||
## 等待某个操作完成 | ||
|
||
有时候我们点击了某个按钮触发了某个操作后,需要等待一段短暂的时间那个操作才能完成。这时在我们的测试中,我们就需要以某种方式,等那个操作完成后,才能继续后面的测试。 | ||
|
||
我们可以使用`browser.wait`来实现这个功能。 | ||
|
||
```js | ||
var button = $("#pop-button"); | ||
button.click(); | ||
|
||
var dialog = $(".dialog"); | ||
browser.wait(function() { | ||
return dialog.isDisplayed(); | ||
}, 2000); | ||
``` | ||
|
||
这 |