@commercetools-frontend/cypress 24.5.0 → 24.7.0

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.
@@ -49,7 +49,11 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _
49
49
 
50
50
  const defaultTimeouts = {
51
51
  waitForEmailInput: 4000,
52
- waitForPasswordInput: 8000
52
+ waitForPasswordInput: 8000,
53
+ waitForElement: 15000,
54
+ waitForUrl: 15000,
55
+ waitForRedirect: 3000,
56
+ waitForIdentityRedirect: 8000
53
57
  };
54
58
  function isFeatureSupported(expectedVersion) {
55
59
  return semver__default["default"].gte(Cypress.version, expectedVersion);
@@ -209,8 +213,14 @@ function loginByForm(commandOptions) {
209
213
  });
210
214
 
211
215
  // Wait for the flow to redirect back to the application.
212
- cy.get('[role="main"]').should('exist');
213
- cy.url().should('include', url);
216
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
217
+ cy.wait(commandOptions.timeouts?.waitForRedirect ?? defaultTimeouts.waitForRedirect);
218
+ cy.get('[role="main"]', {
219
+ timeout: commandOptions.timeouts?.waitForElement ?? defaultTimeouts.waitForElement
220
+ }).should('exist');
221
+ cy.url({
222
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
223
+ }).should('include', url);
214
224
  } else {
215
225
  const mcUrl = appConfig.mcApiUrl.replace('mc-api', 'mc');
216
226
  // See similar comment above regarding the usage of `cy.wait`.
@@ -269,7 +279,12 @@ function loginByForm(commandOptions) {
269
279
  }
270
280
  } else {
271
281
  if (isGlobalIdentityEnabled) {
272
- cy.url().should('include', `${identityUrl}/login`);
282
+ // Wait for redirect to Identity to complete
283
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
284
+ cy.wait(commandOptions.timeouts?.waitForIdentityRedirect ?? defaultTimeouts.waitForIdentityRedirect);
285
+ cy.url({
286
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
287
+ }).should('include', `${identityUrl}/login`);
273
288
  // Fill in the email and click Next
274
289
  cy.get('input[name="identifier"]', {
275
290
  timeout: commandOptions.timeouts?.waitForEmailInput ?? defaultTimeouts.waitForEmailInput
@@ -284,17 +299,32 @@ function loginByForm(commandOptions) {
284
299
  cy.get('input[name="password"]').type(userCredentials.password, {
285
300
  log: false
286
301
  });
287
- cy.get('button').contains('Submit').click();
302
+ cy.get('button').contains('Submit').click({
303
+ force: true
304
+ });
305
+
306
+ // Wait for redirect to start
307
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
308
+ cy.wait(commandOptions.timeouts?.waitForRedirect ?? defaultTimeouts.waitForRedirect);
288
309
 
289
310
  // Wait for the flow to redirect back to the application.
290
311
  cy.origin(Cypress.config('baseUrl'), {
291
312
  args: {
292
- url
313
+ url,
314
+ timeouts: commandOptions.timeouts,
315
+ defaultTimeouts
293
316
  }
294
317
  }, _ref3 => {
295
- let url = _ref3.url;
296
- cy.get('[role="main"]').should('exist');
297
- cy.url().should('include', url);
318
+ let url = _ref3.url,
319
+ timeouts = _ref3.timeouts,
320
+ defaultTimeouts = _ref3.defaultTimeouts;
321
+ // Wait for application to fully load
322
+ cy.get('[role="main"]', {
323
+ timeout: timeouts?.waitForElement ?? defaultTimeouts.waitForElement
324
+ }).should('exist');
325
+ cy.url({
326
+ timeout: timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
327
+ }).should('include', url);
298
328
  });
299
329
  } else {
300
330
  // Legacy login flow.
@@ -320,7 +350,9 @@ function loginByForm(commandOptions) {
320
350
  }
321
351
  if (commandOptions.initialRoute) {
322
352
  cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
323
- cy.url().should('include', commandOptions.initialRoute);
353
+ cy.url({
354
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
355
+ }).should('include', commandOptions.initialRoute);
324
356
  }
325
357
  });
326
358
  }
@@ -49,7 +49,11 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _
49
49
 
50
50
  const defaultTimeouts = {
51
51
  waitForEmailInput: 4000,
52
- waitForPasswordInput: 8000
52
+ waitForPasswordInput: 8000,
53
+ waitForElement: 15000,
54
+ waitForUrl: 15000,
55
+ waitForRedirect: 3000,
56
+ waitForIdentityRedirect: 8000
53
57
  };
54
58
  function isFeatureSupported(expectedVersion) {
55
59
  return semver__default["default"].gte(Cypress.version, expectedVersion);
@@ -209,8 +213,14 @@ function loginByForm(commandOptions) {
209
213
  });
210
214
 
211
215
  // Wait for the flow to redirect back to the application.
212
- cy.get('[role="main"]').should('exist');
213
- cy.url().should('include', url);
216
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
217
+ cy.wait(commandOptions.timeouts?.waitForRedirect ?? defaultTimeouts.waitForRedirect);
218
+ cy.get('[role="main"]', {
219
+ timeout: commandOptions.timeouts?.waitForElement ?? defaultTimeouts.waitForElement
220
+ }).should('exist');
221
+ cy.url({
222
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
223
+ }).should('include', url);
214
224
  } else {
215
225
  const mcUrl = appConfig.mcApiUrl.replace('mc-api', 'mc');
216
226
  // See similar comment above regarding the usage of `cy.wait`.
@@ -269,7 +279,12 @@ function loginByForm(commandOptions) {
269
279
  }
270
280
  } else {
271
281
  if (isGlobalIdentityEnabled) {
272
- cy.url().should('include', `${identityUrl}/login`);
282
+ // Wait for redirect to Identity to complete
283
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
284
+ cy.wait(commandOptions.timeouts?.waitForIdentityRedirect ?? defaultTimeouts.waitForIdentityRedirect);
285
+ cy.url({
286
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
287
+ }).should('include', `${identityUrl}/login`);
273
288
  // Fill in the email and click Next
274
289
  cy.get('input[name="identifier"]', {
275
290
  timeout: commandOptions.timeouts?.waitForEmailInput ?? defaultTimeouts.waitForEmailInput
@@ -284,17 +299,32 @@ function loginByForm(commandOptions) {
284
299
  cy.get('input[name="password"]').type(userCredentials.password, {
285
300
  log: false
286
301
  });
287
- cy.get('button').contains('Submit').click();
302
+ cy.get('button').contains('Submit').click({
303
+ force: true
304
+ });
305
+
306
+ // Wait for redirect to start
307
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
308
+ cy.wait(commandOptions.timeouts?.waitForRedirect ?? defaultTimeouts.waitForRedirect);
288
309
 
289
310
  // Wait for the flow to redirect back to the application.
290
311
  cy.origin(Cypress.config('baseUrl'), {
291
312
  args: {
292
- url
313
+ url,
314
+ timeouts: commandOptions.timeouts,
315
+ defaultTimeouts
293
316
  }
294
317
  }, _ref3 => {
295
- let url = _ref3.url;
296
- cy.get('[role="main"]').should('exist');
297
- cy.url().should('include', url);
318
+ let url = _ref3.url,
319
+ timeouts = _ref3.timeouts,
320
+ defaultTimeouts = _ref3.defaultTimeouts;
321
+ // Wait for application to fully load
322
+ cy.get('[role="main"]', {
323
+ timeout: timeouts?.waitForElement ?? defaultTimeouts.waitForElement
324
+ }).should('exist');
325
+ cy.url({
326
+ timeout: timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
327
+ }).should('include', url);
298
328
  });
299
329
  } else {
300
330
  // Legacy login flow.
@@ -320,7 +350,9 @@ function loginByForm(commandOptions) {
320
350
  }
321
351
  if (commandOptions.initialRoute) {
322
352
  cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
323
- cy.url().should('include', commandOptions.initialRoute);
353
+ cy.url({
354
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
355
+ }).should('include', commandOptions.initialRoute);
324
356
  }
325
357
  });
326
358
  }
@@ -29,7 +29,11 @@ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _
29
29
 
30
30
  const defaultTimeouts = {
31
31
  waitForEmailInput: 4000,
32
- waitForPasswordInput: 8000
32
+ waitForPasswordInput: 8000,
33
+ waitForElement: 15000,
34
+ waitForUrl: 15000,
35
+ waitForRedirect: 3000,
36
+ waitForIdentityRedirect: 8000
33
37
  };
34
38
  function isFeatureSupported(expectedVersion) {
35
39
  return semver.gte(Cypress.version, expectedVersion);
@@ -189,8 +193,14 @@ function loginByForm(commandOptions) {
189
193
  });
190
194
 
191
195
  // Wait for the flow to redirect back to the application.
192
- cy.get('[role="main"]').should('exist');
193
- cy.url().should('include', url);
196
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
197
+ cy.wait(commandOptions.timeouts?.waitForRedirect ?? defaultTimeouts.waitForRedirect);
198
+ cy.get('[role="main"]', {
199
+ timeout: commandOptions.timeouts?.waitForElement ?? defaultTimeouts.waitForElement
200
+ }).should('exist');
201
+ cy.url({
202
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
203
+ }).should('include', url);
194
204
  } else {
195
205
  const mcUrl = appConfig.mcApiUrl.replace('mc-api', 'mc');
196
206
  // See similar comment above regarding the usage of `cy.wait`.
@@ -249,7 +259,12 @@ function loginByForm(commandOptions) {
249
259
  }
250
260
  } else {
251
261
  if (isGlobalIdentityEnabled) {
252
- cy.url().should('include', `${identityUrl}/login`);
262
+ // Wait for redirect to Identity to complete
263
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
264
+ cy.wait(commandOptions.timeouts?.waitForIdentityRedirect ?? defaultTimeouts.waitForIdentityRedirect);
265
+ cy.url({
266
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
267
+ }).should('include', `${identityUrl}/login`);
253
268
  // Fill in the email and click Next
254
269
  cy.get('input[name="identifier"]', {
255
270
  timeout: commandOptions.timeouts?.waitForEmailInput ?? defaultTimeouts.waitForEmailInput
@@ -264,17 +279,32 @@ function loginByForm(commandOptions) {
264
279
  cy.get('input[name="password"]').type(userCredentials.password, {
265
280
  log: false
266
281
  });
267
- cy.get('button').contains('Submit').click();
282
+ cy.get('button').contains('Submit').click({
283
+ force: true
284
+ });
285
+
286
+ // Wait for redirect to start
287
+ // eslint-disable-next-line cypress/no-unnecessary-waiting
288
+ cy.wait(commandOptions.timeouts?.waitForRedirect ?? defaultTimeouts.waitForRedirect);
268
289
 
269
290
  // Wait for the flow to redirect back to the application.
270
291
  cy.origin(Cypress.config('baseUrl'), {
271
292
  args: {
272
- url
293
+ url,
294
+ timeouts: commandOptions.timeouts,
295
+ defaultTimeouts
273
296
  }
274
297
  }, _ref3 => {
275
- let url = _ref3.url;
276
- cy.get('[role="main"]').should('exist');
277
- cy.url().should('include', url);
298
+ let url = _ref3.url,
299
+ timeouts = _ref3.timeouts,
300
+ defaultTimeouts = _ref3.defaultTimeouts;
301
+ // Wait for application to fully load
302
+ cy.get('[role="main"]', {
303
+ timeout: timeouts?.waitForElement ?? defaultTimeouts.waitForElement
304
+ }).should('exist');
305
+ cy.url({
306
+ timeout: timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
307
+ }).should('include', url);
278
308
  });
279
309
  } else {
280
310
  // Legacy login flow.
@@ -300,7 +330,9 @@ function loginByForm(commandOptions) {
300
330
  }
301
331
  if (commandOptions.initialRoute) {
302
332
  cy.visit(`${Cypress.config('baseUrl')}${commandOptions.initialRoute}`);
303
- cy.url().should('include', commandOptions.initialRoute);
333
+ cy.url({
334
+ timeout: commandOptions.timeouts?.waitForUrl ?? defaultTimeouts.waitForUrl
335
+ }).should('include', commandOptions.initialRoute);
304
336
  }
305
337
  });
306
338
  }
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var constants = require('./constants-009cb682.cjs.dev.js');
6
6
 
7
7
  // NOTE: This string will be replaced on build time with the package version.
8
- var version = "24.5.0";
8
+ var version = "24.7.0";
9
9
 
10
10
  exports.HTTP_STATUS_CODES = constants.HTTP_STATUS_CODES;
11
11
  exports.OIDC_RESPONSE_TYPES = constants.OIDC_RESPONSE_TYPES;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var constants = require('./constants-2f1475a6.cjs.prod.js');
6
6
 
7
7
  // NOTE: This string will be replaced on build time with the package version.
8
- var version = "24.5.0";
8
+ var version = "24.7.0";
9
9
 
10
10
  exports.HTTP_STATUS_CODES = constants.HTTP_STATUS_CODES;
11
11
  exports.OIDC_RESPONSE_TYPES = constants.OIDC_RESPONSE_TYPES;
@@ -1,6 +1,6 @@
1
1
  export { H as HTTP_STATUS_CODES, O as OIDC_RESPONSE_TYPES, S as STORAGE_KEYS } from './constants-13c76918.esm.js';
2
2
 
3
3
  // NOTE: This string will be replaced on build time with the package version.
4
- var version = "24.5.0";
4
+ var version = "24.7.0";
5
5
 
6
6
  export { version };
@@ -21,6 +21,26 @@ export type LoginCommandTimeouts = {
21
21
  * Defaults to `8000` (8 seconds).
22
22
  */
23
23
  waitForPasswordInput?: number;
24
+ /**
25
+ * The timeout in milliseconds for cy.get() operations on elements.
26
+ * Defaults to `15000` (15 seconds).
27
+ */
28
+ waitForElement?: number;
29
+ /**
30
+ * The timeout in milliseconds for cy.url() operations.
31
+ * Defaults to `15000` (15 seconds).
32
+ */
33
+ waitForUrl?: number;
34
+ /**
35
+ * The number of milliseconds to wait for redirects to complete.
36
+ * Defaults to `3000` (3 seconds).
37
+ */
38
+ waitForRedirect?: number;
39
+ /**
40
+ * The number of milliseconds to wait for Identity redirect to complete.
41
+ * Defaults to `8000` (8 seconds).
42
+ */
43
+ waitForIdentityRedirect?: number;
24
44
  };
25
45
  export type CommandLoginOptions = {
26
46
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/cypress",
3
- "version": "24.5.0",
3
+ "version": "24.7.0",
4
4
  "description": "Cypress commands and utilities for Custom Applications",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -41,9 +41,9 @@
41
41
  "dependencies": {
42
42
  "@babel/runtime": "^7.22.15",
43
43
  "@babel/runtime-corejs3": "^7.22.15",
44
- "@commercetools-frontend/application-config": "24.5.0",
45
- "@commercetools-frontend/application-shell": "24.5.0",
46
- "@commercetools-frontend/constants": "24.5.0",
44
+ "@commercetools-frontend/application-config": "24.7.0",
45
+ "@commercetools-frontend/application-shell": "24.7.0",
46
+ "@commercetools-frontend/constants": "24.7.0",
47
47
  "@manypkg/get-packages": "1.1.3",
48
48
  "@types/semver": "^7.5.1",
49
49
  "semver": "7.6.2",