import pytest from page_objects.home_page import HomePage from page_objects.login_page import LoginPage @pytest.mark.usefixtures("logged_in_driver") class TestHomePage: """ Test suite for the Home page, which requires user authentication. """ def test_welcome_message_is_displayed(self, logged_in_driver): """ Verifies that the correct welcome message is displayed after login. """ home_page = HomePage(logged_in_driver) welcome_text = home_page.get_welcome_message() # Assert against the hardcoded user name from auth.tsx assert "Welcome, Test User!" in welcome_text, "Welcome message is not correct or not found." def test_dashboard_is_visible_on_load(self, logged_in_driver): """ Verifies that the dashboard tab content is visible by default. """ home_page = HomePage(logged_in_driver) assert home_page.is_dashboard_content_visible(), "Dashboard content should be visible by default." def test_switch_to_profile_tab(self, logged_in_driver): """ Verifies that the user can switch to the Profile tab. """ home_page = HomePage(logged_in_driver) home_page.switch_to_profile_tab() # A proper test would assert that profile-specific elements are visible. def test_logout_functionality(self, logged_in_driver): """ Verifies that clicking the logout button logs the user out and redirects to the login page. """ home_page = HomePage(logged_in_driver) home_page.click_logout_button() # Verify redirection to the login page login_page = LoginPage(logged_in_driver) assert login_page.is_login_form_visible(), "After logout, the login form should be visible."