-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathafterErrorInTest.ts
More file actions
28 lines (21 loc) · 916 Bytes
/
afterErrorInTest.ts
File metadata and controls
28 lines (21 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// eslint-disable-next-line import/no-internal-modules
import {getBrowserConsoleMessages} from '../../actions/getBrowserConsoleMessages';
// eslint-disable-next-line import/no-internal-modules
import {getBrowserJsErrors} from '../../actions/getBrowserJsErrors';
import {addTimeoutToPromise} from '../promise';
import {takeScreenshotsOnErrorIfNeeded} from './takeScreenshotsOnErrorIfNeeded';
import type {TestStaticOptions} from '../../types/internal';
const afterErrorInTestTimeoutInMs = 8_000;
/**
* Internal "after error in test" hook.
* @internal
*/
export const afterErrorInTest = (testStaticOptions: TestStaticOptions): Promise<void> =>
addTimeoutToPromise(
(async () => {
getBrowserConsoleMessages({showMessagesInLog: true});
getBrowserJsErrors({showErrorsInLog: true});
await takeScreenshotsOnErrorIfNeeded(testStaticOptions);
})(),
afterErrorInTestTimeoutInMs,
);