@auxcode/auxta 0.4.8 → 0.5.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/package.json +1 -1
- package/src/AuxTA.ts +26 -22
- package/src/macros/helpers/code.helper.ts +6 -0
- package/src/puppeteer/puppeteer.ts +1 -2
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,12 @@ 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
|
+
|
|
165
171
|
//TODO work in progress
|
|
166
172
|
/*
|
|
167
173
|
private async microsoftLogin(button: string, email: string, password: string) {
|
|
@@ -116,7 +116,6 @@ export class Puppeteer {
|
|
|
116
116
|
await callback(event)
|
|
117
117
|
log.push('When', `Finished puppeteer process`, StatusOfStep.PASSED);
|
|
118
118
|
} catch (err) {
|
|
119
|
-
console.log("Error", err);
|
|
120
119
|
errMessage = err;
|
|
121
120
|
log.push('When', `Finished puppeteer process`, StatusOfStep.FAILED);
|
|
122
121
|
return errMessage;
|
|
@@ -126,8 +125,8 @@ export class Puppeteer {
|
|
|
126
125
|
console.log("Lib error:", e);
|
|
127
126
|
} finally {
|
|
128
127
|
log.clear();
|
|
129
|
-
|
|
130
128
|
}
|
|
129
|
+
return true;
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
private static setupHeader(event: any, uploadModel: UploadModel) {
|