@zeesoft/i18n-verify 3.2.2 → 3.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/executor.mjs +39 -39
  2. package/package.json +1 -1
package/dist/executor.mjs CHANGED
@@ -302,7 +302,7 @@ const pathExists = (path2) => existsSync(path2);
302
302
  const createFolder = (path2) => !pathExists(path2) && mkdirSync(path2, { recursive: true });
303
303
  const ensureDirectoryExists = (path2, log2 = true) => {
304
304
  if (!pathExists(path2) || !dirExists(path2)) {
305
- log2 && Logger$1.debug(`Folder doesn't exists, creating \x1B[34m${path2}\x1B[0m`);
305
+ log2 && Logger.debug(`Folder doesn't exists, creating \x1B[34m${path2}\x1B[0m`);
306
306
  createFolder(path2);
307
307
  }
308
308
  };
@@ -321,7 +321,7 @@ const addContentToFile = (path2, content, encoding = "utf-8") => {
321
321
  flag: "a"
322
322
  });
323
323
  } catch (err) {
324
- Logger$1.error(err);
324
+ Logger.error(err);
325
325
  }
326
326
  };
327
327
  const getDirPath = (filePath) => dirname(filePath);
@@ -414,7 +414,7 @@ class BaseReport {
414
414
  }
415
415
  export(path2, name = DEFAULT_REPORT_NAME) {
416
416
  this.write(path2, name, this.$generatedContent);
417
- Logger$1.info(
417
+ Logger.info(
418
418
  `Exported consolidated I18n Verification ${this.$type} report in ${path2}`
419
419
  );
420
420
  }
@@ -4141,7 +4141,7 @@ class TableReport extends BaseReport {
4141
4141
  * @override
4142
4142
  */
4143
4143
  export() {
4144
- this.#hasData ? this.#printer.printTable() : Logger$1.info("There are no visbile elements with UI strings");
4144
+ this.#hasData ? this.#printer.printTable() : Logger.info("There are no visbile elements with UI strings");
4145
4145
  }
4146
4146
  }
4147
4147
  class ReportFactory {
@@ -5027,21 +5027,21 @@ class Reports {
5027
5027
  Reports.#generateReport(SUPPORTED_REPORT_TYPES.ASCII_TABLE);
5028
5028
  }
5029
5029
  }
5030
- let Logger$1 = class Logger2 {
5030
+ class Logger {
5031
5031
  static #isLogAppending = false;
5032
5032
  static #appenderInterval;
5033
5033
  static #appenderQueue = [];
5034
5034
  static info(message) {
5035
- Logger2.#print("info", message);
5035
+ Logger.#print("info", message);
5036
5036
  }
5037
5037
  static warn(message) {
5038
- Logger2.#print("warn", message);
5038
+ Logger.#print("warn", message);
5039
5039
  }
5040
5040
  static error(message, err) {
5041
- Logger2.#print("errr", message, err);
5041
+ Logger.#print("errr", message, err);
5042
5042
  }
5043
5043
  static debug(message) {
5044
- Logger2.#print("dbug", message);
5044
+ Logger.#print("dbug", message);
5045
5045
  }
5046
5046
  static #print(type, message, additionalObj = "") {
5047
5047
  const colors = {
@@ -5071,30 +5071,30 @@ let Logger$1 = class Logger2 {
5071
5071
  console.log(logMessage);
5072
5072
  }
5073
5073
  logMessage = logMessage.replace(/\x1b\[\d+m/g, "");
5074
- Logger2.#customLog(`${logMessage}
5074
+ Logger.#customLog(`${logMessage}
5075
5075
  `);
5076
5076
  }
5077
5077
  static #customLog = (message) => {
5078
- if (Logger2.#isLogAppending) {
5079
- Logger2.#appenderQueue.push(message);
5080
- Logger2.#appenderInterval = setInterval(() => {
5081
- if (!Logger2.#isLogAppending) {
5082
- clearInterval(Logger2.#appenderInterval);
5083
- message = Logger2.#appenderQueue.join("\n");
5084
- Logger2.#appenderQueue = [];
5085
- message && Logger2.#customLog(message);
5078
+ if (Logger.#isLogAppending) {
5079
+ Logger.#appenderQueue.push(message);
5080
+ Logger.#appenderInterval = setInterval(() => {
5081
+ if (!Logger.#isLogAppending) {
5082
+ clearInterval(Logger.#appenderInterval);
5083
+ message = Logger.#appenderQueue.join("\n");
5084
+ Logger.#appenderQueue = [];
5085
+ message && Logger.#customLog(message);
5086
5086
  }
5087
5087
  }, 10);
5088
5088
  } else {
5089
- Logger2.#isLogAppending = true;
5089
+ Logger.#isLogAppending = true;
5090
5090
  const LOGS_DIR = joinPaths(Reports.getReportPath(), "logs");
5091
5091
  const logFilePath = joinPaths(LOGS_DIR, "log");
5092
5092
  ensureDirectoryExists(LOGS_DIR, DEBUG_MODE);
5093
5093
  fs.appendFileSync(logFilePath, message);
5094
- Logger2.#isLogAppending = false;
5094
+ Logger.#isLogAppending = false;
5095
5095
  }
5096
5096
  };
5097
- };
5097
+ }
5098
5098
  class NightWatchDriver extends BaseDriver {
5099
5099
  constructor(driver) {
5100
5100
  super(driver);
@@ -5248,7 +5248,7 @@ const captureFullPage$1 = async (driver, filePath) => {
5248
5248
  });
5249
5249
  const screenshotBuffer = Buffer.from(data2, "base64");
5250
5250
  writeFileSync(filePath, screenshotBuffer);
5251
- Logger$1.debug(`Screenshot saved as: ${filePath}`);
5251
+ Logger.debug(`Screenshot saved as: ${filePath}`);
5252
5252
  await client.close();
5253
5253
  };
5254
5254
  const getRemoteDebuggerPort$1 = (driver) => {
@@ -5622,7 +5622,7 @@ class CypressDriver extends BaseDriver {
5622
5622
  }
5623
5623
  });
5624
5624
  } catch (textError) {
5625
- Logger$1.error("Error getting text of element:", textError);
5625
+ Logger.error("Error getting text of element:", textError);
5626
5626
  }
5627
5627
  return elementStrings;
5628
5628
  }
@@ -6776,7 +6776,7 @@ class Config {
6776
6776
  this.#ssCount = 0;
6777
6777
  this.getGarbledChars();
6778
6778
  } catch (ex) {
6779
- Logger$1.error(ex.message);
6779
+ Logger.error(ex.message);
6780
6780
  throw ex;
6781
6781
  }
6782
6782
  }
@@ -6929,7 +6929,7 @@ class BaseRunner {
6929
6929
  await this.#executePageProcess();
6930
6930
  }
6931
6931
  } catch (ex) {
6932
- Logger$1.error("unable to run the process", ex);
6932
+ Logger.error("unable to run the process", ex);
6933
6933
  } finally {
6934
6934
  await this.#postRun();
6935
6935
  }
@@ -6952,10 +6952,10 @@ class BaseRunner {
6952
6952
  async captureScreen(imagePath) {
6953
6953
  try {
6954
6954
  await this.#driver.captureScreenshot(imagePath);
6955
- Logger$1.debug("reviewed image has been saved");
6955
+ Logger.debug("reviewed image has been saved");
6956
6956
  return true;
6957
6957
  } catch (ex) {
6958
- Logger$1.error("unable to capture screenshot");
6958
+ Logger.error("unable to capture screenshot");
6959
6959
  return false;
6960
6960
  }
6961
6961
  }
@@ -6992,7 +6992,7 @@ class BaseRunner {
6992
6992
  await this.#processLocatorElements();
6993
6993
  await this.#processIFrames();
6994
6994
  } else {
6995
- Logger$1.debug("No locators provided");
6995
+ Logger.debug("No locators provided");
6996
6996
  }
6997
6997
  }
6998
6998
  async #executePageProcess() {
@@ -7051,19 +7051,19 @@ class BaseRunner {
7051
7051
  }
7052
7052
  }
7053
7053
  if (!hasElements) {
7054
- Logger$1.debug("No UI elements found from the provided locators");
7054
+ Logger.debug("No UI elements found from the provided locators");
7055
7055
  }
7056
7056
  }
7057
7057
  async #processIFrames() {
7058
7058
  if (await this.#driver.checkIfIframeIsPresent()) {
7059
7059
  const frames = await this.#driver.getElements("//iframe");
7060
- Logger$1.debug(
7060
+ Logger.debug(
7061
7061
  `Total ${frames.length} iframes are located on the ${this.#description}`
7062
7062
  );
7063
7063
  for (let fID = 0; fID < frames.length; fID++) {
7064
7064
  const frame = frames[fID];
7065
7065
  const offsets = await this.getElementOffsets(frame);
7066
- Logger$1.debug(`Switching to iFrame: ${fID}`);
7066
+ Logger.debug(`Switching to iFrame: ${fID}`);
7067
7067
  await this.#driver.switchToIFrame(fID, frame);
7068
7068
  this.#driver.pause(1);
7069
7069
  const iframeBody = await this.#driver.getElement("//body");
@@ -7081,7 +7081,7 @@ class BaseRunner {
7081
7081
  }
7082
7082
  }
7083
7083
  }
7084
- !hasAtLeastOneString && Logger$1.debug("No valid UI elements found in the iFrame");
7084
+ !hasAtLeastOneString && Logger.debug("No valid UI elements found in the iFrame");
7085
7085
  await this.#driver.switchToParentFrame();
7086
7086
  }
7087
7087
  }
@@ -7094,7 +7094,7 @@ class BaseRunner {
7094
7094
  try {
7095
7095
  await this.process(string, element, offsets, frameId);
7096
7096
  } catch (ex) {
7097
- Logger$1.error(
7097
+ Logger.error(
7098
7098
  `unable to process the ${frameId ? `iframe-[${frameId}] ` : ""}string "${string}"`,
7099
7099
  ex
7100
7100
  );
@@ -7147,7 +7147,7 @@ class ContextRunner extends BaseRunner {
7147
7147
  this.getBaseImageName(),
7148
7148
  this.getDescription()
7149
7149
  );
7150
- Logger$1.debug(`context creation for "${string}"`);
7150
+ Logger.debug(`context creation for "${string}"`);
7151
7151
  await this.#addToContext(string, element, offsets);
7152
7152
  }
7153
7153
  /**
@@ -7238,12 +7238,12 @@ class Graphic {
7238
7238
  const targetDir = path.dirname(report_img);
7239
7239
  const buffer = await image.getBufferAsync(Jimp.MIME_PNG);
7240
7240
  if (!fs.existsSync(targetDir)) {
7241
- Logger$1.debug("folder not found");
7241
+ Logger.debug("folder not found");
7242
7242
  fs.mkdirSync(targetDir, { recursive: true });
7243
7243
  }
7244
7244
  fs.writeFileSync(report_img, buffer);
7245
7245
  } catch (err) {
7246
- Logger$1.error(`Error: ${err}`);
7246
+ Logger.error(`Error: ${err}`);
7247
7247
  }
7248
7248
  }
7249
7249
  static async drawRectangleOutline(image, x, y, width, height, color, thickness) {
@@ -7325,7 +7325,7 @@ class I18nRunner extends BaseRunner {
7325
7325
  await Graphic.drawRectangle(elRec, color, image);
7326
7326
  }
7327
7327
  #defineColor(status, string) {
7328
- Logger$1.debug(
7328
+ Logger.debug(
7329
7329
  `"${string}" - ${STATUS_COLOR[status][1]}${STATUS_INFO[status]}${"\x1B[0m"}`
7330
7330
  );
7331
7331
  return STATUS_COLOR[status][0];
@@ -7346,7 +7346,7 @@ class SanityRunner extends BaseRunner {
7346
7346
  * @override
7347
7347
  */
7348
7348
  async process(page) {
7349
- Logger$1.info(`${page} loaded`);
7349
+ Logger.info(`${page} loaded`);
7350
7350
  const src_img = joinPaths(
7351
7351
  Reports.reviewedReports(page, this.getBaseImageName()),
7352
7352
  this.getBaseImageName()
@@ -7430,7 +7430,7 @@ class Executor {
7430
7430
  export {
7431
7431
  Config as C,
7432
7432
  Executor as E,
7433
- Logger$1 as L,
7433
+ Logger as L,
7434
7434
  Reports as R,
7435
7435
  SYSTEM_TYPES as S,
7436
7436
  getRootProjectPackageJson as a,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeesoft/i18n-verify",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "description": "Library to perform I18n verification on Nightwatch, WebdriverIO or Selenium framework projects",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",