[Qa-jenkins-scm] [jenkins.debian.net] 09/12: lvc: tidy up some ragged code into loops

Holger Levsen holger at layer-acht.org
Wed Jun 1 22:09:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 8c58ee99dd82b7efd86dc6b1a6b788a149abaf53
Author: Philip Hands <phil at hands.com>
Date:   Wed Jun 1 15:31:10 2016 +0200

    lvc: tidy up some ragged code into loops
---
 cucumber/features/step_definitions/common_steps.rb | 24 ++++++++--------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/cucumber/features/step_definitions/common_steps.rb b/cucumber/features/step_definitions/common_steps.rb
index 20ed27b..bfdc002 100644
--- a/cucumber/features/step_definitions/common_steps.rb
+++ b/cucumber/features/step_definitions/common_steps.rb
@@ -442,14 +442,9 @@ Given /^I select the minimal task$/ do
   @screen.wait(diui_png("DesktopTask_Yes"), 10 * PATIENCE)
 
   @screen.type(Sikuli::Key.SPACE)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN)
+  8.times do
+    @screen.type(Sikuli::Key.DOWN)
+  end
   @screen.type(Sikuli::Key.SPACE)
   @screen.waitVanish(diui_png("DesktopTask_Yes"), 10 * PATIENCE)
 
@@ -468,14 +463,13 @@ Given /^I select the ([A-Z][[:alpha:]]*) task$/ do |desktop|
   debug_log("debug: Found DesktopTask_Yes, pausing for 20s", :color => :blue)
   sleep(20 * PATIENCE)
 
-  @screen.type(Sikuli::Key.DOWN)
-  @screen.type(Sikuli::Key.DOWN) if "XFCE" == desktop
-  @screen.type(Sikuli::Key.DOWN+Sikuli::Key.DOWN) if "KDE" == desktop
-  @screen.type(Sikuli::Key.DOWN+Sikuli::Key.DOWN+Sikuli::Key.DOWN) if "Cinamon" == desktop
-  @screen.type(Sikuli::Key.DOWN+Sikuli::Key.DOWN+Sikuli::Key.DOWN+Sikuli::Key.DOWN) if "MATE" == desktop
-  @screen.type(Sikuli::Key.DOWN+Sikuli::Key.DOWN+Sikuli::Key.DOWN+Sikuli::Key.DOWN+Sikuli::Key.DOWN) if "LXDE" == desktop
-  @screen.type(Sikuli::Key.SPACE)
+  menu = [ '_', 'Gnome', 'XFCE', 'KDE', 'Cinamon', 'MATE', 'LXDE' ]
+
+  menu.index(desktop).times do
+    @screen.type(Sikuli::Key.DOWN)
+  end
   @screen.wait(diui_png("Desktop+" + desktop), 10 * PATIENCE)
+
   if "gui" == @ui_mode
     @screen.wait(diui_png("CONTINUEunselected"), 10 * PATIENCE)
     @screen.type(Sikuli::Key.TAB)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list