Test Overview
This test checks if a simple login form accepts correct credentials and shows a welcome message. It verifies the login process and the final message display.
This test checks if a simple login form accepts correct credentials and shows a welcome message. It verifies the login process and the final message display.
def test_login_success(): # Simulate opening the login page page = open_login_page() # Enter username and password page.find_element('username').send_keys('user1') page.find_element('password').send_keys('pass123') # Click the login button page.find_element('login_button').click() # Check if welcome message is displayed welcome_text = page.find_element('welcome_message').text assert welcome_text == 'Welcome, user1!', f"Expected welcome message not found, got: {welcome_text}"
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts | Test environment initialized, ready to open login page | - | PASS |
| 2 | Open login page | Login page loaded with username, password fields and login button | Check page loaded successfully | PASS |
| 3 | Find username field and enter 'user1' | Username field filled with 'user1' | Verify username field contains 'user1' | PASS |
| 4 | Find password field and enter 'pass123' | Password field filled with 'pass123' | Verify password field contains 'pass123' | PASS |
| 5 | Find and click login button | Login button clicked, processing login | - | PASS |
| 6 | Find welcome message element | Welcome message element found on page | Verify welcome message text equals 'Welcome, user1!' | PASS |
| 7 | Assertion checks welcome message text | Welcome message text is 'Welcome, user1!' | Assert welcome message text is correct | PASS |
| 8 | Test ends | Test completed successfully | - | PASS |