@globisnv/cypress-core 0.0.3 → 0.0.5

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.
@@ -181,18 +181,12 @@ Cypress.Commands.add('GLO_oktaLogin', (company, urlType, skipvNavCheck) => {
181
181
  const target = globisUrlTypes.includes(urlType) ? 'globis_online' : 'online';
182
182
  url = url.replace(target, urlType);
183
183
  }
184
- if (cypressWebsocketLoader) {
185
- cy.WS_visitWithSpy(url);
186
- }
187
- else {
188
- cy.visit(url);
189
- }
184
+ // Stateless Okta login redirects server side before any Servoy client boots, so there is no
185
+ // websocket to wait for on the first visit — the connection is only asserted after the Okta
186
+ // round trip (see waitForWebSocketAfterOkta). The spy itself is attached globally on every
187
+ // AUT page load (see websocketDetector.ts), which covers this server-side redirect too.
188
+ cy.visit(url);
190
189
  cy.task('log', 'Redirect to okta url');
191
- if (cypressWebsocketLoader) {
192
- cy.on('window:before:load', (win) => {
193
- attachWebSocketSpy(win);
194
- });
195
- }
196
190
  cy.origin(Cypress.expose('oktaUrl'), () => {
197
191
  cy.get('.o-form-input', { timeout: 60000 })
198
192
  .find('[autocomplete="username"]')
@@ -1,4 +1,4 @@
1
- import { cypressWebsocketDebug, extraParams } from './tsHelper.js';
1
+ import { cypressWebsocketDebug, cypressWebsocketLoader, extraParams } from './tsHelper.js';
2
2
  /** Module-level flag controlling auto-dismissal of Info dialogs. Disabled by default; set via WS_toggleDialogHandler or env wsEnableDialogHandler=true. */
3
3
  let wsDialogHandlerEnabled = extraParams.wsEnableDialogHandler === 'true';
4
4
  // ─── Cypress action tracking for metric labels ────────────────────────────────
@@ -71,13 +71,16 @@ after(() => {
71
71
  Cypress.log({ name: 'WSMetrics', displayName: '📊 WSMetrics', message: msg });
72
72
  });
73
73
  });
74
- Cypress.Commands.add('WS_visitWithSpy', (url) => {
75
- const enableSpy = () => ({
76
- onBeforeLoad(win) {
77
- attachWebSocketSpy(win);
78
- }
74
+ // Attaches to every AUT page load, not just the one triggered by the WS_visitWithSpy call below —
75
+ // GLO_logout redirects to the login page itself (app-triggered, not via cy.visit), and that load
76
+ // needs the spy too or its websocket connects unpatched (same problem GLO_oktaLogin's redirect has).
77
+ if (cypressWebsocketLoader) {
78
+ Cypress.on('window:before:load', (win) => {
79
+ attachWebSocketSpy(win);
79
80
  });
80
- cy.visit(url, enableSpy());
81
+ }
82
+ Cypress.Commands.add('WS_visitWithSpy', (url) => {
83
+ cy.visit(url);
81
84
  cy.window().then((win) => {
82
85
  cy.wrap(win.wsMessages).as('wsMessages');
83
86
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globisnv/cypress-core",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Core building blocks for Globis Cypress E2E tests",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",