DataDog / terraform-provider-datadog

Terraform Datadog provider
https://www.terraform.io/docs/providers/datadog/
Mozilla Public License 2.0
399 stars 375 forks source link

Document `assert_page_lacks` API #2495

Closed felamaslen closed 1 month ago

felamaslen commented 2 months ago

In datadog synthetic tests, for browser_step items there are a few options for type.

The options are documented here: https://docs.datadoghq.com/service_management/workflows/actions_catalog/synthetics_gettest/

However, there doesn't seem to be any documentation on how to use assert_page_lacks.

Is it possible to use this with a CSS selector, for example?

Drarig29 commented 1 month ago

Hi @felamaslen!

When terraforming Synthetic tests you should read the Datadog Terraform provider's documentation instead of the page you linked.

In your case, you can have a look at the browser_step.params section.

Is it possible to use this with a CSS selector, for example?

No, this assertion looks at the whole page, and only takes a browser_step.params.value parameter.

To use a CSS selector and find one element to assert on, you can use an assertElementContent step instead. For example:

browser_step {
    name = "Check paragraph #copy content"

    params {
      type          = "assertElementContent"
      allow_failure = false
      is_critical   = true
      check         = "contains"
      value         = "the value you want to check"

      element_user_locator {
        value {
          type  = "css"
          value = "#copy"
        }
        fail_test_on_cannot_locate = true
      }
    }
  }