@intuned/runtime-dev 1.0.0-udas.0 → 1.0.0-udas.1
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/commands/interface/run.js +3 -0
- package/dist/common/runApi/index.js +1 -0
- 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":[]}]}
|
|
@@ -106,6 +106,7 @@ function runAutomationCLI(importFunction) {
|
|
|
106
106
|
});
|
|
107
107
|
async function messagesLoop() {
|
|
108
108
|
for await (const data of jsonUnixSocket.receiveJSON()) {
|
|
109
|
+
console.log("Received message");
|
|
109
110
|
const inputParseResult = inputSchema.safeParse(data);
|
|
110
111
|
if (!inputParseResult.success) {
|
|
111
112
|
console.error("Validation error:", (0, _formatZodError.formatZodError)(inputParseResult.error));
|
|
@@ -169,9 +170,11 @@ function runAutomationCLI(importFunction) {
|
|
|
169
170
|
client.end();
|
|
170
171
|
}
|
|
171
172
|
void messagesLoop();
|
|
173
|
+
console.log("Listening for values");
|
|
172
174
|
for await (const {
|
|
173
175
|
value
|
|
174
176
|
} of stream) {
|
|
177
|
+
console.log("Received a value", value);
|
|
175
178
|
const {
|
|
176
179
|
done
|
|
177
180
|
} = await runGeneratorAndSendResult(value);
|
|
@@ -254,6 +254,7 @@ async function importUsingImportFunction(path, importFunction) {
|
|
|
254
254
|
}
|
|
255
255
|
return (0, _neverthrow.err)(new _errors.InvalidApiError("API file path does not have a default async function/generator export"));
|
|
256
256
|
} catch (error) {
|
|
257
|
+
console.error(error);
|
|
257
258
|
return (0, _neverthrow.err)(new _errors.ApiNotFoundError(path));
|
|
258
259
|
}
|
|
259
260
|
}
|