Test Overview
This test checks if a mobile app correctly adapts to different screen sizes and network conditions. It verifies that the app loads the home screen and displays the main menu properly under varying conditions.
This test checks if a mobile app correctly adapts to different screen sizes and network conditions. It verifies that the app loads the home screen and displays the main menu properly under varying conditions.
from appium 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 MobileAppTest(unittest.TestCase): def setUp(self): desired_caps = { "platformName": "Android", "deviceName": "Android Emulator", "app": "/path/to/app.apk", "automationName": "UiAutomator2" } self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) def test_home_screen_loads(self): # Wait for home screen main menu to be visible wait = WebDriverWait(self.driver, 20) main_menu = wait.until(EC.presence_of_element_located((By.ID, "com.example.app:id/main_menu"))) self.assertTrue(main_menu.is_displayed(), "Main menu should be visible on home screen") def tearDown(self): self.driver.quit() if __name__ == '__main__': unittest.main()
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and Appium driver is initialized with Android emulator and app path | Android emulator launches and app installation begins | - | PASS |
| 2 | Waits up to 20 seconds for the main menu element to appear on the home screen | App home screen loads with UI elements rendering | Checks if main menu element is present and visible | PASS |
| 3 | Asserts that the main menu is displayed | Main menu is visible on the screen | assertTrue(main_menu.is_displayed()) | PASS |
| 4 | Test ends and Appium driver quits, closing the app and emulator | App and emulator shut down cleanly | - | PASS |