Feature #8885

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

Added by anonym 2015-02-10 18:21:12 . Updated 2015-02-24 22:41:57 .

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

0%

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

Starter:
Affected tool:
Deliverable for:

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

Subtasks


History

#1 Updated by anonym 2015-02-20 09:14:30

  • Status changed from Confirmed to Fix committed
  • 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 2015-02-24 22:41:57

  • Status changed from Fix committed to Resolved

#3 Updated by intrigeri 2015-03-21 11:16:22

  • blocks #8538 added