@intuned/runtime-dev 1.6.0-dev-52-1 → 1.6.0-dev-52-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.
@@ -1,4 +1,4 @@
1
- import { BrowserContext } from "playwright-core";
1
+ import { BrowserContext } from "playwright";
2
2
  export declare const REMOTE_DEBUGGING_PORT = 9222;
3
3
  export declare const getChromiumLaunchArgs: () => string[];
4
4
  export declare function startOrRestartBrowser(): Promise<void>;
@@ -9,7 +9,7 @@ exports.saveSession = saveSession;
9
9
  exports.saveSessionFromOpenedBrowser = saveSessionFromOpenedBrowser;
10
10
  exports.startOrRestartBrowser = startOrRestartBrowser;
11
11
  var _child_process = require("child_process");
12
- var playwright = _interopRequireWildcard(require("playwright-core"));
12
+ var playwright = _interopRequireWildcard(require("playwright"));
13
13
  var fs = _interopRequireWildcard(require("fs-extra"));
14
14
  var _fileUtils = require("./utils/fileUtils");
15
15
  var _contextStorageStateHelpers = require("../../common/contextStorageStateHelpers");
@@ -1,4 +1,4 @@
1
- import * as playwright from "playwright-core";
1
+ import * as playwright from "playwright";
2
2
  interface StorageEntry {
3
3
  name: string;
4
4
  value: string;
@@ -30,7 +30,23 @@ async function setStorageState(context, state) {
30
30
  }
31
31
  }
32
32
  }
33
- if ("sessionStorage" in state && state.sessionStorage) {}
33
+ if ("sessionStorage" in state && state.sessionStorage) {
34
+ await context.addInitScript(storage => {
35
+ for (const {
36
+ origin,
37
+ sessionStorage
38
+ } of storage) {
39
+ if (window.location.origin === origin) {
40
+ for (const item of sessionStorage) {
41
+ const value = window.sessionStorage.getItem(item.name);
42
+ if (!value) {
43
+ window.sessionStorage.setItem(item.name, item.value);
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }, state.sessionStorage);
49
+ }
34
50
  await page.close();
35
51
  }
36
52
  async function getStorageState(context) {
@@ -1,4 +1,4 @@
1
- import * as playwright from "playwright-core";
1
+ import * as playwright from "playwright";
2
2
  import type { RunApiSession } from "./runApi";
3
3
  interface Proxy {
4
4
  server: string;
@@ -7,7 +7,7 @@ exports.getPlaywrightConstructsForMode = getPlaywrightConstructsForMode;
7
7
  exports.getProductionPlaywrightConstructs = getProductionPlaywrightConstructs;
8
8
  exports.getRemotePlaywrightContext = getRemotePlaywrightContext;
9
9
  exports.loadSessionToContext = loadSessionToContext;
10
- var playwright = _interopRequireWildcard(require("playwright-core"));
10
+ var playwright = _interopRequireWildcard(require("playwright"));
11
11
  var _fsExtra = _interopRequireWildcard(require("fs-extra"));
12
12
  var fs = _fsExtra;
13
13
  var _contextStorageStateHelpers = require("./contextStorageStateHelpers");
@@ -76,9 +76,6 @@ async function getProductionPlaywrightConstructs({
76
76
  });
77
77
  }
78
78
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
79
- await context.addInitScript({
80
- path: assetsFile
81
- });
82
79
  let page = context.pages().at(0);
83
80
  if (page) {
84
81
  const scriptString = await (0, _fsExtra.readFile)(assetsFile, "utf8");
@@ -104,9 +101,6 @@ async function getPlaywrightConstructsForMode(mode, cdpAddress, authSession) {
104
101
  throw new Error("no context found");
105
102
  }
106
103
  const assetsFile = _path.default.join(__dirname, "./assets/browser_scripts.js");
107
- await context.addInitScript({
108
- path: assetsFile
109
- });
110
104
  const pages = await context.pages();
111
105
  let page = null;
112
106
  if (pages.length > 0) {
@@ -163,7 +157,7 @@ async function loadSessionToContext({
163
157
  await (0, _contextStorageStateHelpers.setStorageState)(context, sessionToLoad);
164
158
  }
165
159
  async function getRemotePlaywrightContext(cdpAddress) {
166
- const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright-core")));
160
+ const playwright = await Promise.resolve().then(() => _interopRequireWildcard(require("playwright")));
167
161
  let browser = null;
168
162
  if (!cdpAddress) {
169
163
  throw new Error("cdpAddress is required");
@@ -1,6 +1,6 @@
1
1
  import { Result } from "neverthrow";
2
2
  import { RunAutomationError } from "./errors";
3
- import { Page, BrowserContext } from "playwright-core";
3
+ import { Page, BrowserContext } from "playwright";
4
4
  import { ExtendedRunApiParameters, RunApiResult, RunApiResultWithSessionOk } from "./types";
5
5
  export * from "./types";
6
6
  export * from "./errors";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.6.0-dev-52-1",
3
+ "version": "1.6.0-dev-52-2",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -130,7 +130,6 @@
130
130
  "vitest": "^1.1.3"
131
131
  },
132
132
  "peerDependencies": {
133
- "playwright": "*",
134
- "playwright-core": "*"
133
+ "playwright": "*"
135
134
  }
136
135
  }