From 8c58ee99dd82b7efd86dc6b1a6b788a149abaf53 Mon Sep 17 00:00:00 2001 From: Philip Hands Date: Wed, 1 Jun 2016 15:31:10 +0200 Subject: lvc: tidy up some ragged code into loops --- cucumber/features/step_definitions/common_steps.rb | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'cucumber/features') 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) -- cgit v1.2.3-54-g00ecf