diff --git a/templates.fif.json b/templates.fif.json index d1fb3438..3965f8fb 100644 --- a/templates.fif.json +++ b/templates.fif.json @@ -1213,6 +1213,17 @@ "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%" } }, + "dolphin": { + "profiles": { + "fedora-KDE-live-iso-x86_64-*-64bit": 30 + }, + "settings": { + "BOOTFROM": "c", + "HDD_1": "disk_%FLAVOR%_%MACHINE%.qcow2", + "POSTINSTALL_PATH": "tests/applications/dolphin", + "START_AFTER_TEST": "%DEPLOY_UPLOAD_TEST%" + } + }, "fonts": { "profiles": { "fedora-Silverblue-dvd_ostree-iso-ppc64le-*-ppc64le": 50, diff --git a/tests/applications/dolphin/aaa_setup.pm b/tests/applications/dolphin/aaa_setup.pm new file mode 100644 index 00000000..2642e86d --- /dev/null +++ b/tests/applications/dolphin/aaa_setup.pm @@ -0,0 +1,56 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# This script will download the test files, start Nautilus, +# stretch it all over the screen and upload the status to +# set a milestone as a starting point for the other Nautilus tests. + +sub run { + my $self = shift; + # Switch to console + $self->root_console(tty => 3); + # Perform git test + check_and_install_git(); + # Download the test data + download_testdata(); + + assert_script_run("touch /home/test/Documents/.invisible.txt"); + assert_script_run("chown test:test /home/test/Documents/.invisible.txt"); + assert_script_run("rm -f /home/test/*reference*"); + + # Exit the terminal + desktop_vt; + + # Set the update notification timestamp + set_update_notification_timestamp(); + # Start the application + menu_launch_type("nautilus"); + # Check that is started + assert_screen 'apps_run_files'; + wait_still_screen("2"); + + # Check that the icons are shown + assert_screen("nautilus_big_icon"); + + # Fullsize the Nautilus window. + wait_screen_change { send_key("super-up"); }; + + # Click to change the Directory view to listings. + assert_and_click("nautilus_toggle_view", timeout => '30', button => 'left', mousehide => '1'); + + # This will test the common directory structure. The structure is always created when a user is created, so let's see if it has been created correctly. + assert_screen("nautilus_available_directories"); +} + +sub test_flags { + return {fatal => 1, milestone => 1}; +} + +1; + +# vim: set sw=4 et: + + + diff --git a/tests/applications/dolphin/about.pm b/tests/applications/dolphin/about.pm new file mode 100644 index 00000000..f2ab6f1c --- /dev/null +++ b/tests/applications/dolphin/about.pm @@ -0,0 +1,35 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Test the About dialogue. + +sub run { + my $self = shift; + + # Open the menu by clicking on the Burger icon + assert_and_click("gnome_burger_menu", button => "left", timeout => 30); + wait_still_screen 2; + + # In the menu, click on the About item. + assert_and_click("nautilus_menu_about", button => "left", timeout => 30); + + # Check that the About section has been displayed. + assert_screen("nautilus_about_show"); + + # Click on Credits button to see the second part of the dialogue. + assert_and_click("gnome_button_credits", button => "left", timeout => 30); + + # Check that Credits are accessible and visible, too. + assert_screen("nautilus_credits_shown"); +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + diff --git a/tests/applications/dolphin/copy_file.pm b/tests/applications/dolphin/copy_file.pm new file mode 100644 index 00000000..995b69c1 --- /dev/null +++ b/tests/applications/dolphin/copy_file.pm @@ -0,0 +1,52 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Copy a file. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Click onto a file to select it. + assert_and_click("nautilus_test_file"); + wait_still_screen(2); + + # Press the keyboard shortcut to copy the file + send_key("ctrl-c"); + + # Select a different location to place the file. + assert_and_click("nautilus_directory_downloads"); + wait_still_screen(2); + + # Assert that we have entered the correct directory. + assert_screen("nautilus_directory_reached_downloads"); + + # Put the file in the new location + send_key("ctrl-v"); + + # Check that the file has appeared. + assert_screen("nautilus_test_file"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Verify that the new file exists in original location. + assert_script_run("ls /home/test/Documents/markdown.md", timeout => '60', fail_message => 'The test file was incorrectly removed from the old location.', quiet => '0'); + # And also in the new location. + assert_script_run("ls /home/test/Downloads/markdown.md", timeout => '60', fail_message => 'The test file has not been found in the new location.', quiet => '0'); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/create_directory.pm b/tests/applications/dolphin/create_directory.pm new file mode 100644 index 00000000..0e8f3415 --- /dev/null +++ b/tests/applications/dolphin/create_directory.pm @@ -0,0 +1,48 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Create a new directory. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + wait_still_screen(2); + + # Click on the Burger menu to open it + assert_and_click("gnome_kebab_menu"); + wait_still_screen(2); + + # Click on the Create directory icon to create a new directory. + assert_and_click("nautilus_menu_new_directory"); + wait_still_screen(2); + + # Type in the new name + type_safely("new_directory"); + send_key("ret"); + + # Confirm that the directory has appeared in the tree + assert_screen("nautilus_new_directory_check"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Check that the directory can be listed. + assert_script_run("ls /home/test/Documents/new_directory", fail_message => "The expected directory does not exist."); + # Check that it indeed is a directory and that it is user writable and executable. + validate_script_output("ls -l /home/test/Documents/ | grep new_directory", sub { m/drwx/ }); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/delete_file.pm b/tests/applications/dolphin/delete_file.pm new file mode 100644 index 00000000..4b978974 --- /dev/null +++ b/tests/applications/dolphin/delete_file.pm @@ -0,0 +1,77 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Delete a file. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Click onto a file to select it. + assert_and_click("nautilus_test_file"); + + # Press the keyboard shortcut to delete the file and wait until file disappears + send_key("delete"); + wait_still_screen(2); + + # Now, find the confirmation and click on Undo to return the operation. + assert_and_click("nautilus_delete_undo"); + + # Check that the file is still in its location. + assert_and_click("nautilus_test_file"); + wait_still_screen(2); + + # Delete the file again and this time, let time pass for the confirmation dialogue + # to disappear. + send_key("delete"); + sleep(10); + + # Select another file and delete it. + assert_and_click("nautilus_test_file_another"); + wait_still_screen(2); + send_key("delete"); + sleep(10); + + # Navigate to the Wastebin and check that the file appeared there. + assert_and_click("nautilus_select_wastebin"); + + # Confirm that Wastebin is active + assert_screen("nautilus_confirm_wastebin"); + + # Check that the files are now located here. + assert_screen("nautilus_test_file"); + assert_screen("nautilus_test_file_another"); + + # Select the first file and restore it from the Bin. + assert_and_click("nautilus_test_file", button => "right"); + wait_still_screen(2); + assert_and_click("nautilus_restore_content"); + + # Go to the Documents again and check that the file reappeared there. + assert_and_click("nautilus_directory_documents"); + wait_still_screen(2); + assert_screen("nautilus_test_file"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Verify that the first file still exists in the location as it was restored from the bin. + assert_script_run("ls /home/test/Documents/markdown.md", timeout => '60', fail_message => 'The file has not been found in the location.', quiet => '0'); + + # Verify that the next file has been deleted from the original location + assert_script_run("! ls /home/test/Documents/evince.pdf"); +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/help.pm b/tests/applications/dolphin/help.pm new file mode 100644 index 00000000..8098c8f1 --- /dev/null +++ b/tests/applications/dolphin/help.pm @@ -0,0 +1,36 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Display Help. + +sub run { + my $self = shift; + + # Open help. + send_key("f1"); + wait_still_screen 2; + + # Check that Help has been shown. + assert_screen("nautilus_help_shown"); + + # Open one of the topics. + assert_and_click("nautilus_help_browse_files"); + + # Check that a correct topic has been opened. + assert_screen("nautilus_browse_shown"); + + # Find a subtopic and open it links + assert_and_click("nautilus_help_search_file"); + + # Check that it opened + assert_screen("nautilus_search_file_shown"); +} + +sub test_flags { + return {always_rollback => 1}; +} + +1; + diff --git a/tests/applications/dolphin/hidden_files.pm b/tests/applications/dolphin/hidden_files.pm new file mode 100644 index 00000000..bdee646b --- /dev/null +++ b/tests/applications/dolphin/hidden_files.pm @@ -0,0 +1,85 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Show and unshow hidden files. + +sub toggle_hidden { + # Toggle hidden files using keyboard short cut or menu. + my $type = shift; + if ($type eq "menu") { + my $relnum = get_release_number; + if ($relnum > 40) { + assert_and_click("nautilus_view_menu"); + } + else { + assert_and_click("gnome_burger_menu"); + } + wait_still_screen(2); + assert_and_click("nautilus_toggle_hidden_files", timeout => '30', button => 'left', mousehide => '1'); + sleep(10); + } + else { + send_key("ctrl-h"); + sleep(10); + } +} + +sub run { + my $self = shift; + + # Enter the Documents directory. + assert_and_click("nautilus_directory_documents", timeout => '30', button => 'left', mousehide => '1'); + + # Check that we are in the Documents directory. + assert_screen("nautilus_documents_active", timeout => '30', no_wait => '0'); + + # Check if the hidden files are set to shown. If so, let's remember this status quo for further testing. + my $hidden_a = 0; + my $hidden_b = 0; + + # Set the a variable to 1, if the hidden files are shown. + if (check_screen("nautilus_hidden_file_shown")) { + $hidden_a = 1; + } + + # Now toggle the status of the invisible files and check that it is changed now + # using the keyboard shortcut. + toggle_hidden("key"); + + # Now let us check again, if the invisible file is seen. + if (check_screen("nautilus_hidden_file_shown")) { + $hidden_b = 1; + } + + # Compare the results. They should differ from each other. + if ($hidden_a == $hidden_b) { + die("The ctrl-h keyboard shortcut should have changed the status of invisible files, but the status has not been changed which indicates that the shortcut might not have worked correctly."); + } + + # Toggle again + toggle_hidden("menu"); + + # Check the current status of the invisible files. + if (check_screen("nautilus_hidden_file_shown")) { + $hidden_b = 1; + } + else { + $hidden_b = 0; + } + + # Compare the results. They should be the same if everything up til now has worked correctly. + if ($hidden_a != $hidden_b) { + die("The menu item 'Show hidden files' should have changed the status of the invisible files, but the status has not changed which indicates that the menu item might not have worked correctly."); + } +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + diff --git a/tests/applications/dolphin/keyboard_shortcuts.pm b/tests/applications/dolphin/keyboard_shortcuts.pm new file mode 100644 index 00000000..bc9ee305 --- /dev/null +++ b/tests/applications/dolphin/keyboard_shortcuts.pm @@ -0,0 +1,37 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Display all screens of Keyboard shortcuts. + +sub run { + my $self = shift; + + assert_and_click("gnome_burger_menu"); + wait_still_screen(2); + + assert_and_click("nautilus_menu_shortcuts"); + wait_still_screen(2); + + assert_screen("nautilus_shortcuts_first"); + + send_key("alt-2"); + wait_still_screen(2); + + assert_screen("nautilus_shortcuts_second"); + + send_key("alt-3"); + wait_still_screen(2); + + assert_screen("nautilus_shortcuts_third"); +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + diff --git a/tests/applications/dolphin/move_file.pm b/tests/applications/dolphin/move_file.pm new file mode 100644 index 00000000..28525238 --- /dev/null +++ b/tests/applications/dolphin/move_file.pm @@ -0,0 +1,52 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Move a file. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Click onto a file to select it. + assert_and_click("nautilus_test_file"); + wait_still_screen(2); + + # Press the keyboard shortcut to cut the file + send_key("ctrl-x"); + + # Select a different location to place the file. + assert_and_click("nautilus_directory_downloads"); + wait_still_screen(2); + + # Check that we have entered the Downloads directory + assert_screen("nautilus_directory_reached_downloads"); + + # Put the file in the new location + send_key("ctrl-v"); + + # Check that the file has appeared. + assert_screen("nautilus_test_file"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Verify that the new file does not exist in the original location. + assert_script_run("! ls /home/test/Documents/markdown.md", fail_message => 'The test file still exists in the original location, but it should have been removed.'); + # And that it exists in the new location. + assert_script_run("ls /home/test/Downloads/markdown.md", fail_message => 'The test file has not been found in the expected location when it should have been copied there.', quiet => '0'); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/move_file_into.pm b/tests/applications/dolphin/move_file_into.pm new file mode 100644 index 00000000..ffd70be3 --- /dev/null +++ b/tests/applications/dolphin/move_file_into.pm @@ -0,0 +1,62 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Move and copy files using the Move/Copy To menu items. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Right click onto a file to select it and open the context menu + # for it. + assert_and_click("nautilus_test_file", button => "right"); + wait_still_screen(2); + + # Click on Copy To + wait_screen_change { assert_and_click("nautilus_context_copy_to"); }; + wait_still_screen(5); + + # Select a different location to place the file. + assert_and_click("nautilus_directory_downloads"); + wait_still_screen(2); + + # Click on Select to copy the file into the new location + assert_and_click("gnome_select_button"); + + # Right click on that file again, this time we will move it elsewhere. + assert_and_click("nautilus_test_file", button => "right"); + + # Click on Move to + wait_screen_change { assert_and_click("nautilus_context_move_to"); }; + wait_still_screen(5); + + # Select a new location for this file + assert_and_click("nautilus_directory_videos"); + wait_still_screen(2); + + # Click on Select to move the file into the new location. + assert_and_click("gnome_select_button"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Verify that the new file does not exist in the original location. + assert_script_run("! ls /home/test/Documents/markdown.md", fail_message => 'The test file has not been deleted from its original location.'); + # And that it now exists in the new locations. + assert_script_run("ls /home/test/Downloads/markdown.md", fail_message => 'The test file has not been found in the expected location (copy to).', quiet => '0'); + assert_script_run("ls /home/test/Videos/markdown.md", fail_message => 'The test file has not been found in the expected location (move to).', quiet => '0'); +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/new_instance.pm b/tests/applications/dolphin/new_instance.pm new file mode 100644 index 00000000..40dbc093 --- /dev/null +++ b/tests/applications/dolphin/new_instance.pm @@ -0,0 +1,39 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Open another instance of Nautilus. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Click on the Burger menu to open it + assert_and_click("gnome_burger_menu"); + wait_still_screen(2); + + # Click on the new instance icon to create a new instance of Nautilus. + assert_and_click("nautilus_menu_new_instance"); + wait_still_screen(2); + + # Hit the Meta key to switch to the activities mode for further check. + send_key("super"); + wait_still_screen(2); + + # Confirm that two Nautilus windows exist in the view. + assert_screen("nautilus_instances_check"); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/open_new_tab.pm b/tests/applications/dolphin/open_new_tab.pm new file mode 100644 index 00000000..36bdf36f --- /dev/null +++ b/tests/applications/dolphin/open_new_tab.pm @@ -0,0 +1,40 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Open a new tab. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Click on the Burger menu to open it + assert_and_click("gnome_burger_menu"); + wait_still_screen(2); + + # Click on the New tab to start a new tab of Nautilus. + assert_and_click("nautilus_menu_new_tab"); + wait_still_screen(2); + + # The new tab will open in the same directory, so let us choose + # another directory to be able to compare in the needle. + assert_and_click("nautilus_directory_videos"); + wait_still_screen(2); + + # Confirm that two tabs exists with Documents and Video locations. + assert_screen("nautilus_tabs_check"); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/permissions.pm b/tests/applications/dolphin/permissions.pm new file mode 100644 index 00000000..2ff0914f --- /dev/null +++ b/tests/applications/dolphin/permissions.pm @@ -0,0 +1,70 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# View and change file permissions. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Rigth click onto a file to open context menu. + assert_and_click("nautilus_test_file", button => "right"); + wait_still_screen(2); + + # Click on the Properties menu item + assert_and_click("nautilus_context_properties"); + wait_still_screen(2); + + # Check that the Properties window has appeared and close it. + assert_screen("nautilus_properties_check"); + send_key("esc"); + + # Ensure the file is selected and pane is active (or else + # shortcut may not work). + assert_and_click("nautilus_test_file"); + + # Send a key combination to open the Properties again. + send_key("ctrl-i"); + + # Check that the Properties window has appeared again. + assert_screen("nautilus_properties_check"); + + # Click on the Permissions tab + assert_and_click("nautilus_select_permissions"); + + # Check that the owner can read and write the file + assert_screen("nautilus_owner_permissions"); + + # Check that others cannot do anything. + assert_screen("nautilus_others_permissions"); + + # Set the permission for others to None + assert_and_click("nautilus_permissions_read_only"); + + # Click on Read Only to select it. + assert_and_click("nautilus_permissions_set_none"); + + # Close the Properties + send_key("esc"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Check that the permissions have been changed. + validate_script_output("ls -l /home/test/Documents/markdown.md", sub { m/-rw-r-----/ }); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/rename_file.pm b/tests/applications/dolphin/rename_file.pm new file mode 100644 index 00000000..3416de03 --- /dev/null +++ b/tests/applications/dolphin/rename_file.pm @@ -0,0 +1,46 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Rename a file. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Click onto a file to select it. + assert_and_click("nautilus_test_file"); + + # Press the keyboard shortcut to rename the file + send_key("f2"); + + # Check that a rename dialogue has been displayed. + assert_screen("nautilus_rename_dialogue"); + + # Type a new name and confirm it. + type_very_safely("renamed"); + send_key("ret"); + + # Check that the file has been renamed. + assert_screen("nautilus_rename_check"); + + # Go into the root console and verify the operation in the background. + $self->root_console(tty => 3); + + # Verify that the new file exists in the location. + assert_script_run("ls /home/test/Documents/renamed.md", timeout => '60', fail_message => 'The renamed file has not been found in the location.', quiet => '0'); + +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + + diff --git a/tests/applications/dolphin/star_file.pm b/tests/applications/dolphin/star_file.pm new file mode 100644 index 00000000..c122ba44 --- /dev/null +++ b/tests/applications/dolphin/star_file.pm @@ -0,0 +1,42 @@ +use base "installedtest"; +use strict; +use testapi; +use utils; + +# Star a file and check it is displayed in the Starred folder. + +sub run { + my $self = shift; + + # Enter the Documents directory to get to the test data. + assert_and_click("nautilus_directory_documents"); + + # Select the test file then star it. + assert_and_click("nautilus_test_file"); + assert_and_click("nautilus_star_selected_file"); + # Hide the mouse so the pointer isn't over the star + mouse_hide; + + # Check that a star gets solid on the right part of the selected file + assert_screen("nautilus_star_confirm"); + + # Click on Starred to see all the starred files in a new view. + assert_and_click("nautilus_directory_starred"); + wait_still_screen(2); + + # Check that the view switched to Starred + assert_screen("nautilus_starred_selected"); + + # Check that the file has appeared. + assert_screen("nautilus_test_file"); +} + +sub test_flags { + # Rollback to the previous state to make space for other parts. + return {always_rollback => 1}; +} + +1; + + +