Test Overview
This test checks if the Postman collection documentation is generated correctly and is accessible via the documentation URL.
This test checks if the Postman collection documentation is generated correctly and is accessible via the documentation URL.
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 TestPostmanDocGeneration(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.implicitly_wait(5) def test_documentation_accessible(self): driver = self.driver # Open Postman documentation URL for the collection driver.get('https://documenter.getpostman.com/view/1234567/SOME-API-REFERENCE') # Wait until the documentation title is visible WebDriverWait(driver, 10).until( EC.visibility_of_element_located((By.CSS_SELECTOR, 'h1.doc-title')) ) # Verify the documentation title text title = driver.find_element(By.CSS_SELECTOR, 'h1.doc-title').text self.assertEqual(title, 'Sample API Documentation') # Verify that at least one endpoint is listed endpoints = driver.find_elements(By.CSS_SELECTOR, '.endpoint') self.assertTrue(len(endpoints) > 0) def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and Chrome browser opens | Chrome browser window is open and ready | - | PASS |
| 2 | Navigates to Postman documentation URL for the collection | Browser loads the documentation page at https://documenter.getpostman.com/view/1234567/SOME-API-REFERENCE | - | PASS |
| 3 | Waits until the documentation title element with CSS selector 'h1.doc-title' is visible | Documentation page shows the main title | Checks visibility of the documentation title element | PASS |
| 4 | Finds the documentation title element and reads its text | Title element text is 'Sample API Documentation' | Asserts title text equals 'Sample API Documentation' | PASS |
| 5 | Finds all elements with CSS selector '.endpoint' representing API endpoints | Multiple endpoint elements are present on the page | Asserts that at least one endpoint element exists | PASS |
| 6 | Test ends and browser closes | Browser window is closed | - | PASS |