Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
flaurida committed Mar 9, 2020
1 parent bb672ad commit a5ab90b
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/docs/api/components/cli/ArgumentTest.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import React from 'react';
import Argument from '../Argument';
import ArgumentAllBrowsers from './ArgumentAllBrowsers';
import ArgumentFirefox from './ArgumentFirefox';
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/components/qawolf/ArgumentCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function ArgumentCreate() {
return (
<React.Fragment>
<Argument
description={<React.Fragment>Create options.</React.Fragment>}
description="Create options."
name="options"
optional
type="Object"
Expand Down
6 changes: 4 additions & 2 deletions docs/docs/api/components/qawolf/ArgumentLaunch.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Link from '@docusaurus/Link';
import useBaseUrl from '@docusaurus/useBaseUrl';
import React from 'react';
import Argument from '../Argument';

Expand All @@ -22,9 +24,9 @@ function ArgumentLaunch() {
description={
<React.Fragment>
Launch this type of browser. <b>Default:</b>{' '}
<a href="../../api/environment_variables#qaw_browser">
<Link to={useBaseUrl('docs/api/environment_variables#qaw_browser')}>
<code>QAW_BROWSER</code>
</a>
</Link>
.
</React.Fragment>
}
Expand Down
63 changes: 63 additions & 0 deletions docs/docs/api/components/qawolf/ArgumentWaitForPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React from 'react';
import Argument from '../Argument';

function ArgumentWaitForPage() {
return (
<React.Fragment>
<Argument
description={
<React.Fragment>
The{' '}
<a href="https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browsercontext">
Playwright <code>BrowserContext</code>
</a>{' '}
instance where the page will load.
</React.Fragment>
}
name="context"
type="BrowserContext"
/>
<Argument
description={
<React.Fragment>
The index of the page, starting from <code>0</code>.
</React.Fragment>
}
name="index"
type="number"
/>
<Argument
description="Wait for page options."
name="options"
optional
type="Object"
/>
<Argument
description={
<React.Fragment>
Maximum time in milliseconds to wait for the page. <b>Default:</b>{' '}
<code>30000</code>.
</React.Fragment>
}
name="timeout"
indent
optional
type="number"
/>
<Argument
description={
<React.Fragment>
When to consider navigation on the page over. <b>Default:</b>{' '}
<code>"load"</code>.
</React.Fragment>
}
indent
name="waitUntil"
optional
type='"commit" | "load" | "domcontentloaded" | "networkidle0" | "networkidle2"'
/>
</React.Fragment>
);
}

export default ArgumentWaitForPage;
2 changes: 1 addition & 1 deletion docs/docs/api/components/qawolf/ReturnBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function ReturnBrowser() {
<Argument
description={
<React.Fragment>
Resolves a{' '}
Resolves with a{' '}
<a href="https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browser">
Playwright <code>Browser</code>
</a>{' '}
Expand Down
22 changes: 22 additions & 0 deletions docs/docs/api/components/qawolf/ReturnPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import Argument from '../Argument';

function ReturnPage() {
return (
<Argument
description={
<React.Fragment>
Resolves with a{' '}
<a href="https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page">
Playwright <code>Page</code>
</a>{' '}
instance.
</React.Fragment>
}
name=""
type="Promise<Page>"
/>
);
}

export default ReturnPage;
2 changes: 1 addition & 1 deletion docs/docs/api/qawolf/create.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ArgumentCreate from '../components/qawolf/ArgumentCreate';
import ReturnVoid from '../components/qawolf/ReturnVoid';
import Syntax from '../components/Syntax';

<Syntax code="create([options={}])" />
<Syntax code="create([options])" />

Convert your browser actions to code. Call `create` in a test or script file to insert new code where it was called.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/api/qawolf/launch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ArgumentLaunch from '../components/qawolf/ArgumentLaunch';
import ReturnBrowser from '../components/qawolf/ReturnBrowser';
import Syntax from '../components/Syntax';

<Syntax code="launch([options={}])" />
<Syntax code="launch([options])" />

Launch a [Playwright `Browser`](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browser) instance.

Expand Down
7 changes: 4 additions & 3 deletions docs/docs/api/qawolf/register.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import Syntax from '../components/Syntax';

<Syntax code="register(context)" />

Allow QA Wolf to access the specified [Playwright `BrowserContext`](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browsercontext) instance, which:

- Register the [Playwright `BrowserContext`](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browsercontext) so [waitForPage](TODO) works.
- Register the [html selector](https://github.com/qawolf/playwright-html-selector) so the [default selectors](../../use_custom_selectors#default-selector-logic) work.
- Create [debug artifacts](../../run_tests_in_ci#debug) when [QAW_ARTIFACT_PATH](../environment_variables#qaw_artifact_path) is specified.
- Registers the [Playwright `BrowserContext`](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browsercontext) so [`waitForPage`](wait_for_page) works
- Registers the [HTML selector](https://github.com/qawolf/playwright-html-selector) so the [default selector logic](../../use_custom_selectors#default-selector-logic) works
- Creates [debug artifacts](../../run_tests_in_ci#debug) when [QAW_ARTIFACT_PATH](../environment_variables#qaw_artifact_path) is specified

### Arguments

Expand Down
49 changes: 49 additions & 0 deletions docs/docs/api/qawolf/wait_for_page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
id: wait_for_page
sidebar_label: waitForPage
title: qawolf.waitForPage
---

import ArgumentWaitForPage from '../components/qawolf/ArgumentWaitForPage';
import ReturnPage from '../components/qawolf/ReturnPage';
import Syntax from '../components/Syntax';

<Syntax code="waitForPage(context, index[, options])" />

Wait for [Playwright `Page`](https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page) instance with specified index to load.

### Arguments

<ArgumentWaitForPage />

### Returns

<ReturnPage />

### Examples

Wait for the page with index `1`:

```js
const qawolf = require('qawolf');
// ...
const page = await qawolf.waitForPage(context, 1);
```

Wait for the page with index `0`, timing out in 10 seconds if the page does not load:

```js
const qawolf = require('qawolf');
// ...
const page = await qawolf.waitForPage(context, 0, { timeout: 10000 });
```

Wait for the page with index `0`, considering navigation to be complete after the `DOMContentLoaded` event fires:

```js
const qawolf = require('qawolf');
// ...
const page = await qawolf.waitForPage(context, 0, {
waitUntil: 'domcontentloaded',
});
```
2 changes: 2 additions & 0 deletions docs/docs/api/table_of_contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ In addition to the APIs below, you have full access to the [Playwright API](http
[scroll](qawolf/scroll)

[setState](qawolf/set_state)

[waitForPage](qawolf/wait_for_page)
1 change: 1 addition & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module.exports = {
'api/qawolf/save_state',
'api/qawolf/scroll',
'api/qawolf/set_state',
'api/qawolf/wait_for_page',
],
},
],
Expand Down

0 comments on commit a5ab90b

Please sign in to comment.