Skip to content

Commit

Permalink
reset expect
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Aug 2, 2017
1 parent 4f8a37b commit 68ed736
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions detox/src/ios/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,54 @@ class TapAction extends Action {
class LongPressAction extends Action {
constructor() {
super();
this._call = invoke.callDirectly(GreyActions.actionForLongPress());
this._call = invoke.call(invoke.IOS.Class('GREYActions'), 'actionForLongPress');
}
}

class MultiTapAction extends Action {
constructor(value) {
super();
this._call = invoke.callDirectly(GreyActions.actionForMultipleTapsWithCount(value));
if (typeof value !== 'number') throw new Error(`MultiTapAction ctor argument must be a number, got ${typeof value}`);
this._call = invoke.call(invoke.IOS.Class('GREYActions'), 'actionForMultipleTapsWithCount:', invoke.IOS.NSInteger(value));
}
}

class TypeTextAction extends Action {
constructor(value) {
super();
this._call = invoke.callDirectly(GreyActions.actionForTypeText(value));
if (typeof value !== 'string') throw new Error(`TypeTextAction ctor argument must be a string, got ${typeof value}`);
this._call = invoke.call(invoke.IOS.Class('GREYActions'), 'actionForTypeText:', value);
}
}

class ReplaceTextAction extends Action {
constructor(value) {
super();
this._call = invoke.callDirectly(GreyActions.actionForReplaceText(value));
if (typeof value !== 'string') throw new Error(`ReplaceTextAction ctor argument must be a string, got ${typeof value}`);
this._call = invoke.call(invoke.IOS.Class('GREYActions'), 'actionForReplaceText:', value);
}
}

class ClearTextAction extends Action {
constructor() {
super();
this._call = invoke.callDirectly(GreyActions.actionForClearText(value));
this._call = invoke.call(invoke.IOS.Class('GREYActions'), 'actionForClearText');
}
}

class ScrollAmountAction extends Action {
constructor(direction, amount) {
super();
this._call = invoke.callDirectly(GreyActions.actionForScrollInDirectionamount(direction, amount));
if (typeof direction !== 'string') throw new Error(`ScrollAmountAction ctor 1st argument must be a string, got ${typeof direction}`);
switch (direction) {
case 'left': direction = 1; break;
case 'right': direction = 2; break;
case 'up': direction = 3; break;
case 'down': direction = 4; break;
default: throw new Error(`ScrollAmountAction direction must be a 'left'/'right'/'up'/'down', got ${direction}`);
}
if (typeof amount !== 'number') throw new Error(`ScrollAmountAction ctor 2nd argument must be a number, got ${typeof amount}`);
this._call = invoke.call(invoke.IOS.Class('GREYActions'), 'actionForScrollInDirection:amount:', invoke.IOS.NSInteger(direction), invoke.IOS.CGFloat(amount));
}
}

Expand Down

0 comments on commit 68ed736

Please sign in to comment.