@globisnv/cypress-core 0.0.5 → 0.0.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.
@@ -350,6 +350,52 @@ 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.get('body', { log: false }).then(($body) => {
370
+ if (!$body.find(progressBarSelector).length) {
371
+ log.end();
372
+ resolve();
373
+ return;
374
+ }
375
+ if ($body.find(blockingDialogSelector).filter(':visible').length) {
376
+ log.set({ message: 'Progress bar still shown, but a dialog is waiting for input: continuing' });
377
+ log.end();
378
+ resolve();
379
+ return;
380
+ }
381
+ attempts += 1;
382
+ if (attempts > maxAttempts) {
383
+ log.end();
384
+ reject(new Error(`Timed out after ${Math.round((maxAttempts * pollInterval) / 1000)}s waiting for the progress bar to disappear`));
385
+ return;
386
+ }
387
+ // biome-ignore plugin: wait for next poll interval before checking again
388
+ cy.wait(pollInterval, { log: false }).then(() => {
389
+ log.set({ message: `Still waiting for the progress bar ${attempts}/${maxAttempts}` });
390
+ checkStatus(resolve, reject);
391
+ });
392
+ });
393
+ };
394
+ const promise = new Cypress.Promise((resolve, reject) => {
395
+ checkStatus(resolve, reject);
396
+ });
397
+ cy.then(() => promise);
398
+ };
353
399
  Cypress.Commands.add('GLO_checkLoadingIndicator', () => {
354
400
  if (cypressWebsocketLoader) {
355
401
  cy.WS_loadingCheck();
@@ -357,8 +403,8 @@ Cypress.Commands.add('GLO_checkLoadingIndicator', () => {
357
403
  else {
358
404
  // biome-ignore plugin: wait before checking loading indicator
359
405
  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');
406
+ cy.get('loading-indicator', { timeout: loadingCheckTimeout }).should('not.exist');
407
+ waitForProgressBar();
362
408
  }
363
409
  });
364
410
  Cypress.Commands.add('GLO_clickDatacontrolBrowserButton', (buttonName, skipCheck = noSkipCheck) => {
@@ -1498,7 +1544,7 @@ Cypress.Commands.add('GLO_checkNumberOfRowsInGrid', (selector, numberToValidate,
1498
1544
  let lastError;
1499
1545
  const log = Cypress.log({ name: 'checkNumberOfRowsInGrid', message: `Polling rows (${lengthCondition} ${numberToValidate})…`, autoEnd: false, timeout: 0 });
1500
1546
  const checkStatus = (resolve, reject) => {
1501
- cy.GLO_getElement(selector, { timeout: timeOut }).then(($grid) => {
1547
+ cy.GLO_getElement(selector, { timeout: timeOut, log: false }).then(($grid) => {
1502
1548
  const $rows = $grid.find('.ag-center-cols-container [row-index]');
1503
1549
  let actual = $rows.length;
1504
1550
  let passed = false;
@@ -2309,7 +2355,7 @@ Cypress.Commands.add('GLO_extendedFilter', (filter, clearExistingFilters) => {
2309
2355
  cy.GLO_checkLoadingIndicator();
2310
2356
  });
2311
2357
  Cypress.Commands.add('GLO_selectNamedSearch', (searchName) => {
2312
- cy.GLO_clickDatacontrolBrowserButton('btnExtendedSearch');
2358
+ cy.GLO_getVisible('#txtSearch .dx-icon-search').click();
2313
2359
  cy.GLO_getVisible('.dx-submenu', 10000).contains(searchName).click();
2314
2360
  cy.GLO_checkLoadingIndicator();
2315
2361
  });
@@ -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.6",
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
  },