eliastor / terraform-provider-chromedp

Creating action recipes to do in browser through ChromeDP by terraform
https://registry.terraform.io/providers/eliastor/chromedp/latest
BSD 3-Clause Clear License
2 stars 1 forks source link

Intermediate screenshots #7

Open stoneus opened 1 year ago

stoneus commented 1 year ago

Do we have opportunity to take screenshots after some iterations, for example:

data "chromedp_recipe" "login" {
  screenshot_filename = "${path.module}/test.login.png" # final screenshot
  actions = [
    ["sleep", "3s"],
    ["navigate", data.terraform_remote_state.prod.outputs.site-ui-url],
    ["wait_visible", "#login-html"],
    **# Here is screenshot**
    ["screenshot_filename", "${path.module}/first-login-html.png"],
    ["text", "#caption_header", "greeting"],
    ["sleep", "1s"],
    ["set_value", "input#username", local.credentials.login],
    ["set_value", "input#password", local.credentials.password],
    ["click", "#signinbutton"],
    ["sleep", "8s"],
    **# Here is screenshot**
    ["screenshot_filename", "${path.module}/signin-html.png"],
    ["wait_visible", "input#signOutBtn"],
    ["text", "#currentUser > div > div", "username"],
    ["click", "input#signOutBtn"]
  ]
}
eliastor commented 1 year ago

Thanks for the proposal, let me propose the action name as "screenshot" and I think it will be good to add the selector to it as well, so it would be something like that:

["screenshot", "#login-html", "30s"] # make a screenshot of particular part of the page

or

['screenshot', "20s"] # for screenshot of entire page and timeout.

I'm going to test such approach as well as scenario with setting the selector only. Thanks again for the proposal I'm implementing it in the next release.