detox
Advanced tools
Comparing version 20.19.5 to 20.20.0
{ | ||
"name": "detox", | ||
"description": "E2E tests and automation for mobile", | ||
"version": "20.19.5", | ||
"version": "20.20.0", | ||
"bin": { | ||
@@ -118,3 +118,3 @@ "detox": "local-cli/cli.js" | ||
], | ||
"gitHead": "60a56b0394b4a3a2aa99ce0a82b03b19b6116e54" | ||
"gitHead": "b5821206730e4541260ab98eecaf77a77c569e59" | ||
} |
@@ -48,2 +48,28 @@ const invoke = require('../../invoke'); | ||
class LongPressAndDragAction extends Action { | ||
constructor(duration, normalizedPositionX, normalizedPositionY, targetElement, normalizedTargetPositionX, normalizedTargetPositionY, speed, holdDuration) { | ||
super(); | ||
assertNormalized({ normalizedPositionX }); | ||
assertNormalized({ normalizedPositionY }); | ||
assertNormalized({ normalizedTargetPositionX }); | ||
assertNormalized({ normalizedTargetPositionY }); | ||
assertSpeed({ speed }); | ||
this._call = invoke.callDirectly( | ||
DetoxActionApi.longPressAndDrag( | ||
duration, | ||
normalizedPositionX, | ||
normalizedPositionY, | ||
targetElement._call(), | ||
normalizedTargetPositionX, | ||
normalizedTargetPositionY, | ||
speed === 'fast', | ||
holdDuration | ||
) | ||
); | ||
} | ||
} | ||
class TypeTextAction extends Action { | ||
@@ -161,2 +187,3 @@ constructor(value) { | ||
LongPressAction, | ||
LongPressAndDragAction, | ||
MultiClickAction, | ||
@@ -163,0 +190,0 @@ PressKeyAction, |
@@ -51,2 +51,24 @@ const path = require('path'); | ||
async longPressAndDrag(duration, normalizedPositionX, normalizedPositionY, targetElement, normalizedTargetPositionX, normalizedTargetPositionY, speed, holdDuration) { | ||
const action = new actions.LongPressAndDragAction( | ||
duration, | ||
normalizedPositionX, | ||
normalizedPositionY, | ||
targetElement, | ||
normalizedTargetPositionX, | ||
normalizedTargetPositionY, | ||
speed, | ||
holdDuration); | ||
const traceDescription = actionDescription.longPressAndDrag( | ||
duration, | ||
normalizedPositionX, | ||
normalizedPositionY, | ||
targetElement, | ||
normalizedTargetPositionX, | ||
normalizedTargetPositionY, | ||
speed, | ||
holdDuration); | ||
return await new ActionInteraction(this._invocationManager, this._matcher, action, traceDescription).execute(); | ||
} | ||
async multiTap(times) { | ||
@@ -53,0 +75,0 @@ if (typeof times !== 'number') throw new Error('times should be a number, but got ' + (times + (' (' + (typeof times + ')')))); |
@@ -232,2 +232,44 @@ /** | ||
static longPressAndDrag(duration, normalizedPositionX, normalizedPositionY, targetElement, normalizedTargetPositionX, normalizedTargetPositionY, isFast, holdDuration) { | ||
if (typeof duration !== "number") throw new Error("duration should be a number, but got " + (duration + (" (" + (typeof duration + ")")))); | ||
if (typeof normalizedPositionX !== "number") throw new Error("normalizedPositionX should be a number, but got " + (normalizedPositionX + (" (" + (typeof normalizedPositionX + ")")))); | ||
if (typeof normalizedPositionY !== "number") throw new Error("normalizedPositionY should be a number, but got " + (normalizedPositionY + (" (" + (typeof normalizedPositionY + ")")))); | ||
if (typeof normalizedTargetPositionX !== "number") throw new Error("normalizedTargetPositionX should be a number, but got " + (normalizedTargetPositionX + (" (" + (typeof normalizedTargetPositionX + ")")))); | ||
if (typeof normalizedTargetPositionY !== "number") throw new Error("normalizedTargetPositionY should be a number, but got " + (normalizedTargetPositionY + (" (" + (typeof normalizedTargetPositionY + ")")))); | ||
if (typeof isFast !== "boolean") throw new Error("isFast should be a boolean, but got " + (isFast + (" (" + (typeof isFast + ")")))); | ||
if (typeof holdDuration !== "number") throw new Error("holdDuration should be a number, but got " + (holdDuration + (" (" + (typeof holdDuration + ")")))); | ||
return { | ||
target: { | ||
type: "Class", | ||
value: "com.wix.detox.espresso.DetoxAction" | ||
}, | ||
method: "longPressAndDrag", | ||
args: [{ | ||
type: "Integer", | ||
value: duration | ||
}, { | ||
type: "Double", | ||
value: normalizedPositionX | ||
}, { | ||
type: "Double", | ||
value: normalizedPositionY | ||
}, { | ||
type: "Invocation", | ||
value: targetElement | ||
}, { | ||
type: "Double", | ||
value: normalizedTargetPositionX | ||
}, { | ||
type: "Double", | ||
value: normalizedTargetPositionY | ||
}, { | ||
type: "boolean", | ||
value: isFast | ||
}, { | ||
type: "Integer", | ||
value: holdDuration | ||
}] | ||
}; | ||
} | ||
static takeViewScreenshot() { | ||
@@ -234,0 +276,0 @@ return { |
@@ -0,4 +1,12 @@ | ||
const DEFAULT_RN_VERSION = '99.9999.9999'; | ||
const rnVersion = (function parseRNVersion() { | ||
const packageJson = require('react-native/package.json'); | ||
const raw = packageJson.version; | ||
let raw; | ||
try { | ||
const packageJson = require('react-native/package.json'); | ||
raw = packageJson.version; | ||
} catch { | ||
// Default version for RN | ||
raw = DEFAULT_RN_VERSION; | ||
} | ||
const [major, minor, patch] = raw.split('.'); | ||
@@ -9,3 +17,3 @@ return { | ||
patch, | ||
raw, | ||
raw | ||
}; | ||
@@ -15,3 +23,3 @@ })(); | ||
module.exports = { | ||
rnVersion, | ||
rnVersion | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
8047467
591
23144