@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "0.4.8",
3
+ "version": "0.5.2",
4
4
  "description": "",
5
5
  "main": "src/AuxTA.ts",
6
6
  "scripts": {
package/src/AuxTA.ts CHANGED
@@ -20,32 +20,36 @@ class AuxTA extends FunctionHelper {
20
20
  constructor() {
21
21
  super();
22
22
  let file;
23
- try {
24
- let currentDir = ""
25
- while (true) {
26
- file = path.join(__dirname, currentDir, "auxta.json");
27
- if (!fs.existsSync(file)) {
28
- currentDir += "../"
29
- if (currentDir.length >= 30) {
30
- console.log("auxta.json file not found!")
31
- process.exit(1);
32
- return;
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
- continue;
37
+ break;
35
38
  }
36
- break;
37
- }
38
- const jsonConfig = JSON.parse(fs.readFileSync(file).toString());
39
- try {
40
- this.config = setupConfig(jsonConfig)
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 field in auxta.json:", e)
47
+ console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
48
+ console.log(e);
49
+ process.exit(1);
43
50
  }
44
- this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct, jsonConfig.environment);
45
- } catch (e) {
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) {