Skip to content

Commit

Permalink
Merge pull request #19 from gemini-testing/TESTPLANE-165.newWindow
Browse files Browse the repository at this point in the history
docs: add warning about newWindow command
  • Loading branch information
KuznetsovRoman authored Jul 30, 2024
2 parents a93f786 + 2349dae commit f893306
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/commands/browser/newWindow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ import Admonition from "@theme/Admonition";

<Admonition type="warning">Команда _newWindow_ не работает в мобильных окружениях (!)</Admonition>

<Admonition type="warning">
Команда может не работать c _devtools_ протоколом. Также она не дожидается загрузки страницы.
Чтобы решить эти проблемы, рекомендуется перезаписать команду (на стороне Testplane это будет сделано в версии 9.0.0):
```javascript
browser.overwriteCommand("newWindow", async function(pageUrl, windowName, windowFeatures) {
if (browser.isDevTools) {
const puppeteer = await browser.getPuppeteer();
await puppeteer.newPage();
} else {
await browser.newWindow("about:blank", windowName, windowFeatures);
}

await browser.url(pageUrl);
});
```

</Admonition>

## Использование {#usage}

```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ Note that this command will automatically switch you to the new window upon exec
The _newWindow_ command does not work in mobile environments (!)
</Admonition>

<Admonition type="warning">
The command might not work with _devtools_ protocol. It also does not wait untill page load.
In order to fix these problems, it is recommended to overwrite the command (on the Testplane side it would be done in version 9.0.0):
```javascript
browser.overwriteCommand("newWindow", async function(pageUrl, windowName, windowFeatures) {
if (browser.isDevTools) {
const puppeteer = await browser.getPuppeteer();
await puppeteer.newPage();
} else {
await browser.newWindow("about:blank", windowName, windowFeatures);
}

await browser.url(pageUrl);
});
```

</Admonition>

## Usage {#usage}

```javascript
Expand Down

0 comments on commit f893306

Please sign in to comment.