Test Overview
This test checks if a new collection can be created successfully in Postman. It verifies that the collection appears in the workspace after creation.
This test checks if a new collection can be created successfully in Postman. It verifies that the collection appears in the workspace after creation.
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 TestPostmanCreateCollection(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get('https://web.postman.co/workspace') # Assume user is already logged in for simplicity def test_create_collection(self): driver = self.driver wait = WebDriverWait(driver, 10) # Click on 'New' button new_button = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'button[aria-label="New"]'))) new_button.click() # Select 'Collection' from the new items collection_option = wait.until(EC.element_to_be_clickable((By.XPATH, '//button[contains(text(), "Collection")]'))) collection_option.click() # Enter collection name name_input = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, 'input[placeholder="Enter collection name"]'))) collection_name = 'Test Collection' name_input.send_keys(collection_name) # Click 'Create' button create_button = wait.until(EC.element_to_be_clickable((By.XPATH, '//button[contains(text(), "Create")]'))) create_button.click() # Verify collection appears in sidebar sidebar_collection = wait.until(EC.visibility_of_element_located((By.XPATH, f'//span[text()="{collection_name}"]'))) self.assertEqual(sidebar_collection.text, collection_name) def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and browser opens Postman workspace URL | Browser shows Postman workspace page, user logged in | - | PASS |
| 2 | Finds and clicks 'New' button | 'New' button is visible and clickable | - | PASS |
| 3 | Finds and clicks 'Collection' option from new items | Collection creation modal opens | - | PASS |
| 4 | Finds collection name input and enters 'Test Collection' | Input field contains 'Test Collection' | - | PASS |
| 5 | Finds and clicks 'Create' button | Modal closes, collection creation triggered | - | PASS |
| 6 | Waits for new collection named 'Test Collection' to appear in sidebar | Sidebar shows 'Test Collection' | Verify sidebar collection name equals 'Test Collection' | PASS |