@zohodesk/testinglibrary 0.2.3-exp.1 → 0.2.3-exp.2

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.
@@ -20,11 +20,19 @@ function replaceI18NValuesWithRegex(i18nStr, values) {
20
20
  }
21
21
  return i18nStr;
22
22
  }
23
+ async function isI18NKeyDefined(key) {
24
+ return new Promise(resolve => {
25
+ if (typeof window.i18n[key] !== 'undefined') {
26
+ resolve();
27
+ }
28
+ });
29
+ }
23
30
  var _default = exports.default = {
24
31
  i18N: async ({
25
32
  page
26
33
  }, use) => {
27
34
  await use(async (key, values) => {
35
+ await page.waitForFunction(isI18NKeyDefined(key));
28
36
  const i18nValue = await page.evaluate(i18nKey => window.i18n[i18nKey], key);
29
37
  const i18nStr = replaceI18NValuesWithRegex(i18nValue, values);
30
38
  return i18nStr;
@@ -19,7 +19,12 @@ async function performLoginSteps({
19
19
  const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
20
20
  await (0, _checkAuthCookies.loadCookiesIfPresent)(page, authFile);
21
21
  await page.goto(process.env.domain);
22
- await page.waitForNavigation();
22
+
23
+ // await page.waitForNavigation();
24
+
25
+ // await page.waitForLoadState('networkidle')
26
+
27
+ await Promise.race([page.waitForNavigation(), page.waitForLoadState('networkidle')]);
23
28
  const loginStatus = await isLoggedIn(page);
24
29
  if (!loginStatus) {
25
30
  await (0, _accountLogin.default)(page, useremail, password);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/testinglibrary",
3
- "version": "0.2.3-exp.1",
3
+ "version": "0.2.3-exp.2",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {