@camunda/e2e-test-suite 0.0.1810 → 0.0.1811

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.
@@ -67,8 +67,10 @@ declare class ConsoleOrganizationPage {
67
67
  clickSettingsTab(): Promise<void>;
68
68
  clickOptInButton(): Promise<void>;
69
69
  enableAlphaFeature(name: string): Promise<void>;
70
+ acceptTerms(checkbox: Locator): Promise<void>;
70
71
  closeTermsDialog(): Promise<void>;
71
- scrollToOptInCheckbox(): Promise<void>;
72
+ scrollToOptInCheckbox(checkbox: Locator): Promise<void>;
73
+ private scrollTermsDialogToBottom;
72
74
  checkOptInCheckbox(): Promise<void>;
73
75
  clickMainUser(email: string): Promise<void>;
74
76
  clickAuthorizations(): Promise<void>;
@@ -391,8 +391,8 @@ class ConsoleOrganizationPage {
391
391
  if (await alphaFeatureOptInButton.isEnabled()) {
392
392
  await alphaFeatureOptInButton.click({ timeout: 90000 });
393
393
  await (0, test_1.expect)(this.dialog.first()).toBeVisible({ timeout: 60000 });
394
- await this.scrollToOptInCheckbox();
395
- await this.optInAICheckbox.check({ timeout: 90000 });
394
+ await this.scrollToOptInCheckbox(this.optInAICheckbox);
395
+ await this.acceptTerms(this.optInAICheckbox);
396
396
  await this.closeTermsDialog();
397
397
  }
398
398
  }
@@ -413,18 +413,50 @@ class ConsoleOrganizationPage {
413
413
  await toggle.click();
414
414
  await (0, test_1.expect)(toggle).toBeChecked({ timeout: 60000 });
415
415
  }
416
+ // Closing the dialog before PactSafe's POST /send completes aborts it and
417
+ // the opt-in is silently lost, so wait for the acceptance to be recorded.
418
+ async acceptTerms(checkbox) {
419
+ await Promise.all([
420
+ this.page.waitForResponse((response) => response.url().includes('pactsafe.io/send') &&
421
+ response.request().method() === 'POST' &&
422
+ response.ok(), { timeout: 60000 }),
423
+ checkbox.check({ timeout: 90000 }),
424
+ ]);
425
+ }
416
426
  async closeTermsDialog() {
417
- const closeButton = this.dialog
427
+ // Console closes the dialog itself once the acceptance is recorded.
428
+ const autoClosed = await this.dialog
418
429
  .first()
419
- .getByRole('button', { name: 'Close' });
420
- if (await closeButton.isVisible({ timeout: 10000 }).catch(() => false)) {
421
- await closeButton.click();
430
+ .waitFor({ state: 'hidden', timeout: 30000 })
431
+ .then(() => true)
432
+ .catch(() => false);
433
+ if (!autoClosed) {
434
+ const closeButton = this.dialog
435
+ .first()
436
+ .getByRole('button', { name: 'Close' });
437
+ if (await closeButton.isVisible({ timeout: 10000 }).catch(() => false)) {
438
+ await closeButton.click();
439
+ }
422
440
  }
423
441
  await (0, test_1.expect)(this.dialog.first()).toBeHidden({ timeout: 60000 });
424
442
  }
425
- async scrollToOptInCheckbox() {
443
+ async scrollToOptInCheckbox(checkbox) {
426
444
  const dialog = this.dialog.first();
427
445
  await (0, test_1.expect)(dialog).toBeVisible({ timeout: 30000 });
446
+ // The PactSafe contract loads after the dialog opens and only renders the
447
+ // checkbox once scrolled to the bottom, so scroll until the checkbox shows.
448
+ for (let attempt = 0; attempt < 12; attempt++) {
449
+ await this.scrollTermsDialogToBottom(dialog);
450
+ const checkboxVisible = await checkbox
451
+ .waitFor({ state: 'visible', timeout: 5000 })
452
+ .then(() => true)
453
+ .catch(() => false);
454
+ if (checkboxVisible) {
455
+ return;
456
+ }
457
+ }
458
+ }
459
+ async scrollTermsDialogToBottom(dialog) {
428
460
  const contractScroll = this.page.locator('.ps-contract-scroll').first();
429
461
  if (await contractScroll.isVisible({ timeout: 5000 }).catch(() => false)) {
430
462
  await contractScroll.evaluate((el) => {
@@ -547,8 +579,8 @@ class ConsoleOrganizationPage {
547
579
  }
548
580
  await this.clickOptInButton();
549
581
  await (0, test_1.expect)(this.dialog.first()).toBeVisible({ timeout: 60000 });
550
- await this.scrollToOptInCheckbox();
551
- await this.optInCheckbox.check({ timeout: 90000 });
582
+ await this.scrollToOptInCheckbox(this.optInCheckbox);
583
+ await this.acceptTerms(this.optInCheckbox);
552
584
  await this.closeTermsDialog();
553
585
  await this.page.reload();
554
586
  await this.clickSettingsTab();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1810",
3
+ "version": "0.0.1811",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",