|
|
@ -29,11 +29,11 @@ export default abstract class BasePage { |
|
|
|
responseJsonMatcher?: ResponseSelector; |
|
|
|
responseJsonMatcher?: ResponseSelector; |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
const waitForResponsePromise = this.rootPage.waitForResponse( |
|
|
|
const waitForResponsePromise = this.rootPage.waitForResponse( |
|
|
|
res => { |
|
|
|
async res => { |
|
|
|
let isResJsonMatched = true; |
|
|
|
let isResJsonMatched = true; |
|
|
|
if (responseJsonMatcher) { |
|
|
|
if (responseJsonMatcher) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
isResJsonMatched = responseJsonMatcher(res.json()); |
|
|
|
isResJsonMatched = responseJsonMatcher(await res.json()); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -50,8 +50,7 @@ export default abstract class BasePage { |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
await uiAction(); |
|
|
|
await Promise.all([uiAction(), waitForResponsePromise]); |
|
|
|
await waitForResponsePromise; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async attachFile({ filePickUIAction, filePath }: { filePickUIAction: Promise<any>; filePath: string[] }) { |
|
|
|
async attachFile({ filePickUIAction, filePath }: { filePickUIAction: Promise<any>; filePath: string[] }) { |
|
|
|