Skip to content

Commit 39ca377

Browse files
author
stlc-bot
committed
feat(monitors): add page selector filters (#1037)
Stainless-Generated-From: f472fabf9d436861207974b71d902b8418aa387b
1 parent 36ca492 commit 39ca377

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

‎pkg/cmd/monitor_test.go‎

Lines changed: 14 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, 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, 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, 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, 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,11 @@ func TestMonitorsCreate(t *testing.T) {
5858
"target:\n" +
5959
" type: page\n" +
6060
" url: https://acme.com/pricing\n" +
61+
" exclude_selectors:\n" +
62+
" - .carousel\n" +
63+
" - '[id^=\"TA_\"]'\n" +
64+
" include_selectors:\n" +
65+
" - '#attraction-details'\n" +
6166
" instructions: >-\n" +
6267
" Report pricing or plan availability changes. Ignore counters, timestamps,\n" +
6368
" testimonials, and navigation.\n" +
@@ -120,7 +125,7 @@ func TestMonitorsUpdate(t *testing.T) {
120125
"--status", "active",
121126
"--tag", "pricing",
122127
"--tag", "competitor",
123-
"--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}",
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}`,
124129
"--webhook", "{url: https://example.com/webhook, events: [change.detected, run.completed], retry: {delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}}",
125130
)
126131
})
@@ -143,7 +148,7 @@ func TestMonitorsUpdate(t *testing.T) {
143148
"--status", "active",
144149
"--tag", "pricing",
145150
"--tag", "competitor",
146-
"--target", "{type: page, url: https://acme.com/pricing, instructions: 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', normalize_whitespace: true}",
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}`,
147152
"--webhook.url", "https://example.com/webhook",
148153
"--webhook.events", "[change.detected, run.completed]",
149154
"--webhook.retry", "{delays_seconds: [10, 60, 300, 1800, 7200, 21600, 57600]}",
@@ -167,6 +172,11 @@ func TestMonitorsUpdate(t *testing.T) {
167172
"target:\n" +
168173
" type: page\n" +
169174
" url: https://acme.com/pricing\n" +
175+
" exclude_selectors:\n" +
176+
" - .carousel\n" +
177+
" - '[id^=\"TA_\"]'\n" +
178+
" include_selectors:\n" +
179+
" - '#attraction-details'\n" +
170180
" instructions: >-\n" +
171181
" Report pricing or plan availability changes. Ignore counters, timestamps,\n" +
172182
" testimonials, and navigation.\n" +

0 commit comments

Comments
 (0)