Skip to content

Commit

Permalink
Fix small typos (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoeidelvein authored Feb 12, 2020
1 parent 36ed485 commit 6f5026f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/usage/api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# API Testing
Setting up a test system or providing a consistent data set for a UI test is a challange. A good pactice is to have self-contained UI tests that prepare the test content thmeselves, interact with the UI and then assert changes in the system state. Or cleanup the test content so the system is left in a known state.
Setting up a test system or providing a consistent data set for a UI test is a challenge. A good pactice is to have self-contained UI tests that prepare the test content themselves, interact with the UI and then assert changes in the system state. Or cleanup the test content so the system is left in a known state.

To do so, the test needs a way to call REST endpoints. Our API testing is insipired by [SuperTest](https://github.com/visionmedia/supertest) but is adapted to the UIVeri5 experience. The request object is a pure [SuperAgent](https://github.com/visionmedia/superagent) request object, adapted with execution flow. No additional methods are provided.

Expand Down Expand Up @@ -44,7 +44,7 @@ request.get('http://myapi.dev.hana.ondemand.com/contacts/1').do()
contacts = res.body;
});

// the arrow function is necesary to postpone the URL building till the actual execution time
// the arrow function is necessary to postpone the URL building till the actual execution time
request.delete('http://myapi.dev.hana.ondemand.com/contacts/1').do() => `/contacts/{contacts[0].id}`);
```

Expand All @@ -59,18 +59,18 @@ request.get(restServiceMockUrl +'/usersWithAuth')
```

# OData Helpers
Full OData ORM is out of scope but the following samples can simplify basic OData scenarious. For better oData support, please use [TBD]().
Full OData ORM is out of scope but the following samples can simplify basic OData scenarios. For better oData support, please use [TBD]().

# Advanced
## Control Flow
Currently, UIVeri5 is utilising the WebDriverJs concept of control flow. The flow is a sequence of asynchronous function calls, that a dedicated scheduler runs in sequence.

### Synchrnoze a Promise in the Control Flow
The flow mananager API is based on promises so it is very easy to synchrnonze a promise in the control flow. With this, subsequence flow operations, such as `element().click()` or `expect()` calls will wait for the promise to be resolved and just then proceed.
### Synchronize a Promise in the Control Flow
The flow mananager API is based on promises so it is very easy to synchronize a promise in the control flow. With this, subsequence flow operations, such as `element().click()` or `expect()` calls will wait for the promise to be resolved and just then proceed.

````javascript
browser.driver.control.flow(somePromise);
````

## Async/Await
In ES2017 environment, the concept of control flow is supported natively with the async/await operators. Async/await operators have a great benefit - they make it easy to debug the async executions with the browser/node tool. They also have a disadvantage compared to the execution flow - the synchrnization is explicit and it is a responsibility of the test developer. Due to this explicitness, it is not possible to combine flow manager and async/await transparently, so the app/test should explicitly synchronize on the interaction points.
In ES2017 environment, the concept of control flow is supported natively with the async/await operators. Async/await operators have a great benefit - they make it easy to debug the async executions with the browser/node tool. They also have a disadvantage compared to the execution flow - the synchronization is explicit and it is a responsibility of the test developer. Due to this explicitness, it is not possible to combine flow manager and async/await transparently, so the app/test should explicitly synchronize on the interaction points.

0 comments on commit 6f5026f

Please sign in to comment.