@auxcode/auxta 1.3.82 → 1.3.83

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.
@@ -15,6 +15,7 @@ export declare class FunctionHelper extends ExtendDefaultPage {
15
15
  emulate(phone_name: string, page?: import("puppeteer").Page): Promise<void>;
16
16
  restartBrowser(): Promise<void>;
17
17
  clickAndWaitForPageToBeCreated(selector: string, page: import("puppeteer").Page | undefined, newPage: boolean): Promise<void>;
18
+ waitForResponse(name: string, wait?: boolean, page?: import("puppeteer").Page): Promise<void>;
18
19
  closeLastPage(page?: import("puppeteer").Page): Promise<void>;
19
20
  microsoftLogin(button: string, email: string, password: string, page?: import("puppeteer").Page, newPage?: boolean): Promise<void>;
20
21
  private getEscapedText;
@@ -178,6 +178,14 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
178
178
  }
179
179
  });
180
180
  }
181
+ waitForResponse(name, wait = true, page = puppeteer_1.default.defaultPage) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ if (wait) {
184
+ yield page.waitForResponse(response => response.url().includes(name));
185
+ this.log('Then', `I wait for response with name: ${name}`, status_of_step_1.StatusOfStep.PASSED);
186
+ }
187
+ });
188
+ }
181
189
  closeLastPage(page = puppeteer_1.default.defaultPage) {
182
190
  return __awaiter(this, void 0, void 0, function* () {
183
191
  const pages = yield page.browser().pages();
@@ -189,44 +197,14 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
189
197
  return __awaiter(this, void 0, void 0, function* () {
190
198
  const email_input = 'input[type="email"]';
191
199
  const password_input = 'input[type="password"]';
192
- const next_button = 'input[value="Next"]';
193
- const sign_in_button = 'input[value="Sign in"]';
194
- const no_button = 'input.ext-secondary';
195
200
  yield this.clickAndWaitForPageToBeCreated(button, page, newPage);
196
201
  const pages = yield page.browser().pages();
197
202
  const loginPage = pages[pages.length - 1];
198
203
  yield this.extend_page_functions(loginPage);
199
- yield loginPage.waitForNetworkIdle();
200
- try {
201
- yield loginPage.waitForSelector(next_button, { visible: true, timeout: 60000 });
202
- }
203
- catch (e) {
204
- }
205
- this.log('Then', `I checked for the '${next_button}' element to be visible`, AuxTA_1.StepStatus.PASSED);
204
+ yield this.waitForResponse('signin-options', true, loginPage);
206
205
  yield loginPage.type(email_input, email, { delay: 0 });
207
206
  yield loginPage.keyboard.press('Enter');
208
- yield this.timeout(4000);
209
- let isWorkOrPersonalVisible = yield page.$('div.table');
210
- if (!!isWorkOrPersonalVisible) {
211
- yield (yield page.$$('div.table'))[0].click();
212
- console.log('Then', 'I clicked Work or school account', AuxTA_1.StepStatus.PASSED);
213
- yield this.timeout(4000);
214
- }
215
- else {
216
- yield this.timeout(4000);
217
- }
218
- try {
219
- yield loginPage.waitForSelector(sign_in_button, { visible: true, timeout: 60000 });
220
- }
221
- catch (e) {
222
- }
223
- this.log('Then', `I checked for the '${sign_in_button}' element to be visible`, AuxTA_1.StepStatus.PASSED);
224
- try {
225
- yield loginPage.waitForSelector(password_input, { visible: true, timeout: 60000 });
226
- }
227
- catch (e) {
228
- }
229
- this.log('Then', `I checked for the '${password_input}' element to be visible`, AuxTA_1.StepStatus.PASSED);
207
+ yield this.waitForResponse('microsoft_logo', true, loginPage);
230
208
  try {
231
209
  (_a = (yield loginPage.$(password_input))) === null || _a === void 0 ? void 0 : _a.type(password);
232
210
  yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.PASSED);
@@ -235,14 +213,10 @@ class FunctionHelper extends extend_default_page_1.ExtendDefaultPage {
235
213
  yield this.log('Then', `I type password into the ${password_input}`, AuxTA_1.StepStatus.FAILED);
236
214
  throw new Error(`I type password into the ${password_input}`);
237
215
  }
238
- yield this.timeout(4000);
216
+ yield this.timeout(1000);
239
217
  yield loginPage.keyboard.press('Enter');
240
- try {
241
- yield loginPage.waitForSelector(no_button, { visible: true, timeout: 60000 });
242
- }
243
- catch (e) {
244
- }
245
- this.log('Then', `I checked for the '${no_button}' element to be visible`, AuxTA_1.StepStatus.PASSED);
218
+ yield this.waitForResponse('2_bc3d32a696895f78c19d', true, loginPage);
219
+ yield this.timeout(1000);
246
220
  yield loginPage.keyboard.press('Enter');
247
221
  });
248
222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.82",
3
+ "version": "1.3.83",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",