code: def test_ldcp006_children_identity(dash_dcc):
      lock = Lock()
  
      app = Dash(__name__)
      app.layout = html.Div(
          [
              html.Button("click", id="btn"),
              dcc.Loading(dcc.Graph(id="graph"), className="loading"),
          ]
      )
  
      @app.callback(
          Output("graph", "figure"), [Input("btn", "n_clicks")]
      )
      def update_graph(n):
          with lock:
              bars = list(range(2, (n or 0) + 5))
              return {
                  "data": [{"type": "bar", "x": bars, "y": bars}],
                  "layout": {"width": 400, "height": 400},
              }
  
      def get_graph_visibility():
          return dash_dcc.driver.execute_script(
              "var gd_ = document.querySelector('.js-plotly-plot');"
              "return getComputedStyle(gd_).visibility;"
          )
  
      with lock:
          dash_dcc.start_server(app)
          dash_dcc.find_element(".loading .dash-spinner")
          dash_dcc.find_element("#graph .js-plotly-plot")
          dash_dcc.driver.execute_script(
              "window.gd = document.querySelector('.js-plotly-plot');"
              "window.gd.__test__ = 'boo';"
          )
          assert get_graph_visibility() == "hidden"
  
      test_identity = (
          "var gd_ = document.querySelector('.js-plotly-plot');"
          "return gd_ === window.gd && gd_.__test__ === 'boo';"
      )
  
      wait.until(
          lambda: len(
              dash_dcc.find_elements(".js-plotly-plot .bars path")
          )
          == 3,
          3,
      )
      assert dash_dcc.driver.execute_script(test_identity)
      assert get_graph_visibility() == "visible"
  
      with lock:
          dash_dcc.find_element("#btn").click()
          dash_dcc.find_element(".loading .dash-spinner")
          assert (
              len(dash_dcc.find_elements(".js-plotly-plot .bars path"))
              == 3
          )
          assert dash_dcc.driver.execute_script(test_identity)
          assert get_graph_visibility() == "hidden"
  
      wait.until(
          lambda: len(
              dash_dcc.find_elements(".js-plotly-plot .bars path")
          )
          == 4,
          3,
      )
      assert dash_dcc.driver.execute_script(test_identity)
      assert get_graph_visibility() == "visible"
  
      assert dash_dcc.get_logs() == []
  
file_path: dash/components/dash-core-components/tests/integration/loading/test_loading_component.py
imports: from multiprocessing import Lock
  from dash import Dash, Input, Output, dcc, html
  from dash.testing import wait
label_desc: Use image node_id 6 for calling a global function with example usage: test_ldcp006_children_identity(dash_dcc) and returns: dash_dcc, dict