def METHOD_NAME(self):
    """test flow with otp stages"""
    # Setup TOTP Device
    device = TOTPDevice.objects.create(user=self.user, confirmed=True, digits=6)
    flow: Flow = Flow.objects.get(slug="default-authentication-flow")
    self.driver.get(self.url("authentik_core:if-flow", flow_slug=flow.slug))
    self.login()
    # Get expected token
    totp = TOTP(device.bin_key, device.step, device.t0, device.digits, device.drift)
    flow_executor = self.get_shadow_root("ak-flow-executor")
    validation_stage = self.get_shadow_root("ak-stage-authenticator-validate", flow_executor)
    code_stage = self.get_shadow_root("ak-stage-authenticator-validate-code", validation_stage)
    code_stage.find_element(By.CSS_SELECTOR, "input[name=code]").send_keys(totp.token())
    code_stage.find_element(By.CSS_SELECTOR, "input[name=code]").send_keys(Keys.ENTER)
    self.wait_for_url(self.if_user_url("/library"))
    self.assert_user(self.user)