2022-02-10 09:29:17 +00:00
|
|
|
use base "installedtest";
|
|
|
|
use strict;
|
|
|
|
use testapi;
|
|
|
|
use utils;
|
|
|
|
|
|
|
|
# Delete a file.
|
|
|
|
|
|
|
|
sub run {
|
|
|
|
my $self = shift;
|
|
|
|
|
2022-07-28 20:32:57 +00:00
|
|
|
# Enter the Documents directory to get to the test data.
|
2022-07-23 00:17:59 +00:00
|
|
|
assert_and_click("nautilus_directory_documents");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Click onto a file to select it.
|
|
|
|
assert_and_click("nautilus_test_file");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Press the keyboard shortcut to delete the file and wait until file disappears
|
|
|
|
send_key("delete");
|
|
|
|
wait_still_screen(1);
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Now, find the confirmation and click on Undo to return the operation.
|
|
|
|
assert_and_click("nautilus_delete_undo");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Check that the file is still in its location.
|
|
|
|
assert_and_click("nautilus_test_file");
|
|
|
|
wait_still_screen(2);
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Delete the file again and this time, let time pass for the confirmation dialogue
|
|
|
|
# to disappear.
|
|
|
|
send_key("delete");
|
|
|
|
sleep(10);
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Select another file and delete it.
|
|
|
|
assert_and_click("nautilus_test_file_another");
|
|
|
|
wait_still_screen(2);
|
|
|
|
send_key("delete");
|
|
|
|
sleep(10);
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Navigate to the Wastebin and check that the file appeared there.
|
|
|
|
assert_and_click("nautilus_select_wastebin");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Confirm that Wastebin is active
|
|
|
|
assert_screen("nautilus_confirm_wastebin");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Check that the files are now located here.
|
|
|
|
assert_screen("nautilus_test_file");
|
|
|
|
assert_screen("nautilus_test_file_another");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Select the first file and restore it from the Bin.
|
2022-09-08 22:03:35 +00:00
|
|
|
assert_and_click("nautilus_test_file", button => "right");
|
2022-02-10 09:29:17 +00:00
|
|
|
wait_still_screen(2);
|
|
|
|
assert_and_click("nautilus_restore_content");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# 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");
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Go into the root console and verify the operation in the background.
|
2022-07-28 20:32:57 +00:00
|
|
|
$self->root_console(tty => 3);
|
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# 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');
|
2022-07-28 20:32:57 +00:00
|
|
|
|
2022-02-10 09:29:17 +00:00
|
|
|
# Verify that the next file has been deleted from the original location
|
2023-04-11 18:15:05 +00:00
|
|
|
assert_script_run("! ls /home/test/Documents/evince.pdf");
|
2022-02-10 09:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub test_flags {
|
|
|
|
# Rollback to the previous state to make space for other parts.
|
|
|
|
return {always_rollback => 1};
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
|
|
|
|
|