@auxcode/auxta 1.3.15 → 1.3.17-beta.0
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/README.md +60 -60
- package/build/cjs/AuxTA.d.ts +57 -57
- package/build/cjs/AuxTA.js +148 -148
- package/build/cjs/auxta/configs/config.d.ts +51 -51
- package/build/cjs/auxta/configs/config.js +63 -63
- package/build/cjs/auxta/enums/status-of.step.d.ts +7 -7
- package/build/cjs/auxta/enums/status-of.step.js +11 -11
- package/build/cjs/auxta/helpers/response.helper.d.ts +10 -10
- package/build/cjs/auxta/helpers/response.helper.js +15 -15
- package/build/cjs/auxta/helpers/start.helper.d.ts +1 -1
- package/build/cjs/auxta/helpers/start.helper.js +26 -26
- package/build/cjs/auxta/hooks/report.hook.d.ts +14 -14
- package/build/cjs/auxta/hooks/report.hook.js +66 -66
- package/build/cjs/auxta/models/upload.model.d.ts +32 -32
- package/build/cjs/auxta/models/upload.model.js +75 -75
- package/build/cjs/auxta/services/log.service.d.ts +26 -26
- package/build/cjs/auxta/services/log.service.js +47 -47
- package/build/cjs/auxta/services/report.service.d.ts +36 -36
- package/build/cjs/auxta/services/report.service.js +164 -164
- package/build/cjs/auxta/services/runtime.service.d.ts +16 -16
- package/build/cjs/auxta/services/runtime.service.js +41 -41
- package/build/cjs/auxta/utilities/runtime.helper.d.ts +15 -15
- package/build/cjs/auxta/utilities/runtime.helper.js +19 -19
- package/build/cjs/auxta/utilities/screenshot.helper.d.ts +2 -2
- package/build/cjs/auxta/utilities/screenshot.helper.js +36 -36
- package/build/cjs/auxta/utilities/start-suite.helper.d.ts +17 -17
- package/build/cjs/auxta/utilities/start-suite.helper.js +31 -31
- package/build/cjs/macros/helpers/Aux2faAuth.d.ts +7 -7
- package/build/cjs/macros/helpers/Aux2faAuth.js +29 -29
- package/build/cjs/macros/helpers/code.helper.d.ts +23 -21
- package/build/cjs/macros/helpers/code.helper.js +166 -192
- package/build/cjs/macros/helpers/extend-default-page.d.ts +6 -6
- package/build/cjs/macros/helpers/extend-default-page.js +88 -88
- package/build/cjs/puppeteer/puppeteer.d.ts +25 -25
- package/build/cjs/puppeteer/puppeteer.js +200 -200
- package/build/esm/AuxTA.d.ts +57 -57
- package/build/esm/AuxTA.js +119 -119
- package/build/esm/auxta/configs/config.d.ts +51 -51
- package/build/esm/auxta/configs/config.js +58 -58
- package/build/esm/auxta/enums/status-of.step.d.ts +7 -7
- package/build/esm/auxta/enums/status-of.step.js +8 -8
- package/build/esm/auxta/helpers/response.helper.d.ts +10 -10
- package/build/esm/auxta/helpers/response.helper.js +11 -11
- package/build/esm/auxta/helpers/start.helper.d.ts +1 -1
- package/build/esm/auxta/helpers/start.helper.js +24 -24
- package/build/esm/auxta/hooks/report.hook.d.ts +14 -14
- package/build/esm/auxta/hooks/report.hook.js +58 -58
- package/build/esm/auxta/models/upload.model.d.ts +32 -32
- package/build/esm/auxta/models/upload.model.js +71 -71
- package/build/esm/auxta/services/log.service.d.ts +26 -26
- package/build/esm/auxta/services/log.service.js +43 -43
- package/build/esm/auxta/services/report.service.d.ts +36 -36
- package/build/esm/auxta/services/report.service.js +150 -150
- package/build/esm/auxta/services/runtime.service.d.ts +16 -16
- package/build/esm/auxta/services/runtime.service.js +37 -37
- package/build/esm/auxta/utilities/runtime.helper.d.ts +15 -15
- package/build/esm/auxta/utilities/runtime.helper.js +15 -15
- package/build/esm/auxta/utilities/screenshot.helper.d.ts +2 -2
- package/build/esm/auxta/utilities/screenshot.helper.js +29 -29
- package/build/esm/auxta/utilities/start-suite.helper.d.ts +17 -17
- package/build/esm/auxta/utilities/start-suite.helper.js +26 -26
- package/build/esm/macros/helpers/Aux2faAuth.d.ts +7 -7
- package/build/esm/macros/helpers/Aux2faAuth.js +25 -25
- package/build/esm/macros/helpers/code.helper.d.ts +23 -21
- package/build/esm/macros/helpers/code.helper.js +159 -185
- package/build/esm/macros/helpers/extend-default-page.d.ts +6 -6
- package/build/esm/macros/helpers/extend-default-page.js +81 -81
- package/build/esm/puppeteer/puppeteer.d.ts +25 -25
- package/build/esm/puppeteer/puppeteer.js +192 -192
- package/build/tsconfig-cjs.tsbuildinfo +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +29 -29
|
@@ -1,192 +1,166 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.FunctionHelper = void 0;
|
|
16
|
-
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
17
|
-
const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
|
|
18
|
-
const status_of_step_1 = require("../../auxta/enums/status-of.step");
|
|
19
|
-
const AuxTA_1 = require("../../AuxTA");
|
|
20
|
-
const extend_default_page_1 = require("./extend-default-page");
|
|
21
|
-
const puppeteer_2 = require("puppeteer");
|
|
22
|
-
class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
23
|
-
log(keyword, name, status) {
|
|
24
|
-
log_service_1.default.push(keyword, name, status);
|
|
25
|
-
}
|
|
26
|
-
suggest(name) {
|
|
27
|
-
log_service_1.default.addSuggestion(name);
|
|
28
|
-
}
|
|
29
|
-
getEscapedText(text) {
|
|
30
|
-
const splitedQuotes = text.replace(/'/g, `', "'", '`);
|
|
31
|
-
return `concat('${splitedQuotes}', '')`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
clickByTextWithClass(class_selector, class_name, selector, text, dotOrText = '.', page = puppeteer_1.default.defaultPage) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
const message = `I click on the '${text}' '${selector}'`;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
yield puppeteer_1.default.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
yield
|
|
147
|
-
yield
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
yield this.extend_page_functions(loginPage);
|
|
168
|
-
yield loginPage.waitForNetworkIdle();
|
|
169
|
-
yield this.waitForSelector('visible', next_button, 60000, loginPage);
|
|
170
|
-
yield loginPage.type(email_input, email);
|
|
171
|
-
yield loginPage.keyboard.press('Enter');
|
|
172
|
-
yield loginPage.waitForNetworkIdle();
|
|
173
|
-
yield this.waitForSelector('visible', sign_in_button, 60000, loginPage);
|
|
174
|
-
yield this.waitForSelector('visible', password_input, 6000, loginPage);
|
|
175
|
-
try {
|
|
176
|
-
(_a = (yield loginPage.$(password_input))) === null || _a === void 0 ? void 0 : _a.type(password);
|
|
177
|
-
yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.PASSED);
|
|
178
|
-
}
|
|
179
|
-
catch (e) {
|
|
180
|
-
yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.FAILED);
|
|
181
|
-
throw new Error(`I type password into the ${password_input}`);
|
|
182
|
-
}
|
|
183
|
-
yield this.timeout(3000);
|
|
184
|
-
yield loginPage.keyboard.press('Enter');
|
|
185
|
-
yield this.waitForSelector('visible', no_button, 60000, loginPage);
|
|
186
|
-
yield loginPage.keyboard.press('Enter');
|
|
187
|
-
yield loginPage.waitForNetworkIdle();
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
exports.FunctionHelper = FunctionHelper;
|
|
192
|
-
exports.default = new FunctionHelper();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FunctionHelper = void 0;
|
|
16
|
+
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
17
|
+
const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
|
|
18
|
+
const status_of_step_1 = require("../../auxta/enums/status-of.step");
|
|
19
|
+
const AuxTA_1 = require("../../AuxTA");
|
|
20
|
+
const extend_default_page_1 = require("./extend-default-page");
|
|
21
|
+
const puppeteer_2 = require("puppeteer");
|
|
22
|
+
class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
|
|
23
|
+
log(keyword, name, status) {
|
|
24
|
+
log_service_1.default.push(keyword, name, status);
|
|
25
|
+
}
|
|
26
|
+
suggest(name) {
|
|
27
|
+
log_service_1.default.addSuggestion(name);
|
|
28
|
+
}
|
|
29
|
+
getEscapedText(text) {
|
|
30
|
+
const splitedQuotes = text.replace(/'/g, `', "'", '`);
|
|
31
|
+
return `concat('${splitedQuotes}', '')`;
|
|
32
|
+
}
|
|
33
|
+
waitClick(message, xPath, page) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const findElement = yield page.waitForXPath(xPath, { visible: true, timeout: this.defaultTimeout });
|
|
36
|
+
if (findElement) {
|
|
37
|
+
const linkHandlers = yield page.$x(xPath);
|
|
38
|
+
yield linkHandlers.click();
|
|
39
|
+
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
log_service_1.default.push('Then', message + ", but it didn't appear in ${time / 1000}", status_of_step_1.StatusOfStep.FAILED);
|
|
43
|
+
throw Error(message + ", but it didn't appear in ${time / 1000}");
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
clickByText(selector, text, dotOrText = '.', page = puppeteer_1.default.defaultPage, time = this.defaultTimeout, log_message = true) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const message = `I clicked on the '${text}' '${selector}'`;
|
|
50
|
+
const xPath = `//${selector}[contains(${dotOrText},"${text}")]`;
|
|
51
|
+
yield this.waitClick(message, xPath, page);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
clickByTextWithClass(class_selector, class_name, selector, text, dotOrText = '.', page = puppeteer_1.default.defaultPage) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const message = `I click on the '${text}' '${selector}'`;
|
|
57
|
+
const xPath = `//${class_selector}[contains(@class,${this.getEscapedText(class_name)})]//${selector}[contains(${dotOrText},"${text}")]`;
|
|
58
|
+
yield this.waitClick(message, xPath, page);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
waitForSelectorWithText(selector, text, dotOrText = '.', page = puppeteer_1.default.defaultPage) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const message = `I check for '${text}' on the current page`;
|
|
64
|
+
const xPath = `//${selector}[contains(${dotOrText},"${text}")]`;
|
|
65
|
+
yield this.waitClick(message, xPath, page);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
timeout(timeout = this.defaultTimeout, page = puppeteer_1.default.defaultPage) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
yield page.waitForTimeout(timeout);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
waitForSelector(option, selector, time = this.defaultTimeout, page = puppeteer_1.default.defaultPage, log_message = true) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const message = `I checked for the '${selector}' element to be ${option}`;
|
|
76
|
+
const findSelector = yield page.waitForSelector(selector, {
|
|
77
|
+
[option]: true,
|
|
78
|
+
timeout: time
|
|
79
|
+
});
|
|
80
|
+
if (findSelector) {
|
|
81
|
+
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
log_service_1.default.push('And', `${message}, but it didn't appear in ${time / 1000} seconds.`, status_of_step_1.StatusOfStep.FAILED);
|
|
85
|
+
throw Error(`${message}, but it didn't appear in ${time / 1000} seconds.`);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
urlContains(selector, page = puppeteer_1.default.defaultPage) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const url = page.url();
|
|
92
|
+
let message = `I am on the ${selector} page`;
|
|
93
|
+
if (!url.includes(selector)) {
|
|
94
|
+
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.FAILED);
|
|
95
|
+
throw new Error(message);
|
|
96
|
+
}
|
|
97
|
+
log_service_1.default.push('And', message, status_of_step_1.StatusOfStep.PASSED);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
pressEnter(page = puppeteer_1.default.defaultPage) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
yield page.keyboard.press('Enter');
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
emulate(phone_name, page = puppeteer_1.default.defaultPage) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
const phone = puppeteer_2.KnownDevices[phone_name];
|
|
108
|
+
yield page.emulate(phone);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
restartBrowser() {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
yield puppeteer_1.default.close();
|
|
114
|
+
yield puppeteer_1.default.startBrowser();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
clickAndWaitForPageToBeCreated(selector, page = puppeteer_1.default.defaultPage) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
const nav = new Promise(res => page.browser().on('targetcreated', res));
|
|
120
|
+
yield page.click(selector);
|
|
121
|
+
yield nav;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
closeLastPage(page = puppeteer_1.default.defaultPage) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const pages = yield page.browser().pages();
|
|
127
|
+
yield pages[pages.length - 1].close();
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
microsoftLogin(button, email, password) {
|
|
131
|
+
var _a;
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
const email_input = 'input[type="email"]';
|
|
134
|
+
const password_input = 'input[type="password"]';
|
|
135
|
+
const next_button = 'input[value="Next"]';
|
|
136
|
+
const sign_in_button = 'input[value="Sign in"]';
|
|
137
|
+
const no_button = 'input.ext-secondary';
|
|
138
|
+
yield this.clickAndWaitForPageToBeCreated(button);
|
|
139
|
+
const pages = yield puppeteer_1.default.defaultPage.browser().pages();
|
|
140
|
+
const loginPage = pages[pages.length - 1];
|
|
141
|
+
yield this.extend_page_functions(loginPage);
|
|
142
|
+
yield loginPage.waitForNetworkIdle();
|
|
143
|
+
yield this.waitForSelector('visible', next_button, 60000, loginPage);
|
|
144
|
+
yield loginPage.type(email_input, email);
|
|
145
|
+
yield loginPage.keyboard.press('Enter');
|
|
146
|
+
yield loginPage.waitForNetworkIdle();
|
|
147
|
+
yield this.waitForSelector('visible', sign_in_button, 60000, loginPage);
|
|
148
|
+
yield this.waitForSelector('visible', password_input, 6000, loginPage);
|
|
149
|
+
try {
|
|
150
|
+
(_a = (yield loginPage.$(password_input))) === null || _a === void 0 ? void 0 : _a.type(password);
|
|
151
|
+
yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.PASSED);
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.FAILED);
|
|
155
|
+
throw new Error(`I type password into the ${password_input}`);
|
|
156
|
+
}
|
|
157
|
+
yield this.timeout(3000);
|
|
158
|
+
yield loginPage.keyboard.press('Enter');
|
|
159
|
+
yield this.waitForSelector('visible', no_button, 60000, loginPage);
|
|
160
|
+
yield loginPage.keyboard.press('Enter');
|
|
161
|
+
yield loginPage.waitForNetworkIdle();
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.FunctionHelper = FunctionHelper;
|
|
166
|
+
exports.default = new FunctionHelper();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare class ExtendDefaultPage {
|
|
2
|
-
readonly defaultTimeout: number;
|
|
3
|
-
extend_page_functions(page: any, time?: number): Promise<any>;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: ExtendDefaultPage;
|
|
6
|
-
export default _default;
|
|
1
|
+
export declare class ExtendDefaultPage {
|
|
2
|
+
readonly defaultTimeout: number;
|
|
3
|
+
extend_page_functions(page: any, time?: number): Promise<any>;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: ExtendDefaultPage;
|
|
6
|
+
export default _default;
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ExtendDefaultPage = void 0;
|
|
16
|
-
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
17
|
-
const status_of_step_1 = require("../../auxta/enums/status-of.step");
|
|
18
|
-
const config_1 = require("../../auxta/configs/config");
|
|
19
|
-
class ExtendDefaultPage {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.defaultTimeout = config_1.config.timeout;
|
|
22
|
-
}
|
|
23
|
-
extend_page_functions(page, time = this.defaultTimeout) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const { goto: original_goto, click: original_click, type: original_type, waitForNetworkIdle: original_waitForNetworkIdle } = page;
|
|
26
|
-
page.goto = function goto(url, options) {
|
|
27
|
-
log_service_1.default.push('Then', `I go to the '${url}' page`, status_of_step_1.StatusOfStep.PASSED);
|
|
28
|
-
return original_goto.apply(page, arguments);
|
|
29
|
-
};
|
|
30
|
-
page.click = function click(selector, options) {
|
|
31
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
32
|
-
try {
|
|
33
|
-
yield page.waitForSelector(selector, {
|
|
34
|
-
timeout: time
|
|
35
|
-
});
|
|
36
|
-
let elementName = yield page.$eval(selector, (e) => e.textContent);
|
|
37
|
-
if (!elementName || elementName === ' ')
|
|
38
|
-
elementName = selector;
|
|
39
|
-
yield original_click.apply(page, arguments);
|
|
40
|
-
log_service_1.default.push('Then', `I click on the '${elementName}'`, status_of_step_1.StatusOfStep.PASSED);
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
const msg = `I click on the '${selector}'`;
|
|
44
|
-
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
45
|
-
throw new Error(msg);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
page.waitForNetworkIdle = function waitForNetworkIdle(selector, option) {
|
|
50
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
51
|
-
let message = 'I wait for the page to load';
|
|
52
|
-
let result;
|
|
53
|
-
try {
|
|
54
|
-
result = yield original_waitForNetworkIdle.apply(page, arguments);
|
|
55
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
59
|
-
throw new Error(message);
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
page.type = function type(field, value) {
|
|
65
|
-
return __awaiter(this, arguments, void 0, function* () {
|
|
66
|
-
try {
|
|
67
|
-
yield page.waitForSelector(field, {
|
|
68
|
-
timeout: time
|
|
69
|
-
});
|
|
70
|
-
yield original_type.apply(page, arguments);
|
|
71
|
-
let elementName = yield page.$eval(field, (e) => e.textContent);
|
|
72
|
-
if (!elementName || elementName === ' ')
|
|
73
|
-
elementName = field;
|
|
74
|
-
log_service_1.default.push('Then', `I type '${value}' into the '${elementName}' field`, status_of_step_1.StatusOfStep.PASSED);
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
const msg = `I type '${value}' into the '${field}' field`;
|
|
78
|
-
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
79
|
-
throw new Error(msg);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
return page;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.ExtendDefaultPage = ExtendDefaultPage;
|
|
88
|
-
exports.default = new ExtendDefaultPage();
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ExtendDefaultPage = void 0;
|
|
16
|
+
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
17
|
+
const status_of_step_1 = require("../../auxta/enums/status-of.step");
|
|
18
|
+
const config_1 = require("../../auxta/configs/config");
|
|
19
|
+
class ExtendDefaultPage {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.defaultTimeout = config_1.config.timeout;
|
|
22
|
+
}
|
|
23
|
+
extend_page_functions(page, time = this.defaultTimeout) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const { goto: original_goto, click: original_click, type: original_type, waitForNetworkIdle: original_waitForNetworkIdle } = page;
|
|
26
|
+
page.goto = function goto(url, options) {
|
|
27
|
+
log_service_1.default.push('Then', `I go to the '${url}' page`, status_of_step_1.StatusOfStep.PASSED);
|
|
28
|
+
return original_goto.apply(page, arguments);
|
|
29
|
+
};
|
|
30
|
+
page.click = function click(selector, options) {
|
|
31
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
32
|
+
try {
|
|
33
|
+
yield page.waitForSelector(selector, {
|
|
34
|
+
timeout: time
|
|
35
|
+
});
|
|
36
|
+
let elementName = yield page.$eval(selector, (e) => e.textContent);
|
|
37
|
+
if (!elementName || elementName === ' ')
|
|
38
|
+
elementName = selector;
|
|
39
|
+
yield original_click.apply(page, arguments);
|
|
40
|
+
log_service_1.default.push('Then', `I click on the '${elementName}'`, status_of_step_1.StatusOfStep.PASSED);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
const msg = `I click on the '${selector}'`;
|
|
44
|
+
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
45
|
+
throw new Error(msg);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
page.waitForNetworkIdle = function waitForNetworkIdle(selector, option) {
|
|
50
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
51
|
+
let message = 'I wait for the page to load';
|
|
52
|
+
let result;
|
|
53
|
+
try {
|
|
54
|
+
result = yield original_waitForNetworkIdle.apply(page, arguments);
|
|
55
|
+
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.PASSED);
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
log_service_1.default.push('Then', message, status_of_step_1.StatusOfStep.FAILED);
|
|
59
|
+
throw new Error(message);
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
page.type = function type(field, value) {
|
|
65
|
+
return __awaiter(this, arguments, void 0, function* () {
|
|
66
|
+
try {
|
|
67
|
+
yield page.waitForSelector(field, {
|
|
68
|
+
timeout: time
|
|
69
|
+
});
|
|
70
|
+
yield original_type.apply(page, arguments);
|
|
71
|
+
let elementName = yield page.$eval(field, (e) => e.textContent);
|
|
72
|
+
if (!elementName || elementName === ' ')
|
|
73
|
+
elementName = field;
|
|
74
|
+
log_service_1.default.push('Then', `I type '${value}' into the '${elementName}' field`, status_of_step_1.StatusOfStep.PASSED);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
const msg = `I type '${value}' into the '${field}' field`;
|
|
78
|
+
log_service_1.default.push('Then', msg, status_of_step_1.StatusOfStep.FAILED);
|
|
79
|
+
throw new Error(msg);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return page;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.ExtendDefaultPage = ExtendDefaultPage;
|
|
88
|
+
exports.default = new ExtendDefaultPage();
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { UploadModel } from "../auxta/models/upload.model";
|
|
2
|
-
import puppeteer = require("puppeteer");
|
|
3
|
-
export declare class Puppeteer {
|
|
4
|
-
defaultPage: puppeteer.Page;
|
|
5
|
-
private browser;
|
|
6
|
-
startBrowser(): Promise<void>;
|
|
7
|
-
close(): Promise<void>;
|
|
8
|
-
run(event: any, callback: any, featureName?: string, scenarioName?: string, uploadModel?: UploadModel): Promise<{
|
|
9
|
-
nextSuites?: undefined;
|
|
10
|
-
reportId?: undefined;
|
|
11
|
-
currentSuite?: undefined;
|
|
12
|
-
retries?: undefined;
|
|
13
|
-
} | {
|
|
14
|
-
nextSuites: string[];
|
|
15
|
-
reportId: string | undefined;
|
|
16
|
-
currentSuite: string | undefined;
|
|
17
|
-
retries: string;
|
|
18
|
-
} | {
|
|
19
|
-
statusCode: number;
|
|
20
|
-
} | undefined>;
|
|
21
|
-
runRPA(event: any, callback: any, uploadModel?: UploadModel, close?: boolean): Promise<any>;
|
|
22
|
-
private static setupHeader;
|
|
23
|
-
}
|
|
24
|
-
declare const _default: Puppeteer;
|
|
25
|
-
export default _default;
|
|
1
|
+
import { UploadModel } from "../auxta/models/upload.model";
|
|
2
|
+
import puppeteer = require("puppeteer");
|
|
3
|
+
export declare class Puppeteer {
|
|
4
|
+
defaultPage: puppeteer.Page;
|
|
5
|
+
private browser;
|
|
6
|
+
startBrowser(): Promise<void>;
|
|
7
|
+
close(): Promise<void>;
|
|
8
|
+
run(event: any, callback: any, featureName?: string, scenarioName?: string, uploadModel?: UploadModel): Promise<{
|
|
9
|
+
nextSuites?: undefined;
|
|
10
|
+
reportId?: undefined;
|
|
11
|
+
currentSuite?: undefined;
|
|
12
|
+
retries?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
nextSuites: string[];
|
|
15
|
+
reportId: string | undefined;
|
|
16
|
+
currentSuite: string | undefined;
|
|
17
|
+
retries: string;
|
|
18
|
+
} | {
|
|
19
|
+
statusCode: number;
|
|
20
|
+
} | undefined>;
|
|
21
|
+
runRPA(event: any, callback: any, uploadModel?: UploadModel, close?: boolean): Promise<any>;
|
|
22
|
+
private static setupHeader;
|
|
23
|
+
}
|
|
24
|
+
declare const _default: Puppeteer;
|
|
25
|
+
export default _default;
|