detox-allure2-adapter
Version:
Detox adapter for jest-allure2-reporter
164 lines • 5.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UiDevice = exports.UiAutomator = void 0;
const utils_1 = require("../../utils");
class UiAutomator {
static uiDevice() {
return UiDevice;
}
}
exports.UiAutomator = UiAutomator;
class UiDevice {
static click(x, y) {
return (0, utils_1.msg)(`Click at (${x}, ${y})`, { x, y });
}
static pressBack() {
return (0, utils_1.msg)('Press back button');
}
static pressKeyCode(keyCode, metaState) {
return (0, utils_1.msg)(`Press key code ${keyCode}`, { keyCode, metaState });
}
static swipe(startX, startY, endX, endY, steps) {
return (0, utils_1.msg)(`Swipe from (${startX}, ${startY}) to (${endX}, ${endY})`, {
start_x: startX,
start_y: startY,
end_x: endX,
end_y: endY,
steps,
});
}
static setCompressedLayoutHeirarchy(compressed) {
return (0, utils_1.msg)(`Set compressed layout hierarchy to ${compressed}`, { compressed });
}
static getInstance() {
return (0, utils_1.msg)('Get UI device instance');
}
static getDisplaySizeDp() {
return (0, utils_1.msg)('Get display size in DP');
}
static getProductName() {
return (0, utils_1.msg)('Get product name');
}
static getLastTraversedText() {
return (0, utils_1.msg)('Get last traversed text');
}
static clearLastTraversedText() {
return (0, utils_1.msg)('Clear last traversed text');
}
static pressMenu() {
return (0, utils_1.msg)('Press menu button');
}
static pressHome() {
return (0, utils_1.msg)('Press home button');
}
static pressSearch() {
return (0, utils_1.msg)('Press search button');
}
static pressDPadCenter() {
return (0, utils_1.msg)('Press D-pad center');
}
static pressDPadDown() {
return (0, utils_1.msg)('Press D-pad down');
}
static pressDPadUp() {
return (0, utils_1.msg)('Press D-pad up');
}
static pressDPadLeft() {
return (0, utils_1.msg)('Press D-pad left');
}
static pressDPadRight() {
return (0, utils_1.msg)('Press D-pad right');
}
static pressDelete() {
return (0, utils_1.msg)('Press delete button');
}
static pressEnter() {
return (0, utils_1.msg)('Press enter button');
}
static pressRecentApps() {
return (0, utils_1.msg)('Press recent apps button');
}
static openNotification() {
return (0, utils_1.msg)('Open notification drawer');
}
static openQuickSettings() {
return (0, utils_1.msg)('Open quick settings');
}
static getDisplayWidth() {
return (0, utils_1.msg)('Get display width');
}
static getDisplayHeight() {
return (0, utils_1.msg)('Get display height');
}
static drag(startX, startY, endX, endY, steps) {
return (0, utils_1.msg)(`Drag from (${startX}, ${startY}) to (${endX}, ${endY})`, {
start_x: startX,
start_y: startY,
end_x: endX,
end_y: endY,
steps,
});
}
static waitForIdle() {
return (0, utils_1.msg)('Wait for idle');
}
static getCurrentActivityName() {
return (0, utils_1.msg)('Get current activity name');
}
static getCurrentPackageName() {
return (0, utils_1.msg)('Get current package name');
}
static removeWatcher(name) {
return (0, utils_1.msg)(`Remove watcher "${name}"`, { name });
}
static runWatchers() {
return (0, utils_1.msg)('Run watchers');
}
static resetWatcherTriggers() {
return (0, utils_1.msg)('Reset watcher triggers');
}
static hasWatcherTriggered(watcherName) {
return (0, utils_1.msg)(`Check if watcher "${watcherName}" has triggered`, { watcherName });
}
static hasAnyWatcherTriggered() {
return (0, utils_1.msg)('Check if any watcher has triggered');
}
static setWatcherTriggered(watcherName) {
return (0, utils_1.msg)(`Set watcher "${watcherName}" as triggered`, { watcherName });
}
static isNaturalOrientation() {
return (0, utils_1.msg)('Check if orientation is natural');
}
static getDisplayRotation() {
return (0, utils_1.msg)('Get display rotation');
}
static freezeRotation() {
return (0, utils_1.msg)('Freeze rotation');
}
static unfreezeRotation() {
return (0, utils_1.msg)('Unfreeze rotation');
}
static setOrientationLeft() {
return (0, utils_1.msg)('Set orientation to left');
}
static setOrientationRight() {
return (0, utils_1.msg)('Set orientation to right');
}
static setOrientationNatural() {
return (0, utils_1.msg)('Set orientation to natural');
}
static wakeUp() {
return (0, utils_1.msg)('Wake up device');
}
static isScreenOn() {
return (0, utils_1.msg)('Check if screen is on');
}
static sleep() {
return (0, utils_1.msg)('Put device to sleep');
}
static dumpWindowHierarchy(fileName) {
return (0, utils_1.msg)(`Dump window hierarchy to "${fileName}"`, { fileName });
}
}
exports.UiDevice = UiDevice;
//# sourceMappingURL=UiAutomator.js.map