• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.platform.spectatio.constants;
18 
19 public class JsonConfigConstants {
20     // Spectatio Config Constants
21     public static final String ACTIONS = "ACTIONS";
22     public static final String COMMANDS = "COMMANDS";
23     public static final String PACKAGES = "PACKAGES";
24     public static final String UI_ELEMENTS = "UI_ELEMENTS";
25     public static final String WORKFLOWS = "WORKFLOWS";
26 
27     // UI Element Constants
28     public static final String TYPE = "TYPE";
29     public static final String VALUE = "VALUE";
30     public static final String COMMAND_LINE_KEY = "COMMAND_LINE_KEY";
31     public static final String DEFAULT_VALUE = "DEFAULT_VALUE";
32     public static final String FLAG = "FLAG";
33     public static final String PACKAGE = "PACKAGE";
34     public static final String ANCESTOR = "ANCESTOR";
35     public static final String DESCENDANT = "DESCENDANT";
36     public static final String MAX_DEPTH = "MAX_DEPTH";
37     public static final String SPECIFIERS = "SPECIFIERS";
38 
39     public static final String RESOURCE_ID = "RESOURCE_ID";
40     public static final String SCROLLABLE = "SCROLLABLE";
41     public static final String CLICKABLE = "CLICKABLE";
42     public static final String TEXT = "TEXT";
43     public static final String TEXT_CONTAINS = "TEXT_CONTAINS";
44     public static final String DESCRIPTION = "DESCRIPTION";
45     public static final String DESCRIPTION_CONTAINS = "DESCRIPTION_CONTAINS";
46     public static final String CLASS = "CLASS";
47     public static final String DISPLAY_ID = "DISPLAY_ID";
48     public static final String HAS_ANCESTOR = "HAS_ANCESTOR";
49     public static final String HAS_DESCENDANT = "HAS_DESCENDANT";
50     public static final String MULTIPLE = "MULTIPLE";
51 
52     // Workflow Task Constants
53     // Supported Properties
54     public static final String NAME = "NAME";
55     public static final String WORKFLOW_TYPE = "TYPE";
56     public static final String CONFIG = "CONFIG";
57     public static final String REPEAT_COUNT = "REPEAT_COUNT";
58     public static final String SCROLL_CONFIG = "SCROLL_CONFIG";
59     public static final String SET_TEXT_CONFIG = "SET_TEXT_CONFIG";
60     public static final String SWIPE_CONFIG = "SWIPE_CONFIG";
61     public static final String VALIDATION_CONFIG = "VALIDATION_CONFIG";
62 
63     // Supported Workflow Tasks
64     public static enum SupportedWorkFlowTasks {
65         // Execute the given Command
66         COMMAND,
67         // Press Key e.g. Home, Back, Power, etc.
68         PRESS,
69         // Long Press Key e.g. Power, Screen Center, etc.
70         LONG_PRESS,
71         // Click on given UI Element ( throws exception if UI Element does not exist )
72         CLICK,
73         // Click on given UI Element if it exist otherwise ignore ( i.e. No Exception
74         // even if UI Element is missing )
75         CLICK_IF_EXIST,
76         // Long Click on given UI Element ( throws exception if UI Element does not exist )
77         LONG_CLICK,
78         // Validates if package is in foreground ( throws exception if it is not in foreground )
79         HAS_PACKAGE_IN_FOREGROUND,
80         // Validates if Ui Element is in foreground ( throws exception if it is not in foreground )
81         HAS_UI_ELEMENT_IN_FOREGROUND,
82         // Finds the given UI Element by Scrolling and Click on it ( Throws an exception if
83         // UI Element not found )
84         SCROLL_TO_FIND_AND_CLICK,
85         // Finds the given UI Element by Scrolling and Click on it if found ( i.e. No Exception
86         // even if UI Element is missing )
87         SCROLL_TO_FIND_AND_CLICK_IF_EXIST,
88         // Sets the text of an element (used for quickly filling search boxes)
89         SET_TEXT,
90         // Swipes once
91         SWIPE,
92         // Finds the given UI Element by Swiping and Click on it ( Throws an exception if
93         // UI Element not found )
94         SWIPE_TO_FIND_AND_CLICK,
95         // Finds the given UI Element by Swiping and Click on it if found ( i.e. No Exception
96         // even if UI Element is missing )
97         SWIPE_TO_FIND_AND_CLICK_IF_EXIST,
98         // Confirm that the given value is what's expected, and fail the test by throwing an
99         // exception if it's not
100         VALIDATE_VALUE,
101         // Wait For Given Time in milliseconds
102         WAIT_MS;
103     }
104 
105     // Workflow Task Config
106     public static final String CONFIG_TEXT = "TEXT";
107     public static final String CONFIG_UI_ELEMENT = "UI_ELEMENT";
108     public static final String CONFIG_UI_ELEMENT_REFERENCE = "UI_ELEMENT_REFERENCE";
109 
110     // Scroll Config Constants
111     // Supported Properties
112     public static final String SCROLL_ACTION = "SCROLL_ACTION";
113     public static final String SCROLL_DIRECTION = "SCROLL_DIRECTION";
114     public static final String SCROLL_FORWARD = "SCROLL_FORWARD";
115     public static final String SCROLL_BACKWARD = "SCROLL_BACKWARD";
116     public static final String SCROLL_ELEMENT = "SCROLL_ELEMENT";
117     public static final String SCROLL_MARGIN = "SCROLL_MARGIN";
118     public static final String SCROLL_WAIT_TIME = "SCROLL_WAIT_TIME";
119 
120     public enum FindType {
121         NONE,
122         SCROLL,
123         SWIPE,
124     }
125 
126     // Scroll Action
127     public enum ScrollActions {
128         USE_BUTTON,
129         USE_GESTURE;
130     }
131 
132     // Scroll Direction
133     public enum ScrollDirection {
134         VERTICAL,
135         HORIZONTAL;
136     }
137 }
138