GREYConfiguration
@interface GREYConfiguration : NSObject
Provides an interface for runtime configuration of EarlGrey’s behavior.
-
Declaration
Objective-C
+ (nonnull instancetype)sharedInstance;
Swift
class func sharedInstance() -> Self
Return Value
The singleton GREYConfiguration instance.
-
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.
@throws NSInvalidArgumentException If no value could be found associated with @c configKey.
Declaration
Objective-C
- (nonnull id)valueForConfigKey:(nonnull NSString *)configKey;
Swift
func value(forConfigKey configKey: String) -> Any
Parameters
configKey
The key whose value is being queried. Must be a valid @c NSString.
Return Value
The value for the configuration stored associate with @c 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.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
Declaration
Objective-C
- (BOOL)boolValueForConfigKey:(nonnull NSString *)configKey;
Swift
func boolValue(forConfigKey configKey: String) -> Bool
Parameters
configKey
The key whose value is being queried. Must be a valid @c NSString.
Return Value
The @c BOOL value for the configuration associated with @c 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.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
Declaration
Objective-C
- (NSInteger)integerValueForConfigKey:(nonnull NSString *)configKey;
Swift
func integerValue(forConfigKey configKey: String) -> Int
Parameters
configKey
The key whose value is being queried. Must be a valid @c NSString.
Return Value
The integer value for the configuration associated with @c 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.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
Declaration
Objective-C
- (double)doubleValueForConfigKey:(nonnull NSString *)configKey;
Swift
func doubleValue(forConfigKey configKey: String) -> Double
Parameters
configKey
The key whose value is being queried. Must be a valid @c NSString.
Return Value
The @c double value for the configuration associated with @c 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.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
Declaration
Objective-C
- (nonnull NSString *)stringValueForConfigKey:(nonnull NSString *)configKey;
Swift
func stringValue(forConfigKey configKey: String) -> String
Parameters
configKey
The key whose value is being queried. Must be a valid @c NSString.
Return Value
The string value for the configuration associated with @c 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.
@throws NSInvalidArgumentException If no value could be found for the given @c configKey.
Declaration
Objective-C
- (nonnull NSArray *)arrayValueForConfigKey:(nonnull NSString *)configKey;
Swift
func arrayValue(forConfigKey configKey: String) -> [Any]
Parameters
configKey
The key whose value is being queried. Must be a valid @c NSString.
Return Value
The array value for the configuration associated with @c 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.
Declaration
Objective-C
- (void)reset;
Swift
func reset()
-
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.
Declaration
Objective-C
- (void)setValue:(nonnull id)value forConfigKey:(nonnull NSString *)configKey;
Swift
func setValue(_ value: Any, forConfigKey configKey: String)
Parameters
value
The configuration value to be set. Scalars should be wrapped in @c NSValue.
configKey
Key identifying an existing or new configuration. Must be a valid @c NSString.
-
Associates configuration identified by @c configKey with the provided @c value.
@remark Default values persist even after resetting the configuration (using GREYConfiguration::reset)
Declaration
Objective-C
- (void)setDefaultValue:(nonnull id)value forConfigKey:(nonnull NSString *)configKey;
Swift
func setDefaultValue(_ value: Any, forConfigKey configKey: String)
Parameters
value
The configuration value to be set. Scalars should be wrapped in @c NSValue.
configKey
Key identifying an existing or new configuration. Must be a valid @c NSString.