@zondax/zemu
Advanced tools
Comparing version 0.50.3 to 0.51.0
@@ -63,2 +63,3 @@ /** ****************************************************************************** | ||
toggleExpertMode(testcaseName?: string, takeSnapshots?: boolean, startImgIndex?: number): Promise<number>; | ||
toggleBlindSigning(testcaseName?: string, takeSnapshots?: boolean, startImgIndex?: number): Promise<number>; | ||
enableSpecialMode(nanoModeText: string, nanoIsSecretMode?: boolean, touchToggleSettingButton?: ButtonKind, path?: string, testcaseName?: string, waitForScreenUpdate?: boolean, takeSnapshots?: boolean, startImgIndex?: number, timeout?: number): Promise<number>; | ||
@@ -69,5 +70,5 @@ navigate(path: string, testcaseName: string, navigateSchedule: Array<INavElement | number>, waitForScreenUpdate?: boolean, takeSnapshots?: boolean, startImgIndex?: number, waitForEventsChange?: boolean): Promise<number>; | ||
compareSnapshots(path: string, testcaseName: string, lastSnapshotIdx: number): boolean; | ||
compareSnapshotsAndApprove(path: string, testcaseName: string, waitForScreenUpdate?: boolean, startImgIndex?: number, timeout?: number): Promise<boolean>; | ||
compareSnapshotsAndApprove(path: string, testcaseName: string, waitForScreenUpdate?: boolean, startImgIndex?: number, timeout?: number, isBlindSigning?: boolean): Promise<boolean>; | ||
compareSnapshotsAndReject(path: string, testcaseName: string, waitForScreenUpdate?: boolean, startImgIndex?: number, timeout?: number): Promise<boolean>; | ||
navigateUntilText(path: string, testcaseName: string, text: string | RegExp, waitForScreenUpdate?: boolean, takeSnapshots?: boolean, startImgIndex?: number, timeout?: number, runLastAction?: boolean, waitForInitialEventsChange?: boolean): Promise<number>; | ||
navigateUntilText(path: string, testcaseName: string, text: string | RegExp, waitForScreenUpdate?: boolean, takeSnapshots?: boolean, startImgIndex?: number, timeout?: number, runLastAction?: boolean, waitForInitialEventsChange?: boolean, isBlindSigning?: boolean): Promise<number>; | ||
navigateAndCompareUntilText(path: string, testcaseName: string, text: string | RegExp, waitForScreenUpdate?: boolean, startImgIndex?: number, timeout?: number, waitForInitialEventsChange?: boolean): Promise<boolean>; | ||
@@ -74,0 +75,0 @@ getEvents(): Promise<IEvent[]>; |
@@ -339,2 +339,6 @@ "use strict"; | ||
} | ||
async toggleBlindSigning(testcaseName = "", takeSnapshots = false, startImgIndex = 0) { | ||
const nav = (0, zondax_1.zondaxToggleBlindSigning)(this.startOptions.model); | ||
return await this.navigate(".", testcaseName, nav.schedule, true, takeSnapshots, startImgIndex); | ||
} | ||
async enableSpecialMode(nanoModeText, nanoIsSecretMode = false, touchToggleSettingButton, path = ".", testcaseName = "", waitForScreenUpdate = true, takeSnapshots = false, startImgIndex = 0, timeout = constants_1.DEFAULT_METHOD_TIMEOUT) { | ||
@@ -413,6 +417,6 @@ if (!(0, zondax_1.isTouchDevice)(this.startOptions.model)) { | ||
} | ||
async compareSnapshotsAndApprove(path, testcaseName, waitForScreenUpdate = true, startImgIndex = 0, timeout = constants_1.DEFAULT_METHOD_TIMEOUT) { | ||
async compareSnapshotsAndApprove(path, testcaseName, waitForScreenUpdate = true, startImgIndex = 0, timeout = constants_1.DEFAULT_METHOD_TIMEOUT, isBlindSigning = false) { | ||
const approveKeyword = this.startOptions.approveKeyword; | ||
const takeSnapshots = true; | ||
const lastSnapshotIdx = await this.navigateUntilText(path, testcaseName, approveKeyword, waitForScreenUpdate, takeSnapshots, startImgIndex, timeout); | ||
const lastSnapshotIdx = await this.navigateUntilText(path, testcaseName, approveKeyword, waitForScreenUpdate, takeSnapshots, startImgIndex, timeout, true, true, isBlindSigning); | ||
if ((0, zondax_1.isTouchDevice)(this.startOptions.model)) { | ||
@@ -448,3 +452,3 @@ // Avoid taking a snapshot of the final animation | ||
} | ||
async navigateUntilText(path, testcaseName, text, waitForScreenUpdate = true, takeSnapshots = true, startImgIndex = 0, timeout = constants_1.DEFAULT_METHOD_TIMEOUT, runLastAction = true, waitForInitialEventsChange = true) { | ||
async navigateUntilText(path, testcaseName, text, waitForScreenUpdate = true, takeSnapshots = true, startImgIndex = 0, timeout = constants_1.DEFAULT_METHOD_TIMEOUT, runLastAction = true, waitForInitialEventsChange = true, isBlindSigning = false) { | ||
const snapshotPrefixGolden = (0, path_1.resolve)(`${path}/snapshots/${testcaseName}`); | ||
@@ -479,3 +483,5 @@ const snapshotPrefixTmp = (0, path_1.resolve)(`${path}/snapshots-tmp/${testcaseName}`); | ||
type: touchDevice ? 3 /* ActionKind.Touch */ : 1 /* ActionKind.RightClick */, | ||
button: (0, buttons_1.getTouchElement)(this.startOptions.model, 2 /* ButtonKind.SwipeContinueButton */), // For clicks, this will be ignored | ||
button: imageIndex === 1 && isBlindSigning | ||
? (0, buttons_1.getTouchElement)(this.startOptions.model, 14 /* ButtonKind.RejectButton */) | ||
: (0, buttons_1.getTouchElement)(this.startOptions.model, 2 /* ButtonKind.SwipeContinueButton */), // Change button based on imageIndex | ||
}; | ||
@@ -482,0 +488,0 @@ await this.runAction(nav, filename, waitForScreenUpdate, true); |
@@ -21,2 +21,3 @@ /** ****************************************************************************** | ||
export declare function zondaxToggleExpertMode(model: TModel, clickArray?: number[]): ClickNavigation | TouchNavigation; | ||
export declare function zondaxToggleBlindSigning(model: TModel, clickArray?: number[]): ClickNavigation | TouchNavigation; | ||
export declare function zondaxTouchEnableSpecialMode(model: TModel, toggleSettingButton?: ButtonKind): TouchNavigation; |
@@ -6,2 +6,3 @@ "use strict"; | ||
exports.zondaxToggleExpertMode = zondaxToggleExpertMode; | ||
exports.zondaxToggleBlindSigning = zondaxToggleBlindSigning; | ||
exports.zondaxTouchEnableSpecialMode = zondaxTouchEnableSpecialMode; | ||
@@ -52,2 +53,13 @@ /** ****************************************************************************** | ||
} | ||
function zondaxToggleBlindSigning(model, clickArray) { | ||
if (isTouchDevice(model)) { | ||
return new actions_1.TouchNavigation(model, [ | ||
0 /* ButtonKind.InfoButton */, | ||
8 /* ButtonKind.ToggleSettingButton2 */, | ||
6 /* ButtonKind.SettingsQuitButton */, | ||
]); | ||
} | ||
const DEFAULT_BLIND_SIGNING_MODE_CLICKS = [2, 0, -2]; | ||
return new actions_1.ClickNavigation(clickArray ?? DEFAULT_BLIND_SIGNING_MODE_CLICKS); | ||
} | ||
function zondaxTouchEnableSpecialMode(model, toggleSettingButton) { | ||
@@ -54,0 +66,0 @@ return new actions_1.TouchNavigation(model, [ |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.50.3", | ||
"version": "0.51.0", | ||
"description": "Zemu Testing Framework", | ||
@@ -8,0 +8,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95918
1832