@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "0.4.9",
3
+ "version": "0.5.3",
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,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) {