Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed expect api index docs #324

Open
wants to merge 1 commit into
base: versions/3.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 84 additions & 3 deletions docs/api/expect/index.md
Original file line number Diff line number Diff line change
@@ -98,7 +98,54 @@ These methods will perform assertions on the specified target on the current ele
</div>
</div>

<%- include('./_cookie.md') %>


<!-- .cookie() -->

<h2 id="expect-cookie">expect.cookie()</h2>
<div class="apimethod">

Expect assertions operating on a single cookie after retrieving the entire cookie string, using `.getCookies()`.

<h5>Syntax:</h5>
<div class="sample-test" style="max-width:600px" >
<pre data-language="javascript" style="padding-top: 10px"><code class="language-javascript">browser.expect.cookie('cookie-name', ['cookie-domain'])</code></pre>
</div>

<div class="sample-test">
<pre class="line-numbers" data-language="javascript"><code class="language-javascript">this.demoTest = function (browser) {
browser.expect.cookie('cookie-name').to.contain('cookie-value');
browser.expect.cookie('cookie-name').to.match(/regex/);
browser.expect.cookie('loginCookie', 'example.org').to.contain('cookie-value');
};</code></pre>
</div>

<h5>Parameters:</h5>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">Name</th>
<th style="width: 100px;">Type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>name</code></td>
<td>String</td>
<td>The name of the cookie to be inspected.</td>
</tr>
<tr>
<td><code>domain</code><br><span class="optional">Optional</span></td>
<td>String</td>
<td>The domain name on which the cookie is set to.</td>
</tr>
</tbody>
</table>
</div>
</div>


<h2 id="expect-element">expect.element()</h2>

@@ -120,5 +167,39 @@ These methods will perform assertions on the specified target on the current ele
### Assertions:
- [count()](/api/expect/elements/count.html)

<%- include('./_title.md') %>
<%- include('./_url.md') %>


<!-- .title() -->

<h2 id="expect-title">expect.title()</h2>

<div class="apimethod">

Retrieves the page title value in order to be used for performing `equal`, `match` or `contains` assertions on it.

<h5>Usage:</h5>
<div class="sample-test">
<pre class="line-numbers" data-language="javascript"><code class="language-javascript">this.demoTest = function (browser) {
browser.expect.title().to.contain('value');
browser.expect.title().to.match(/value/);
};</code></pre>
</div>
</div>



<!-- .url() -->

<h2 id="expect-url">expect.url()</h3>
<div class="apimethod">

Retrieves the page url value in order to be used for performing `equal`, `match` or `contains` assertions on it.

<h5>Usage:</h5>
<div class="sample-test">
<pre class="line-numbers" data-language="javascript"><code class="language-javascript">this.demoTest = function (browser) {
browser.expect.url().to.contain('https://');
browser.expect.url().to.endWith('.org');
};</code></pre>
</div>
</div>