@globisnv/cypress-core 0.0.5 → 0.0.7

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.
@@ -350,6 +350,55 @@ Cypress.Commands.add('GLO_searchDataControl', (elementName) => {
350
350
  cy.GLO_checkLoadingIndicator();
351
351
  });
352
352
  });
353
+ const loadingCheckTimeout = 1200000;
354
+ const progressBarSelector = '[data-cy="ng$main_form2.progress"] dx-progress-bar';
355
+ /** Modal overlays that park the Servoy server thread until the user answers. */
356
+ const blockingDialogSelector = '.svy-message-dialog, .servoycore-dialog-body, .svy-dialog';
357
+ /**
358
+ * Polls the full screen progress bar away. A process that asks the user something halfway - a formula
359
+ * showing a select dialog, for instance - keeps the bar in the DOM while its thread is parked on that
360
+ * dialog, so a visible dialog resolves the poll and lets the test answer it. The dialog handler calls
361
+ * the loading check again afterwards, which re-enters this same poll.
362
+ */
363
+ const waitForProgressBar = () => {
364
+ const pollInterval = 1000;
365
+ const maxAttempts = Math.ceil(loadingCheckTimeout / pollInterval);
366
+ let attempts = 0;
367
+ const log = Cypress.log({ name: 'checkLoadingIndicator', message: 'Waiting for the progress bar…', autoEnd: false, timeout: 0 });
368
+ const checkStatus = (resolve, reject) => {
369
+ // cy.document(), not cy.get('body'): commands called from inside a .within() block - such as
370
+ // GLO_clickRowInGrid - would scope that query to the within subject and never find the body.
371
+ cy.document({ log: false }).then((doc) => {
372
+ const $body = Cypress.$(doc.body);
373
+ if (!$body.find(progressBarSelector).length) {
374
+ log.end();
375
+ resolve();
376
+ return;
377
+ }
378
+ if ($body.find(blockingDialogSelector).filter(':visible').length) {
379
+ log.set({ message: 'Progress bar still shown, but a dialog is waiting for input: continuing' });
380
+ log.end();
381
+ resolve();
382
+ return;
383
+ }
384
+ attempts += 1;
385
+ if (attempts > maxAttempts) {
386
+ log.end();
387
+ reject(new Error(`Timed out after ${Math.round((maxAttempts * pollInterval) / 1000)}s waiting for the progress bar to disappear`));
388
+ return;
389
+ }
390
+ // biome-ignore plugin: wait for next poll interval before checking again
391
+ cy.wait(pollInterval, { log: false }).then(() => {
392
+ log.set({ message: `Still waiting for the progress bar ${attempts}/${maxAttempts}` });
393
+ checkStatus(resolve, reject);
394
+ });
395
+ });
396
+ };
397
+ const promise = new Cypress.Promise((resolve, reject) => {
398
+ checkStatus(resolve, reject);
399
+ });
400
+ cy.then(() => promise);
401
+ };
353
402
  Cypress.Commands.add('GLO_checkLoadingIndicator', () => {
354
403
  if (cypressWebsocketLoader) {
355
404
  cy.WS_loadingCheck();
@@ -357,8 +406,8 @@ Cypress.Commands.add('GLO_checkLoadingIndicator', () => {
357
406
  else {
358
407
  // biome-ignore plugin: wait before checking loading indicator
359
408
  cy.wait(1000);
360
- cy.get('loading-indicator', { timeout: 1200000 }).should('not.exist');
361
- cy.get('[data-cy="ng$main_form2.progress"] dx-progress-bar', { timeout: 1200000, log: false }).should('not.exist');
409
+ cy.get('loading-indicator', { timeout: loadingCheckTimeout }).should('not.exist');
410
+ waitForProgressBar();
362
411
  }
363
412
  });
364
413
  Cypress.Commands.add('GLO_clickDatacontrolBrowserButton', (buttonName, skipCheck = noSkipCheck) => {
@@ -1498,7 +1547,7 @@ Cypress.Commands.add('GLO_checkNumberOfRowsInGrid', (selector, numberToValidate,
1498
1547
  let lastError;
1499
1548
  const log = Cypress.log({ name: 'checkNumberOfRowsInGrid', message: `Polling rows (${lengthCondition} ${numberToValidate})…`, autoEnd: false, timeout: 0 });
1500
1549
  const checkStatus = (resolve, reject) => {
1501
- cy.GLO_getElement(selector, { timeout: timeOut }).then(($grid) => {
1550
+ cy.GLO_getElement(selector, { timeout: timeOut, log: false }).then(($grid) => {
1502
1551
  const $rows = $grid.find('.ag-center-cols-container [row-index]');
1503
1552
  let actual = $rows.length;
1504
1553
  let passed = false;
@@ -2309,7 +2358,7 @@ Cypress.Commands.add('GLO_extendedFilter', (filter, clearExistingFilters) => {
2309
2358
  cy.GLO_checkLoadingIndicator();
2310
2359
  });
2311
2360
  Cypress.Commands.add('GLO_selectNamedSearch', (searchName) => {
2312
- cy.GLO_clickDatacontrolBrowserButton('btnExtendedSearch');
2361
+ cy.GLO_getVisible('#txtSearch .dx-icon-search').click();
2313
2362
  cy.GLO_getVisible('.dx-submenu', 10000).contains(searchName).click();
2314
2363
  cy.GLO_checkLoadingIndicator();
2315
2364
  });
@@ -3,8 +3,8 @@ import * as http from 'node:http';
3
3
  import * as https from 'node:https';
4
4
  import { URL } from 'node:url';
5
5
  import { Sha256 } from '@aws-crypto/sha256-js';
6
- import { fromContainerMetadata } from '@aws-sdk/credential-provider-imds';
7
- import { SignatureV4 } from '@aws-sdk/signature-v4';
6
+ import { fromContainerMetadata } from '@smithy/credential-provider-imds';
7
+ import { SignatureV4 } from '@smithy/signature-v4';
8
8
  import { compress } from 'snappyjs';
9
9
  // ─── Minimal Prometheus remote-write protobuf encoder ─────────────────────────
10
10
  // WriteRequest { repeated TimeSeries timeseries = 1 }
@@ -143,7 +143,7 @@ export declare function parseLocalizedNumber(value: string | number | undefined)
143
143
  * will fall back to a random generated 4-character UUID if not found.
144
144
  * @returns {string} CYP + build number or random 4-character UUID
145
145
  */
146
- export declare const getOrCreateUuid: (index?: number) => string;
146
+ export declare const getOrCreateUuid: (createNew?: 'createNew') => string;
147
147
  /**
148
148
  * Returns the ISO 8601 week number for the given date.
149
149
  *
package/dist/tsHelper.js CHANGED
@@ -153,12 +153,13 @@ export function parseLocalizedNumber(value) {
153
153
  * will fall back to a random generated 4-character UUID if not found.
154
154
  * @returns {string} CYP + build number or random 4-character UUID
155
155
  */
156
- export const getOrCreateUuid = (index) => {
157
- const envKey = index !== undefined ? `BUILD_UUID_${index}` : 'BUILD_UUID';
156
+ export const getOrCreateUuid = (createNew) => {
157
+ const id = createNew === 'createNew' ? getUUID(3) : undefined;
158
+ const envKey = id !== undefined ? `BUILD_UUID_${id}` : 'BUILD_UUID';
158
159
  let uuid = Cypress.expose(envKey);
159
160
  if (!uuid) {
160
161
  const buildNumber = Cypress.expose('BUILD_NUMBER');
161
- const suffix = index !== undefined ? `-${index}` : '';
162
+ const suffix = id !== undefined ? `-${id}` : '';
162
163
  uuid = buildNumber ? `CYP${buildNumber}${suffix}` : `CYP${getUUID(4)}${suffix}`;
163
164
  Cypress.expose({ [envKey]: uuid });
164
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globisnv/cypress-core",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Core building blocks for Globis Cypress E2E tests",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@aws-crypto/sha256-js": "^5.2.0",
51
- "@aws-sdk/credential-provider-imds": "^3.374.0",
52
- "@aws-sdk/signature-v4": "^3.374.0",
51
+ "@smithy/credential-provider-imds": "^4.5.2",
52
+ "@smithy/signature-v4": "^5.7.3",
53
53
  "snappyjs": "^0.7.0",
54
54
  "uuid": "^14.0.1"
55
55
  },