@camunda/e2e-test-suite 0.0.1171 → 0.0.1172

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.
@@ -14,6 +14,8 @@ declare class TaskPanelPage {
14
14
  constructor(page: Page);
15
15
  openTask(name: string, assignButton?: boolean): Promise<void>;
16
16
  filterBy(option: 'All open' | 'Unassigned' | 'Assigned to me' | 'Completed'): Promise<void>;
17
+ private expandFilterPanel;
18
+ private static appliedFilterUrl;
17
19
  scrollToLastTask(name: string): Promise<void>;
18
20
  scrollToFirstTask(name: string): Promise<void>;
19
21
  clickCollapseFilter(): Promise<void>;
@@ -72,11 +72,66 @@ class TaskPanelPage {
72
72
  }
73
73
  }
74
74
  async filterBy(option) {
75
- await this.filterOptions.click({ timeout: 45000 });
76
- await (0, test_1.expect)(this.page.getByRole('link', { name: option })).toBeVisible({
77
- timeout: 120000,
78
- });
79
- await this.page.getByRole('link', { name: option }).click({ timeout: 120000 });
75
+ // The task list refetches every 5s behind a suspense boundary, so a poll
76
+ // landing on the filter click tears the floating filter panel down before
77
+ // the router navigates: the panel closes but the filter never changes.
78
+ // Nothing downstream notices, so the test fails much later on an assertion
79
+ // that reads the still-unfiltered list -- which is how a dropped click on
80
+ // "Completed" surfaced as the completed-filter heading never appearing.
81
+ // Confirm the route actually carries the filter, and re-pick if it does not.
82
+ const maxAttempts = 3;
83
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
84
+ await this.expandFilterPanel();
85
+ // Deliberately not `exact`: the panel spells the default filter
86
+ // "All open tasks" while callers pass "All open".
87
+ const filterLink = this.page.getByRole('link', { name: option });
88
+ // Only the first attempt waits out a slow first render. Later attempts
89
+ // re-pick from a panel that has already rendered once, so they stay
90
+ // short -- three attempts at the full budget would outlast the
91
+ // 12-minute test timeout and turn a dropped click into a timeout with
92
+ // no retry spent.
93
+ const renderTimeout = attempt === 1 ? 120000 : 15000;
94
+ await (0, test_1.expect)(filterLink).toBeVisible({ timeout: renderTimeout });
95
+ await filterLink.click({ timeout: renderTimeout });
96
+ const applied = await this.page
97
+ .waitForURL(TaskPanelPage.appliedFilterUrl(option), { timeout: 15000 })
98
+ .then(() => true)
99
+ .catch(() => false);
100
+ if (applied) {
101
+ return;
102
+ }
103
+ if (attempt < maxAttempts) {
104
+ console.warn(`Attempt ${attempt} did not apply the "${option}" filter. Retrying...`);
105
+ }
106
+ }
107
+ throw new Error(`Filter "${option}" was not applied after ${maxAttempts} attempts`);
108
+ }
109
+ // The filter panel renders either the collapsed rail (which carries the
110
+ // expand control) or the expanded nav -- never both -- and picking a filter
111
+ // leaves it expanded, so a retry must not click "expand" a second time.
112
+ async expandFilterPanel() {
113
+ const alreadyExpanded = await this.collapseFilter
114
+ .waitFor({ state: 'visible', timeout: 2000 })
115
+ .then(() => true)
116
+ .catch(() => false);
117
+ if (!alreadyExpanded) {
118
+ await this.filterOptions.click({ timeout: 45000 });
119
+ }
120
+ }
121
+ // Tasklist keeps the active filter in the `filter` search param. "All open"
122
+ // is the route's default and is stripped from the URL, so it is asserted as
123
+ // the absence of the param.
124
+ static appliedFilterUrl(option) {
125
+ const filterParam = {
126
+ 'All open': undefined,
127
+ Unassigned: 'unassigned',
128
+ 'Assigned to me': 'assigned-to-me',
129
+ Completed: 'completed',
130
+ };
131
+ const param = filterParam[option];
132
+ return param === undefined
133
+ ? /\/tasklist(?:\/[^?]*)?(?:\?(?!.*\bfilter=).*)?$/
134
+ : new RegExp(`[?&]filter=${param}(?:&|$)`);
80
135
  }
81
136
  async scrollToLastTask(name) {
82
137
  await this.page.getByText(name).last().scrollIntoViewIfNeeded();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/e2e-test-suite",
3
- "version": "0.0.1171",
3
+ "version": "0.0.1172",
4
4
  "description": "End-to-end test helpers for Camunda 8",
5
5
  "repository": {
6
6
  "type": "git",