ag-awsauth 0.0.246 → 0.0.248

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.
@@ -105,6 +105,7 @@ function getMFA(p) {
105
105
  yield page.waitForNetworkIdle({ idleTime: 250 });
106
106
  //
107
107
  try {
108
+ (0, log_1.info)('wait optional alert message');
108
109
  const messageDiv = yield page.waitForSelector('.awsui-alert-message', {
109
110
  timeout: config_1.timeoutShortMs,
110
111
  });
@@ -156,26 +157,33 @@ function getMFA(p) {
156
157
  retry = false;
157
158
  }
158
159
  }
160
+ try {
161
+ (0, log_1.info)('wait for access prompt');
162
+ const messageDiv = yield page.waitForSelector('[data-testid="allow-access-button"]', {
163
+ timeout: config_1.timeoutShortMs,
164
+ });
165
+ if (messageDiv) {
166
+ (0, log_1.info)('click access prompt');
167
+ yield messageDiv.click();
168
+ }
169
+ else {
170
+ throw new Error('access prompt not found');
171
+ }
172
+ }
173
+ catch (e) {
174
+ const em = e.toString();
175
+ if (!em.includes('exceeded')) {
176
+ const em2 = `mfa error:` + em + ' retry';
177
+ (0, log_1.error)(em2);
178
+ }
179
+ else {
180
+ retry = false;
181
+ }
182
+ }
159
183
  } while (retry);
160
184
  //
161
- yield (0, sleep_1.sleep)(config_1.timeoutShortMs);
162
- yield page.waitForNetworkIdle({ idleTime: 250 });
163
- (0, log_1.info)('waiting for sign in button');
164
- yield page.waitForSelector('.awsui-signin-button', {
165
- timeout: config_1.timeoutShortMs,
166
- });
167
- (0, log_1.info)('pressing sign in');
168
- yield page.$eval('.awsui-signin-button', (el) => el.click());
169
- (0, log_1.info)('waiting for completion');
170
- yield (0, sleep_1.sleep)(250);
171
- try {
172
- yield page.waitForNetworkIdle({ idleTime: 250, timeout: config_1.timeoutShortMs });
173
- }
174
- catch (e) {
175
- //
176
- }
177
185
  (0, log_1.info)('waiting for success');
178
- yield page.waitForSelector('.awsui-icon-variant-success', {
186
+ yield page.waitForSelector('[data-analytics-alert="success"]', {
179
187
  timeout: config_1.timeoutMs,
180
188
  });
181
189
  (0, log_1.warn)('mfa success');
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "andrei gec (andreigec@hotmail.com)",
6
6
  "license": "ISC",
7
7
  "private": false,
8
- "version": "0.0.246",
8
+ "version": "0.0.248",
9
9
  "preferGlobal": true,
10
10
  "scripts": {
11
11
  "format": "eslint --ext .ts,.tsx src --fix",