def test_document_api(self):
        """
        Tests all document API operations in a controlled sequence:
        1. get_document - Verifies initial documents can be retrieved
        2. delete_documents - Tests document deletion functionality
        3. add_documents - Tests adding new documents after deletion
        """
        for index in self.indexes_to_test_on:
            index_name = index['indexName']

            # Step 1: Test get_document
            with self.subTest(index=index_name, operation="get_document"):
                stored_results = self.load_results_from_file()

                for doc in self.text_docs:
                    doc_id = doc['_id']
                    expected_doc = stored_results[index_name][doc_id]
                    actual_doc = self.client.index(index_name).get_document(doc_id)
                    self.assertEqual(expected_doc, actual_doc)

            # Step 2: Test delete_documents
            with self.subTest(index=index_name, operation="delete_documents"):
                doc_ids = [doc['_id'] for doc in self.text_docs]

                # Delete documents
                delete_result = self.client.index(index_name).delete_documents(ids=doc_ids)
                self.assertEqual('succeeded', delete_result['status'])
                self.assertEqual(len(doc_ids), len(delete_result.get('items', [])))

                # Verify documents are deleted
                for doc_id in doc_ids:
                    with self.assertRaises(MarqoWebError) as e:
                        self.client.index(index_name).get_document(doc_id)
                    self.assertEqual(404, e.exception.status_code)

            # Step 3: Test add_documents
            with self.subTest(index=index_name, operation="add_documents"):
                # Add new documents
                if index.get("type") is not None and index.get('type') == 'structured':
                    add_result = self.client.index(index_name=index_name).add_documents(documents=self.new_docs)
                else:
                    add_result = self.client.index(index_name=index_name).add_documents(
                        documents=self.new_docs,
                        tensor_fields=["Description", "Genre", "Title"]
                    )

                self.assertEqual(False, add_result['errors'])

                # Verify documents are added correctly
                for doc in self.new_docs:
                    doc_id = doc['_id']
                    retrieved_doc = self.client.index(index_name).get_document(doc_id)
                    self.assertEqual(doc, retrieved_doc)

        Tests all document API operations in a controlled sequence:
        1. get_document - Verifies initial documents can be retrieved
        2. delete_documents - Tests document deletion functionality
        3. add_documents - Tests adding new documents after deletion
        
tests/compatibility_tests/add_or_replace_documents/test_document_api.py