summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Hands <phil@hands.com>2016-06-01 15:31:10 +0200
committerPhilip Hands <phil@hands.com>2016-06-01 20:02:22 +0200
commit8c58ee99dd82b7efd86dc6b1a6b788a149abaf53 (patch)
tree0aa010c8ea06ea5bac94e88ac4c9e84c62377ba3
parentcea6a22376abb43839a025a24dcf156db2d333b3 (diff)
downloadjenkins.debian.net-8c58ee99dd82b7efd86dc6b1a6b788a149abaf53.tar.xz
lvc: tidy up some ragged code into loops
-rw-r--r--cucumber/features/step_definitions/common_steps.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/cucumber/features/step_definitions/common_steps.rb b/cucumber/features/step_definitions/common_steps.rb
index 20ed27b2..bfdc0028 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)