Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit cca12ab

Browse files
committed
docs(control-flow): readability improvements for the control flow doc
1 parent 2131c03 commit cca12ab

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

docs/control-flow.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
The Webdriver Control Flow
22
==========================
33

4-
The WebDriverJS API is based on promises, which are managed by a control flow.
5-
I highly recommend reading the [WebDriverJS documentation](https://code.google.com/p/selenium/wiki/WebDriverJs#Understanding_the_API)
6-
on this topic. A short summary, and how Protractor interacts with the control
7-
flow, is presented below.
4+
The WebDriverJS API is based on [promises](https://code.google.com/p/selenium/wiki/WebDriverJs#Promises),
5+
which are managed by a [control flow](https://code.google.com/p/selenium/wiki/WebDriverJs#Control_Flows)
6+
and adapated for [Jasmine](http://jasmine.github.io/1.3/introduction.html).
7+
A short summary about how Protractor interacts with the control flow is presented below.
8+
89

910
Promises and the Control Flow
1011
-----------------------------
1112

1213
WebDriverJS (and thus, Protractor) APIs are entirely asynchronous. All functions
13-
return [promises](https://code.google.com/p/selenium/wiki/WebDriverJs#Promises).
14+
return promises.
1415

1516
WebDriverJS maintains a queue of pending promises, called the control flow,
16-
to keep execution organized. For example, consider the test
17+
to keep execution organized. For example, consider this test:
1718

1819
```javascript
1920
it('should find an element by text input model', function() {
@@ -44,12 +45,10 @@ Protractor adapts Jasmine so that each spec automatically waits until the
4445
control flow is empty before exiting. This means you don't need to worry
4546
about calling runs() and waitsFor() blocks.
4647

47-
Jasmine expectations are also adapted to understand promises. That's why
48-
the line
48+
Jasmine expectations are also adapted to understand promises. That's why this
49+
line works - the code actually adds an expectation task to the control flow,
50+
which will run after the other tasks:
4951

5052
```javascript
5153
expect(name.getText()).toEqual('Jane Doe');
5254
```
53-
54-
works - this code actually adds an expectation task to the control flow,
55-
which will run after the other tasks.

0 commit comments

Comments
 (0)