@auxcode/auxta 1.3.73-beta.4 → 1.3.73-beta.6

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.
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  exports.AuxGoogleAuth = void 0;
39
39
  const config_1 = require("../../auxta/configs/config");
40
- const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
40
+ const puppeteer_extra_1 = __importDefault(require("../../puppeteer/puppeteer-extra"));
41
41
  const code_helper_1 = __importDefault(require("../helpers/code.helper"));
42
42
  const status_of_step_1 = __importDefault(require("../../auxta/enums/status-of.step"));
43
43
  const fs = require('fs');
@@ -61,6 +61,7 @@ const TOKEN_PATH = 'token.json';
61
61
  let TOKEN;
62
62
  let EMAIL;
63
63
  let PASSWORD;
64
+ let count = 0;
64
65
  class AuxGoogleAuth {
65
66
  static get oAuth2Client() {
66
67
  return this._oAuth2Client;
@@ -177,41 +178,45 @@ class AuxGoogleAuth {
177
178
  return __awaiter(this, void 0, void 0, function* () {
178
179
  const email = EMAIL ? EMAIL : process.env.google_account;
179
180
  const password = PASSWORD ? PASSWORD : process.env.google_password;
181
+ yield puppeteer_extra_1.default.startBrowser();
182
+ count++;
180
183
  if (email && password) {
181
- const context = yield puppeteer_1.default.defaultPage.browser().createIncognitoBrowserContext();
184
+ const context = yield puppeteer_extra_1.default.defaultPage.browser().createIncognitoBrowserContext();
182
185
  const page = yield context.newPage();
183
186
  yield page.goto(authUrl);
184
- yield code_helper_1.default.waitForSelector('visible', '#identifierId', config_1.config.timeout, page);
187
+ yield code_helper_1.default.waitForSelector('visible', '#identifierId', config_1.config.timeout, page, count >= 2);
185
188
  yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(email));
186
189
  yield (yield page.$$('button'))[3].click();
187
190
  yield code_helper_1.default.timeout(4000);
188
- yield code_helper_1.default.waitForSelector('visible', 'input[type="password"]', config_1.config.timeout, page);
191
+ yield code_helper_1.default.waitForSelector('visible', 'input[type="password"]', config_1.config.timeout, page, count >= 2);
189
192
  yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(password));
190
193
  yield (yield page.$$('button'))[1].click();
191
194
  yield code_helper_1.default.timeout(4000);
192
- yield code_helper_1.default.waitForSelector('visible', '#headingText', config_1.config.timeout, page);
195
+ yield code_helper_1.default.waitForSelector('visible', '#headingText', config_1.config.timeout, page, count >= 2);
193
196
  yield (yield page.$$('button'))[2].click();
194
197
  yield code_helper_1.default.timeout(4000);
195
198
  const checkbox = yield page.$$('input[type="checkbox"]');
196
199
  if (checkbox.length > 0) {
197
- yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page);
200
+ yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page, count >= 2);
198
201
  yield checkbox[0].click();
199
202
  yield (yield page.$$('button'))[2].click();
200
203
  }
201
204
  else {
202
- yield code_helper_1.default.waitForSelector('visible', `div[data-email="${email.toLocaleLowerCase()}"]`, config_1.config.timeout, page);
205
+ yield code_helper_1.default.waitForSelector('visible', `div[data-email="${email.toLocaleLowerCase()}"]`, config_1.config.timeout, page, count >= 2);
203
206
  yield code_helper_1.default.timeout(4000);
204
207
  yield (yield page.$$('button'))[2].click();
205
208
  }
206
209
  yield code_helper_1.default.timeout(4000);
207
- yield code_helper_1.default.waitForSelector('visible', 'body', config_1.config.timeout, page);
210
+ yield code_helper_1.default.waitForSelector('visible', 'body', config_1.config.timeout, page, count >= 2);
208
211
  const currentUrl = page.url();
209
212
  const code = currentUrl.substring(currentUrl.indexOf("code=") + 5, currentUrl.lastIndexOf("&"));
210
213
  code_helper_1.default.log('Then', 'I get the code form the url', status_of_step_1.default.PASSED);
211
214
  yield page.close();
215
+ yield puppeteer_extra_1.default.close();
212
216
  return decodeURIComponent(code);
213
217
  }
214
218
  else {
219
+ yield puppeteer_extra_1.default.close();
215
220
  throw new Error('The email or password for the google account are empty');
216
221
  }
217
222
  });
@@ -1,7 +1,7 @@
1
1
  import { UploadModel } from "../auxta/models/upload.model";
2
- import puppeteerN = require("puppeteer");
2
+ import puppeteer = require("puppeteer");
3
3
  export declare class Puppeteer {
4
- defaultPage: puppeteerN.Page;
4
+ defaultPage: puppeteer.Page;
5
5
  private browser;
6
6
  startBrowser(): Promise<void>;
7
7
  close(): Promise<void>;
@@ -21,7 +21,7 @@ const status_of_step_1 = require("../auxta/enums/status-of.step");
21
21
  const config_1 = require("../auxta/configs/config");
22
22
  const start_suite_helper_1 = require("../auxta/utilities/start-suite.helper");
23
23
  const report_service_1 = require("../auxta/services/report.service");
24
- const puppeteer = require("puppeteer-extra");
24
+ const puppeteer = require("puppeteer");
25
25
  class Puppeteer {
26
26
  startBrowser() {
27
27
  return __awaiter(this, void 0, void 0, function* () {
@@ -37,8 +37,6 @@ class Puppeteer {
37
37
  DISPLAY: ":10.0"
38
38
  };
39
39
  }
40
- const StealthPlugin = require('puppeteer-extra-plugin-stealth');
41
- puppeteer.default.use(StealthPlugin());
42
40
  this.browser = yield puppeteer.default.launch({
43
41
  slowMo: process.env.slowMo ? Number(process.env.slowMo) : 0,
44
42
  executablePath: puppeteer.default.executablePath(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auxcode/auxta",
3
- "version": "1.3.73-beta.4",
3
+ "version": "1.3.73-beta.6",
4
4
  "description": "",
5
5
  "main": "./build/AuxTA.js",
6
6
  "types": "./build/AuxTA.d.ts",