Verify tester skills checklist on skills page
Preconditions (2)
✅ Expected Result: The skills checklist is displayed with all required skills visible and enabled
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 SkillsPage: def __init__(self, driver): self.driver = driver self.skills_section_locator = (By.ID, 'skills-checklist') self.skill_items_locator = (By.CSS_SELECTOR, '#skills-checklist li') def wait_for_skills_section(self): WebDriverWait(self.driver, 10).until( EC.visibility_of_element_located(self.skills_section_locator) ) def get_skills_texts(self): elements = self.driver.find_elements(*self.skill_items_locator) return [el.text.strip() for el in elements] class TestSkillsForModernTesters(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.get('https://example.com/skills') self.skills_page = SkillsPage(self.driver) def test_skills_checklist(self): # Verify URL self.assertIn('/skills', self.driver.current_url) # Wait for skills section self.skills_page.wait_for_skills_section() # Expected skills expected_skills = [ 'Critical Thinking', 'Automation Knowledge', 'Communication', 'Domain Understanding', 'Exploratory Testing', 'Continuous Learning' ] # Get actual skills actual_skills = self.skills_page.get_skills_texts() # Verify all expected skills are present for skill in expected_skills: self.assertIn(skill, actual_skills, f"Skill '{skill}' not found in checklist") # Verify each skill item is visible and enabled skill_elements = self.driver.find_elements(*self.skills_page.skill_items_locator) for el in skill_elements: self.assertTrue(el.is_displayed(), f"Skill item '{el.text}' is not visible") self.assertTrue(el.is_enabled(), f"Skill item '{el.text}' is not enabled") def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
This test script uses Selenium with Python and unittest framework.
We define a SkillsPage class to hold locators and methods for the skills checklist section, following the Page Object Model for easy maintenance.
The test test_skills_checklist does these steps:
Explicit waits ensure the page elements are ready before interacting.
Assertions provide clear failure messages if any skill is missing or not visible/enabled.
The setUp and tearDown methods handle browser start and cleanup.
Now add data-driven testing with 3 different sets of expected skills lists for different user roles.
def is_bug_fixed(status):
return status == "fixed"
result = is_bug_fixed("Fixed")
print(result)def check_positive(num):
if num > 0:
return True
else
return False
Pass the test and this pattern moves unknown