UNPKG

e2ed

Version:

E2E testing framework over Playwright

30 lines (29 loc) 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.test = void 0; const config_1 = require("./utils/config"); const getGlobalErrorHandler_1 = require("./utils/getGlobalErrorHandler"); const test_1 = require("./utils/test"); const uiMode_1 = require("./utils/uiMode"); const test_2 = require("@playwright/test"); process.on('uncaughtException', (0, getGlobalErrorHandler_1.getGlobalErrorHandler)('TestUncaughtException')); process.on('unhandledRejection', (0, getGlobalErrorHandler_1.getGlobalErrorHandler)('TestUnhandledRejection')); /** * Creates test with name, metatags, options and test function. * @internal */ const test = (name, options, testFn) => { const runTest = (0, test_1.getRunTest)({ name, options, testFn }); let playwrightTestName = name; if (uiMode_1.isUiMode) { const { getTestNamePrefixInUiMode } = (0, config_1.getFullPackConfig)(); const prefix = getTestNamePrefixInUiMode(options); playwrightTestName = `${prefix} ${name}`; } if (options.enableCsp !== undefined) { // eslint-disable-next-line @typescript-eslint/naming-convention test_2.test.use({ bypassCSP: !options.enableCsp }); } (0, test_2.test)(playwrightTestName, runTest); }; exports.test = test;