code: def test_add_job_flow_steps_raises_exception_on_failure(
      self, mock_conn, mock_sleep, caplog
  ):
      hook = EmrHook(
          aws_conn_id="aws_default",
          emr_conn_id="emr_default",
          region_name="us-east-1",
      )
      mock_conn.describe_step.return_value = {
          "Step": {
              "Status": {
                  "State": "FAILED",
                  "FailureDetails": "test failure details",
              }
          }
      }
      mock_conn.add_job_flow_steps.return_value = {
          "StepIds": [
              "step_id",
          ],
          "ResponseMetadata": {"HTTPStatusCode": 200},
      }
      steps = [
          {
              "ActionOnFailure": "test_step",
              "HadoopJarStep": {
                  "Args": ["test args"],
                  "Jar": "test.jar",
              },
              "Name": "step_1",
          }
      ]
      waiter_error = WaiterError(
          name="test_error", reason="test_reason", last_response={}
      )
      waiter_error_failure = WaiterError(
          name="test_error", reason="terminal failure", last_response={}
      )
      mock_conn.get_waiter().wait.side_effect = [
          waiter_error,
          waiter_error_failure,
      ]
  
      with pytest.raises(AirflowException):
          hook.add_job_flow_steps(
              job_flow_id="job_flow_id",
              steps=steps,
              wait_for_completion=True,
          )
      assert "test failure details" in caplog.messages[-1]
      mock_conn.get_waiter.assert_called_with("step_complete")
  
imports: from __future__ import annotations
  import re
  from unittest import mock
  import boto3
  import pytest
  from botocore.exceptions import WaiterError
  from moto import mock_emr
  from airflow.exceptions import AirflowException
  from airflow.providers.amazon.aws.hooks.emr import EmrHook
label_desc: Use image node_id 6 for calling the TestEmrHook obj's underlying member method code with example usage: obj.test_add_job_flow_steps_raises_exception_on_failure(mock_conn, mock_sleep, caplog) without return types