@digital-ai/devops-page-object-deploy 0.0.10 → 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
@@ -1136,7 +1136,11 @@ class $3fb4750cbb53e5e6$export$1533b625ec0c75e2 extends (0, $6480ad852470b7ac$ex
1136
1136
 
1137
1137
 
1138
1138
 
1139
+
1139
1140
  class $fe9360dc1f965c8f$export$95a11cbd2815051e extends (0, $6480ad852470b7ac$export$cb21416f3c2fd176) {
1141
+ constructor(page){
1142
+ super(page);
1143
+ }
1140
1144
  /* Helps to navigate to the Gitops Configuration page */ async navigateToGitopsConfigurationPage() {
1141
1145
  await this.openRootContextMenu('Configuration');
1142
1146
  await this.page.getByRole('link', {
@@ -1180,6 +1184,196 @@ class $fe9360dc1f965c8f$export$95a11cbd2815051e extends (0, $6480ad852470b7ac$ex
1180
1184
  }).click();
1181
1185
  await this.handleSaveToastOrAlreadyExists();
1182
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
+ }
1183
1377
  }
1184
1378
 
1185
1379