@auxcode/auxta 0.1.7 → 0.1.11
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
package/src/AuxTA.ts
CHANGED
|
@@ -20,20 +20,25 @@ class AuxTA extends FunctionHelper {
|
|
|
20
20
|
super();
|
|
21
21
|
let file;
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
let currentDir = "../"
|
|
23
|
+
let currentDir = ""
|
|
25
24
|
while (true) {
|
|
26
25
|
file = path.join(__dirname, currentDir, "auxta.json");
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
if (!fs.existsSync(file)) {
|
|
27
|
+
console.log("Current dir: ", file)
|
|
28
|
+
console.log("Files: ")
|
|
29
|
+
const files = fs.readdirSync(path.join(__dirname, currentDir));
|
|
30
|
+
files.forEach(file => {
|
|
31
|
+
console.log("- " + file);
|
|
32
|
+
});
|
|
31
33
|
currentDir += "../"
|
|
32
34
|
if (currentDir.length >= 30) {
|
|
35
|
+
console.log("auxta.json file not found!")
|
|
33
36
|
process.exit(1);
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
39
|
+
continue;
|
|
36
40
|
}
|
|
41
|
+
break;
|
|
37
42
|
}
|
|
38
43
|
const jsonConfig = JSON.parse(fs.readFileSync(file).toString());
|
|
39
44
|
try {
|
|
@@ -43,7 +48,7 @@ class AuxTA extends FunctionHelper {
|
|
|
43
48
|
}
|
|
44
49
|
this.uploadModel = new UploadModel(jsonConfig.organization, jsonConfig.baseURL, jsonConfig.digitalProduct);
|
|
45
50
|
} catch (e: any) {
|
|
46
|
-
console.log("Missing or corrupted config:
|
|
51
|
+
console.log("Missing or corrupted config: auxta.json. Searching in location:", file)
|
|
47
52
|
console.log(e);
|
|
48
53
|
process.exit(1);
|
|
49
54
|
}
|
|
@@ -36,16 +36,20 @@ function headers(token: string) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
async function auth() {
|
|
39
|
-
|
|
40
|
-
return (await axios.post(
|
|
39
|
+
return axios.post(
|
|
41
40
|
config.auxtaURL + 'login',
|
|
42
41
|
config.auxtaCredentials,
|
|
43
42
|
{
|
|
44
43
|
headers: {
|
|
45
44
|
'Content-Type': 'application/json',
|
|
46
45
|
}
|
|
47
|
-
}
|
|
48
|
-
|
|
46
|
+
})
|
|
47
|
+
.then(({data}) => {
|
|
48
|
+
return data.token
|
|
49
|
+
})
|
|
50
|
+
.catch(() => {
|
|
51
|
+
throw new Error("Invalid login credentials")
|
|
52
|
+
});
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
export async function createEmptyReport(body: any): Promise<string> {
|
|
@@ -80,8 +80,8 @@ export class FunctionHelper {
|
|
|
80
80
|
|
|
81
81
|
public async click(className: string, page = puppeteer.defaultPage) {
|
|
82
82
|
await page.waitForTimeout(this.defaultTimeout);
|
|
83
|
-
await page.click(className);
|
|
84
83
|
const elementName = await puppeteer.defaultPage.$eval(className, (e) => e.textContent);
|
|
84
|
+
await page.click(className);
|
|
85
85
|
log.push('Then', `I click on ${elementName}`, StepStatusEnum.PASSED);
|
|
86
86
|
}
|
|
87
87
|
|