[gnome-boxes] Add LiveCD tests



commit 72794a81fcebb911809830a71282059327c82ec7
Author: Vladimir Benes <vbenes redhat com>
Date:   Tue Jan 6 09:17:17 2015 -0500

    Add LiveCD tests
    
    Patch adding LiveCD tests. Tiny Core 10 MB isos are used to avoid large
    downloads.
    
    Coverage:
     * add new livecd from file and menu
     * go into box
     * delete/undo
     * poweroff/pause/resume
     * force shutdown
     * restart persistence
    
    https://bugzilla.gnome.org/review?bug=736288

 Makefile.am          |    1 +
 tests/README         |    6 ++
 tests/livecd.feature |  165 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/steps/utils.py |    7 ++
 4 files changed, 179 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index b161b2f..6ea3788 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -77,6 +77,7 @@ win-tools.iso:
 INSTALLED_TESTS=                               \
        general.feature                         \
        import-vms.feature                      \
+       livecd.feature                          \
        $(NULL)
 INSTALLED_TESTS_TYPE=session-exclusive
 -include $(top_srcdir)/git.mk
diff --git a/tests/README b/tests/README
index 7f6f5a6..ffd46af 100644
--- a/tests/README
+++ b/tests/README
@@ -18,6 +18,12 @@ Structure
     * search boxes
   * import.feature
     * import local qcow2 and vmdk images
+  * livecd.feature
+    * new box from file/menu
+    * go into box
+    * delete/undo
+    * poweroff/pause/resume
+    * force shutdown
 * Environment file
   * everything for setting/cleaning up the environment
 * Steps
diff --git a/tests/livecd.feature b/tests/livecd.feature
new file mode 100644
index 0000000..56b0000
--- /dev/null
+++ b/tests/livecd.feature
@@ -0,0 +1,165 @@
+Feature: LiceCD
+
+  Background:
+    * Make sure that gnome-boxes is running
+    * Wait until overview is loaded
+
+  @new_local_livecd_box_via_file
+  Scenario: New local liveCD box via file
+    * Create new box from file "Downloads/Core-5.3.iso"
+    * Press "Create"
+    * Wait for "sleep 10" end
+    * Hit "Enter"
+    * Wait for "sleep 20" end
+    * Save IP for machine "Core-5"
+    * Press "back" in vm
+    Then Box "Core-5" "does" exist
+    Then Ping "Core-5"
+
+  @new_local_livecd_box_via_iso
+  Scenario: New local liveCD box
+    * Create new box from menu "Core-5"
+    * Press "Create"
+    * Wait for "sleep 10" end
+    * Hit "Enter"
+    * Wait for "sleep 20" end
+    * Save IP for machine "Core-5"
+    * Press "back" in vm
+    Then Box "Core-5" "does" exist
+    Then Ping "Core-5"
+
+  @create_five_local_liveCD_boxes
+  Scenario: Create five liveCD boxes
+    * Create new box "Core-5"
+    Then Ping "Core-5"
+    * Create new box "Core-5"
+    Then Ping "Core-5 2"
+    * Create new box "Core-5"
+    Then Ping "Core-5 3"
+    * Create new box "Core-5"
+    Then Ping "Core-5 4"
+    * Create new box "Core-5"
+    Then Ping "Core-5 5"
+
+  @go_into_local_livecd_box
+  Scenario: Go into local liveCD box
+    * Create new box "Core-5"
+    * Box "Core-5" "does" exist
+    * Ping "Core-5"
+    * Go into "Core-5" box
+    * Wait for "sleep 2" end
+    * Type "sudo ifconfig eth0 down"
+    * Wait for "sleep 5" end
+    Then Cannot ping "Core-5"
+
+  @delete_local_livecd_box
+  Scenario: Delete local liveCD box
+    * Create new box "Core-5"
+    * Select "Core-5" box
+    * Press "Delete"
+    * Close warning
+    Then Box "Core-5" "does not" exist
+    Then Cannot ping "Core-5"
+
+  @undo_delete_local_livecd_box
+  Scenario: Undo Delete of local liveCD box
+    * Create new box "Core-5"
+    When Box "Core-5" "does" exist
+    When Ping "Core-5"
+    * Select "Core-5" box
+    * Press "Delete"
+    * Press "Undo"
+    Then Box "Core-5" "does" exist
+    Then Ping "Core-5"
+
+  @delete_five_local_livecd_boxes
+  Scenario: Delete five local liveCD boxes
+    * Create new box "Core-5"
+    * Create new box "Core-5"
+    * Create new box "Core-5"
+    * Create new box "Core-5"
+    * Create new box "Core-5"
+    * Select "Core-5" box
+    * Select "Core-5 2" box
+    * Select "Core-5 3" box
+    * Select "Core-5 4" box
+    * Select "Core-5 5" box
+    * Press "Delete"
+    * Close warning
+    Then Box "Core-5" "does not" exist
+    Then Cannot ping "Core-5"
+    Then Box "Core-5 2" "does not" exist
+    Then Cannot ping "Core-5 2"
+    Then Box "Core-5 3" "does not" exist
+    Then Cannot ping "Core-5 3"
+    Then Box "Core-5 4" "does not" exist
+    Then Cannot ping "Core-5 4"
+    Then Box "Core-5 5" "does not" exist
+    Then Cannot ping "Core-5 5"
+
+  # https://bugzilla.gnome.org/show_bug.cgi?id=742392
+  @poweroff_local_livecd_box
+  Scenario: Go into local liveCD box
+    * Create new box "Core-5"
+    * Box "Core-5" "does" exist
+    * Ping "Core-5"
+    * Go into "Core-5" box
+    * Wait for "sleep 1" end
+    * Type "sudo poweroff"
+    * Wait for "sleep 20" end
+    Then Box "Core-5" "does not" exist
+    Then Cannot ping "Core-5"
+
+  @pause_livecd_box
+  Scenario: Pause liveCD box
+    * Create new box "Core-5"
+    When Ping "Core-5"
+    * Select "Core-5" box
+    * Press "Pause"
+    * Wait for "sleep 8" end
+    Then Cannot ping "Core-5"
+
+  @resume_livecd_box
+  Scenario: Pause liveCD box
+    * Create new box "Core-5"
+    * Select "Core-5" box
+    * Press "Pause"
+    * Wait for "sleep 2" end
+    * Hit "Esc"
+    * Go into "Core-5" box
+    * Wait for "sleep 2" end
+    Then Ping "Core-5"
+
+  @force_shutdown_local_machine
+  Scenario: Force off local liveCD box
+    * Create new box "Core-5"
+    * Select "Core-5" box
+    * Press "Properties"
+    * Press "Force Shutdown"
+    * Press "Shutdown" in alert
+    Then Box "Core-5" "does" exist
+    Then Cannot ping "Core-5"
+
+  @force_shutdown_local_machine_cancel
+  Scenario: Cancel Force off of local liveCD box
+    * Create new box "Core-5"
+    * Select "Core-5" box
+    * Press "Properties"
+    * Press "Force Shutdown"
+    * Press "Cancel" in alert
+    * Press "Back"
+    Then Box "Core-5" "does" exist
+    Then Ping "Core-5"
+
+  @livecd_restart_persistence
+  Scenario: LiveCD restart persistence
+    * Initiate new box "Core-5" installation
+    * Initiate new box "Core-5" installation
+    * Import machine "Core-5" from image "Downloads/Core-5.3.qcow2"
+    * Import machine "Core-5" from image "Downloads/Core-5.3.vmdk"
+    * Quit Boxes
+    * Start Boxes
+    Then Box "Core-5" "does" exist
+    Then Box "Core-5 2" "does" exist
+    Then Box "Core-5 3" "does" exist
+    Then Box "Core-5 4" "does" exist
diff --git a/tests/steps/utils.py b/tests/steps/utils.py
index 4c19942..0514203 100644
--- a/tests/steps/utils.py
+++ b/tests/steps/utils.py
@@ -30,6 +30,13 @@ def cannot_ping_vm(context, vm):
     cmd = "ping -qn -c 1 %s" %context.ips[vm]
     assert call(cmd, shell=True) != 0, "Machine %s is pingable!" %vm
 
+ step(u'Close warning')
+def close_warning(context):
+    context.app.findChildren(lambda x: x.name == 'Undo' and x.showing)[0].grabFocus()
+    pressKey('Tab')
+    pressKey('Enter')
+    sleep(1)
+
 @step(u'Hit "{keycombo}"')
 def hit_keycombo(context, keycombo):
     sleep(0.2)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]