@digital-ai/devops-page-object-deploy 0.0.9 → 0.0.11

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/module.js CHANGED
@@ -1137,6 +1137,248 @@ class $3fb4750cbb53e5e6$export$1533b625ec0c75e2 extends (0, $6480ad852470b7ac$ex
1137
1137
 
1138
1138
 
1139
1139
 
1140
+ class $fe9360dc1f965c8f$export$95a11cbd2815051e extends (0, $6480ad852470b7ac$export$cb21416f3c2fd176) {
1141
+ constructor(page){
1142
+ super(page);
1143
+ }
1144
+ /* Helps to navigate to the Gitops Configuration page */ async navigateToGitopsConfigurationPage() {
1145
+ await this.openRootContextMenu('Configuration');
1146
+ await this.page.getByRole('link', {
1147
+ name: 'New'
1148
+ }).click();
1149
+ await this.page.locator('a[title="git"]').click();
1150
+ await this.page.getByRole('link', {
1151
+ name: 'GitSource'
1152
+ }).click();
1153
+ await this.ensureExplorerTreeReady();
1154
+ }
1155
+ async openNewgitops() {
1156
+ await this.closeModalIfPresent();
1157
+ await this.ensureExplorerTreeReady();
1158
+ const infrastructureRoot = this.page.locator('span[data-id="Configuration"]');
1159
+ await infrastructureRoot.scrollIntoViewIfNeeded();
1160
+ await infrastructureRoot.click();
1161
+ const contextMenu = this.page.locator('i.context-menu-button[data-id="Configuration"]');
1162
+ await contextMenu.scrollIntoViewIfNeeded();
1163
+ await contextMenu.click({
1164
+ force: true
1165
+ });
1166
+ await this.page.getByRole('link', {
1167
+ name: 'New'
1168
+ }).click();
1169
+ await this.page.locator('a[title="git"]').click();
1170
+ await this.page.getByRole('link', {
1171
+ name: 'GitSource'
1172
+ }).click();
1173
+ }
1174
+ async openConfigurationNewgit() {
1175
+ await this.openNewgitops();
1176
+ }
1177
+ /* Helps to create a gitops ci*/ async createGitopsCI(ciName, gitData) {
1178
+ await this.page.locator('input[name="name"]').fill(ciName);
1179
+ await this.page.locator('input[name="username"]').fill(gitData[0]);
1180
+ await this.page.locator('input[name="password"]').fill(gitData[1]);
1181
+ await this.page.locator('input[name="url"]').fill(gitData[2]);
1182
+ await this.page.getByRole('button', {
1183
+ name: /^Save and close$/i
1184
+ }).click();
1185
+ await this.handleSaveToastOrAlreadyExists();
1186
+ }
1187
+ /**
1188
+ * Opens New -> git -> GitDirectory under the provided GitSource node.
1189
+ * @param gitSourceDataId The full tree data-id, e.g. "Configuration/MyGitSource"
1190
+ */ async openNewGitDirectoryUnderGitSource(gitSourceDataId) {
1191
+ const configurationToggle = this.page.locator('div[data-id="Configuration"] .infinite-tree-node > a');
1192
+ const gitSourceNode = this.page.locator(`span[data-id="${gitSourceDataId}"]`);
1193
+ for(let attempt = 0; attempt < 3; attempt += 1){
1194
+ if (await gitSourceNode.count() > 0 && await gitSourceNode.isVisible()) break;
1195
+ await configurationToggle.click();
1196
+ await this.page.waitForTimeout(500);
1197
+ }
1198
+ await gitSourceNode.scrollIntoViewIfNeeded();
1199
+ await gitSourceNode.hover();
1200
+ const contextMenu = this.page.locator(`i.context-menu-button[data-id="${gitSourceDataId}"]`);
1201
+ await contextMenu.waitFor({
1202
+ state: 'visible',
1203
+ timeout: 5000
1204
+ });
1205
+ await contextMenu.click({
1206
+ force: true
1207
+ });
1208
+ await this.page.getByRole('link', {
1209
+ name: /^New$/i
1210
+ }).click();
1211
+ await this.page.getByRole('link', {
1212
+ name: /^git$/i
1213
+ }).click();
1214
+ await this.page.getByRole('link', {
1215
+ name: /^GitDirectory$/i
1216
+ }).click();
1217
+ }
1218
+ /**
1219
+ * Runs the "Check connection" control task on the given GitSource node once.
1220
+ * @param gitSourceDataId The full tree data-id, e.g. "Configuration/MyGitSource"
1221
+ */ async runCheckConnection(gitSourceDataId) {
1222
+ const configurationToggle = this.page.locator('div[data-id="Configuration"] .infinite-tree-node > a');
1223
+ const gitSourceNode = this.page.locator(`span[data-id="${gitSourceDataId}"]`);
1224
+ // Ensure the GitSource node is visible in the tree before opening context menu.
1225
+ for(let attempt = 0; attempt < 3; attempt += 1){
1226
+ if (await gitSourceNode.count() > 0 && await gitSourceNode.isVisible()) break;
1227
+ await configurationToggle.click();
1228
+ await this.page.waitForTimeout(500);
1229
+ }
1230
+ await gitSourceNode.waitFor({
1231
+ state: 'visible',
1232
+ timeout: 5000
1233
+ });
1234
+ await gitSourceNode.scrollIntoViewIfNeeded();
1235
+ await gitSourceNode.hover();
1236
+ const ctxBtn = this.page.locator(`i.context-menu-button[data-id="${gitSourceDataId}"]`);
1237
+ await ctxBtn.waitFor({
1238
+ state: 'visible',
1239
+ timeout: 5000
1240
+ });
1241
+ await ctxBtn.click({
1242
+ force: true
1243
+ });
1244
+ await this.page.getByRole('link', {
1245
+ name: /check connection/i
1246
+ }).click();
1247
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().waitFor({
1248
+ state: 'visible',
1249
+ timeout: 10000
1250
+ });
1251
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().click();
1252
+ // Wait for DONE status
1253
+ const doneLabel = this.page.locator('span.label', {
1254
+ hasText: 'DONE'
1255
+ }).first();
1256
+ await doneLabel.waitFor({
1257
+ state: 'visible',
1258
+ timeout: 45000
1259
+ });
1260
+ // Capture task ID using the same source as deployment flows.
1261
+ const taskIdLocator = this.page.locator('div.task-id').first();
1262
+ await (0, $lE6ZQ$expect)(taskIdLocator).toBeVisible({
1263
+ timeout: 60000
1264
+ });
1265
+ await (0, $lE6ZQ$expect)(taskIdLocator).not.toHaveText('', {
1266
+ timeout: 60000
1267
+ });
1268
+ const capturedTaskId = (await taskIdLocator.textContent() ?? '').trim();
1269
+ if (!capturedTaskId) throw new Error(`Unable to capture check connection task ID for ${gitSourceDataId}.`);
1270
+ this.taskId = capturedTaskId;
1271
+ this.executedText = 'DONE';
1272
+ this.targetCi = gitSourceDataId;
1273
+ // Finish
1274
+ const finishButton = this.page.locator('button.finish.xl-primary, button:has-text("Finish")').first();
1275
+ if (await finishButton.isVisible()) await finishButton.click();
1276
+ // Wait for modal/plan to close
1277
+ const modal = this.page.locator('div.xl-react-widget-modal-dialog.in');
1278
+ if (await modal.count() > 0) await modal.first().waitFor({
1279
+ state: 'hidden',
1280
+ timeout: 15000
1281
+ });
1282
+ }
1283
+ /**
1284
+ * Runs the "Check connection" control task and expects it to fail with invalid credentials.
1285
+ * @param gitSourceDataId The full tree data-id, e.g. "Configuration/MyGitSource"
1286
+ */ async runCheckConnectionExpectFailure(gitSourceDataId) {
1287
+ const configurationToggle = this.page.locator('div[data-id="Configuration"] .infinite-tree-node > a');
1288
+ const gitSourceNode = this.page.locator(`span[data-id="${gitSourceDataId}"]`);
1289
+ // Ensure the GitSource node is visible in the tree before opening context menu.
1290
+ for(let attempt = 0; attempt < 3; attempt += 1){
1291
+ if (await gitSourceNode.count() > 0 && await gitSourceNode.isVisible()) break;
1292
+ await configurationToggle.click();
1293
+ await this.page.waitForTimeout(500);
1294
+ }
1295
+ await gitSourceNode.scrollIntoViewIfNeeded();
1296
+ await gitSourceNode.hover();
1297
+ const ctxBtn = this.page.locator(`i.context-menu-button[data-id="${gitSourceDataId}"]`);
1298
+ await ctxBtn.waitFor({
1299
+ state: 'visible',
1300
+ timeout: 5000
1301
+ });
1302
+ await ctxBtn.click({
1303
+ force: true
1304
+ });
1305
+ await this.page.getByRole('link', {
1306
+ name: /check connection/i
1307
+ }).click();
1308
+ // Click Execute button
1309
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().waitFor({
1310
+ state: 'visible',
1311
+ timeout: 10000
1312
+ });
1313
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().click();
1314
+ // Wait for FAILED status (instead of EXECUTED)
1315
+ const failedLabel = this.page.locator('span.label', {
1316
+ hasText: 'FAILED'
1317
+ }).first();
1318
+ await failedLabel.waitFor({
1319
+ state: 'visible',
1320
+ timeout: 30000
1321
+ });
1322
+ // Finish
1323
+ const finishButton = this.page.locator('button.finish.xl-primary, button:has-text("Finish")').first();
1324
+ if (await finishButton.isVisible()) await finishButton.click();
1325
+ // Wait for modal/plan to close
1326
+ const modal = this.page.locator('div.xl-react-widget-modal-dialog.in');
1327
+ if (await modal.count() > 0) await modal.first().waitFor({
1328
+ state: 'hidden',
1329
+ timeout: 15000
1330
+ });
1331
+ }
1332
+ /**
1333
+ * Verifies the captured Check Connection task in Reports -> Control tasks.
1334
+ */ async verifyCheckConnectionTaskInReports() {
1335
+ if (!this.taskId) throw new Error('Check connection task ID is empty. Run check connection before verifying reports.');
1336
+ await this.page.locator('p.MuiTypography-root', {
1337
+ hasText: 'Reports'
1338
+ }).click();
1339
+ const controlTasksTab = this.page.locator('.app-root .dot-sidebar .dot-list p').filter({
1340
+ hasText: 'Control tasks'
1341
+ }).first();
1342
+ await controlTasksTab.scrollIntoViewIfNeeded();
1343
+ await controlTasksTab.click();
1344
+ const pane = this.page.locator('#pane-ControlTasksTab');
1345
+ await pane.waitFor({
1346
+ state: 'visible',
1347
+ timeout: 20000
1348
+ });
1349
+ const showFilters = pane.getByRole('button', {
1350
+ name: 'Show filters'
1351
+ });
1352
+ if (await showFilters.isVisible()) await showFilters.click({
1353
+ force: true
1354
+ });
1355
+ const taskIdFilter = pane.locator('.control-task-id input[placeholder="Search"]');
1356
+ await taskIdFilter.fill(this.taskId);
1357
+ const tableBody = pane.locator('table.table-striped tbody');
1358
+ const row = tableBody.locator('tr').filter({
1359
+ hasText: this.taskId
1360
+ }).first();
1361
+ for(let attempt = 0; attempt < 3; attempt += 1){
1362
+ if (await row.count() > 0 && await row.isVisible()) break;
1363
+ const refreshButton = pane.getByRole('button', {
1364
+ name: 'Refresh'
1365
+ });
1366
+ if (await refreshButton.isVisible()) await refreshButton.click();
1367
+ await this.page.waitForTimeout(1500);
1368
+ }
1369
+ await (0, $lE6ZQ$expect)(row).toBeVisible({
1370
+ timeout: 30000
1371
+ });
1372
+ await (0, $lE6ZQ$expect)(row).toContainText(this.taskId);
1373
+ await (0, $lE6ZQ$expect)(row).toContainText(/check connection/i);
1374
+ await (0, $lE6ZQ$expect)(row).toContainText(new RegExp(this.executedText, 'i'));
1375
+ await (0, $lE6ZQ$expect)(row).toContainText(this.targetCi);
1376
+ }
1377
+ }
1378
+
1379
+
1380
+
1381
+
1140
1382
  class $5eb37a606d823774$export$b8a443164510a1b4 extends (0, $7d546dcaafadc158$export$2b65d1d97338f32b) {
1141
1383
  async openTab(tabLabel, paneId) {
1142
1384
  const tab = this.page.locator('.app-root .dot-sidebar .dot-list p').filter({
@@ -2530,6 +2772,39 @@ class $e3cbc2135fe6aa40$export$ecd8b3e50e92d781 extends (0, $6480ad852470b7ac$ex
2530
2772
  }
2531
2773
 
2532
2774
 
2775
+
2776
+ class $9c5904ab27d13841$export$170f2cb42585788e extends (0, $6480ad852470b7ac$export$cb21416f3c2fd176) {
2777
+ /* Navigates to the Configuration Edit Permissions page via the tree context menu */ async navigateToPage() {
2778
+ await this.openRootContextMenu('Configuration');
2779
+ await this.page.getByRole('link', {
2780
+ name: 'Edit Permissions'
2781
+ }).click();
2782
+ }
2783
+ async navigateToConfigurationEditPermissionsPage() {
2784
+ await this.navigateToPage();
2785
+ }
2786
+ /* Gives the permissions to a role */ async givePermissionsToRole(roleName) {
2787
+ const filter = this.page.getByPlaceholder('Filter by roles').first();
2788
+ await filter.waitFor({
2789
+ state: 'visible'
2790
+ });
2791
+ await filter.scrollIntoViewIfNeeded();
2792
+ await filter.fill(roleName);
2793
+ const roleRow = this.page.locator('table.table-striped tbody tr').first();
2794
+ const checkboxes = roleRow.locator('input[type="checkbox"]');
2795
+ const count = await checkboxes.count();
2796
+ for(let i = 0; i < count; i += 1){
2797
+ const checkbox = checkboxes.nth(i);
2798
+ if (!await checkbox.isChecked()) await checkbox.check();
2799
+ }
2800
+ await this.page.getByRole('button', {
2801
+ name: 'Save and close'
2802
+ }).click();
2803
+ await this.handleSaveToastOrAlreadyExists();
2804
+ }
2805
+ }
2806
+
2807
+
2533
2808
  class $95d5ebc9765b570f$export$b8a61e5c71402559 extends (0, $6480ad852470b7ac$export$cb21416f3c2fd176) {
2534
2809
  constructor(page){
2535
2810
  super(page);
@@ -2545,6 +2820,8 @@ class $95d5ebc9765b570f$export$b8a61e5c71402559 extends (0, $6480ad852470b7ac$ex
2545
2820
  this.infrastructureEditPermissionsPage = new (0, $801d6ccd71155137$export$e37b272c81a10693)(page);
2546
2821
  this.environmentEditPermissionsPage = new (0, $0c1804a88a0b5036$export$c919546f4bf88f35)(page);
2547
2822
  this.applicationEditPermissionsPage = new (0, $e3cbc2135fe6aa40$export$ecd8b3e50e92d781)(page);
2823
+ this.configurationEditPermissionsPage = new (0, $9c5904ab27d13841$export$170f2cb42585788e)(page);
2824
+ this.gitopsConfigurationPage = new (0, $fe9360dc1f965c8f$export$95a11cbd2815051e)(page);
2548
2825
  }
2549
2826
  async navigateToHomePage() {
2550
2827
  await this.page.goto('/home');