code: def test_rdls003_update_title(
      dash_duo, kwargs, expected_update_title, clientside_title
  ):
      app = Dash("Dash", **kwargs)
      lock = Lock()
  
      app.layout = html.Div(
          children=[
              html.H3("Press button see document title updating"),
              html.Div(id="output"),
              html.Button("Update", id="button", n_clicks=0),
              html.Button("Update Page", id="page", n_clicks=0),
              html.Div(id="dummy"),
          ]
      )
      if clientside_title:
          app.clientside_callback(
              """
              function(n_clicks) {
                  document.title = 'Page ' + n_clicks;
                  return 'Page ' + n_clicks;
              }
              """,
              Output("dummy", "children"),
              [Input("page", "n_clicks")],
          )
  
      @app.callback(
          Output("output", "children"), [Input("button", "n_clicks")]
      )
      def update(n):
          with lock:
              return n
  
      with lock:
          dash_duo.start_server(app)
          # check for update-title during startup
          # the clientside callback isn't blocking so it may update the title
          if not clientside_title:
              until(
                  lambda: dash_duo.driver.title
                  == expected_update_title,
                  timeout=1,
              )
  
      # check for original title after loading
      until(
          lambda: dash_duo.driver.title == "Page 0"
          if clientside_title
          else "Dash",
          timeout=1,
      )
  
      with lock:
          dash_duo.find_element("#button").click()
          # check for update-title while processing callback
          if clientside_title and not kwargs.get("update_title", True):
              until(
                  lambda: dash_duo.driver.title == "Page 0", timeout=1
              )
          else:
              until(
                  lambda: dash_duo.driver.title
                  == expected_update_title,
                  timeout=1,
              )
  
      if clientside_title:
          dash_duo.find_element("#page").click()
          dash_duo.wait_for_text_to_equal("#dummy", "Page 1")
          until(lambda: dash_duo.driver.title == "Page 1", timeout=1)
  
      # verify that when a separate callback runs, the page title gets restored
      dash_duo.find_element("#button").click()
      dash_duo.wait_for_text_to_equal("#output", "2")
      if clientside_title:
          until(lambda: dash_duo.driver.title == "Page 1", timeout=1)
      else:
          until(lambda: dash_duo.driver.title == "Dash", timeout=1)
  
file_path: dash/tests/integration/renderer/test_loading_states.py
imports: from multiprocessing import Lock
  import pytest
  from dash import Dash, Input, Output, dcc, html
  from dash.testing.wait import until
label_desc: Use image node_id 3 for calling a global function with example usage: test_rdls003_update_title(dash_duo, kwargs, expected_update_title, clientside_title) and returns: n