diff --git a/tests/app_gnome_weather.pm b/tests/app_gnome_weather.pm index 33c3b2989d3979763c02933c598c7bd34440140b..277380049085b36f4dbe1509ac44eb2ab8e12c9b 100644 --- a/tests/app_gnome_weather.pm +++ b/tests/app_gnome_weather.pm @@ -4,10 +4,53 @@ use warnings; use testapi; use gnomeutils; +# Constants for key sequences +use constant { + DISPLAY_CURRENT_WEATHER => 'alt-w', + DISPLAY_FORECAST => 'alt-f', + ADD_LOCATION => 'alt-a', + REMOVE_LOCATION => 'alt-r', + SEARCH_LOCATION => 'alt-s', +}; + +# Test the current weather display +sub test_current_weather_display { + send_key(DISPLAY_CURRENT_WEATHER); + assert_screen('app_gnome_weather_current_weather', 10); +} + +# Test the forecast display +sub test_forecast_display { + send_key(DISPLAY_FORECAST); + assert_screen('app_gnome_weather_forecast', 10); +} + +# Test the addition and removal of locations +sub test_location_management { + send_key(ADD_LOCATION); + assert_screen('app_gnome_weather_location_added', 10); + send_key(REMOVE_LOCATION); + assert_screen('app_gnome_weather_location_removed', 10); +} + +# Test the location search functionality +sub test_location_search { + send_key(SEARCH_LOCATION); + type_string("Location Name"); + send_key('ret'); + assert_screen('app_gnome_weather_location_search', 10); +} + sub run { - start_app('gnome-weather'); - assert_screen('app_gnome_weather_home', 10); - close_app; + start_app('gnome-weather'); + assert_screen('app_gnome_weather_home', 10); + + test_current_weather_display(); + test_forecast_display(); + test_location_management(); + test_location_search(); + + close_app; } 1;