Test Overview
This test verifies that a custom documentation template in Postman is applied correctly and displays the expected content for an API collection.
This test verifies that a custom documentation template in Postman is applied correctly and displays the expected content for an API collection.
import unittest from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC class TestPostmanCustomDocTemplate(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.maximize_window() def test_custom_doc_template_display(self): driver = self.driver driver.get('https://documenter.getpostman.com/view/your-collection-id') # Wait for the custom documentation container to load WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CSS_SELECTOR, '.custom-doc-template')) ) # Verify the custom title is displayed title_element = driver.find_element(By.CSS_SELECTOR, '.custom-doc-template .doc-title') self.assertEqual(title_element.text, 'My Custom API Documentation') # Verify a custom section content is present section_element = driver.find_element(By.CSS_SELECTOR, '.custom-doc-template .custom-section') self.assertIn('This section explains the authentication process.', section_element.text) def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and Chrome browser opens | Browser window is maximized and ready | - | PASS |
| 2 | Navigates to the Postman documentation URL with custom template | Page begins loading the custom documentation | - | PASS |
| 3 | Waits up to 10 seconds for the custom documentation container to appear using CSS selector '.custom-doc-template' | Custom documentation container is present on the page | Presence of element located by '.custom-doc-template' | PASS |
| 4 | Finds the title element inside the custom documentation container | Title element with class '.doc-title' is visible | Title text equals 'My Custom API Documentation' | PASS |
| 5 | Finds a custom section element inside the custom documentation container | Custom section element with class '.custom-section' is visible | Section text contains 'This section explains the authentication process.' | PASS |
| 6 | Test ends and browser closes | Browser window is closed | - | PASS |