Skip to content

Commit 9cbc8fb

Browse files
authored
SYN-4427 : Update default wait_for_nav_timeout to 50 & add test cases (#62)
* SYN-4427 : Update default wait_for_nav_timeout to 50 & add test cases * update default vallue to 50 in assertion
1 parent 29e6543 commit 9cbc8fb

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

synthetics/resource_browser_check_v2.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ func resourceBrowserCheckV2() *schema.Resource {
248248
"wait_for_nav_timeout": {
249249
Type: schema.TypeInt,
250250
Optional: true,
251+
Default: 50,
252+
ValidateFunc: validation.IntAtLeast(1),
251253
},
252254
"max_wait_time": {
253255
Type: schema.TypeInt,

synthetics/resource_browser_check_v2_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ resource "synthetics_create_browser_check_v2" "browser_v2_foo_check" {
9494
selector_type = "id"
9595
type = "enter_value"
9696
value = "{{env.acceptance-variable-terraform-test}}"
97-
wait_for_nav_timeout = 50
97+
wait_for_nav_timeout = null
9898
}
9999
steps {
100100
name = "03 click"
101101
selector = "clicky"
102102
selector_type = "id"
103103
type = "click_element"
104104
wait_for_nav = true
105-
wait_for_nav_timeout = 2000
105+
wait_for_nav_timeout = 50
106106
}
107107
steps {
108108
name = "04 accept---Alert"
@@ -116,7 +116,7 @@ resource "synthetics_create_browser_check_v2" "browser_v2_foo_check" {
116116
selector_type = "id"
117117
type = "select_option"
118118
wait_for_nav = false
119-
wait_for_nav_timeout = 50
119+
wait_for_nav_timeout = 0
120120
}
121121
}
122122
transactions {
@@ -132,7 +132,6 @@ resource "synthetics_create_browser_check_v2" "browser_v2_foo_check" {
132132
selector_type = "id"
133133
type = "enter_value"
134134
value = "{{env.acceptance-variable-terraform-test}}"
135-
wait_for_nav_timeout = 50
136135
}
137136
steps {
138137
name = "assert element visible"
@@ -335,6 +334,7 @@ func TestAccCreateUpdateBrowserCheckV2(t *testing.T) {
335334
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.0.type", "go_to_url"),
336335
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.0.url", "https://www.splunk.com"),
337336
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.name", "02 fill in fieldz"),
337+
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.wait_for_nav_timeout", "50"),
338338
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.selector", "beep"),
339339
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.selector_type", "id"),
340340
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.type", "enter_value"),
@@ -360,6 +360,7 @@ func TestAccCreateUpdateBrowserCheckV2(t *testing.T) {
360360
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.0.type", "go_to_url"),
361361
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.0.url", "https://www.splunk.com"),
362362
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.name", "fill in more fields field"),
363+
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.wait_for_nav_timeout", "50"),
363364
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.selector", "beep"),
364365
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.selector_type", "id"),
365366
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.type", "enter_value"),

synthetics/structures.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,8 @@ func flattenStepsData(checkSteps *[]sc2.StepsV2) []interface{} {
965965

966966
if checkStep.WaitForNavTimeout != 0 {
967967
cl["wait_for_nav_timeout"] = checkStep.WaitForNavTimeout
968+
} else {
969+
cl["wait_for_nav_timeout"] = 50
968970
}
969971

970972
if checkStep.MaxWaitTime != 0 {

0 commit comments

Comments
 (0)