-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update testplane config docs (#26)
* docs: refactor config docs
- Loading branch information
Showing
40 changed files
with
2,764 additions
and
1,635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<table> | ||
<thead> | ||
<tr> | ||
<td>**Опция**</td> | ||
<td>**Тип**</td> | ||
<td>**Описание**</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>ignoreElements</td> | ||
<td>Array или String</td> | ||
<td> | ||
Элементы (задаются как селекторы), которые будут проигнорированы при сравнении | ||
скриншотов. Игнор реализуется с помощью закраски перечисленных элементов черным | ||
цветом. В случае одного элемента параметр можно задавать как строку. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>tolerance</td> | ||
<td>Number</td> | ||
<td>Чувствительность к разнице в цветам.</td> | ||
</tr> | ||
<tr> | ||
<td>antialiasingTolerance</td> | ||
<td>Number</td> | ||
<td>Чувствительность в антиалиасинге.</td> | ||
</tr> | ||
<tr> | ||
<td>allowViewportOverflow</td> | ||
<td>Boolean</td> | ||
<td> | ||
По умолчанию Testplane выдает ошибку, если элемент находится за пределами границ | ||
вьюпорта. Этот параметр отключает проверку на границы, позволяя снимать скриншоты | ||
элементов, не влезающих во вьюпорт. При этом на скриншоте будут видны только те | ||
части элемента, которые влезли во вьюпорт. Однако если _compositeImage_ равен | ||
_true_, то части элемента, которые оказались за _нижней_ границей вьюпорта, тоже | ||
будут видны на скриншоте. Аналогично если _captureElementFromTop_ равен _true_, то | ||
на скриншот попадут и те части элемента, которые оказались за пределами _верхней_ | ||
границы вьюпорта. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>captureElementFromTop</td> | ||
<td>Boolean</td> | ||
<td> | ||
Снимать скриншот элемента с самого верха. Если элемент находится за пределами | ||
вьюпорта, то к нему будет выполнен подскролл. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>compositeImage</td> | ||
<td>Boolean</td> | ||
<td> | ||
Если элемент не влазит во вьюпорт, то при включении этой опции поочередно будет | ||
сделано несколько скриншотов разных частей элемента, после чего скриншоты будут | ||
склеены в один, чтобы отобразить элемент полностью. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>screenshotDelay</td> | ||
<td>Number</td> | ||
<td> | ||
Задержка в миллисекундах перед снятием скриншота. Может пригодиться, когда на | ||
странице есть элементы, использующие анимацию, или скроллбар, который исчезает не | ||
сразу и попадает на результирующий скриншот. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>selectorToScroll</td> | ||
<td>String</td> | ||
<td> | ||
Селектор, который нужно скроллировать. Может пригодиться, когда надо сделать | ||
скриншот модального окна, которое не помещается на экране. Иначе без указания | ||
селектора скролл будет применяться к объекту _window_, и скроллироваться будет | ||
задний фон, оставляя попап-окно на месте. | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>disableAnimation</td> | ||
<td>Boolean</td> | ||
<td> | ||
Отключение анимаций и переходов при снятии скриншота. По умолчанию `true` начиная с | ||
версии `8.0.0` | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>ignoreDiffPixelCount</td> | ||
<td>`` `${number}%` `` или Number</td> | ||
<td> | ||
Процент пикселей, которые нужно игнорировать при диффе. Удобно для игнорирования | ||
очень маленьких диффов. По умолчанию `0`. Доступен начиная с версии `8.2.0` | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
browsers: { | ||
"<browser-id>": { | ||
desiredCapabilities: { | ||
browserName: "<browser-name>", | ||
// ... | ||
}, | ||
// ... | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
17 changes: 17 additions & 0 deletions
17
docs/config/_partials/examples/_browsers-desired-capabilities.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
browsers: { | ||
chrome: { | ||
desiredCapabilities: { | ||
browserName: "chrome", | ||
browserVersion: "125.0", | ||
"goog:chromeOptions": { | ||
args: ["--hide-scrollbars", "--headless=new"], | ||
}, | ||
}, | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
sessionsPerBrowser: 10, | ||
browsers: { | ||
chrome: { | ||
/* ... */ | ||
}, | ||
firefox: { | ||
// ... | ||
sessionsPerBrowser: 5, | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
14 changes: 14 additions & 0 deletions
14
docs/config/_partials/examples/_browsers-session-env-flags.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
browsers: { | ||
"chrome-phone": { | ||
// ... | ||
sessionEnvFlags: { | ||
isMobile: true, | ||
}, | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
retry: process.env.IS_CI ? 5 : 0, | ||
|
||
httpTimeout: 60_000, | ||
sessionsPerBrowser: 5, | ||
testsPerSession: 20, | ||
|
||
browsers: { | ||
chrome: { | ||
desiredCapabilities: { | ||
browserName: "chrome", | ||
automationProtocol: "devtools", | ||
headless: true, | ||
}, | ||
}, | ||
}, | ||
sets: { | ||
desktop: { | ||
files: ["testplane-tests/**/*.testplane.(t|j)s"], | ||
browsers: ["chrome"], | ||
}, | ||
}, | ||
plugins: { | ||
"html-reporter/testplane": { | ||
enabled: true, | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
const SERVER_PORT = 3000; | ||
|
||
export default { | ||
// ... | ||
devServer: { | ||
command: "npm run server:dev", | ||
env: { PORT: SERVER_PORT }, | ||
readinessProbe: { | ||
url: `http://localhost:${SERVER_PORT}/health`, | ||
timeouts: { | ||
// optional | ||
waitServerTimeout: 60_000, // default value | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
// ... | ||
lastFailed: { | ||
only: false, | ||
input: [".testplane/failed.json"], | ||
output: ".testplane/failed.json", | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
browsers: { | ||
chrome: { | ||
desiredCapabilities: { | ||
browserName: "chrome", | ||
}, | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
```typescript title="testplane.config.ts" | ||
import type { ConfigInput } from "testplane"; | ||
|
||
export default { | ||
// ... | ||
plugins: { | ||
"my-cool-plugin": { | ||
param: "some-value", | ||
}, | ||
}, | ||
} satisfies ConfigInput; | ||
``` | ||
|
||
```typescript title="testplane-my-cool-plugin/index.ts" | ||
exports = function (testplane, opts) { | ||
testplane.on(testplane.events.RUNNER_START, function (runner) { | ||
console.info(opts.param); // some-value | ||
|
||
return setUp(testplane.config, opts.param); | ||
}); | ||
|
||
testplane.on(testplane.events.RUNNER_END, function () { | ||
return tearDown(); | ||
}); | ||
}; | ||
``` |
Oops, something went wrong.