@camunda/e2e-test-suite 0.0.716 → 0.0.717

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.
@@ -15,6 +15,7 @@ declare class OperateProcessesPage {
15
15
  private readonly gotItButton;
16
16
  private readonly processesTabLink;
17
17
  constructor(page: Page);
18
+ private setCheckboxState;
18
19
  private checkCheckbox;
19
20
  private uncheckCheckbox;
20
21
  private uncheckCompletedCheckbox;
@@ -46,44 +46,49 @@ class OperateProcessesPage {
46
46
  });
47
47
  this.gotItButton = page.getByRole('button', { name: 'Got it' });
48
48
  }
49
- async checkCheckbox(checkbox) {
49
+ // Carbon DS checkboxes are hidden inputs — click the label to trigger React's
50
+ // synthetic event. Operate's filter sidebar is URL-bound and the URL→state
51
+ // hydration that runs on mount can revert a click that races with it, so the
52
+ // setter re-clicks (bounded) when the post-click assertion fails.
53
+ async setCheckboxState(checkbox, desired) {
50
54
  await checkbox.waitFor({ state: 'attached', timeout: constants_1._1_SECOND_IN_MS * 10 });
51
- if (!(await checkbox.isChecked())) {
52
- // Carbon DS checkboxes are hidden inputs — click the label to trigger React's
53
- // synthetic event instead of force-checking the hidden input directly, which
54
- // would be overridden by React's controlled state on the next render.
55
- const checkboxId = await checkbox.getAttribute('id');
56
- if (checkboxId) {
57
- await this.page
58
- .locator(`label[for="${checkboxId}"]`)
59
- .click({ timeout: constants_1._1_SECOND_IN_MS * 30 });
55
+ const checkboxId = await checkbox.getAttribute('id');
56
+ const MAX_ATTEMPTS = 4;
57
+ let lastError;
58
+ for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
59
+ if ((await checkbox.isChecked()) !== desired) {
60
+ if (checkboxId) {
61
+ await this.page
62
+ .locator(`label[for="${checkboxId}"]`)
63
+ .click({ timeout: constants_1._1_SECOND_IN_MS * 10 });
64
+ }
65
+ else if (desired) {
66
+ await checkbox.check({ force: true, timeout: constants_1._1_SECOND_IN_MS * 10 });
67
+ }
68
+ else {
69
+ await checkbox.uncheck({ force: true, timeout: constants_1._1_SECOND_IN_MS * 10 });
70
+ }
60
71
  }
61
- else {
62
- await checkbox.check({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
72
+ try {
73
+ await (0, test_1.expect)(checkbox).toBeChecked({
74
+ checked: desired,
75
+ timeout: constants_1._1_SECOND_IN_MS * 5,
76
+ });
77
+ return;
78
+ }
79
+ catch (err) {
80
+ lastError = err;
63
81
  }
64
- await (0, test_1.expect)(checkbox).toBeChecked({
65
- checked: true,
66
- timeout: constants_1._1_SECOND_IN_MS * 30,
67
- });
68
82
  }
83
+ throw lastError instanceof Error
84
+ ? lastError
85
+ : new Error(`Checkbox did not settle to checked=${desired} after ${MAX_ATTEMPTS} attempts`);
86
+ }
87
+ async checkCheckbox(checkbox) {
88
+ await this.setCheckboxState(checkbox, true);
69
89
  }
70
90
  async uncheckCheckbox(checkbox) {
71
- await checkbox.waitFor({ state: 'attached', timeout: constants_1._1_SECOND_IN_MS * 10 });
72
- if (await checkbox.isChecked()) {
73
- const checkboxId = await checkbox.getAttribute('id');
74
- if (checkboxId) {
75
- await this.page
76
- .locator(`label[for="${checkboxId}"]`)
77
- .click({ timeout: constants_1._1_SECOND_IN_MS * 30 });
78
- }
79
- else {
80
- await checkbox.uncheck({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
81
- }
82
- await (0, test_1.expect)(checkbox).toBeChecked({
83
- checked: false,
84
- timeout: constants_1._1_SECOND_IN_MS * 30,
85
- });
86
- }
91
+ await this.setCheckboxState(checkbox, false);
87
92
  }
88
93
  async uncheckCompletedCheckbox() {
89
94
  await this.uncheckCheckbox(this.processCompletedCheckbox);
@@ -15,6 +15,7 @@ declare class OperateProcessesPage {
15
15
  private readonly gotItButton;
16
16
  private readonly processesTabLink;
17
17
  constructor(page: Page);
18
+ private setCheckboxState;
18
19
  private checkCheckbox;
19
20
  private uncheckCheckbox;
20
21
  private uncheckCompletedCheckbox;
@@ -46,44 +46,49 @@ class OperateProcessesPage {
46
46
  });
47
47
  this.gotItButton = page.getByRole('button', { name: 'Got it' });
48
48
  }
49
- async checkCheckbox(checkbox) {
49
+ // Carbon DS checkboxes are hidden inputs — click the label to trigger React's
50
+ // synthetic event. Operate's filter sidebar is URL-bound and the URL→state
51
+ // hydration that runs on mount can revert a click that races with it, so the
52
+ // setter re-clicks (bounded) when the post-click assertion fails.
53
+ async setCheckboxState(checkbox, desired) {
50
54
  await checkbox.waitFor({ state: 'attached', timeout: constants_1._1_SECOND_IN_MS * 10 });
51
- if (!(await checkbox.isChecked())) {
52
- // Carbon Design System checkboxes use a hidden input + label pattern.
53
- // Clicking the label triggers the React onChange event; .check({force})
54
- // does not fire synthetic events on hidden inputs.
55
- const id = await checkbox.getAttribute('id');
56
- if (id) {
57
- await this.page
58
- .locator(`label[for="${id}"]`)
59
- .click({ timeout: constants_1._1_SECOND_IN_MS * 30 });
55
+ const checkboxId = await checkbox.getAttribute('id');
56
+ const MAX_ATTEMPTS = 4;
57
+ let lastError;
58
+ for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
59
+ if ((await checkbox.isChecked()) !== desired) {
60
+ if (checkboxId) {
61
+ await this.page
62
+ .locator(`label[for="${checkboxId}"]`)
63
+ .click({ timeout: constants_1._1_SECOND_IN_MS * 10 });
64
+ }
65
+ else if (desired) {
66
+ await checkbox.check({ force: true, timeout: constants_1._1_SECOND_IN_MS * 10 });
67
+ }
68
+ else {
69
+ await checkbox.uncheck({ force: true, timeout: constants_1._1_SECOND_IN_MS * 10 });
70
+ }
60
71
  }
61
- else {
62
- await checkbox.check({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
72
+ try {
73
+ await (0, test_1.expect)(checkbox).toBeChecked({
74
+ checked: desired,
75
+ timeout: constants_1._1_SECOND_IN_MS * 5,
76
+ });
77
+ return;
78
+ }
79
+ catch (err) {
80
+ lastError = err;
63
81
  }
64
- await (0, test_1.expect)(checkbox).toBeChecked({
65
- checked: true,
66
- timeout: constants_1._1_SECOND_IN_MS * 30,
67
- });
68
82
  }
83
+ throw lastError instanceof Error
84
+ ? lastError
85
+ : new Error(`Checkbox did not settle to checked=${desired} after ${MAX_ATTEMPTS} attempts`);
86
+ }
87
+ async checkCheckbox(checkbox) {
88
+ await this.setCheckboxState(checkbox, true);
69
89
  }
70
90
  async uncheckCheckbox(checkbox) {
71
- await checkbox.waitFor({ state: 'attached', timeout: constants_1._1_SECOND_IN_MS * 10 });
72
- if (await checkbox.isChecked()) {
73
- const id = await checkbox.getAttribute('id');
74
- if (id) {
75
- await this.page
76
- .locator(`label[for="${id}"]`)
77
- .click({ timeout: constants_1._1_SECOND_IN_MS * 30 });
78
- }
79
- else {
80
- await checkbox.uncheck({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
81
- }
82
- await (0, test_1.expect)(checkbox).toBeChecked({
83
- checked: false,
84
- timeout: constants_1._1_SECOND_IN_MS * 30,
85
- });
86
- }
91
+ await this.setCheckboxState(checkbox, false);
87
92
  }
88
93
  async uncheckCompletedCheckbox() {
89
94
  await this.uncheckCheckbox(this.processCompletedCheckbox);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.716",
3
+ "version": "0.0.717",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",