-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGREYConfiguration.js
158 lines (128 loc) · 5.52 KB
/
GREYConfiguration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
This code is generated.
For more information see generation/README.md.
*/
class GREYConfiguration {
/*@return The singleton GREYConfiguration instance.*/
static sharedInstance() {
return {
target: {
type: "Class",
value: "GREYConfiguration"
},
method: "sharedInstance",
args: []
};
}
/*If a user-configured value is associated with the given @c configKey, it is returned,
otherwise the default value is returned. If a default value is not found, or an
NSInvalidArgumentException is raised.
@param configKey The key whose value is being queried. Must be a valid @c NSString.
@throws NSInvalidArgumentException If no value could be found associated with @c configKey.
@return The value for the configuration stored associate with @c configKey.*/
static valueForConfigKey(element, configKey) {
if (typeof configKey !== "string") throw new Error("configKey should be a string, but got " + (configKey + (" (" + (typeof configKey + ")"))));
return {
target: element,
method: "valueForConfigKey:",
args: [{
type: "NSString",
value: configKey
}]
};
}
/*If a user-configured value is associated with the given @c configKey, it is returned, otherwise
the default value is returned. If a default value is not found, NSInvalidArgumentException is
raised.
@param configKey The key whose value is being queried. Must be a valid @c NSString.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
@return The @c BOOL value for the configuration associated with @c configKey.*/
static boolValueForConfigKey(element, configKey) {
if (typeof configKey !== "string") throw new Error("configKey should be a string, but got " + (configKey + (" (" + (typeof configKey + ")"))));
return {
target: element,
method: "boolValueForConfigKey:",
args: [{
type: "NSString",
value: configKey
}]
};
}
/*If a user-configured value is associated with the given @c configKey, it is returned, otherwise
the default value is returned. If a default value is not found, NSInvalidArgumentException is
raised.
@param configKey The key whose value is being queried. Must be a valid @c NSString.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
@return The integer value for the configuration associated with @c configKey.*/
static integerValueForConfigKey(element, configKey) {
if (typeof configKey !== "string") throw new Error("configKey should be a string, but got " + (configKey + (" (" + (typeof configKey + ")"))));
return {
target: element,
method: "integerValueForConfigKey:",
args: [{
type: "NSString",
value: configKey
}]
};
}
/*If a user-configured value is associated with the given @c configKey, it is returned, otherwise
the default value is returned. If a default value is not found, NSInvalidArgumentException is
raised.
@param configKey The key whose value is being queried. Must be a valid @c NSString.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
@return The @c double value for the configuration associated with @c configKey.*/
static doubleValueForConfigKey(element, configKey) {
if (typeof configKey !== "string") throw new Error("configKey should be a string, but got " + (configKey + (" (" + (typeof configKey + ")"))));
return {
target: element,
method: "doubleValueForConfigKey:",
args: [{
type: "NSString",
value: configKey
}]
};
}
/*Resets all configurations to default values, removing all the configured values.
@remark Any default values added by calling GREYConfiguration:setDefaultValue:forConfigKey:
are not reset.*/
static reset(element) {
return {
target: element,
method: "reset",
args: []
};
}
/*Given a value and a key that identifies a configuration, set the value of the configuration.
Overwrites any previous value for the configuration.
@remark To restore original values, call GREYConfiguration::reset.
@param value The configuration value to be set. Scalars should be wrapped in @c NSValue.
@param configKey Key identifying an existing or new configuration. Must be a valid @c NSString.*/
static setValueForConfigKey(element, value, configKey) {
if (typeof configKey !== "string") throw new Error("configKey should be a string, but got " + (configKey + (" (" + (typeof configKey + ")"))));
return {
target: element,
method: "setValue:forConfigKey:",
args: [value, {
type: "NSString",
value: configKey
}]
};
}
/*Associates configuration identified by @c configKey with the provided @c value.
@remark Default values persist even after resetting the configuration
(using GREYConfiguration::reset)
@param value The configuration value to be set. Scalars should be wrapped in @c NSValue.
@param configKey Key identifying an existing or new configuration. Must be a valid @c NSString.*/
static setDefaultValueForConfigKey(element, value, configKey) {
if (typeof configKey !== "string") throw new Error("configKey should be a string, but got " + (configKey + (" (" + (typeof configKey + ")"))));
return {
target: element,
method: "setDefaultValue:forConfigKey:",
args: [value, {
type: "NSString",
value: configKey
}]
};
}
}
module.exports = GREYConfiguration;