Complete the code to check if the app handles screen rotation correctly.
def test_screen_rotation(): app.launch() app.rotate_screen([1]) assert app.is_ui_stable()
The correct orientation to test screen rotation is "landscape" or "portrait". Here, we use "landscape" to simulate rotation.
Complete the code to simulate a low battery condition in the mobile app test.
def test_low_battery_warning(): device.set_battery_level([1]) app.launch() assert app.shows_low_battery_warning()
Battery levels below 20% usually trigger low battery warnings. Here, 15 simulates a low battery state.
Fix the error in the code that tests app behavior when network is lost.
def test_network_loss(): device.set_network_status([1]) app.perform_sync() assert app.sync_failed()
The correct network status to simulate no connectivity is "offline". Other options are invalid and cause errors.
Fill both blanks to create a test that verifies app behavior on different screen sizes.
def test_screen_size(): device.set_screen_size([1]) app.launch() assert app.layout_is_responsive([2])
We set the screen size to "small" and expect the layout to be responsive, so True is used for the assertion.
Fill all three blanks to test app behavior when switching between Wi-Fi and mobile data.
def test_network_switch(): device.set_network_type([1]) app.sync_data() device.set_network_type([2]) app.sync_data() assert app.sync_successful([3])
The test switches network from "wifi" to "mobile" and expects sync to be successful, so True is asserted.