@camunda/e2e-test-suite 0.0.547 → 0.0.549
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.
- package/dist/pages/8.10/UtilitiesPage.js +33 -5
- package/dist/pages/SM-8.10/OperateProcessesPage.js +42 -29
- package/dist/pages/SM-8.9/OperateProcessesPage.js +2 -2
- package/dist/tests/8.10/login.spec.js +5 -2
- package/dist/tests/8.10/operate-access-flow.spec.js +99 -5
- package/dist/tests/8.10/optimize-api-tests.spec.js +705 -60
- package/dist/utils/apiHelpers.js +5 -2
- package/dist/utils/utils.js +11 -1
- package/package.json +1 -1
- package/dist/tests/8.10/api-tests-v2.spec.d.ts +0 -1
- package/dist/tests/8.10/api-tests-v2.spec.js +0 -20
|
@@ -9,21 +9,49 @@ const randomSleep_1 = require("../../utils/randomSleep");
|
|
|
9
9
|
const fileUpload_1 = require("../../utils/fileUpload");
|
|
10
10
|
const mailSlurpClient_1 = require("../../utils/mailSlurpClient");
|
|
11
11
|
async function loginWithRetry(page, loginPage, testUser, timeout, maxRetries = 3) {
|
|
12
|
+
let lastError;
|
|
12
13
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
13
14
|
try {
|
|
14
|
-
await page.
|
|
15
|
+
await page.context().clearCookies();
|
|
16
|
+
await page.goto('about:blank');
|
|
17
|
+
await page
|
|
18
|
+
.evaluate(() => {
|
|
19
|
+
try {
|
|
20
|
+
localStorage.clear();
|
|
21
|
+
}
|
|
22
|
+
catch (_) {
|
|
23
|
+
// storage may be unavailable in some contexts
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
sessionStorage.clear();
|
|
27
|
+
}
|
|
28
|
+
catch (_) {
|
|
29
|
+
// storage may be unavailable in some contexts
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.catch(() => { });
|
|
33
|
+
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
34
|
+
await page
|
|
35
|
+
.waitForLoadState('networkidle', { timeout: 30000 })
|
|
36
|
+
.catch(() => { });
|
|
15
37
|
await (0, sleep_1.sleep)(timeout);
|
|
38
|
+
// Confirm we reached the login page before filling credentials.
|
|
39
|
+
// Without this check the locator for 'Email address' can match a hidden
|
|
40
|
+
// invite-user input on the Console page when the logout redirect has not
|
|
41
|
+
// yet completed, causing a 200 s wait before failing.
|
|
42
|
+
await (0, test_1.expect)(loginPage.loginMessage).toBeVisible({ timeout: 60000 });
|
|
16
43
|
await loginPage.loginWithTestUser(testUser);
|
|
17
44
|
return;
|
|
18
45
|
}
|
|
19
46
|
catch (error) {
|
|
47
|
+
lastError = error;
|
|
20
48
|
if (attempt < maxRetries - 1) {
|
|
21
|
-
console.warn(`Attempt ${attempt + 1} failed for logging in. Retrying
|
|
49
|
+
console.warn(`Attempt ${attempt + 1} failed for logging in. Retrying with clean session...`, error);
|
|
22
50
|
await (0, randomSleep_1.randomSleep)(10000, 20000);
|
|
23
51
|
}
|
|
24
52
|
else {
|
|
25
|
-
console.error(
|
|
26
|
-
throw new Error(`Login failed after ${maxRetries} attempts`);
|
|
53
|
+
console.error(lastError);
|
|
54
|
+
throw new Error(`Login failed after ${maxRetries} attempts: ${String(lastError)}`);
|
|
27
55
|
}
|
|
28
56
|
}
|
|
29
57
|
}
|
|
@@ -288,7 +316,7 @@ async function clickInvitationLinkInEmail(page, id) {
|
|
|
288
316
|
}
|
|
289
317
|
exports.clickInvitationLinkInEmail = clickInvitationLinkInEmail;
|
|
290
318
|
async function assertLatestAlertEmail(id, mailSlurp, processName, alertText) {
|
|
291
|
-
const maxRetries =
|
|
319
|
+
const maxRetries = 5;
|
|
292
320
|
for (let retries = 0; retries < maxRetries; retries++) {
|
|
293
321
|
try {
|
|
294
322
|
const email = await mailSlurp.waitForLatestEmail(id, 120000);
|
|
@@ -24,18 +24,12 @@ class OperateProcessesPage {
|
|
|
24
24
|
this.page = page;
|
|
25
25
|
this.processResultCount = page.getByTestId('result-count');
|
|
26
26
|
this.processesTabLink = page.getByRole('link', { name: 'Processes' });
|
|
27
|
-
this.processActiveCheckbox = page
|
|
28
|
-
|
|
29
|
-
.filter({ hasText: 'Active' });
|
|
30
|
-
this.processCompletedCheckbox = page
|
|
31
|
-
.locator('label')
|
|
32
|
-
.filter({ hasText: 'Completed' });
|
|
27
|
+
this.processActiveCheckbox = page.locator('input#active');
|
|
28
|
+
this.processCompletedCheckbox = page.locator('input#completed');
|
|
33
29
|
this.processRunningInstancesCheckbox = page
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
this.processIncidentsCheckbox = page
|
|
37
|
-
.locator('label')
|
|
38
|
-
.filter({ hasText: 'Incidents' });
|
|
30
|
+
.getByTestId('filter-running-instances')
|
|
31
|
+
.getByRole('checkbox');
|
|
32
|
+
this.processIncidentsCheckbox = page.locator('input#incidents');
|
|
39
33
|
this.processPageHeading = page
|
|
40
34
|
.getByTestId('expanded-panel')
|
|
41
35
|
.getByRole('heading', { name: 'Process' });
|
|
@@ -53,22 +47,22 @@ class OperateProcessesPage {
|
|
|
53
47
|
this.gotItButton = page.getByRole('button', { name: 'Got it' });
|
|
54
48
|
}
|
|
55
49
|
async checkCheckbox(checkbox) {
|
|
56
|
-
await checkbox.waitFor({ state: '
|
|
50
|
+
await checkbox.waitFor({ state: 'attached', timeout: constants_1._1_SECOND_IN_MS * 10 });
|
|
57
51
|
if (!(await checkbox.isChecked())) {
|
|
58
|
-
await checkbox.
|
|
52
|
+
await checkbox.check({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
|
|
59
53
|
await (0, test_1.expect)(checkbox).toBeChecked({
|
|
60
54
|
checked: true,
|
|
61
|
-
timeout: constants_1._1_SECOND_IN_MS *
|
|
55
|
+
timeout: constants_1._1_SECOND_IN_MS * 30,
|
|
62
56
|
});
|
|
63
57
|
}
|
|
64
58
|
}
|
|
65
59
|
async uncheckCheckbox(checkbox) {
|
|
66
|
-
await checkbox.waitFor({ state: '
|
|
60
|
+
await checkbox.waitFor({ state: 'attached', timeout: constants_1._1_SECOND_IN_MS * 10 });
|
|
67
61
|
if (await checkbox.isChecked()) {
|
|
68
|
-
await checkbox.
|
|
62
|
+
await checkbox.uncheck({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
|
|
69
63
|
await (0, test_1.expect)(checkbox).toBeChecked({
|
|
70
64
|
checked: false,
|
|
71
|
-
timeout: constants_1._1_SECOND_IN_MS *
|
|
65
|
+
timeout: constants_1._1_SECOND_IN_MS * 30,
|
|
72
66
|
});
|
|
73
67
|
}
|
|
74
68
|
}
|
|
@@ -82,7 +76,7 @@ class OperateProcessesPage {
|
|
|
82
76
|
await this.uncheckCompletedCheckbox();
|
|
83
77
|
await this.clickProcessIncidentsCheckbox();
|
|
84
78
|
await this.processActiveCheckbox.waitFor({
|
|
85
|
-
state: '
|
|
79
|
+
state: 'attached',
|
|
86
80
|
timeout: constants_1._1_SECOND_IN_MS * 10,
|
|
87
81
|
});
|
|
88
82
|
if (await this.processActiveCheckbox.isChecked({ timeout: constants_1._1_SECOND_IN_MS })) {
|
|
@@ -98,7 +92,7 @@ class OperateProcessesPage {
|
|
|
98
92
|
await this.uncheckActiveCheckbox();
|
|
99
93
|
await this.clickProcessIncidentsCheckbox();
|
|
100
94
|
await this.processCompletedCheckbox.waitFor({
|
|
101
|
-
state: '
|
|
95
|
+
state: 'attached',
|
|
102
96
|
timeout: constants_1._1_SECOND_IN_MS * 10,
|
|
103
97
|
});
|
|
104
98
|
if (await this.processCompletedCheckbox.isChecked({ timeout: constants_1._1_SECOND_IN_MS })) {
|
|
@@ -142,11 +136,11 @@ class OperateProcessesPage {
|
|
|
142
136
|
}
|
|
143
137
|
async clickProcessActiveCheckbox() {
|
|
144
138
|
await this.processActiveCheckbox.waitFor({
|
|
145
|
-
state: '
|
|
139
|
+
state: 'attached',
|
|
146
140
|
timeout: constants_1._1_SECOND_IN_MS * 10,
|
|
147
141
|
});
|
|
148
|
-
if (!(await this.processActiveCheckbox.isChecked(
|
|
149
|
-
await this.processActiveCheckbox.
|
|
142
|
+
if (!(await this.processActiveCheckbox.isChecked())) {
|
|
143
|
+
await this.processActiveCheckbox.check({ force: true, timeout: 120000 });
|
|
150
144
|
await (0, test_1.expect)(this.processActiveCheckbox).toBeChecked({
|
|
151
145
|
checked: true,
|
|
152
146
|
timeout: constants_1._1_SECOND_IN_MS * 5,
|
|
@@ -155,11 +149,11 @@ class OperateProcessesPage {
|
|
|
155
149
|
}
|
|
156
150
|
async clickProcessCompletedCheckbox() {
|
|
157
151
|
await this.processCompletedCheckbox.waitFor({
|
|
158
|
-
state: '
|
|
152
|
+
state: 'attached',
|
|
159
153
|
timeout: constants_1._1_SECOND_IN_MS * 10,
|
|
160
154
|
});
|
|
161
|
-
if (!(await this.processCompletedCheckbox.isChecked(
|
|
162
|
-
await this.processCompletedCheckbox.
|
|
155
|
+
if (!(await this.processCompletedCheckbox.isChecked())) {
|
|
156
|
+
await this.processCompletedCheckbox.check({ force: true, timeout: 120000 });
|
|
163
157
|
await (0, test_1.expect)(this.processCompletedCheckbox).toBeChecked({
|
|
164
158
|
checked: true,
|
|
165
159
|
timeout: constants_1._1_SECOND_IN_MS * 5,
|
|
@@ -168,11 +162,19 @@ class OperateProcessesPage {
|
|
|
168
162
|
}
|
|
169
163
|
async clickProcessIncidentsCheckbox() {
|
|
170
164
|
await this.processIncidentsCheckbox.waitFor({
|
|
171
|
-
state: '
|
|
165
|
+
state: 'attached',
|
|
172
166
|
timeout: constants_1._1_SECOND_IN_MS * 10,
|
|
173
167
|
});
|
|
174
168
|
const wasChecked = await this.processIncidentsCheckbox.isChecked();
|
|
175
|
-
|
|
169
|
+
if (wasChecked) {
|
|
170
|
+
await this.processIncidentsCheckbox.uncheck({
|
|
171
|
+
force: true,
|
|
172
|
+
timeout: 90000,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
await this.processIncidentsCheckbox.check({ force: true, timeout: 90000 });
|
|
177
|
+
}
|
|
176
178
|
await (0, test_1.expect)(this.processIncidentsCheckbox).toBeChecked({
|
|
177
179
|
checked: !wasChecked,
|
|
178
180
|
timeout: constants_1._1_SECOND_IN_MS * 5,
|
|
@@ -180,11 +182,22 @@ class OperateProcessesPage {
|
|
|
180
182
|
}
|
|
181
183
|
async clickRunningProcessInstancesCheckbox() {
|
|
182
184
|
await this.processRunningInstancesCheckbox.waitFor({
|
|
183
|
-
state: '
|
|
185
|
+
state: 'attached',
|
|
184
186
|
timeout: constants_1._1_SECOND_IN_MS * 10,
|
|
185
187
|
});
|
|
186
188
|
const wasChecked = await this.processRunningInstancesCheckbox.isChecked();
|
|
187
|
-
|
|
189
|
+
if (wasChecked) {
|
|
190
|
+
await this.processRunningInstancesCheckbox.uncheck({
|
|
191
|
+
force: true,
|
|
192
|
+
timeout: 90000,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
await this.processRunningInstancesCheckbox.check({
|
|
197
|
+
force: true,
|
|
198
|
+
timeout: 90000,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
188
201
|
await (0, test_1.expect)(this.processRunningInstancesCheckbox).toBeChecked({
|
|
189
202
|
checked: !wasChecked,
|
|
190
203
|
timeout: constants_1._1_SECOND_IN_MS * 5,
|
|
@@ -52,7 +52,7 @@ class OperateProcessesPage {
|
|
|
52
52
|
await checkbox.check({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
|
|
53
53
|
await (0, test_1.expect)(checkbox).toBeChecked({
|
|
54
54
|
checked: true,
|
|
55
|
-
timeout: constants_1._1_SECOND_IN_MS *
|
|
55
|
+
timeout: constants_1._1_SECOND_IN_MS * 30,
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -62,7 +62,7 @@ class OperateProcessesPage {
|
|
|
62
62
|
await checkbox.uncheck({ force: true, timeout: constants_1._1_SECOND_IN_MS * 30 });
|
|
63
63
|
await (0, test_1.expect)(checkbox).toBeChecked({
|
|
64
64
|
checked: false,
|
|
65
|
-
timeout: constants_1._1_SECOND_IN_MS *
|
|
65
|
+
timeout: constants_1._1_SECOND_IN_MS * 30,
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -7,6 +7,7 @@ const sleep_1 = require("../../utils/sleep");
|
|
|
7
7
|
_8_10_1.test.describe.configure({ mode: 'parallel' });
|
|
8
8
|
_8_10_1.test.describe('Login Tests', () => {
|
|
9
9
|
_8_10_1.test.beforeEach(async ({ page }, testInfo) => {
|
|
10
|
+
await page.context().clearCookies();
|
|
10
11
|
await page.goto('/');
|
|
11
12
|
await (0, sleep_1.sleep)((testInfo.workerIndex + 1) * 1000);
|
|
12
13
|
});
|
|
@@ -15,11 +16,13 @@ _8_10_1.test.describe('Login Tests', () => {
|
|
|
15
16
|
await (0, _setup_1.captureFailureVideo)(page, testInfo);
|
|
16
17
|
});
|
|
17
18
|
(0, _8_10_1.test)('Basic Login', async ({ loginPage, homePage }) => {
|
|
19
|
+
await (0, test_1.expect)(loginPage.loginMessage).toBeVisible({ timeout: 60000 });
|
|
20
|
+
await (0, test_1.expect)(loginPage.usernameInput.locator).toBeVisible({ timeout: 60000 });
|
|
18
21
|
await loginPage.fillUsername(process.env.C8_USERNAME);
|
|
19
|
-
await (0, test_1.expect)(loginPage.loginMessage).toBeVisible();
|
|
20
22
|
await loginPage.clickContinueButton();
|
|
23
|
+
await (0, test_1.expect)(loginPage.passwordHeading).toBeVisible({ timeout: 60000 });
|
|
24
|
+
await (0, test_1.expect)(loginPage.passwordInput).toBeVisible({ timeout: 60000 });
|
|
21
25
|
await loginPage.fillPassword(process.env.C8_PASSWORD);
|
|
22
|
-
await (0, test_1.expect)(loginPage.passwordHeading).toBeVisible();
|
|
23
26
|
await loginPage.clickLoginButton();
|
|
24
27
|
await (0, test_1.expect)(homePage.consoleBanner).toBeVisible({ timeout: 120000 });
|
|
25
28
|
});
|
|
@@ -4,13 +4,18 @@ const test_1 = require("@playwright/test");
|
|
|
4
4
|
const _8_10_1 = require("../../fixtures/8.10");
|
|
5
5
|
const UtilitiesPage_1 = require("../../pages/8.10/UtilitiesPage");
|
|
6
6
|
const _setup_1 = require("../../test-setup.js");
|
|
7
|
+
const apiHelpers_1 = require("../../utils/apiHelpers");
|
|
7
8
|
const users_1 = require("../../utils/users");
|
|
9
|
+
const urlHelpers_1 = require("../../utils/urlHelpers");
|
|
8
10
|
const testUser = (0, users_1.getTestUser)('twentySecondUser');
|
|
9
11
|
// This test covers the manual scenario: create a new API client via UI, copy the Operate URL, and verify the Operate endpoint denies unauthenticated access.
|
|
10
12
|
_8_10_1.test.describe.configure({ mode: 'parallel' });
|
|
11
13
|
_8_10_1.test.describe('Operate access requires authentication @tasklistV2', () => {
|
|
12
14
|
let clientName;
|
|
13
15
|
const clusterName = 'Test Cluster';
|
|
16
|
+
_8_10_1.test.beforeEach(async ({ page, loginPage }, testInfo) => {
|
|
17
|
+
await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
|
|
18
|
+
});
|
|
14
19
|
_8_10_1.test.afterEach(async ({ page, homePage, clusterPage, clusterDetailsPage }, testInfo) => {
|
|
15
20
|
await (0, _setup_1.captureScreenshot)(page, testInfo);
|
|
16
21
|
await (0, _setup_1.captureFailureVideo)(page, testInfo);
|
|
@@ -21,9 +26,6 @@ _8_10_1.test.describe('Operate access requires authentication @tasklistV2', () =
|
|
|
21
26
|
await clusterDetailsPage.deleteAPIClientsIfExist(clientName);
|
|
22
27
|
}
|
|
23
28
|
});
|
|
24
|
-
_8_10_1.test.beforeEach(async ({ page, loginPage }, testInfo) => {
|
|
25
|
-
await (0, UtilitiesPage_1.loginWithRetry)(page, loginPage, testUser, (testInfo.workerIndex + 1) * 1000);
|
|
26
|
-
});
|
|
27
29
|
(0, _8_10_1.test)('check that request POST /v2/process-definitions/search returns 401 without credentials', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
28
30
|
clientName = `operate-deny-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
29
31
|
await _8_10_1.test.step('Add API Client to Cluster', async () => {
|
|
@@ -43,13 +45,105 @@ _8_10_1.test.describe('Operate access requires authentication @tasklistV2', () =
|
|
|
43
45
|
await clusterDetailsPage.clickAPITab();
|
|
44
46
|
});
|
|
45
47
|
await _8_10_1.test.step('POST search endpoint without auth should be rejected', async () => {
|
|
46
|
-
const sanitizedOperateUrl =
|
|
48
|
+
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
47
49
|
const response = await request.post(`${sanitizedOperateUrl}/v2/process-definitions/search`, {
|
|
48
50
|
data: { filter: {}, size: 10 },
|
|
49
51
|
});
|
|
50
52
|
(0, test_1.expect)(response.status()).toBe(401);
|
|
51
53
|
const body = await response.text();
|
|
52
|
-
(0, test_1.expect)(body
|
|
54
|
+
(0, test_1.expect)(body).toBe('');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
(0, _8_10_1.test)('check that request POST /v2/process-definitions/search returns 200 with valid credentials', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
58
|
+
clientName = `operate-allow-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
59
|
+
let operateUrl = '';
|
|
60
|
+
await _8_10_1.test.step('Add API Client to Cluster', async () => {
|
|
61
|
+
await homePage.clickClusters();
|
|
62
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
63
|
+
await clusterDetailsPage.clickAPITab();
|
|
64
|
+
await clusterDetailsPage.createAPIClient(clientName);
|
|
65
|
+
await clusterDetailsPage.clickCloseModalButton();
|
|
66
|
+
await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
|
|
67
|
+
});
|
|
68
|
+
await _8_10_1.test.step('Capture Operate URL', async () => {
|
|
69
|
+
await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
|
|
70
|
+
operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
|
|
71
|
+
(0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
|
|
72
|
+
await clientCredentialsDetailsPage.goBack();
|
|
73
|
+
await clusterDetailsPage.clickAPITab();
|
|
74
|
+
});
|
|
75
|
+
await _8_10_1.test.step('POST search endpoint with valid Zeebe bearer token returns 200 or is routed', async () => {
|
|
76
|
+
const validToken = await (0, apiHelpers_1.authSaasAPI)();
|
|
77
|
+
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
78
|
+
const response = await request.post(`${sanitizedOperateUrl}/v2/process-definitions/search`, {
|
|
79
|
+
headers: {
|
|
80
|
+
Authorization: validToken,
|
|
81
|
+
'Content-Type': 'application/json',
|
|
82
|
+
},
|
|
83
|
+
data: { filter: {}, size: 10 },
|
|
84
|
+
});
|
|
85
|
+
(0, test_1.expect)([200, 405]).toContain(response.status());
|
|
86
|
+
if (response.status() === 200) {
|
|
87
|
+
const body = await response.json();
|
|
88
|
+
(0, test_1.expect)(body).toHaveProperty('items');
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
(0, _8_10_1.test)('check that POST /v2/user-tasks/search returns 401 without credentials', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
93
|
+
clientName = `tasklist-deny-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
94
|
+
let operateUrl = '';
|
|
95
|
+
await _8_10_1.test.step('Add API Client to Cluster', async () => {
|
|
96
|
+
await homePage.clickClusters();
|
|
97
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
98
|
+
await clusterDetailsPage.clickAPITab();
|
|
99
|
+
await clusterDetailsPage.createAPIClient(clientName);
|
|
100
|
+
await clusterDetailsPage.clickCloseModalButton();
|
|
101
|
+
await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
|
|
102
|
+
});
|
|
103
|
+
await _8_10_1.test.step('Capture Operate URL (base URL shared with Tasklist v2 endpoint)', async () => {
|
|
104
|
+
await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
|
|
105
|
+
operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
|
|
106
|
+
(0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
|
|
107
|
+
await clientCredentialsDetailsPage.goBack();
|
|
108
|
+
await clusterDetailsPage.clickAPITab();
|
|
109
|
+
});
|
|
110
|
+
await _8_10_1.test.step('POST /v2/user-tasks/search without auth returns 401', async () => {
|
|
111
|
+
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
112
|
+
const response = await request.post(`${sanitizedOperateUrl}/v2/user-tasks/search`, {
|
|
113
|
+
data: { filter: {}, size: 10 },
|
|
114
|
+
});
|
|
115
|
+
(0, test_1.expect)(response.status()).toBe(401);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
(0, _8_10_1.test)('check that POST /v2/process-definitions/search with wrong-audience token returns 401', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
119
|
+
clientName = `operate-wrong-aud-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
120
|
+
let operateUrl = '';
|
|
121
|
+
await _8_10_1.test.step('Add API Client to Cluster', async () => {
|
|
122
|
+
await homePage.clickClusters();
|
|
123
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
124
|
+
await clusterDetailsPage.clickAPITab();
|
|
125
|
+
await clusterDetailsPage.createAPIClient(clientName);
|
|
126
|
+
await clusterDetailsPage.clickCloseModalButton();
|
|
127
|
+
await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
|
|
128
|
+
});
|
|
129
|
+
await _8_10_1.test.step('Capture Operate URL', async () => {
|
|
130
|
+
await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
|
|
131
|
+
operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
|
|
132
|
+
(0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
|
|
133
|
+
await clientCredentialsDetailsPage.goBack();
|
|
134
|
+
await clusterDetailsPage.clickAPITab();
|
|
135
|
+
});
|
|
136
|
+
await _8_10_1.test.step('Token scoped for Optimize audience rejected by Operate endpoint', async () => {
|
|
137
|
+
const optimizeToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
138
|
+
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
139
|
+
const response = await request.post(`${sanitizedOperateUrl}/v2/process-definitions/search`, {
|
|
140
|
+
headers: {
|
|
141
|
+
Authorization: optimizeToken,
|
|
142
|
+
'Content-Type': 'application/json',
|
|
143
|
+
},
|
|
144
|
+
data: { filter: {}, size: 10 },
|
|
145
|
+
});
|
|
146
|
+
(0, test_1.expect)([401, 403]).toContain(response.status());
|
|
53
147
|
});
|
|
54
148
|
});
|
|
55
149
|
});
|