Custom Action with Earlgrey2
- Dominant language
- Objective-C
- Stars
- 5.7k
- Forks
- 737
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 5
Description
Can you still write custom action in Earlgrey2 ?
I am trying to implement a custom action in earlgrey2.
But I am facing 2 issues whenever I am calling an Earlgrey method within my custom action Earlgrey get stuck.
```
@implementation RateAction
- (instancetype)initWithGrade:(double)grade {
if (self = [super init]) {
_grade = grade;
_name = [NSString stringWithFormat:@"Slide to value: %g", grade];
}
return self;
}
- (nonnull NSString *)name {
return _name;
}
- (BOOL)perform:(nonnull UIView *)element error:(NSError * __strong * _Nullable)errorOrNil {
if (element == nil) {
*errorOrNil = [NSError errorWithDomain:@"UITesting-> rateAction nil element"
code: 1001
userInfo:nil];
return NO;
}
SEL setValueSelector = NSSelectorFromString(@"setValue:sendValueChangedAction:");
if ([element respondsToSelector:setValueSelector]) {
[element performSelector: setValueSelector
withObject: [NSNumber numberWithDouble: _grade]
];
}
return YES;
}
- (BOOL)shouldRunOnMainThread {
return YES;
}
@end
```
So I have come to try using selector on my view to make it do what I want. But when I try I think the view the perform method receive is a copy of the view in the application. So it does not work as expected.
Is there any guide on writing CustomAction from Earlgrey2 or this possibility has just been remove from the framework ?
Contributor guide
Research direction
Start with the shown RateAction implementation, especially perform: and shouldRunOnMainThread, and trace how EarlGrey2 invokes custom actions and supplies the UIView. Reproduce the hang with the selector call, then determine whether custom actions are supported and whether the behavior should be fixed or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c
- Domain
- mobile-dev, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100