Skip to content

Commit 1cf2e4a

Browse files
author
stlc-bot
committed
feat(monitors): support browser actions on page monitors (#1365)
Stainless-Generated-From: 0a4844c8613c79b71621cabb3e683a7aaf6ddc22
1 parent 89aa64e commit 1cf2e4a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎pkg/cmd/monitor_test.go‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func TestMonitorsCreate(t *testing.T) {
1717
"--api-key", "string",
1818
"monitors", "create",
1919
"--name", "Acme pricing page",
20-
"--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
20+
"--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
2121
"--change-detection", "{type: exact}",
2222
"--mode", "web",
2323
"--schedule", "{frequency: 6, type: interval, unit: hours}",
@@ -37,7 +37,7 @@ func TestMonitorsCreate(t *testing.T) {
3737
"--api-key", "string",
3838
"monitors", "create",
3939
"--name", "Acme pricing page",
40-
"--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
40+
"--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
4141
"--change-detection", "{type: exact}",
4242
"--mode", "web",
4343
"--schedule.frequency", "6",
@@ -58,6 +58,9 @@ func TestMonitorsCreate(t *testing.T) {
5858
"target:\n" +
5959
" type: page\n" +
6060
" url: https://acme.com/pricing\n" +
61+
" actions:\n" +
62+
" - do: wait\n" +
63+
" timeMs: 0\n" +
6164
" exclude_selectors:\n" +
6265
" - .carousel\n" +
6366
" - '[id^=\"TA_\"]'\n" +
@@ -125,7 +128,7 @@ func TestMonitorsUpdate(t *testing.T) {
125128
"--status", "active",
126129
"--tag", "pricing",
127130
"--tag", "competitor",
128-
"--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
131+
"--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
129132
"--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed], retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}",
130133
)
131134
})
@@ -148,7 +151,7 @@ func TestMonitorsUpdate(t *testing.T) {
148151
"--status", "active",
149152
"--tag", "pricing",
150153
"--tag", "competitor",
151-
"--target", `{type: page, url: https://acme.com/pricing, exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
154+
"--target", `{type: page, url: https://acme.com/pricing, actions: [{do: wait, timeMs: 0}], exclude_selectors: [.carousel, '[id^="TA_"]'], include_selectors: ['#attraction-details'], instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}`,
152155
"--webhook.url", "https://example.com/webhook",
153156
"--webhook.events", "[change.detected, run.completed]",
154157
"--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}",
@@ -172,6 +175,9 @@ func TestMonitorsUpdate(t *testing.T) {
172175
"target:\n" +
173176
" type: page\n" +
174177
" url: https://acme.com/pricing\n" +
178+
" actions:\n" +
179+
" - do: wait\n" +
180+
" timeMs: 0\n" +
175181
" exclude_selectors:\n" +
176182
" - .carousel\n" +
177183
" - '[id^=\"TA_\"]'\n" +

0 commit comments

Comments
 (0)