1 | # testcafe-browser-tools
|
2 |
|
3 | [![Build Status](https://travis-ci.org/DevExpress/testcafe-browser-tools.svg)](https://travis-ci.org/DevExpress/testcafe-browser-tools)
|
4 |
|
5 | TestСafe Browser Tools is an utility library for performing platform-dependent actions on browser windows.
|
6 | Working with browsers is specific for each operating system and requires native code to deal with. In order to provide painless and simple installation, this package encapsulates pre-built binaries for all supported platforms and JS-wrappers around them. This helps end-users avoid running *post-npm-install* build actions.
|
7 |
|
8 | # Build Process
|
9 | To build native binaries from source files, execute the gulp task corresponding to your operating system:
|
10 | ```
|
11 | 'build-win'
|
12 | 'build-mac'
|
13 | 'build-linux'
|
14 | ```
|
15 | Note that the application for a particular platform must be built on a machine with the same platform.
|
16 |
|
17 | The *bin* directory contains pre-built native binaries. Consider using them if your contribution does not affect the native modules.
|
18 |
|
19 | # Install
|
20 |
|
21 | ```
|
22 | $ npm install testcafe-browser-tools
|
23 | ```
|
24 | # API Reference
|
25 |
|
26 | **Important note**: To identify the web browser window, most of the provided functions use its title.
|
27 | This title matches the web page's `document.title` in most of the browsers.
|
28 | However, Microsoft Edge truncates the window title to the hostname if `document.title` contains only a URL
|
29 | ( e.g. `document.title = 'http://localhost:1337/page'` gives `localhost` in the window title).
|
30 |
|
31 | So, you need to add some characters before the URL in order to bring it to the window title:
|
32 | ```js
|
33 | document.title = 'title: ' + document.location.toString()
|
34 | ```
|
35 | For API reference, see the [API](API.md) document.
|
36 |
|
37 | # Testing
|
38 |
|
39 | To run automated tests:
|
40 | ```
|
41 | $ npm test
|
42 | ```
|
43 | Since the module functionality depends on browsers available on a testing machine and you cannot predict expected returned values for some functions, the automated tests cover only a part of the functionality.
|
44 | To test all the functions provided by the module, use the playground. To run it, execute the gulp task corresponding to your operating system:
|
45 | ```
|
46 | $ gulp run-playground-win
|
47 | $ gulp run-playground-mac
|
48 | $ gulp run-playground-linux
|
49 | ```
|
50 | This will open the Playground web page at [http://localhost:1334/](http://localhost:1334/), where you can manually check if the functions work correctly.
|
51 |
|
52 | # Author
|
53 |
|
54 | Developer Express Inc.([http://devexpress.com](http://devexpress.com))
|