code: def test_cnfd001_dialog(
      dash_dcc, confirm_callback, confirms, components
  ):
      app = Dash(__name__)
      app.layout = html.Div(components + [html.Div(id="confirmed")])
  
      @app.callback(
          Output("confirm", "displayed"), [Input("button", "n_clicks")]
      )
      def on_click_confirm(n_clicks):
          if n_clicks:
              return True
  
      count = Value("i", 0)
  
      if confirm_callback:
  
          @app.callback(
              Output("confirmed", "children"),
              [
                  Input("confirm", "submit_n_clicks"),
                  Input("confirm", "cancel_n_clicks"),
              ],
              [
                  State("confirm", "submit_n_clicks_timestamp"),
                  State("confirm", "cancel_n_clicks_timestamp"),
              ],
          )
          def on_confirmed(
              submit_n_clicks,
              cancel_n_clicks,
              submit_timestamp,
              cancel_timestamp,
          ):
              count.value += 1
  
              if not submit_n_clicks and not cancel_n_clicks:
                  return ""
  
              trigger = callback_context.triggered[0]["prop_id"].split(
                  "."
              )[1]
  
              return (
                  "confirmed"
                  if trigger == "submit_n_clicks"
                  else "canceled"
              )
  
      dash_dcc.start_server(app)
      dash_dcc.wait_for_element("#button")
  
      for confirm in confirms:
          dash_dcc.find_element("#button").click()
          time.sleep(0.5)
          if confirm:
              dash_dcc.driver.switch_to.alert.accept()
          else:
              dash_dcc.driver.switch_to.alert.dismiss()
          time.sleep(0.5)
  
          if confirm_callback:
              dash_dcc.wait_for_text_to_equal(
                  "#confirmed", "confirmed" if confirm else "canceled"
              )
  
      if confirm_callback:
          assert wait.until(lambda: count.value == 1 + len(confirms), 3)
  
      assert dash_dcc.get_logs() == []
  
imports: from multiprocessing import Value
  from dash.testing import wait
  from dash import Dash, Input, Output, State, dcc, html, callback_context
  import pytest
  import time
label_desc: Use image node_id 1 for calling a global function with example usage: test_cnfd001_dialog(dash_dcc, confirm_callback, confirms, components) and returns: True, unknown, str