@intuned/runtime-dev 1.0.0-udas.2 → 1.0.0-udas.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.
@@ -45,9 +45,16 @@ async function getProductionPlaywrightConstructs({
45
45
  }
46
46
  const executablePath = playwright.chromium.executablePath();
47
47
  const chromium127Path = executablePath.replace("chromium-1117", "chromium-1124");
48
- const isChrome127There = (0, _fsExtra.existsSync)(chromium127Path);
48
+ console.log("Checking if chrome exists at", chromium127Path);
49
+ const isChrome127There = await (0, _fsExtra.exists)(chromium127Path);
50
+ console.log({
51
+ isChrome127There
52
+ });
49
53
  const userAgent = `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${isChrome127There ? 127 : 125}.0.0.0 Safari/537.36`;
54
+ console.log("Creating user dir with preferences");
50
55
  const userDataDir = await createUserDirWithPreferences();
56
+ console.log("User data dir created", userDataDir);
57
+ console.log("Launching playwright context");
51
58
  const context = await playwright.chromium.launchPersistentContext(userDataDir, {
52
59
  headless,
53
60
  ignoreDefaultArgs: [...getChromiumLaunchArgsToIgnore(), "--headless"],
@@ -57,6 +64,7 @@ async function getProductionPlaywrightConstructs({
57
64
  downloadsPath,
58
65
  userAgent
59
66
  });
67
+ console.log("Playwright context launched");
60
68
  context.once("close", async () => {
61
69
  try {
62
70
  await (0, _fsExtra.rm)(userDataDir, {
@@ -70,20 +78,29 @@ async function getProductionPlaywrightConstructs({
70
78
  }
71
79
  });
72
80
  if (storageState) {
81
+ console.log("Loading session to context");
73
82
  await loadSessionToContext({
74
83
  context,
75
84
  session: storageState
76
85
  });
86
+ console.log("Session loaded to context");
87
+ } else {
88
+ console.log("No session to load");
77
89
  }
90
+ console.log("Adding init script");
78
91
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
79
92
  await context.addInitScript({
80
93
  path: assetsFile
81
94
  });
95
+ console.log("Init script added");
82
96
  let page = context.pages().at(0);
83
97
  if (page) {
98
+ console.log("Adding script to page");
84
99
  const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
85
100
  await page.evaluate(scriptString);
101
+ console.log("Script added to page");
86
102
  } else {
103
+ console.log("Creating new page");
87
104
  page = await context.newPage();
88
105
  }
89
106
  return {
@@ -87,6 +87,7 @@ async function* runApiGenerator({
87
87
  downloadsPath,
88
88
  storageState: auth === null || auth === void 0 ? void 0 : auth.session
89
89
  }));
90
+ console.log("Got page and context");
90
91
  } else {
91
92
  const {
92
93
  mode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.0.0-udas.2",
3
+ "version": "1.0.0-udas.4",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",