@auxcode/auxta 1.3.51-beta.12 → 1.3.51-beta.14

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.
@@ -25,6 +25,7 @@ function captureScreenshot() {
25
25
  const lastPage = pages[pages.length - 1] || puppeteer_1.default.defaultPage;
26
26
  const screenshotBuffer = yield lastPage.screenshot({
27
27
  fullPage: true,
28
+ captureBeyondViewport: false,
28
29
  encoding: 'binary'
29
30
  });
30
31
  if (Buffer.isBuffer(screenshotBuffer))
@@ -14,10 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AuxGoogleAuth = void 0;
16
16
  const config_1 = require("../../auxta/configs/config");
17
- const fs = require('fs');
18
- const readline = require('readline');
19
17
  const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
20
18
  const code_helper_1 = __importDefault(require("../helpers/code.helper"));
19
+ const status_of_step_1 = __importDefault(require("../../auxta/enums/status-of.step"));
20
+ const fs = require('fs');
21
+ const readline = require('readline');
21
22
  const { google } = require("googleapis");
22
23
  const SCOPES = [
23
24
  'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
@@ -133,17 +134,19 @@ class AuxGoogleAuth {
133
134
  scope: SCOPES,
134
135
  });
135
136
  const code = yield this.LogIn(authUrl);
137
+ code_helper_1.default.log('tes', code, status_of_step_1.default.PASSED);
136
138
  oAuth2Client.getToken(code, (err, token) => {
137
139
  if (err)
138
140
  return console.error('Error retrieving access token', err);
139
141
  oAuth2Client.setCredentials(token);
140
- TOKEN = token;
142
+ code_helper_1.default.log('tes', token, status_of_step_1.default.PASSED);
143
+ TOKEN = token.toString();
141
144
  this._oAuth2Client = oAuth2Client;
142
145
  });
143
146
  });
144
147
  }
145
148
  static LogIn(authUrl) {
146
- var _a, _b, _c;
149
+ var _a, _b;
147
150
  return __awaiter(this, void 0, void 0, function* () {
148
151
  const context = yield puppeteer_1.default.defaultPage.browser().createIncognitoBrowserContext();
149
152
  const page = yield context.newPage();
@@ -159,9 +162,15 @@ class AuxGoogleAuth {
159
162
  yield code_helper_1.default.waitForSelector('visible', '#headingText', config_1.config.timeout, page);
160
163
  yield (yield page.$$('button'))[2].click();
161
164
  yield code_helper_1.default.timeout(3000);
162
- yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page);
163
- yield ((_c = (yield page.$('input[type="checkbox"]'))) === null || _c === void 0 ? void 0 : _c.click());
164
- yield (yield page.$$('button'))[2].click();
165
+ const checkbox = yield page.$$('input[type="checkbox"]');
166
+ if (checkbox.length > 0) {
167
+ yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page);
168
+ yield checkbox[0].click();
169
+ yield (yield page.$$('button'))[2].click();
170
+ }
171
+ else {
172
+ yield (yield page.$$('button'))[2].click();
173
+ }
165
174
  yield code_helper_1.default.timeout(3000);
166
175
  const currentUrl = page.url();
167
176
  const code = currentUrl.substring(currentUrl.indexOf("code=") + 5, currentUrl.lastIndexOf("&"));
@@ -19,6 +19,7 @@ export function captureScreenshot() {
19
19
  const lastPage = pages[pages.length - 1] || puppeteer.defaultPage;
20
20
  const screenshotBuffer = yield lastPage.screenshot({
21
21
  fullPage: true,
22
+ captureBeyondViewport: false,
22
23
  encoding: 'binary'
23
24
  });
24
25
  if (Buffer.isBuffer(screenshotBuffer))
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { config } from "../../auxta/configs/config";
11
- const fs = require('fs');
12
- const readline = require('readline');
13
11
  import puppeteer from "../../puppeteer/puppeteer";
14
12
  import FunctionHelper from "../helpers/code.helper";
13
+ import StatusOfStep from "../../auxta/enums/status-of.step";
14
+ const fs = require('fs');
15
+ const readline = require('readline');
15
16
  const { google } = require("googleapis");
16
17
  const SCOPES = [
17
18
  'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
@@ -127,17 +128,19 @@ export class AuxGoogleAuth {
127
128
  scope: SCOPES,
128
129
  });
129
130
  const code = yield this.LogIn(authUrl);
131
+ FunctionHelper.log('tes', code, StatusOfStep.PASSED);
130
132
  oAuth2Client.getToken(code, (err, token) => {
131
133
  if (err)
132
134
  return console.error('Error retrieving access token', err);
133
135
  oAuth2Client.setCredentials(token);
134
- TOKEN = token;
136
+ FunctionHelper.log('tes', token, StatusOfStep.PASSED);
137
+ TOKEN = token.toString();
135
138
  this._oAuth2Client = oAuth2Client;
136
139
  });
137
140
  });
138
141
  }
139
142
  static LogIn(authUrl) {
140
- var _a, _b, _c;
143
+ var _a, _b;
141
144
  return __awaiter(this, void 0, void 0, function* () {
142
145
  const context = yield puppeteer.defaultPage.browser().createIncognitoBrowserContext();
143
146
  const page = yield context.newPage();
@@ -153,9 +156,15 @@ export class AuxGoogleAuth {
153
156
  yield FunctionHelper.waitForSelector('visible', '#headingText', config.timeout, page);
154
157
  yield (yield page.$$('button'))[2].click();
155
158
  yield FunctionHelper.timeout(3000);
156
- yield FunctionHelper.waitForSelector('visible', 'input[type="checkbox"]', config.timeout, page);
157
- yield ((_c = (yield page.$('input[type="checkbox"]'))) === null || _c === void 0 ? void 0 : _c.click());
158
- yield (yield page.$$('button'))[2].click();
159
+ const checkbox = yield page.$$('input[type="checkbox"]');
160
+ if (checkbox.length > 0) {
161
+ yield FunctionHelper.waitForSelector('visible', 'input[type="checkbox"]', config.timeout, page);
162
+ yield checkbox[0].click();
163
+ yield (yield page.$$('button'))[2].click();
164
+ }
165
+ else {
166
+ yield (yield page.$$('button'))[2].click();
167
+ }
159
168
  yield FunctionHelper.timeout(3000);
160
169
  const currentUrl = page.url();
161
170
  const code = currentUrl.substring(currentUrl.indexOf("code=") + 5, currentUrl.lastIndexOf("&"));