Skip to content

Commit

Permalink
#3 Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
gidztech committed Jan 14, 2019
1 parent 4319195 commit 9da4b6f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 48 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# puppeteer-extensions

[![Build Status](https://travis-ci.org/HuddleEng/puppeteer-extensions.svg?branch=master)](https://travis-ci.org/HuddleEng/puppeteer-extensions)

This library exposes a number of convenience functions to extend Puppeteer's API, in order to make writing tests easier.
The idea is that many of these functions (or similar ones) will eventually make their way into Puppeteer's own API, but
this allows us to experiment with new ways of improving UI testing.
Provides extension functions for working with Puppeteer, in order to make writing tests easier.

## Usage
- `page` Puppeteer page instance
- `timeout` [Optional] Timeout for waits in milliseconds (default: 5000 ms)

- `page` Puppeteer page instance
- `timeout` [Optional] Timeout for waits in milliseconds (default: 5000 ms)

```javascript
const extensions = require('puppeteer-extensions')(page);
```

**Example:**

```javascript
(async() {
const listItem = '.todo-list li';
...
await extensions.waitForNthSelectorAttributeValue(listItem, 1, 'class', 'completed');
})();

```
```
54 changes: 27 additions & 27 deletions docs/classes/extensions.html
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L51">Extensions.ts:51</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L51">Extensions.ts:51</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -1105,7 +1105,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> default<wbr>Timeout</h3
<div class="tsd-signature tsd-kind-icon">default<wbr>Timeout<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L51">Extensions.ts:51</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L51">Extensions.ts:51</a></li>
</ul>
</aside>
</section>
Expand All @@ -1115,7 +1115,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> puppeteer<wbr>Page</h3>
<div class="tsd-signature tsd-kind-icon">puppeteer<wbr>Page<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Page</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L49">Extensions.ts:49</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L49">Extensions.ts:49</a></li>
</ul>
</aside>
</section>
Expand All @@ -1125,7 +1125,7 @@ <h3><span class="tsd-flag ts-flagPrivate">Private</span> resource<wbr>Requests</
<div class="tsd-signature tsd-kind-icon">resource<wbr>Requests<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Request</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol"> =&nbsp;[]</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L50">Extensions.ts:50</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L50">Extensions.ts:50</a></li>
</ul>
</aside>
</section>
Expand All @@ -1142,7 +1142,7 @@ <h3>evaluate</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L488">Extensions.ts:488</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L488">Extensions.ts:488</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1191,7 +1191,7 @@ <h3>fast<wbr>Forward<wbr>Time</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L475">Extensions.ts:475</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L475">Extensions.ts:475</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1222,7 +1222,7 @@ <h3>get<wbr>Property<wbr>Value</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L413">Extensions.ts:413</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L413">Extensions.ts:413</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1262,7 +1262,7 @@ <h3>get<wbr>Text</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L401">Extensions.ts:401</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L401">Extensions.ts:401</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1296,7 +1296,7 @@ <h3>get<wbr>Value</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L390">Extensions.ts:390</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L390">Extensions.ts:390</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1330,7 +1330,7 @@ <h3>is<wbr>Element<wbr>Focused</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L436">Extensions.ts:436</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L436">Extensions.ts:436</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1364,7 +1364,7 @@ <h3>reset<wbr>Resource<wbr>Requests</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L496">Extensions.ts:496</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L496">Extensions.ts:496</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -1386,7 +1386,7 @@ <h3>turn<wbr>Off<wbr>Animations</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L447">Extensions.ts:447</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L447">Extensions.ts:447</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand All @@ -1408,7 +1408,7 @@ <h3>wait<wbr>For</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L377">Extensions.ts:377</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L377">Extensions.ts:377</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1439,7 +1439,7 @@ <h3>wait<wbr>For<wbr>Document<wbr>Title</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L346">Extensions.ts:346</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L346">Extensions.ts:346</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1470,7 +1470,7 @@ <h3>wait<wbr>For<wbr>Element<wbr>Count</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L330">Extensions.ts:330</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L330">Extensions.ts:330</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1507,7 +1507,7 @@ <h3>wait<wbr>For<wbr>Function</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L165">Extensions.ts:165</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L165">Extensions.ts:165</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1567,7 +1567,7 @@ <h3>wait<wbr>For<wbr>Loaded<wbr>Web<wbr>Font<wbr>Count<wbr>ToBe</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L107">Extensions.ts:107</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L107">Extensions.ts:107</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1604,7 +1604,7 @@ <h3>wait<wbr>For<wbr>Nth<wbr>Selector<wbr>Attribute</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L245">Extensions.ts:245</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L245">Extensions.ts:245</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1647,7 +1647,7 @@ <h3>wait<wbr>For<wbr>Nth<wbr>Selector<wbr>Attribute<wbr>Value</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L283">Extensions.ts:283</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L283">Extensions.ts:283</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1696,7 +1696,7 @@ <h3>wait<wbr>For<wbr>Resource</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L68">Extensions.ts:68</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L68">Extensions.ts:68</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1733,7 +1733,7 @@ <h3>wait<wbr>For<wbr>Selector<wbr>Attribute</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L268">Extensions.ts:268</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L268">Extensions.ts:268</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1770,7 +1770,7 @@ <h3>wait<wbr>For<wbr>Selector<wbr>Attribute<wbr>Value</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L311">Extensions.ts:311</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L311">Extensions.ts:311</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1813,7 +1813,7 @@ <h3>wait<wbr>For<wbr>Url</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L362">Extensions.ts:362</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L362">Extensions.ts:362</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1844,7 +1844,7 @@ <h3>wait<wbr>Until<wbr>Exists<wbr>And<wbr>Visible</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L180">Extensions.ts:180</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L180">Extensions.ts:180</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1880,7 +1880,7 @@ <h3>wait<wbr>Until<wbr>Selector<wbr>Has<wbr>Visible<wbr>Content</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L203">Extensions.ts:203</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L203">Extensions.ts:203</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1911,7 +1911,7 @@ <h3>wait<wbr>While<wbr>Exists<wbr>And<wbr>Visible</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L192">Extensions.ts:192</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L192">Extensions.ts:192</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1947,7 +1947,7 @@ <h3>wait<wbr>While<wbr>Selector<wbr>Has<wbr>Visible<wbr>Content</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/Extensions.ts#L223">Extensions.ts:223</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/Extensions.ts#L223">Extensions.ts:223</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
6 changes: 3 additions & 3 deletions docs/classes/hackydate.html
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ <h3>constructor</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/HackyDate.ts#L2">HackyDate.ts:2</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/HackyDate.ts#L2">HackyDate.ts:2</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -1006,7 +1006,7 @@ <h3>date</h3>
<div class="tsd-signature tsd-kind-icon">date<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">Date</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/HackyDate.ts#L2">HackyDate.ts:2</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/HackyDate.ts#L2">HackyDate.ts:2</a></li>
</ul>
</aside>
</section>
Expand All @@ -1023,7 +1023,7 @@ <h3>now</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/HackyDate.ts#L10">HackyDate.ts:10</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/HackyDate.ts#L10">HackyDate.ts:10</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
Expand Down
11 changes: 5 additions & 6 deletions docs/globals.html
Original file line number Diff line number Diff line change
Expand Up @@ -931,15 +931,14 @@
<div class="tsd-panel tsd-typography">
<h1 id="puppeteer-extensions">puppeteer-extensions</h1>
<p><a href="https://travis-ci.org/HuddleEng/puppeteer-extensions"><img src="https://travis-ci.org/HuddleEng/puppeteer-extensions.svg?branch=master" alt="Build Status"></a></p>
<p>This library exposes a number of convenience functions to extend Puppeteer&#39;s API, in order to make writing tests easier.
The idea is that many of these functions (or similar ones) will eventually make their way into Puppeteer&#39;s own API, but
this allows us to experiment with new ways of improving UI testing.</p>
<p>Provides extension functions for working with Puppeteer, in order to make writing tests easier.</p>
<h2 id="usage">Usage</h2>
<ul>
<li><code>page</code> Puppeteer page instance</li>
<li><code>timeout</code> [Optional] Timeout for waits in milliseconds (default: 5000 ms)</li>
</ul>
<pre><code class="language-javascript"><span class="hljs-keyword">const</span> extensions = <span class="hljs-built_in">require</span>(<span class="hljs-string">'puppeteer-extensions'</span>)(page);</code></pre>
<p><strong>Example:</strong></p>
<pre><code class="language-javascript">(<span class="hljs-keyword">async</span>() {
<span class="hljs-keyword">const</span> listItem = <span class="hljs-string">'.todo-list li'</span>;
...
Expand Down Expand Up @@ -982,7 +981,7 @@ <h3><span class="tsd-flag ts-flagConst">Const</span> DEFAULT_<wbr>TIMEOUT_<wbr>M
<div class="tsd-signature tsd-kind-icon">DEFAULT_<wbr>TIMEOUT_<wbr>MS<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> =&nbsp;5000</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/index.ts#L3">index.ts:3</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/index.ts#L3">index.ts:3</a></li>
</ul>
</aside>
</section>
Expand All @@ -999,7 +998,7 @@ <h3><span class="tsd-flag ts-flagExport assignment">Export assignment</span> ini
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/index.ts#L10">index.ts:10</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/index.ts#L10">index.ts:10</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down Expand Up @@ -1032,7 +1031,7 @@ <h3>serialize<wbr>Function<wbr>With<wbr>Args</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/01fc503/src/external/Serialization.ts#L90">external/Serialization.ts:90</a></li>
<li>Defined in <a href="https://github.com/HuddleEng/puppeteer-extensions/blob/526e451/src/external/Serialization.ts#L90">external/Serialization.ts:90</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
Expand Down
Loading

0 comments on commit 9da4b6f

Please sign in to comment.