@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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @digital-ai/devops-page-object-deploy
2
2
 
3
+ ## 0.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 7a22243: Check Connection for Gitops CI
8
+
3
9
  ## 0.0.10
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -1142,7 +1142,11 @@ class $408106958eb335da$export$1533b625ec0c75e2 extends (0, $84f8d1abd29d48fd$ex
1142
1142
 
1143
1143
 
1144
1144
 
1145
+
1145
1146
  class $179e7dbfee839d39$export$95a11cbd2815051e extends (0, $84f8d1abd29d48fd$export$cb21416f3c2fd176) {
1147
+ constructor(page){
1148
+ super(page);
1149
+ }
1146
1150
  /* Helps to navigate to the Gitops Configuration page */ async navigateToGitopsConfigurationPage() {
1147
1151
  await this.openRootContextMenu('Configuration');
1148
1152
  await this.page.getByRole('link', {
@@ -1186,6 +1190,196 @@ class $179e7dbfee839d39$export$95a11cbd2815051e extends (0, $84f8d1abd29d48fd$ex
1186
1190
  }).click();
1187
1191
  await this.handleSaveToastOrAlreadyExists();
1188
1192
  }
1193
+ /**
1194
+ * Opens New -> git -> GitDirectory under the provided GitSource node.
1195
+ * @param gitSourceDataId The full tree data-id, e.g. "Configuration/MyGitSource"
1196
+ */ async openNewGitDirectoryUnderGitSource(gitSourceDataId) {
1197
+ const configurationToggle = this.page.locator('div[data-id="Configuration"] .infinite-tree-node > a');
1198
+ const gitSourceNode = this.page.locator(`span[data-id="${gitSourceDataId}"]`);
1199
+ for(let attempt = 0; attempt < 3; attempt += 1){
1200
+ if (await gitSourceNode.count() > 0 && await gitSourceNode.isVisible()) break;
1201
+ await configurationToggle.click();
1202
+ await this.page.waitForTimeout(500);
1203
+ }
1204
+ await gitSourceNode.scrollIntoViewIfNeeded();
1205
+ await gitSourceNode.hover();
1206
+ const contextMenu = this.page.locator(`i.context-menu-button[data-id="${gitSourceDataId}"]`);
1207
+ await contextMenu.waitFor({
1208
+ state: 'visible',
1209
+ timeout: 5000
1210
+ });
1211
+ await contextMenu.click({
1212
+ force: true
1213
+ });
1214
+ await this.page.getByRole('link', {
1215
+ name: /^New$/i
1216
+ }).click();
1217
+ await this.page.getByRole('link', {
1218
+ name: /^git$/i
1219
+ }).click();
1220
+ await this.page.getByRole('link', {
1221
+ name: /^GitDirectory$/i
1222
+ }).click();
1223
+ }
1224
+ /**
1225
+ * Runs the "Check connection" control task on the given GitSource node once.
1226
+ * @param gitSourceDataId The full tree data-id, e.g. "Configuration/MyGitSource"
1227
+ */ async runCheckConnection(gitSourceDataId) {
1228
+ const configurationToggle = this.page.locator('div[data-id="Configuration"] .infinite-tree-node > a');
1229
+ const gitSourceNode = this.page.locator(`span[data-id="${gitSourceDataId}"]`);
1230
+ // Ensure the GitSource node is visible in the tree before opening context menu.
1231
+ for(let attempt = 0; attempt < 3; attempt += 1){
1232
+ if (await gitSourceNode.count() > 0 && await gitSourceNode.isVisible()) break;
1233
+ await configurationToggle.click();
1234
+ await this.page.waitForTimeout(500);
1235
+ }
1236
+ await gitSourceNode.waitFor({
1237
+ state: 'visible',
1238
+ timeout: 5000
1239
+ });
1240
+ await gitSourceNode.scrollIntoViewIfNeeded();
1241
+ await gitSourceNode.hover();
1242
+ const ctxBtn = this.page.locator(`i.context-menu-button[data-id="${gitSourceDataId}"]`);
1243
+ await ctxBtn.waitFor({
1244
+ state: 'visible',
1245
+ timeout: 5000
1246
+ });
1247
+ await ctxBtn.click({
1248
+ force: true
1249
+ });
1250
+ await this.page.getByRole('link', {
1251
+ name: /check connection/i
1252
+ }).click();
1253
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().waitFor({
1254
+ state: 'visible',
1255
+ timeout: 10000
1256
+ });
1257
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().click();
1258
+ // Wait for DONE status
1259
+ const doneLabel = this.page.locator('span.label', {
1260
+ hasText: 'DONE'
1261
+ }).first();
1262
+ await doneLabel.waitFor({
1263
+ state: 'visible',
1264
+ timeout: 45000
1265
+ });
1266
+ // Capture task ID using the same source as deployment flows.
1267
+ const taskIdLocator = this.page.locator('div.task-id').first();
1268
+ await (0, $1UEKj$playwrighttest.expect)(taskIdLocator).toBeVisible({
1269
+ timeout: 60000
1270
+ });
1271
+ await (0, $1UEKj$playwrighttest.expect)(taskIdLocator).not.toHaveText('', {
1272
+ timeout: 60000
1273
+ });
1274
+ const capturedTaskId = (await taskIdLocator.textContent() ?? '').trim();
1275
+ if (!capturedTaskId) throw new Error(`Unable to capture check connection task ID for ${gitSourceDataId}.`);
1276
+ this.taskId = capturedTaskId;
1277
+ this.executedText = 'DONE';
1278
+ this.targetCi = gitSourceDataId;
1279
+ // Finish
1280
+ const finishButton = this.page.locator('button.finish.xl-primary, button:has-text("Finish")').first();
1281
+ if (await finishButton.isVisible()) await finishButton.click();
1282
+ // Wait for modal/plan to close
1283
+ const modal = this.page.locator('div.xl-react-widget-modal-dialog.in');
1284
+ if (await modal.count() > 0) await modal.first().waitFor({
1285
+ state: 'hidden',
1286
+ timeout: 15000
1287
+ });
1288
+ }
1289
+ /**
1290
+ * Runs the "Check connection" control task and expects it to fail with invalid credentials.
1291
+ * @param gitSourceDataId The full tree data-id, e.g. "Configuration/MyGitSource"
1292
+ */ async runCheckConnectionExpectFailure(gitSourceDataId) {
1293
+ const configurationToggle = this.page.locator('div[data-id="Configuration"] .infinite-tree-node > a');
1294
+ const gitSourceNode = this.page.locator(`span[data-id="${gitSourceDataId}"]`);
1295
+ // Ensure the GitSource node is visible in the tree before opening context menu.
1296
+ for(let attempt = 0; attempt < 3; attempt += 1){
1297
+ if (await gitSourceNode.count() > 0 && await gitSourceNode.isVisible()) break;
1298
+ await configurationToggle.click();
1299
+ await this.page.waitForTimeout(500);
1300
+ }
1301
+ await gitSourceNode.scrollIntoViewIfNeeded();
1302
+ await gitSourceNode.hover();
1303
+ const ctxBtn = this.page.locator(`i.context-menu-button[data-id="${gitSourceDataId}"]`);
1304
+ await ctxBtn.waitFor({
1305
+ state: 'visible',
1306
+ timeout: 5000
1307
+ });
1308
+ await ctxBtn.click({
1309
+ force: true
1310
+ });
1311
+ await this.page.getByRole('link', {
1312
+ name: /check connection/i
1313
+ }).click();
1314
+ // Click Execute button
1315
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().waitFor({
1316
+ state: 'visible',
1317
+ timeout: 10000
1318
+ });
1319
+ await this.page.locator('.xl-react-widget-modal-dialog button.deploy.xl-primary, button.xl-primary:has-text("Execute")').first().click();
1320
+ // Wait for FAILED status (instead of EXECUTED)
1321
+ const failedLabel = this.page.locator('span.label', {
1322
+ hasText: 'FAILED'
1323
+ }).first();
1324
+ await failedLabel.waitFor({
1325
+ state: 'visible',
1326
+ timeout: 30000
1327
+ });
1328
+ // Finish
1329
+ const finishButton = this.page.locator('button.finish.xl-primary, button:has-text("Finish")').first();
1330
+ if (await finishButton.isVisible()) await finishButton.click();
1331
+ // Wait for modal/plan to close
1332
+ const modal = this.page.locator('div.xl-react-widget-modal-dialog.in');
1333
+ if (await modal.count() > 0) await modal.first().waitFor({
1334
+ state: 'hidden',
1335
+ timeout: 15000
1336
+ });
1337
+ }
1338
+ /**
1339
+ * Verifies the captured Check Connection task in Reports -> Control tasks.
1340
+ */ async verifyCheckConnectionTaskInReports() {
1341
+ if (!this.taskId) throw new Error('Check connection task ID is empty. Run check connection before verifying reports.');
1342
+ await this.page.locator('p.MuiTypography-root', {
1343
+ hasText: 'Reports'
1344
+ }).click();
1345
+ const controlTasksTab = this.page.locator('.app-root .dot-sidebar .dot-list p').filter({
1346
+ hasText: 'Control tasks'
1347
+ }).first();
1348
+ await controlTasksTab.scrollIntoViewIfNeeded();
1349
+ await controlTasksTab.click();
1350
+ const pane = this.page.locator('#pane-ControlTasksTab');
1351
+ await pane.waitFor({
1352
+ state: 'visible',
1353
+ timeout: 20000
1354
+ });
1355
+ const showFilters = pane.getByRole('button', {
1356
+ name: 'Show filters'
1357
+ });
1358
+ if (await showFilters.isVisible()) await showFilters.click({
1359
+ force: true
1360
+ });
1361
+ const taskIdFilter = pane.locator('.control-task-id input[placeholder="Search"]');
1362
+ await taskIdFilter.fill(this.taskId);
1363
+ const tableBody = pane.locator('table.table-striped tbody');
1364
+ const row = tableBody.locator('tr').filter({
1365
+ hasText: this.taskId
1366
+ }).first();
1367
+ for(let attempt = 0; attempt < 3; attempt += 1){
1368
+ if (await row.count() > 0 && await row.isVisible()) break;
1369
+ const refreshButton = pane.getByRole('button', {
1370
+ name: 'Refresh'
1371
+ });
1372
+ if (await refreshButton.isVisible()) await refreshButton.click();
1373
+ await this.page.waitForTimeout(1500);
1374
+ }
1375
+ await (0, $1UEKj$playwrighttest.expect)(row).toBeVisible({
1376
+ timeout: 30000
1377
+ });
1378
+ await (0, $1UEKj$playwrighttest.expect)(row).toContainText(this.taskId);
1379
+ await (0, $1UEKj$playwrighttest.expect)(row).toContainText(/check connection/i);
1380
+ await (0, $1UEKj$playwrighttest.expect)(row).toContainText(new RegExp(this.executedText, 'i'));
1381
+ await (0, $1UEKj$playwrighttest.expect)(row).toContainText(this.targetCi);
1382
+ }
1189
1383
  }
1190
1384
 
1191
1385