Project

General

Profile

Feature #8885

Improve the 'I press the "KEY" key' step with meta-programming

Added by anonym almost 5 years ago. Updated almost 5 years ago.

Status:
Resolved
Priority:
Low
Assignee:
-
Category:
Test suite
Target version:
Start date:
02/10/2015
Due date:
% Done:

0%

Feature Branch:
test/8688-gnome-screenshot
Type of work:
Code
Blueprint:
Starter:
Affected tool:

Description

With the use of eval we don't need to handle each key separately as long as we call the keys the same as Sikuli does:

--- a/features/step_definitions/common_steps.rb
+++ b/features/step_definitions/common_steps.rb
@@ -809,10 +809,9 @@ end

 When /^I press the "([^"]+)" key$/ do |key|
   next if @skip_steps_while_restoring_background
-  case key
-  when "ENTER" 
-    @screen.type(Sikuli::Key.ENTER)
-  else
+  begin
+    @screen.type(eval("Sikuli::Key.#{key}"))
+  rescue RuntimeError
     raise "unsupported key #{key}" 
   end
 end

History

#1 Updated by anonym almost 5 years ago

  • Status changed from Confirmed to 11
  • Target version set to Tails_1.3
  • QA Check set to Pass
  • Feature Branch set to test/8688-gnome-screenshot

Fixed in commit 0d90074 of the now merged test/8688-gnome-screenshot branch.

#2 Updated by BitingBird almost 5 years ago

  • Status changed from 11 to Resolved

Also available in: Atom PDF