code: def test_grva005_graph_extend_trace(dash_dcc, is_eager):
      app = Dash(__name__, eager_loading=is_eager)
  
      def generate_with_id(_id, data=None):
          if data is None:
              data = [{"x": [0, 1, 2, 3, 4], "y": [0, 0.5, 1, 0.5, 0]}]
  
          return html.Div(
              [
                  html.P(_id),
                  dcc.Graph(id=_id, figure=dict(data=data)),
                  html.Div(id=f"output_{_id}"),
              ]
          )
  
      figs = [
          "trace_will_extend",
          "trace_will_extend_with_no_indices",
          "trace_will_extend_with_max_points",
      ]
  
      layout = [generate_with_id(_id) for _id in figs]
  
      figs.append("trace_will_allow_repeated_extend")
      data = [{"y": [0, 0, 0]}]
      layout.append(generate_with_id(figs[-1], data))
  
      figs.append("trace_will_extend_selectively")
      data = [
          {"x": [0, 1, 2, 3, 4], "y": [0, 0.5, 1, 0.5, 0]},
          {"x": [0, 1, 2, 3, 4], "y": [1, 1, 1, 1, 1]},
      ]
      layout.append(generate_with_id(figs[-1], data))
  
      layout.append(
          dcc.Interval(
              id="interval_extendablegraph_update",
              interval=10,
              n_intervals=0,
              max_intervals=1,
          )
      )
  
      layout.append(
          dcc.Interval(
              id="interval_extendablegraph_extendtwice",
              interval=500,
              n_intervals=0,
              max_intervals=2,
          )
      )
  
      app.layout = html.Div(layout)
  
      @app.callback(
          Output("trace_will_allow_repeated_extend", "extendData"),
          Input("interval_extendablegraph_extendtwice", "n_intervals"),
      )
      def trace_will_allow_repeated_extend(n_intervals):
          if n_intervals is None or n_intervals < 1:
              raise PreventUpdate
  
          return dict(y=[[0.1, 0.2, 0.3, 0.4, 0.5]])
  
      @app.callback(
          Output("trace_will_extend", "extendData"),
          Input("interval_extendablegraph_update", "n_intervals"),
      )
      def trace_will_extend(n_intervals):
          if n_intervals is None or n_intervals < 1:
              raise PreventUpdate
  
          x_new = [5, 6, 7, 8, 9]
          y_new = [0.1, 0.2, 0.3, 0.4, 0.5]
          return dict(x=[x_new], y=[y_new]), [0]
  
      @app.callback(
          Output("trace_will_extend_selectively", "extendData"),
          Input("interval_extendablegraph_update", "n_intervals"),
      )
      def trace_will_extend_selectively(n_intervals):
          if n_intervals is None or n_intervals < 1:
              raise PreventUpdate
  
          x_new = [5, 6, 7, 8, 9]
          y_new = [0.1, 0.2, 0.3, 0.4, 0.5]
          return dict(x=[x_new], y=[y_new]), [1]
  
      @app.callback(
          Output("trace_will_extend_with_no_indices", "extendData"),
          Input("interval_extendablegraph_update", "n_intervals"),
      )
      def trace_will_extend_with_no_indices(n_intervals):
          if n_intervals is None or n_intervals < 1:
              raise PreventUpdate
  
          x_new = [5, 6, 7, 8, 9]
          y_new = [0.1, 0.2, 0.3, 0.4, 0.5]
          return dict(x=[x_new], y=[y_new])
  
      @app.callback(
          Output("trace_will_extend_with_max_points", "extendData"),
          Input("interval_extendablegraph_update", "n_intervals"),
      )
      def trace_will_extend_with_max_points(n_intervals):
          if n_intervals is None or n_intervals < 1:
              raise PreventUpdate
  
          x_new = [5, 6, 7, 8, 9]
          y_new = [0.1, 0.2, 0.3, 0.4, 0.5]
          return dict(x=[x_new], y=[y_new]), [0], 7
  
      for _id in figs:
  
          @app.callback(
              Output(f"output_{_id}", "children"),
              Input(_id, "extendData"),
              State(_id, "figure"),
          )
          def display_data(trigger, fig):
              return json.dumps(fig["data"])
  
      dash_dcc.start_server(app)
  
      comparison = list(
          zip(
              [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
              [0, 0.5, 1, 0.5, 0, 0.1, 0.2, 0.3, 0.4, 0.5],
          )
      )
      assert_graph_equals(dash_dcc, "#trace_will_extend", comparison)
      assert_graph_equals(
          dash_dcc, "#trace_will_extend_with_no_indices", comparison
      )
      compare1 = list(zip([0, 1, 2, 3, 4], [0, 0.5, 1, 0.5, 0]))
      compare2 = list(
          zip(
              [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
              [1, 1, 1, 1, 1, 0.1, 0.2, 0.3, 0.4, 0.5],
          )
      )
      assert_graph_equals(
          dash_dcc,
          "#trace_will_extend_selectively",
          compare1 + compare2,
      )
  
      comparison = list(
          zip([3, 4, 5, 6, 7, 8, 9], [0.5, 0, 0.1, 0.2, 0.3, 0.4, 0.5])
      )
      assert_graph_equals(
          dash_dcc, "#trace_will_extend_with_max_points", comparison
      )
  
      comparison = list(
          zip(
              [],
              [
                  0,
                  0,
                  0,
                  0.1,
                  0.2,
                  0.3,
                  0.4,
                  0.5,
                  0.1,
                  0.2,
                  0.3,
                  0.4,
                  0.5,
              ],
          )
      )
      assert_graph_equals(
          dash_dcc,
          "#output_trace_will_allow_repeated_extend",
          comparison,
      )
  
      assert dash_dcc.get_logs() == []
  
imports: import pytest
  import time
  import json
  import werkzeug
  from selenium.webdriver import ActionChains
  from dash import Dash, Input, Output, State, dcc, html
  from dash.exceptions import PreventUpdate
  from dash.testing.wait import until
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions
label_desc: Use image node_id 7 for calling a global function with example usage: test_grva005_graph_extend_trace(dash_dcc, is_eager) and returns: html, dict, dict,  list, dict,  list, dict, dict,  list,  int, json