@camunda/e2e-test-suite 0.0.571 → 0.0.573
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.9/UtilitiesPage.js +27 -4
- package/dist/pages/SM-8.10/IdentityTenantPage.js +47 -24
- package/dist/pages/SM-8.8/IdentityTenantPage.js +47 -24
- package/dist/pages/SM-8.8/OperateProcessesPage.js +9 -3
- package/dist/pages/SM-8.9/IdentityTenantPage.js +47 -24
- package/dist/tests/8.9/api-tests-v2.spec.js +1 -1
- package/dist/tests/8.9/operate-access-flow.spec.js +68 -7
- package/dist/tests/8.9/optimize-api-tests.spec.js +705 -59
- package/dist/utils/apiHelpers.js +41 -7
- package/dist/utils/utils.js +2 -2
- package/package.json +1 -1
|
@@ -9,21 +9,44 @@ 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);
|
|
16
38
|
await loginPage.loginWithTestUser(testUser);
|
|
17
39
|
return;
|
|
18
40
|
}
|
|
19
41
|
catch (error) {
|
|
42
|
+
lastError = error;
|
|
20
43
|
if (attempt < maxRetries - 1) {
|
|
21
|
-
console.warn(`Attempt ${attempt + 1} failed for logging in. Retrying
|
|
44
|
+
console.warn(`Attempt ${attempt + 1} failed for logging in. Retrying with clean session...`, error);
|
|
22
45
|
await (0, randomSleep_1.randomSleep)(10000, 20000);
|
|
23
46
|
}
|
|
24
47
|
else {
|
|
25
|
-
console.error(
|
|
26
|
-
throw new Error(`Login failed after ${maxRetries} attempts`);
|
|
48
|
+
console.error(lastError);
|
|
49
|
+
throw new Error(`Login failed after ${maxRetries} attempts: ${String(lastError)}`);
|
|
27
50
|
}
|
|
28
51
|
}
|
|
29
52
|
}
|
|
@@ -109,21 +109,28 @@ class IdentityTenantPage {
|
|
|
109
109
|
await this.searchUsersInput.fill(user);
|
|
110
110
|
}
|
|
111
111
|
async clickAssignUserFinalButton() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
|
|
113
|
+
await this.assignUserFinalButton.click();
|
|
114
|
+
const successToast = this.page.getByText('Users assigned', { exact: true });
|
|
115
|
+
const errorToast = this.page.getByText('An error occurred');
|
|
116
|
+
const alreadyExists = this.page.getByText('ALREADY_EXISTS');
|
|
117
|
+
await (0, test_1.expect)(successToast.or(errorToast).or(alreadyExists)).toBeVisible({
|
|
118
|
+
timeout: 30000,
|
|
119
|
+
});
|
|
120
|
+
if (await alreadyExists.isVisible()) {
|
|
121
|
+
console.log('User already assigned to tenant');
|
|
122
|
+
await this.cancelButton.click();
|
|
123
|
+
await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
|
|
124
|
+
return;
|
|
116
125
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
else {
|
|
124
|
-
throw new Error('Assigning user to tenant failed' + e);
|
|
125
|
-
}
|
|
126
|
+
if (await errorToast.isVisible()) {
|
|
127
|
+
await this.cancelButton.click().catch(() => { });
|
|
128
|
+
await (0, test_1.expect)(this.dialog)
|
|
129
|
+
.not.toBeVisible({ timeout: 15000 })
|
|
130
|
+
.catch(() => { });
|
|
131
|
+
throw new Error('Identity API returned "An error occurred" when assigning user to tenant');
|
|
126
132
|
}
|
|
133
|
+
// success: "Users assigned" toast visible
|
|
127
134
|
}
|
|
128
135
|
async clickRemoveUserButton() {
|
|
129
136
|
await this.removeUserButton.click();
|
|
@@ -176,18 +183,34 @@ class IdentityTenantPage {
|
|
|
176
183
|
return false;
|
|
177
184
|
}
|
|
178
185
|
async assignUserToTenant(tenantName, user, userEmail) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
const MAX_ATTEMPTS = 3;
|
|
187
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
188
|
+
await (0, sleep_1.sleep)(attempt === 1 ? 1000 : 10000);
|
|
189
|
+
await this.clickTenant(tenantName);
|
|
190
|
+
await this.clickAssignedUsersTab();
|
|
191
|
+
if (await this.isRowVisible(userEmail)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
await this.clickAssignUsersButton();
|
|
196
|
+
await this.clickSearchUsersInput();
|
|
197
|
+
await this.fillSearchUsersInput(user);
|
|
198
|
+
await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({
|
|
199
|
+
timeout: 30000,
|
|
200
|
+
});
|
|
201
|
+
await this.page.getByText(userEmail).click({ timeout: 30000 });
|
|
202
|
+
await this.clickAssignUserFinalButton();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
console.log(`Attempt ${attempt} to assign user '${user}' to tenant '${tenantName}' failed: ${e}.`);
|
|
207
|
+
if (attempt >= MAX_ATTEMPTS) {
|
|
208
|
+
throw new Error(`Failed to assign user '${user}' to tenant '${tenantName}' after ${MAX_ATTEMPTS} attempts: ${e}`);
|
|
209
|
+
}
|
|
210
|
+
await this.page.reload({ timeout: 30000 }).catch(() => { });
|
|
211
|
+
await (0, sleep_1.sleep)(5000);
|
|
212
|
+
}
|
|
184
213
|
}
|
|
185
|
-
await this.clickAssignUsersButton();
|
|
186
|
-
await this.clickSearchUsersInput();
|
|
187
|
-
await this.fillSearchUsersInput(user);
|
|
188
|
-
await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({ timeout: 30000 });
|
|
189
|
-
await this.page.getByText(userEmail).click({ timeout: 30000 });
|
|
190
|
-
await this.clickAssignUserFinalButton();
|
|
191
214
|
}
|
|
192
215
|
async removeUserFromTenant(tenantName) {
|
|
193
216
|
await this.page.getByText(tenantName).first().click();
|
|
@@ -109,21 +109,28 @@ class IdentityTenantPage {
|
|
|
109
109
|
await this.searchUsersInput.fill(user);
|
|
110
110
|
}
|
|
111
111
|
async clickAssignUserFinalButton() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
|
|
113
|
+
await this.assignUserFinalButton.click();
|
|
114
|
+
const successToast = this.page.getByText('Users assigned', { exact: true });
|
|
115
|
+
const errorToast = this.page.getByText('An error occurred');
|
|
116
|
+
const alreadyExists = this.page.getByText('ALREADY_EXISTS');
|
|
117
|
+
await (0, test_1.expect)(successToast.or(errorToast).or(alreadyExists)).toBeVisible({
|
|
118
|
+
timeout: 30000,
|
|
119
|
+
});
|
|
120
|
+
if (await alreadyExists.isVisible()) {
|
|
121
|
+
console.log('User already assigned to tenant');
|
|
122
|
+
await this.cancelButton.click();
|
|
123
|
+
await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
|
|
124
|
+
return;
|
|
116
125
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
else {
|
|
124
|
-
throw new Error('Assigning user to tenant failed' + e);
|
|
125
|
-
}
|
|
126
|
+
if (await errorToast.isVisible()) {
|
|
127
|
+
await this.cancelButton.click().catch(() => { });
|
|
128
|
+
await (0, test_1.expect)(this.dialog)
|
|
129
|
+
.not.toBeVisible({ timeout: 15000 })
|
|
130
|
+
.catch(() => { });
|
|
131
|
+
throw new Error('Identity API returned "An error occurred" when assigning user to tenant');
|
|
126
132
|
}
|
|
133
|
+
// success: "Users assigned" toast visible
|
|
127
134
|
}
|
|
128
135
|
async clickRemoveUserButton() {
|
|
129
136
|
await this.removeUserButton.click();
|
|
@@ -176,18 +183,34 @@ class IdentityTenantPage {
|
|
|
176
183
|
return false;
|
|
177
184
|
}
|
|
178
185
|
async assignUserToTenant(tenantName, user, userEmail) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
const MAX_ATTEMPTS = 3;
|
|
187
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
188
|
+
await (0, sleep_1.sleep)(attempt === 1 ? 1000 : 10000);
|
|
189
|
+
await this.clickTenant(tenantName);
|
|
190
|
+
await this.clickAssignedUsersTab();
|
|
191
|
+
if (await this.isRowVisible(userEmail)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
await this.clickAssignUsersButton();
|
|
196
|
+
await this.clickSearchUsersInput();
|
|
197
|
+
await this.fillSearchUsersInput(user);
|
|
198
|
+
await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({
|
|
199
|
+
timeout: 30000,
|
|
200
|
+
});
|
|
201
|
+
await this.page.getByText(userEmail).click({ timeout: 30000 });
|
|
202
|
+
await this.clickAssignUserFinalButton();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
console.log(`Attempt ${attempt} to assign user '${user}' to tenant '${tenantName}' failed: ${e}.`);
|
|
207
|
+
if (attempt >= MAX_ATTEMPTS) {
|
|
208
|
+
throw new Error(`Failed to assign user '${user}' to tenant '${tenantName}' after ${MAX_ATTEMPTS} attempts: ${e}`);
|
|
209
|
+
}
|
|
210
|
+
await this.page.reload({ timeout: 30000 }).catch(() => { });
|
|
211
|
+
await (0, sleep_1.sleep)(5000);
|
|
212
|
+
}
|
|
184
213
|
}
|
|
185
|
-
await this.clickAssignUsersButton();
|
|
186
|
-
await this.clickSearchUsersInput();
|
|
187
|
-
await this.fillSearchUsersInput(user);
|
|
188
|
-
await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({ timeout: 30000 });
|
|
189
|
-
await this.page.getByText(userEmail).click({ timeout: 30000 });
|
|
190
|
-
await this.clickAssignUserFinalButton();
|
|
191
214
|
}
|
|
192
215
|
async removeUserFromTenant(tenantName) {
|
|
193
216
|
await this.page.getByText(tenantName).first().click();
|
|
@@ -179,8 +179,12 @@ class OperateProcessesPage {
|
|
|
179
179
|
catch (err) {
|
|
180
180
|
lastError = err instanceof Error ? err.message : err;
|
|
181
181
|
console.log(`Attempt ${attempt} failed for "${processName}". URL: ${this.page.url()}. Error: ${String(lastError)}. Reloading...`);
|
|
182
|
-
await this.page
|
|
183
|
-
|
|
182
|
+
await this.page
|
|
183
|
+
.reload({ timeout: 30000 })
|
|
184
|
+
.catch(() => console.log('Page reload timed out or refused, continuing...'));
|
|
185
|
+
await this.page
|
|
186
|
+
.waitForLoadState('networkidle', { timeout: 30000 })
|
|
187
|
+
.catch(() => console.log('waitForLoadState networkidle timed out, continuing...'));
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
throw new Error(`Failed to open instance "${processName}" after ${MAX_ATTEMPTS} attempts. Last error: ${String(lastError)}`);
|
|
@@ -223,7 +227,9 @@ class OperateProcessesPage {
|
|
|
223
227
|
catch (error) {
|
|
224
228
|
retryCount++;
|
|
225
229
|
console.log(`Attempt ${retryCount} failed. Retrying...`);
|
|
226
|
-
await this.page
|
|
230
|
+
await this.page
|
|
231
|
+
.reload({ timeout: 30000 })
|
|
232
|
+
.catch(() => console.log('Page reload timed out or refused, continuing...'));
|
|
227
233
|
await this.page.waitForTimeout(10000);
|
|
228
234
|
}
|
|
229
235
|
}
|
|
@@ -109,21 +109,28 @@ class IdentityTenantPage {
|
|
|
109
109
|
await this.searchUsersInput.fill(user);
|
|
110
110
|
}
|
|
111
111
|
async clickAssignUserFinalButton() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
await (0, test_1.expect)(this.assignUserFinalButton).toBeVisible({ timeout: 60000 });
|
|
113
|
+
await this.assignUserFinalButton.click();
|
|
114
|
+
const successToast = this.page.getByText('Users assigned', { exact: true });
|
|
115
|
+
const errorToast = this.page.getByText('An error occurred');
|
|
116
|
+
const alreadyExists = this.page.getByText('ALREADY_EXISTS');
|
|
117
|
+
await (0, test_1.expect)(successToast.or(errorToast).or(alreadyExists)).toBeVisible({
|
|
118
|
+
timeout: 30000,
|
|
119
|
+
});
|
|
120
|
+
if (await alreadyExists.isVisible()) {
|
|
121
|
+
console.log('User already assigned to tenant');
|
|
122
|
+
await this.cancelButton.click();
|
|
123
|
+
await (0, test_1.expect)(this.dialog).not.toBeVisible({ timeout: 15000 });
|
|
124
|
+
return;
|
|
116
125
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
else {
|
|
124
|
-
throw new Error('Assigning user to tenant failed' + e);
|
|
125
|
-
}
|
|
126
|
+
if (await errorToast.isVisible()) {
|
|
127
|
+
await this.cancelButton.click().catch(() => { });
|
|
128
|
+
await (0, test_1.expect)(this.dialog)
|
|
129
|
+
.not.toBeVisible({ timeout: 15000 })
|
|
130
|
+
.catch(() => { });
|
|
131
|
+
throw new Error('Identity API returned "An error occurred" when assigning user to tenant');
|
|
126
132
|
}
|
|
133
|
+
// success: "Users assigned" toast visible
|
|
127
134
|
}
|
|
128
135
|
async clickRemoveUserButton() {
|
|
129
136
|
await this.removeUserButton.click();
|
|
@@ -176,18 +183,34 @@ class IdentityTenantPage {
|
|
|
176
183
|
return false;
|
|
177
184
|
}
|
|
178
185
|
async assignUserToTenant(tenantName, user, userEmail) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
const MAX_ATTEMPTS = 3;
|
|
187
|
+
for (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {
|
|
188
|
+
await (0, sleep_1.sleep)(attempt === 1 ? 1000 : 10000);
|
|
189
|
+
await this.clickTenant(tenantName);
|
|
190
|
+
await this.clickAssignedUsersTab();
|
|
191
|
+
if (await this.isRowVisible(userEmail)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
await this.clickAssignUsersButton();
|
|
196
|
+
await this.clickSearchUsersInput();
|
|
197
|
+
await this.fillSearchUsersInput(user);
|
|
198
|
+
await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({
|
|
199
|
+
timeout: 30000,
|
|
200
|
+
});
|
|
201
|
+
await this.page.getByText(userEmail).click({ timeout: 30000 });
|
|
202
|
+
await this.clickAssignUserFinalButton();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
console.log(`Attempt ${attempt} to assign user '${user}' to tenant '${tenantName}' failed: ${e}.`);
|
|
207
|
+
if (attempt >= MAX_ATTEMPTS) {
|
|
208
|
+
throw new Error(`Failed to assign user '${user}' to tenant '${tenantName}' after ${MAX_ATTEMPTS} attempts: ${e}`);
|
|
209
|
+
}
|
|
210
|
+
await this.page.reload({ timeout: 30000 }).catch(() => { });
|
|
211
|
+
await (0, sleep_1.sleep)(5000);
|
|
212
|
+
}
|
|
184
213
|
}
|
|
185
|
-
await this.clickAssignUsersButton();
|
|
186
|
-
await this.clickSearchUsersInput();
|
|
187
|
-
await this.fillSearchUsersInput(user);
|
|
188
|
-
await (0, test_1.expect)(this.page.getByText(userEmail)).toBeVisible({ timeout: 30000 });
|
|
189
|
-
await this.page.getByText(userEmail).click({ timeout: 30000 });
|
|
190
|
-
await this.clickAssignUserFinalButton();
|
|
191
214
|
}
|
|
192
215
|
async removeUserFromTenant(tenantName) {
|
|
193
216
|
await this.page.getByText(tenantName).first().click();
|
|
@@ -6,7 +6,7 @@ _8_9_1.test.describe.configure({ mode: 'parallel' });
|
|
|
6
6
|
_8_9_1.test.describe('API V2 tests on SaaS cluster ', () => {
|
|
7
7
|
let bearerToken;
|
|
8
8
|
_8_9_1.test.beforeAll(async () => {
|
|
9
|
-
bearerToken = await (0, apiHelpers_1.authSaasAPI)();
|
|
9
|
+
bearerToken = await (0, apiHelpers_1.authSaasAPI)(process.env.ZEEBE_API_TOKEN_AUDIENCE);
|
|
10
10
|
});
|
|
11
11
|
(0, _8_9_1.test)('Get cluster topology', async ({ request }) => {
|
|
12
12
|
const topologyResponse = await request.get(`${process.env.ZEEBE_API_URL}/v2/topology`, {
|
|
@@ -4,6 +4,7 @@ const test_1 = require("@playwright/test");
|
|
|
4
4
|
const _8_9_1 = require("../../fixtures/8.9");
|
|
5
5
|
const UtilitiesPage_1 = require("../../pages/8.9/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");
|
|
8
9
|
const urlHelpers_1 = require("../../utils/urlHelpers");
|
|
9
10
|
const testUser = (0, users_1.getTestUser)('twentySecondUser');
|
|
@@ -25,8 +26,9 @@ _8_9_1.test.describe('Operate access requires authentication @tasklistV2', () =>
|
|
|
25
26
|
await clusterDetailsPage.deleteAPIClientsIfExist(clientName);
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
|
-
(0, _8_9_1.test)('check that request POST /v2/process-definitions/search returns
|
|
29
|
-
clientName = `operate-
|
|
29
|
+
(0, _8_9_1.test)('check that request POST /v2/process-definitions/search returns 200 with valid credentials', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
30
|
+
clientName = `operate-allow-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
31
|
+
let operateUrl = '';
|
|
30
32
|
await _8_9_1.test.step('Add API Client to Cluster', async () => {
|
|
31
33
|
await homePage.clickClusters();
|
|
32
34
|
await clusterPage.clickClusterLink(clusterName);
|
|
@@ -35,22 +37,81 @@ _8_9_1.test.describe('Operate access requires authentication @tasklistV2', () =>
|
|
|
35
37
|
await clusterDetailsPage.clickCloseModalButton();
|
|
36
38
|
await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
|
|
37
39
|
});
|
|
38
|
-
|
|
39
|
-
await _8_9_1.test.step('Capture Operate URL from client credentials page and close it', async () => {
|
|
40
|
+
await _8_9_1.test.step('Capture Operate URL', async () => {
|
|
40
41
|
await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
|
|
41
42
|
operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
|
|
42
43
|
(0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
|
|
43
44
|
await clientCredentialsDetailsPage.goBack();
|
|
44
45
|
await clusterDetailsPage.clickAPITab();
|
|
45
46
|
});
|
|
46
|
-
await _8_9_1.test.step('POST search endpoint
|
|
47
|
+
await _8_9_1.test.step('POST search endpoint with valid Zeebe bearer token returns 200 or 405', async () => {
|
|
48
|
+
const validToken = await (0, apiHelpers_1.authSaasAPI)();
|
|
47
49
|
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
48
50
|
const response = await request.post(`${sanitizedOperateUrl}/v2/process-definitions/search`, {
|
|
51
|
+
headers: {
|
|
52
|
+
Authorization: validToken,
|
|
53
|
+
'Content-Type': 'application/json',
|
|
54
|
+
},
|
|
55
|
+
data: { filter: {}, size: 10 },
|
|
56
|
+
});
|
|
57
|
+
(0, test_1.expect)([200, 405]).toContain(response.status());
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
(0, _8_9_1.test)('check that POST /v2/user-tasks/search returns 401 without credentials', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
61
|
+
clientName = `tasklist-deny-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
62
|
+
let operateUrl = '';
|
|
63
|
+
await _8_9_1.test.step('Add API Client to Cluster', async () => {
|
|
64
|
+
await homePage.clickClusters();
|
|
65
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
66
|
+
await clusterDetailsPage.clickAPITab();
|
|
67
|
+
await clusterDetailsPage.createAPIClient(clientName);
|
|
68
|
+
await clusterDetailsPage.clickCloseModalButton();
|
|
69
|
+
await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
|
|
70
|
+
});
|
|
71
|
+
await _8_9_1.test.step('Capture Operate URL (base URL shared with Tasklist v2 endpoint)', async () => {
|
|
72
|
+
await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
|
|
73
|
+
operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
|
|
74
|
+
(0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
|
|
75
|
+
await clientCredentialsDetailsPage.goBack();
|
|
76
|
+
await clusterDetailsPage.clickAPITab();
|
|
77
|
+
});
|
|
78
|
+
await _8_9_1.test.step('POST /v2/user-tasks/search without auth returns 401', async () => {
|
|
79
|
+
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
80
|
+
const response = await request.post(`${sanitizedOperateUrl}/v2/user-tasks/search`, {
|
|
49
81
|
data: { filter: {}, size: 10 },
|
|
50
82
|
});
|
|
51
83
|
(0, test_1.expect)(response.status()).toBe(401);
|
|
52
|
-
|
|
53
|
-
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
(0, _8_9_1.test)('check that POST /v2/process-definitions/search with wrong-audience token returns 401', async ({ homePage, clusterPage, clusterDetailsPage, clientCredentialsDetailsPage, request, }) => {
|
|
87
|
+
clientName = `operate-wrong-aud-${await (0, _setup_1.generateRandomStringAsync)(5)}`;
|
|
88
|
+
let operateUrl = '';
|
|
89
|
+
await _8_9_1.test.step('Add API Client to Cluster', async () => {
|
|
90
|
+
await homePage.clickClusters();
|
|
91
|
+
await clusterPage.clickClusterLink(clusterName);
|
|
92
|
+
await clusterDetailsPage.clickAPITab();
|
|
93
|
+
await clusterDetailsPage.createAPIClient(clientName);
|
|
94
|
+
await clusterDetailsPage.clickCloseModalButton();
|
|
95
|
+
await (0, test_1.expect)(clusterDetailsPage.clientsList.filter({ hasText: clientName })).toBeVisible({ timeout: 6000 });
|
|
96
|
+
});
|
|
97
|
+
await _8_9_1.test.step('Capture Operate URL', async () => {
|
|
98
|
+
await clusterDetailsPage.searchAndClickClientCredentialsLink(clientName);
|
|
99
|
+
operateUrl = await clientCredentialsDetailsPage.getOperateUrl();
|
|
100
|
+
(0, test_1.expect)(operateUrl).toMatch(/^https?:\/\//);
|
|
101
|
+
await clientCredentialsDetailsPage.goBack();
|
|
102
|
+
await clusterDetailsPage.clickAPITab();
|
|
103
|
+
});
|
|
104
|
+
await _8_9_1.test.step('Token scoped for Optimize audience rejected by Operate endpoint', async () => {
|
|
105
|
+
const optimizeToken = await (0, apiHelpers_1.authSaasAPI)(process.env.OPTIMIZE_API_TOKEN_AUDIENCE);
|
|
106
|
+
const sanitizedOperateUrl = (0, urlHelpers_1.sanitizeUrl)(operateUrl);
|
|
107
|
+
const response = await request.post(`${sanitizedOperateUrl}/v2/process-definitions/search`, {
|
|
108
|
+
headers: {
|
|
109
|
+
Authorization: optimizeToken,
|
|
110
|
+
'Content-Type': 'application/json',
|
|
111
|
+
},
|
|
112
|
+
data: { filter: {}, size: 10 },
|
|
113
|
+
});
|
|
114
|
+
(0, test_1.expect)([401, 403]).toContain(response.status());
|
|
54
115
|
});
|
|
55
116
|
});
|
|
56
117
|
});
|