From 5a1ab796e23ad370e3fda46c466a9a84b8fbaf87 Mon Sep 17 00:00:00 2001 From: "zhiyong.yue" Date: Thu, 2 Nov 2023 14:12:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0temporarilyDisableDialog?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/PagesInstance.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/PagesInstance.ts b/tests/PagesInstance.ts index 9c108b9..e0775eb 100644 --- a/tests/PagesInstance.ts +++ b/tests/PagesInstance.ts @@ -73,4 +73,20 @@ export default class PagesInstance { await this.page.evaluate("window.maskTag=1"); } } + + // 临时停用dialog,避免添加异常测试时,误处发接口告警 + // + // 参数: + // - callback: 要执行的回调函数 + // + // 返回值: + // - Promise: 异步回调函数的返回值 + async temporarilyDisableDialog(callback: () => Promise): Promise { + await this.page.evaluate("window.diaglogTag=0"); + try { + return await callback(); + } finally { + await this.page.evaluate("window.dialogTag=1"); + } + } }