Skip to content

Commit

Permalink
SYN-4427 : Update default wait_for_nav_timeout to 50 & add test cases (
Browse files Browse the repository at this point in the history
…#62)

* SYN-4427 : Update default wait_for_nav_timeout to 50 & add test cases

* update  default vallue to 50 in assertion
  • Loading branch information
nitun-splunk authored Sep 25, 2024
1 parent 29e6543 commit 9cbc8fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions synthetics/resource_browser_check_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ func resourceBrowserCheckV2() *schema.Resource {
"wait_for_nav_timeout": {
Type: schema.TypeInt,
Optional: true,
Default: 50,
ValidateFunc: validation.IntAtLeast(1),
},
"max_wait_time": {
Type: schema.TypeInt,
Expand Down
9 changes: 5 additions & 4 deletions synthetics/resource_browser_check_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ resource "synthetics_create_browser_check_v2" "browser_v2_foo_check" {
selector_type = "id"
type = "enter_value"
value = "{{env.acceptance-variable-terraform-test}}"
wait_for_nav_timeout = 50
wait_for_nav_timeout = null
}
steps {
name = "03 click"
selector = "clicky"
selector_type = "id"
type = "click_element"
wait_for_nav = true
wait_for_nav_timeout = 2000
wait_for_nav_timeout = 50
}
steps {
name = "04 accept---Alert"
Expand All @@ -116,7 +116,7 @@ resource "synthetics_create_browser_check_v2" "browser_v2_foo_check" {
selector_type = "id"
type = "select_option"
wait_for_nav = false
wait_for_nav_timeout = 50
wait_for_nav_timeout = 0
}
}
transactions {
Expand All @@ -132,7 +132,6 @@ resource "synthetics_create_browser_check_v2" "browser_v2_foo_check" {
selector_type = "id"
type = "enter_value"
value = "{{env.acceptance-variable-terraform-test}}"
wait_for_nav_timeout = 50
}
steps {
name = "assert element visible"
Expand Down Expand Up @@ -335,6 +334,7 @@ func TestAccCreateUpdateBrowserCheckV2(t *testing.T) {
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.0.type", "go_to_url"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.0.url", "https://www.splunk.com"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.name", "02 fill in fieldz"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.wait_for_nav_timeout", "50"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.selector", "beep"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.selector_type", "id"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.0.steps.1.type", "enter_value"),
Expand All @@ -360,6 +360,7 @@ func TestAccCreateUpdateBrowserCheckV2(t *testing.T) {
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.0.type", "go_to_url"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.0.url", "https://www.splunk.com"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.name", "fill in more fields field"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.wait_for_nav_timeout", "50"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.selector", "beep"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.selector_type", "id"),
resource.TestCheckResourceAttr("synthetics_create_browser_check_v2.browser_v2_foo_check", "test.0.transactions.1.steps.1.type", "enter_value"),
Expand Down
2 changes: 2 additions & 0 deletions synthetics/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,8 @@ func flattenStepsData(checkSteps *[]sc2.StepsV2) []interface{} {

if checkStep.WaitForNavTimeout != 0 {
cl["wait_for_nav_timeout"] = checkStep.WaitForNavTimeout
} else {
cl["wait_for_nav_timeout"] = 50
}

if checkStep.MaxWaitTime != 0 {
Expand Down

0 comments on commit 9cbc8fb

Please sign in to comment.