Skip to content

Commit

Permalink
[U-3684] Update playwright docs and add an example (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
iatanas0v authored Nov 22, 2024
1 parent d658bb4 commit 3fbe5d4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/data-sources/betteruptime_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Monitor lookup.
- **remember_cookies** (Boolean) Set to true to keep cookies when redirecting.
- **request_body** (String) Request body for POST, PUT, PATCH requests. Required if monitor_type is set to dns (domain to query the DNS server with).
- **request_headers** (List of Map of String) An array of request headers, consisting of name and value pairs
- **request_timeout** (Number) How long to wait before timing out the request? In seconds.
- **request_timeout** (Number) How long to wait before timing out the request? In seconds. When `monitor_type` is set to `playwright`, this determines the Playwright scenario timeout.
- **required_keyword** (String) Required if monitor_type is set to keyword or udp. We will create a new incident if this keyword is missing on your page.
- **scenario_name** (String) For Playwright monitors, the scenario name identifying the monitor in the UI.
- **sms** (Boolean) Should we send an SMS to the on-call person?
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/betteruptime_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ https://betterstack.com/docs/uptime/api/monitors/
- **remember_cookies** (Boolean) Set to true to keep cookies when redirecting.
- **request_body** (String) Request body for POST, PUT, PATCH requests. Required if monitor_type is set to dns (domain to query the DNS server with).
- **request_headers** (List of Map of String) An array of request headers, consisting of name and value pairs
- **request_timeout** (Number) How long to wait before timing out the request? In seconds.
- **request_timeout** (Number) How long to wait before timing out the request? In seconds. When `monitor_type` is set to `playwright`, this determines the Playwright scenario timeout.
- **required_keyword** (String) Required if monitor_type is set to keyword or udp. We will create a new incident if this keyword is missing on your page.
- **scenario_name** (String) For Playwright monitors, the scenario name identifying the monitor in the UI.
- **sms** (Boolean) Should we send an SMS to the on-call person?
Expand Down
15 changes: 15 additions & 0 deletions examples/advanced/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,21 @@ resource "betteruptime_monitor" "dns" {
monitor_group_id = betteruptime_monitor_group.this.id
}

resource "betteruptime_monitor" "playwright" {
url = "Better Stack Homepage"
monitor_type = "playwright"
monitor_group_id = betteruptime_monitor_group.this.id
playwright_script = <<-EOT
const { test, expect } = require('@playwright/test');
test('has title', async ({ page }) => {
await page.goto('https://betterstack.com/')
await expect(page).toHaveTitle(/Better Stack/)
});
EOT
request_timeout = 60
}

resource "betteruptime_status_page_resource" "monitor_status" {
status_page_id = betteruptime_status_page.this.id
status_page_section_id = betteruptime_status_page_section.monitors.id
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/resource_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ var monitorSchema = map[string]*schema.Schema{
// TODO: ValidateDiagFunc: validation.StringInSlice
},
"request_timeout": {
Description: "How long to wait before timing out the request? In seconds.",
Description: "How long to wait before timing out the request? In seconds. When `monitor_type` is set to `playwright`, this determines the Playwright scenario timeout.",
Type: schema.TypeInt,
Optional: true,
Computed: true,
Expand Down

0 comments on commit 3fbe5d4

Please sign in to comment.