@intuned/runtime-dev 1.0.0-udas.0 → 1.0.0-udas.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.
- package/Intuned.json +5 -0
- package/api/authed.ts +12 -0
- package/api/test.ts +3 -0
- package/api/test2.ts +27 -0
- package/auth-sessions/check.ts +11 -0
- package/auth-sessions/create.ts +32 -0
- package/authSessions +1 -0
- package/dist/common/runApi/index.js +9 -1
- package/output.txt +39 -0
- package/package.json +3 -3
package/Intuned.json
ADDED
package/api/authed.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Page, BrowserContext } from "@intuned/playwright-core";
|
|
2
|
+
|
|
3
|
+
export default async function authed(
|
|
4
|
+
params: any,
|
|
5
|
+
page: Page,
|
|
6
|
+
context: BrowserContext
|
|
7
|
+
) {
|
|
8
|
+
await page.goto("https://setcookie.net");
|
|
9
|
+
return {
|
|
10
|
+
cookies: await page.locator("ul li code").allInnerTexts(),
|
|
11
|
+
};
|
|
12
|
+
}
|
package/api/test.ts
ADDED
package/api/test2.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Page, BrowserContext } from "@intuned/playwright-core";
|
|
2
|
+
import { extendTimeout, extendPayload } from "../src/runtime";
|
|
3
|
+
|
|
4
|
+
export default async function test2(
|
|
5
|
+
{ n }: { n?: number },
|
|
6
|
+
page: Page,
|
|
7
|
+
context: BrowserContext
|
|
8
|
+
) {
|
|
9
|
+
await page.goto("https://wikipedia.org/");
|
|
10
|
+
await page.waitForTimeout(1000);
|
|
11
|
+
|
|
12
|
+
const titles: string[] = [];
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < (n ?? 2); i++) {
|
|
15
|
+
await page.goto(`https://wikipedia.org/wiki/Special:Random`);
|
|
16
|
+
await page.waitForTimeout(1000);
|
|
17
|
+
titles.push(await page.locator("h1").innerText());
|
|
18
|
+
extendTimeout();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
extendPayload({
|
|
22
|
+
api: "test",
|
|
23
|
+
parameters: {},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return { titles };
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Page, BrowserContext } from "@intuned/playwright-core";
|
|
2
|
+
|
|
3
|
+
export default async function check(
|
|
4
|
+
page: Page,
|
|
5
|
+
_context: BrowserContext
|
|
6
|
+
): Promise<boolean> {
|
|
7
|
+
await page.goto("https://setcookie.net");
|
|
8
|
+
const result = (await page.locator("ul li code").all()).length > 0;
|
|
9
|
+
console.log("Check result", result);
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Page, BrowserContext } from "@intuned/playwright-core";
|
|
2
|
+
import {
|
|
3
|
+
requestOTP,
|
|
4
|
+
requestMultipleChoice,
|
|
5
|
+
} from "../src/runtime/requestMoreInfo";
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line require-yield
|
|
8
|
+
export default async function* create(
|
|
9
|
+
params: any,
|
|
10
|
+
page: Page,
|
|
11
|
+
context: BrowserContext
|
|
12
|
+
) {
|
|
13
|
+
await page.goto("https://setcookie.net/");
|
|
14
|
+
await page.locator("#name").fill("intuned");
|
|
15
|
+
await page.locator("#value").fill("password");
|
|
16
|
+
await page.locator("input[type=submit]").click();
|
|
17
|
+
|
|
18
|
+
// console.log("Received", yield requestOTP("Enter useless otp"));
|
|
19
|
+
// console.log(
|
|
20
|
+
// "Received",
|
|
21
|
+
// yield requestMultipleChoice("Choose the correct answer", [
|
|
22
|
+
// "A",
|
|
23
|
+
// "B",
|
|
24
|
+
// "C",
|
|
25
|
+
// "D",
|
|
26
|
+
// ])
|
|
27
|
+
// );
|
|
28
|
+
|
|
29
|
+
await page.goto("http://www.sharonminsuk.com/code/storage-test.html");
|
|
30
|
+
await page.locator("#local").fill("intuned");
|
|
31
|
+
await page.locator("#local + input[type=button]").click();
|
|
32
|
+
}
|
package/authSessions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"cookies":[{"name":"intuned","value":"password","domain":"setcookie.net","path":"/","expires":-1,"httpOnly":true,"secure":false,"sameSite":"Lax"}],"origins":[{"origin":"http://www.sharonminsuk.com","localStorage":[{"name":"theirValue","value":"intuned"}]}],"sessionStorage":[{"origin":"http://www.sharonminsuk.com","sessionStorage":[]}]}
|
|
@@ -73,6 +73,11 @@ async function* runApiGenerator({
|
|
|
73
73
|
headless,
|
|
74
74
|
proxy
|
|
75
75
|
} = runOptions;
|
|
76
|
+
console.log("Running in standalone mode", {
|
|
77
|
+
headless,
|
|
78
|
+
proxy,
|
|
79
|
+
downloadsPath
|
|
80
|
+
});
|
|
76
81
|
({
|
|
77
82
|
page,
|
|
78
83
|
context
|
|
@@ -108,6 +113,7 @@ async function* runApiGenerator({
|
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
if (tracing.enabled) {
|
|
116
|
+
console.log("Starting trace");
|
|
111
117
|
await context.tracing.start({
|
|
112
118
|
screenshots: true,
|
|
113
119
|
snapshots: true,
|
|
@@ -131,6 +137,7 @@ async function* runApiGenerator({
|
|
|
131
137
|
}
|
|
132
138
|
async function* runAutomation() {
|
|
133
139
|
var _getExecutionContext;
|
|
140
|
+
(0, _cleanEnvironmentVariables.cleanEnvironmentVariables)();
|
|
134
141
|
if (auth !== null && auth !== void 0 && auth.runCheck) {
|
|
135
142
|
if (!auth.session) {
|
|
136
143
|
return (0, _neverthrow.err)(new _errors.AuthRequiredError());
|
|
@@ -148,7 +155,7 @@ async function* runApiGenerator({
|
|
|
148
155
|
return (0, _neverthrow.err)(new _errors.AuthCheckFailedError());
|
|
149
156
|
}
|
|
150
157
|
}
|
|
151
|
-
(
|
|
158
|
+
console.log("Running automation");
|
|
152
159
|
const args = [...(automationFunction.params !== undefined ? [automationFunction.params] : []), page, context];
|
|
153
160
|
const validatedModuleResult = await importUsingImportFunction(automationFunction.name, importFunction);
|
|
154
161
|
if (validatedModuleResult.isErr()) {
|
|
@@ -254,6 +261,7 @@ async function importUsingImportFunction(path, importFunction) {
|
|
|
254
261
|
}
|
|
255
262
|
return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default async function/generator export"));
|
|
256
263
|
} catch (error) {
|
|
264
|
+
console.error(error);
|
|
257
265
|
return (0, _neverthrow.err)(new _errors.ApiNotFoundError(path));
|
|
258
266
|
}
|
|
259
267
|
}
|