@auxcode/auxta 1.3.51-beta.11 → 1.3.51-beta.13

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))
@@ -143,11 +143,12 @@ class AuxGoogleAuth {
143
143
  });
144
144
  }
145
145
  static LogIn(authUrl) {
146
- var _a, _b, _c;
146
+ var _a, _b;
147
147
  return __awaiter(this, void 0, void 0, function* () {
148
148
  const context = yield puppeteer_1.default.defaultPage.browser().createIncognitoBrowserContext();
149
149
  const page = yield context.newPage();
150
150
  yield page.goto(authUrl);
151
+ yield page.waitForNetworkIdle();
151
152
  yield code_helper_1.default.waitForSelector('visible', '#identifierId', config_1.config.timeout, page);
152
153
  yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
153
154
  yield (yield page.$$('button'))[3].click();
@@ -159,12 +160,19 @@ class AuxGoogleAuth {
159
160
  yield code_helper_1.default.waitForSelector('visible', '#headingText', config_1.config.timeout, page);
160
161
  yield (yield page.$$('button'))[2].click();
161
162
  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();
163
+ const checkbox = yield page.$('input[type="checkbox"]');
164
+ if (checkbox) {
165
+ yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page);
166
+ yield checkbox.click();
167
+ yield (yield page.$$('button'))[2].click();
168
+ }
169
+ else {
170
+ yield (yield page.$$('button'))[3].click();
171
+ }
165
172
  yield code_helper_1.default.timeout(3000);
166
173
  const currentUrl = page.url();
167
174
  const code = currentUrl.substring(currentUrl.indexOf("code=") + 5, currentUrl.lastIndexOf("&"));
175
+ yield page.close();
168
176
  return decodeURIComponent(code);
169
177
  });
170
178
  }
@@ -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))
@@ -137,11 +137,12 @@ export class AuxGoogleAuth {
137
137
  });
138
138
  }
139
139
  static LogIn(authUrl) {
140
- var _a, _b, _c;
140
+ var _a, _b;
141
141
  return __awaiter(this, void 0, void 0, function* () {
142
142
  const context = yield puppeteer.defaultPage.browser().createIncognitoBrowserContext();
143
143
  const page = yield context.newPage();
144
144
  yield page.goto(authUrl);
145
+ yield page.waitForNetworkIdle();
145
146
  yield FunctionHelper.waitForSelector('visible', '#identifierId', config.timeout, page);
146
147
  yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
147
148
  yield (yield page.$$('button'))[3].click();
@@ -153,12 +154,19 @@ export class AuxGoogleAuth {
153
154
  yield FunctionHelper.waitForSelector('visible', '#headingText', config.timeout, page);
154
155
  yield (yield page.$$('button'))[2].click();
155
156
  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();
157
+ const checkbox = yield page.$('input[type="checkbox"]');
158
+ if (checkbox) {
159
+ yield FunctionHelper.waitForSelector('visible', 'input[type="checkbox"]', config.timeout, page);
160
+ yield checkbox.click();
161
+ yield (yield page.$$('button'))[2].click();
162
+ }
163
+ else {
164
+ yield (yield page.$$('button'))[3].click();
165
+ }
159
166
  yield FunctionHelper.timeout(3000);
160
167
  const currentUrl = page.url();
161
168
  const code = currentUrl.substring(currentUrl.indexOf("code=") + 5, currentUrl.lastIndexOf("&"));
169
+ yield page.close();
162
170
  return decodeURIComponent(code);
163
171
  });
164
172
  }