engine/wrap.js
async function handleErrorWhenDriverExistsAndRecCountZero() {
  gIn.errRecursionCount = 1; // To prevent recursive error report on error report.
  /* Here we use selenium GUI stuff when there was gT.s.driver.init call  */
  gIn.tracer.msg1('A.W.: Error report: printSelDriverLogs');
  await gT.s.driver.printSelDriverLogs(900).catch(() => {
    gIn.tracer.msg1(
      `Error at printSelDriverLogs at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  if (!gIn.brHelpersInitiated) {
    gIn.tracer.msg1('A.W.: Error report: initTiaBrHelpers');
    await gT.s.browser.initTiaBrHelpers(true).catch(() => {
      gIn.tracer.msg1(
        `Error at initTiaBrHelpers at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
      );
    });
  }

  gIn.tracer.msg1('A.W.: Error report: printCaughtExceptions');
  await gT.s.browser.printCaughtExceptions(true).catch(() => {
    gIn.tracer.msg1(
      `Error at logExceptions at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  gIn.tracer.msg1('A.W.: Error report: printSelBrowserLogs');
  await gT.s.browser.printSelBrowserLogs().catch(() => {
    gIn.tracer.msg1(
      `Error at logConsoleContent at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  gIn.tracer.msg1('A.W.: Error report: screenshot');
  await gT.s.browser.screenshot().catch(() => {
    gIn.tracer.msg1(
      `Error at screenshot at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  await quitDriver();

  throw new Error(gT.engineConsts.CANCELLING_THE_TEST);
}
async function handleErrorWhenDriverExistsAndRecCountZero() {
  gIn.errRecursionCount = 1; // To prevent recursive error report on error report.
  /* Here we use selenium GUI stuff when there was gT.s.driver.init call  */
  gIn.tracer.msg1('A.W.: Error report: printSelDriverLogs');
  await gT.s.driver.printSelDriverLogs(900).catch(() => {
    gIn.tracer.msg1(
      `Error at printSelDriverLogs at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  if (!gIn.brHelpersInitiated) {
    gIn.tracer.msg1('A.W.: Error report: initTiaBrHelpers');
    await gT.s.browser.initTiaBrHelpers(true).catch(() => {
      gIn.tracer.msg1(
        `Error at initTiaBrHelpers at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
      );
    });
  }

  gIn.tracer.msg1('A.W.: Error report: printCaughtExceptions');
  await gT.s.browser.printCaughtExceptions(true).catch(() => {
    gIn.tracer.msg1(
      `Error at logExceptions at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  gIn.tracer.msg1('A.W.: Error report: printSelBrowserLogs');
  await gT.s.browser.printSelBrowserLogs().catch(() => {
    gIn.tracer.msg1(
      `Error at logConsoleContent at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  gIn.tracer.msg1('A.W.: Error report: screenshot');
  await gT.s.browser.screenshot().catch(() => {
    gIn.tracer.msg1(
      `Error at screenshot at error handling, driver exists: ${Boolean(gT.sOrig.driver)}`
    );
  });

  await quitDriver();

  throw new Error(gT.engineConsts.CANCELLING_THE_TEST);
}
async function handleErrorWhenDriverExistsAndRecCountZero ( ) { gIn . errRecursionCount = 1 ; // To prevent recursive error report on error report. /* Here we use selenium GUI stuff when there was gT.s.driver.init call  */ gIn . tracer . msg1 ( 'A.W.: Error report: printSelDriverLogs' ) ; await gT . s . driver . printSelDriverLogs ( 900 ) . catch ( ( ) => { gIn . tracer . msg1 ( ` ${ Boolean ( gT . sOrig . driver ) } ` ) ; } ) ; if ( ! gIn . brHelpersInitiated ) { gIn . tracer . msg1 ( 'A.W.: Error report: initTiaBrHelpers' ) ; await gT . s . browser . initTiaBrHelpers ( true ) . catch ( ( ) => { gIn . tracer . msg1 ( ` ${ Boolean ( gT . sOrig . driver ) } ` ) ; } ) ; } gIn . tracer . msg1 ( 'A.W.: Error report: printCaughtExceptions' ) ; await gT . s . browser . printCaughtExceptions ( true ) . catch ( ( ) => { gIn . tracer . msg1 ( ` ${ Boolean ( gT . sOrig . driver ) } ` ) ; } ) ; gIn . tracer . msg1 ( 'A.W.: Error report: printSelBrowserLogs' ) ; await gT . s . browser . printSelBrowserLogs ( ) . catch ( ( ) => { gIn . tracer . msg1 ( ` ${ Boolean ( gT . sOrig . driver ) } ` ) ; } ) ; gIn . tracer . msg1 ( 'A.W.: Error report: screenshot' ) ; await gT . s . browser . screenshot ( ) . catch ( ( ) => { gIn . tracer . msg1 ( ` ${ Boolean ( gT . sOrig . driver ) } ` ) ; } ) ; await quitDriver ( ) ; throw new Error ( gT . engineConsts . CANCELLING_THE_TEST ) ; }
Handles an error when webdriver exists and recursion count is zero.
Reports various info about the error and quits the driver if there is not
keepBrowserAtError flag. Also see gT.s.driver.quit code for conditions when driver
will not quit.
Then tries to stop the current test case by throwing according error.
Handles an error when webdriver exists and recursion count is zero . Reports various info about the error and quits the driver if there is not keepBrowserAtError flag . Also see gT . s . driver . quit code for conditions when driver will not quit . Then tries to stop the current test case by throwing according error .