-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add synthetics configuration docs (#847)
* add synthetics configuration docs * Apply suggestions from code review Co-authored-by: Brandon Morelli <bmorelli25@gmail.com> * complete the export sentence Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>
- Loading branch information
1 parent
bbe3f2a
commit f4f605f
Showing
3 changed files
with
70 additions
and
5 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
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,63 @@ | ||
[[synthetics-configuration]] | ||
= Synthetic tests configuration | ||
|
||
++++ | ||
<titleabbrev>Synthetic tests configuration</titleabbrev> | ||
++++ | ||
|
||
beta[] Synthetic tests support the configuration of dynamic parameters that can be | ||
used in the suites. In addition, the Synthetics agent, which is built on top | ||
of Playwright, supports configuring browser and context options that are available | ||
in Playwright specific methods, for example, `ignoreHTTPSErrors` and `viewport`. | ||
|
||
[discrete] | ||
[[synthetics-config-file]] | ||
== Global Synthetics Configuration | ||
|
||
Create a `synthetics.config.js` or `synthetics.config.ts` file in the root of the | ||
synthetics project and specify the options: | ||
|
||
[source,js] | ||
---- | ||
import { SyntheticsConfig } from "@elastic/synthetics" | ||
const config: SyntheticsConfig = { | ||
params: { | ||
url: "https://www.elastic.co" | ||
}, | ||
playwrightOptions: { | ||
ignoreHTTPSErrors: true, // ignores all HTTPS errors during navigation | ||
} | ||
} | ||
export default config; | ||
---- | ||
|
||
The configuration file can either export an object, or a function that when | ||
called should return the generated configuration. To know more about configuring | ||
the tests based on environments, look at the <<synthetics-dynamic-configs, dynamic configuration>> documentation. | ||
|
||
[discrete] | ||
[[synthetics-config-device-emulation]] | ||
=== Device emulation | ||
|
||
Users can emulate a mobile device using the configuration file. | ||
The example configuration below runs tests in "Pixel 5" emulation mode. | ||
|
||
[source,js] | ||
---- | ||
import { SyntheticsConfig } from "@elastic/synthetics" | ||
import { devices } from "playwright-chromium" | ||
const config: SyntheticsConfig = { | ||
playwrightOptions: { | ||
...devices['Pixel 5'] | ||
} | ||
} | ||
export default config; | ||
---- | ||
|
||
|
||
NOTE: Synthetics tests configuration can only be used along with synthetics | ||
projects and is not available for inline suites. |
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