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
import unittest
class TestManagementCoordination(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.driver.maximize_window()
self.wait = WebDriverWait(self.driver, 10)
def test_coordination_dashboard(self):
driver = self.driver
wait = self.wait
# Step 1: Login
driver.get('https://testmanagement.example.com/login')
wait.until(EC.visibility_of_element_located((By.ID, 'username'))).send_keys('tester1')
driver.find_element(By.ID, 'password').send_keys('Password123!')
driver.find_element(By.ID, 'loginBtn').click()
# Step 2: Navigate to dashboard
wait.until(EC.url_contains('/dashboard'))
# Step 3: Check test case assignments
assignments = wait.until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, '.test-assignment')))
self.assertGreater(len(assignments), 1, 'Expected multiple test assignments for teams')
# Step 4: Verify progress status updated
progress_elements = driver.find_elements(By.CSS_SELECTOR, '.team-progress')
self.assertTrue(any(pe.text.strip() != '' for pe in progress_elements), 'Progress status should be updated')
# Step 5: Check communication logs visible
comm_logs = driver.find_element(By.ID, 'communicationLogs')
self.assertTrue(comm_logs.is_displayed(), 'Communication logs section should be visible')
# Step 6: Generate and verify summary report
driver.find_element(By.ID, 'generateReportBtn').click()
report = wait.until(EC.visibility_of_element_located((By.ID, 'summaryReport')))
self.assertIn('Combined Testing Efforts', report.text, 'Summary report should reflect combined efforts')
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
unittest.main()This test script uses Selenium with Python's unittest framework to automate the manual test case.
setUp: Opens the browser and prepares explicit waits.
test_coordination_dashboard: Performs each manual step precisely:
- Logs in with valid credentials.
- Waits for dashboard URL to confirm navigation.
- Checks multiple test assignments exist to confirm distribution.
- Verifies progress status elements contain updated text.
- Ensures communication logs section is visible.
- Clicks to generate report and verifies it contains combined efforts text.
tearDown: Closes the browser to clean up.
Explicit waits ensure elements are ready before interaction, avoiding flaky tests. Locators use IDs and CSS selectors for clarity and maintainability. Assertions have clear messages to help identify failures.