From fb2da1cdaa6544211669b0180fcb0893add72a35 Mon Sep 17 00:00:00 2001 From: Asiful Alam Date: Mon, 30 Oct 2023 01:52:07 +0000 Subject: [PATCH 1/2] add tests for weather --- tests/app_gnome_weather.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/app_gnome_weather.pm b/tests/app_gnome_weather.pm index 33c3b29..d25c560 100644 --- a/tests/app_gnome_weather.pm +++ b/tests/app_gnome_weather.pm @@ -6,7 +6,27 @@ use gnomeutils; sub run { start_app('gnome-weather'); + + # Home screen test assert_screen('app_gnome_weather_home', 10); + + # Weather Information Test + assert_screen('app_gnome_weather_info', 10); + + # Location Search Test + enter_text('New York'); + assert_screen('app_gnome_weather_location_search', 10); + send_key('ret'); + assert_screen('app_gnome_weather_location_new_york', 10); + + # Forecast Test + assert_screen('app_gnome_weather_forecast', 10); + + # Settings Test + send_key('alt'); + send_key('right'); + assert_screen('app_gnome_weather_settings', 10); + close_app; } -- GitLab From 11fe8af980f2baf46cebae9511a4ce325ae1ec8e Mon Sep 17 00:00:00 2001 From: Asiful Alam Date: Tue, 14 Nov 2023 06:00:08 +0000 Subject: [PATCH 2/2] add function --- tests/app_gnome_weather.pm | 61 ++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/tests/app_gnome_weather.pm b/tests/app_gnome_weather.pm index d25c560..2773800 100644 --- a/tests/app_gnome_weather.pm +++ b/tests/app_gnome_weather.pm @@ -4,30 +4,53 @@ use warnings; use testapi; use gnomeutils; -sub run { - start_app('gnome-weather'); - - # Home screen test - assert_screen('app_gnome_weather_home', 10); +# 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', +}; - # Weather Information Test - assert_screen('app_gnome_weather_info', 10); +# Test the current weather display +sub test_current_weather_display { + send_key(DISPLAY_CURRENT_WEATHER); + assert_screen('app_gnome_weather_current_weather', 10); +} - # Location Search Test - enter_text('New York'); - assert_screen('app_gnome_weather_location_search', 10); - send_key('ret'); - assert_screen('app_gnome_weather_location_new_york', 10); +# Test the forecast display +sub test_forecast_display { + send_key(DISPLAY_FORECAST); + assert_screen('app_gnome_weather_forecast', 10); +} - # Forecast Test - 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); +} - # Settings Test - send_key('alt'); - send_key('right'); - assert_screen('app_gnome_weather_settings', 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); +} - close_app; +sub run { + 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; -- GitLab