@auxcode/auxta 0.4.9 → 0.5.3
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/package.json +1 -1
- package/src/AuxTA.ts +26 -22
- package/src/macros/helpers/code.helper.ts +11 -0
package/package.json
CHANGED
package/src/AuxTA.ts
CHANGED
|
@@ -20,32 +20,36 @@ class AuxTA extends FunctionHelper {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
22
|
let file;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
if (!process.env.RPA) {
|
|
24
|
+
try {
|
|
25
|
+
let currentDir = ""
|
|
26
|
+
while (true) {
|
|
27
|
+
file = path.join(__dirname, currentDir, "auxta.json");
|
|
28
|
+
if (!fs.existsSync(file)) {
|
|
29
|
+
currentDir += "../"
|
|
30
|
+
if (currentDir.length >= 30) {
|
|
31
|
+
console.log("auxta.json file not found!")
|
|
32
|
+
process.exit(1);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
continue;
|
|
33
36
|
}
|
|
34
|
-
|
|
37
|
+
break;
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const jsonConfig = JSON.parse(fs.readFileSync(file).toString());
|
|
40
|
+
try {
|
|
41
|
+
this.config = setupConfig(jsonConfig)
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.log("Missing field in auxta.json:", e)
|
|
44
|
+
}
|
|
45
|
+
this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment);
|
|
41
46
|
} catch (e) {
|
|
42
|
-
console.log("Missing
|
|
47
|
+
console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
|
|
48
|
+
console.log(e);
|
|
49
|
+
process.exit(1);
|
|
43
50
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
|
|
47
|
-
console.log(e);
|
|
48
|
-
process.exit(1);
|
|
51
|
+
} else {
|
|
52
|
+
this.uploadModel = new UploadModel('', '', '', '');
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -162,6 +162,17 @@ export class FunctionHelper {
|
|
|
162
162
|
await page.keyboard.press('Enter');
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
public async clickAndWaitForPageToBeCreated(selector: string,page = puppeteer.defaultPage) {
|
|
166
|
+
const nav = new Promise(res => page.browser().on('targetcreated', res));
|
|
167
|
+
await this.click(selector);
|
|
168
|
+
await nav;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public async closeLastPage(page = puppeteer.defaultPage) {
|
|
172
|
+
const pages = await page.browser().pages();
|
|
173
|
+
await pages[pages.length - 1].close();
|
|
174
|
+
}
|
|
175
|
+
|
|
165
176
|
//TODO work in progress
|
|
166
177
|
/*
|
|
167
178
|
private async microsoftLogin(button: string, email: string, password: string) {
|