def test_state_inheritance(
    state_inheritance: AppHarness,
    driver: WebDriver,
    token: str,
):
    """Test that background tasks work as expected.

    Args:
        state_inheritance: harness for StateInheritance app.
        driver: WebDriver instance.
        token: The token for the connected client.
    """
    assert state_inheritance.app_instance is not None

    # Initial State values Test
    # Base 1
    base1_mixin = driver.find_element(By.ID, "base1-computed_mixin")
    assert base1_mixin.text == "computed_mixin"

    base1_computed_basevar = driver.find_element(By.ID, "base1-computed_basevar")
    assert base1_computed_basevar.text == "computed_basevar1"

    base1_computed_child_mixin = driver.find_element(
        By.ID, "base1-computed-child-mixin"
    )
    assert base1_computed_child_mixin.text == "computed_child_mixin"

    base1_base1 = driver.find_element(By.ID, "base1-base1")
    assert base1_base1.text == "base1"

    base1_computed_backend_vars = driver.find_element(
        By.ID, "base1-computed_backend_vars"
    )
    assert base1_computed_backend_vars.text == "_base1"

    base1_child_mixin = driver.find_element(By.ID, "base1-child-mixin")
    assert base1_child_mixin.text == "child_mixin"

    # Base 2
    base2_computed_basevar = driver.find_element(By.ID, "base2-computed_basevar")
    assert base2_computed_basevar.text == "computed_basevar2"

    base2_base2 = driver.find_element(By.ID, "base2-base2")
    assert base2_base2.text == "base2"

    base2_computed_backend_vars = driver.find_element(
        By.ID, "base2-computed_backend_vars"
    )
    assert base2_computed_backend_vars.text == "_base2"

    # Child 1
    child1_computed_basevar = driver.find_element(By.ID, "child1-computed_basevar")
    assert child1_computed_basevar.text == "computed_basevar1"

    child1_mixin = driver.find_element(By.ID, "child1-computed_mixin")
    assert child1_mixin.text == "computed_mixin"

    child1_computed_other_mixin = driver.find_element(By.ID, "child1-other-mixin")
    assert child1_computed_other_mixin.text == "other_mixin"

    child1_computed_child_mixin = driver.find_element(
        By.ID, "child1-computed-child-mixin"
    )
    assert child1_computed_child_mixin.text == "computed_child_mixin"

    child1_base1 = driver.find_element(By.ID, "child1-base1")
    assert child1_base1.text == "base1"

    child1_other_mixin = driver.find_element(By.ID, "child1-other_mixin")
    assert child1_other_mixin.text == "other_mixin"

    child1_child_mixin = driver.find_element(By.ID, "child1-child-mixin")
    assert child1_child_mixin.text == "child_mixin"

    # Child 2
    child2_computed_basevar = driver.find_element(By.ID, "child2-computed_basevar")
    assert child2_computed_basevar.text == "computed_basevar2"

    child2_mixin = driver.find_element(By.ID, "child2-computed_mixin")
    assert child2_mixin.text == "computed_mixin"

    child2_computed_other_mixin = driver.find_element(By.ID, "child2-other-mixin")
    assert child2_computed_other_mixin.text == "other_mixin"

    child2_computed_child_mixin = driver.find_element(
        By.ID, "child2-computed-child-mixin"
    )
    assert child2_computed_child_mixin.text == "computed_child_mixin"

    child2_base2 = driver.find_element(By.ID, "child2-base2")
    assert child2_base2.text == "base2"

    child2_other_mixin = driver.find_element(By.ID, "child2-other_mixin")
    assert child2_other_mixin.text == "other_mixin"

    child2_child_mixin = driver.find_element(By.ID, "child2-child-mixin")
    assert child2_child_mixin.text == "child_mixin"

    # Child 3
    child3_computed_basevar = driver.find_element(By.ID, "child3-computed_basevar")
    assert child3_computed_basevar.text == "computed_basevar2"

    child3_mixin = driver.find_element(By.ID, "child3-computed_mixin")
    assert child3_mixin.text == "computed_mixin"

    child3_computed_other_mixin = driver.find_element(By.ID, "child3-other-mixin")
    assert child3_computed_other_mixin.text == "other_mixin"

    child3_computed_childvar = driver.find_element(By.ID, "child3-computed_childvar")
    assert child3_computed_childvar.text == "computed_childvar"

    child3_computed_child_mixin = driver.find_element(
        By.ID, "child3-computed-child-mixin"
    )
    assert child3_computed_child_mixin.text == "computed_child_mixin"

    child3_child3 = driver.find_element(By.ID, "child3-child3")
    assert child3_child3.text == "child3"

    child3_base2 = driver.find_element(By.ID, "child3-base2")
    assert child3_base2.text == "base2"

    child3_other_mixin = driver.find_element(By.ID, "child3-other_mixin")
    assert child3_other_mixin.text == "other_mixin"

    child3_child_mixin = driver.find_element(By.ID, "child3-child-mixin")
    assert child3_child_mixin.text == "child_mixin"

    child3_computed_backend_vars = driver.find_element(
        By.ID, "child3-computed_backend_vars"
    )
    assert child3_computed_backend_vars.text == "_base2._child3"

    # Event Handler Tests
    raises_alert(driver, "base1-mixin-btn")
    raises_alert(driver, "child2-mixin-btn")
    raises_alert(driver, "child3-mixin-btn")

    child1_other_mixin_btn = driver.find_element(By.ID, "child1-other-mixin-btn")
    child1_other_mixin_btn.click()
    child1_other_mixin_value = state_inheritance.poll_for_content(
        child1_other_mixin, exp_not_equal="other_mixin"
    )
    child1_computed_mixin_value = state_inheritance.poll_for_content(
        child1_computed_other_mixin, exp_not_equal="other_mixin"
    )
    assert child1_other_mixin_value == "Child1.clicked.1"
    assert child1_computed_mixin_value == "Child1.clicked.1"

    child2_other_mixin_btn = driver.find_element(By.ID, "child2-other-mixin-btn")
    child2_other_mixin_btn.click()
    child2_other_mixin_value = state_inheritance.poll_for_content(
        child2_other_mixin, exp_not_equal="other_mixin"
    )
    child2_computed_mixin_value = state_inheritance.poll_for_content(
        child2_computed_other_mixin, exp_not_equal="other_mixin"
    )
    child3_other_mixin_value = state_inheritance.poll_for_content(
        child3_other_mixin, exp_not_equal="other_mixin"
    )
    child3_computed_mixin_value = state_inheritance.poll_for_content(
        child3_computed_other_mixin, exp_not_equal="other_mixin"
    )
    assert child2_other_mixin_value == "Child2.clicked.1"
    assert child2_computed_mixin_value == "Child2.clicked.1"
    assert child3_other_mixin_value == "Child2.clicked.1"
    assert child3_computed_mixin_value == "Child2.clicked.1"

    child3_other_mixin_btn = driver.find_element(By.ID, "child3-other-mixin-btn")
    child3_other_mixin_btn.click()
    child2_other_mixin_value = state_inheritance.poll_for_content(
        child2_other_mixin, exp_not_equal="Child2.clicked.1"
    )
    child2_computed_mixin_value = state_inheritance.poll_for_content(
        child2_computed_other_mixin, exp_not_equal="Child2.clicked.1"
    )
    child3_other_mixin_value = state_inheritance.poll_for_content(
        child3_other_mixin, exp_not_equal="Child2.clicked.1"
    )
    child3_computed_mixin_value = state_inheritance.poll_for_content(
        child3_computed_other_mixin, exp_not_equal="Child2.clicked.1"
    )
    assert child2_other_mixin_value == "Child2.clicked.2"
    assert child2_computed_mixin_value == "Child2.clicked.2"
    assert child3_other_mixin.text == "Child2.clicked.2"
    assert child3_computed_other_mixin.text == "Child2.clicked.2"
Test that background tasks work as expected.

    Args:
        state_inheritance: harness for StateInheritance app.
        driver: WebDriver instance.
        token: The token for the connected client.
    
tests/integration/test_state_inheritance.py