@digital-ai/devops-page-object-release 0.0.1

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 ADDED
@@ -0,0 +1,590 @@
1
+ import {test as $hOLA6$test, expect as $hOLA6$expect} from "@playwright/test";
2
+ import {execFile as $hOLA6$execFile} from "child_process";
3
+ import $hOLA6$lodashisNil from "lodash/isNil";
4
+ import {env as $hOLA6$env} from "process";
5
+ import $hOLA6$lodashisUndefined from "lodash/isUndefined";
6
+ import $hOLA6$lodasheach from "lodash/each";
7
+ import $hOLA6$lodashforEach from "lodash/forEach";
8
+ import $hOLA6$lodashdefaults from "lodash/defaults";
9
+ import $hOLA6$lodashtoPairs from "lodash/toPairs";
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+ class $9626bc9256ce31f7$export$2b65d1d97338f32b {
19
+ constructor(page){
20
+ this.page = page;
21
+ }
22
+ }
23
+
24
+
25
+ class $5359280e98d97ff9$export$a678525e79c4ccc4 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
26
+ async expectNumberOfReleases(releaseTitle, amount) {
27
+ if (amount === 1) await (0, $hOLA6$expect)(this.page.locator(".release").getByText(releaseTitle)).toBeVisible();
28
+ else await (0, $hOLA6$expect)(this.page.locator(".release").getByText(releaseTitle).count()).toBe(amount);
29
+ }
30
+ async openReleaseByName(releaseTitle) {
31
+ await this.page.locator(".release-line .row-wrapper .release-title-wrapper a", {
32
+ hasText: releaseTitle
33
+ }).click();
34
+ return new (0, $6100b25ffc426db0$export$f43492e8ac3c566)(this.page);
35
+ }
36
+ }
37
+
38
+
39
+
40
+ class $862f65268e488e83$export$fb932093f944abe4 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
41
+ async openRelatedReleasesOf(title) {
42
+ await this.openContextMenu(title);
43
+ await this.page.locator(".popover-content xlr-context-menu a", {
44
+ hasText: "View releases"
45
+ }).click();
46
+ return new (0, $5359280e98d97ff9$export$a678525e79c4ccc4)(this.page);
47
+ }
48
+ async openContextMenu(title) {
49
+ await (0, $hOLA6$expect)(async ()=>{
50
+ await this.page.locator(".trigger-row-content", {
51
+ hasText: title
52
+ }).locator(".context-menu-button").click();
53
+ await (0, $hOLA6$expect)(this.page.locator(".popover-content")).toBeVisible();
54
+ }).toPass();
55
+ }
56
+ }
57
+
58
+
59
+
60
+
61
+
62
+ class $1b3e547d6616178c$export$90ba71b7d7997728 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
63
+ constructor(page){
64
+ super(page);
65
+ this.taskModalLocator = this.page.locator(".modal-content.task-details");
66
+ }
67
+ async close() {
68
+ await this.taskModalLocator.locator(".modal-header button.close").click();
69
+ }
70
+ }
71
+
72
+
73
+ class $aaf14e80ae835616$export$b66cc3708c7bd4a4 extends (0, $1b3e547d6616178c$export$90ba71b7d7997728) {
74
+ async expectFieldNotEmpty(field) {
75
+ await (0, $hOLA6$expect)(this.taskModalLocator.locator(`#${field} .display`).textContent).toBeDefined();
76
+ }
77
+ async setSelectField(propertyName, value) {
78
+ await this.focusOnField(propertyName);
79
+ await this.taskModalLocator.locator(`select[name="${propertyName}"]`).selectOption(value);
80
+ }
81
+ async setTextField(propertyName, value) {
82
+ await this.focusOnField(propertyName);
83
+ await this.taskModalLocator.locator(`input[name="${propertyName}"]`).fill(value);
84
+ }
85
+ async setAutocompleteField(propertyName, value) {
86
+ await this.focusOnAutocompleteField(propertyName);
87
+ await this.taskModalLocator.locator(`#${propertyName} ul li`).getByText(value).click();
88
+ }
89
+ async expectOutputValueToBe(propertyName, value) {
90
+ await (0, $hOLA6$expect)(this.taskModalLocator.locator(`#${propertyName} .field-readonly span`)).toContainText(value);
91
+ }
92
+ // TODO move this to a new inline-editor
93
+ async focusOnField(propertyName) {
94
+ await (0, $hOLA6$expect)(async ()=>{
95
+ await this.taskModalLocator.locator(`#${propertyName} .display`).click({
96
+ force: true
97
+ });
98
+ await (0, $hOLA6$expect)(this.taskModalLocator.locator(`#${propertyName} label.edit`)).toBeVisible();
99
+ }).toPass();
100
+ }
101
+ async focusOnAutocompleteField(propertyName) {
102
+ await (0, $hOLA6$expect)(async ()=>{
103
+ await this.taskModalLocator.locator(`#${propertyName} input`).click({
104
+ force: true
105
+ });
106
+ await (0, $hOLA6$expect)(this.taskModalLocator.locator(`#${propertyName} ul`)).toBeVisible();
107
+ }).toPass();
108
+ }
109
+ }
110
+
111
+
112
+
113
+
114
+ class $2d8ab26bb7c4ceb5$export$a87f0ae8695e74be extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
115
+ async openVariable(variableKey) {
116
+ await this.page.locator(`.variables-list .variable`).getByText(variableKey).click();
117
+ return new $2d8ab26bb7c4ceb5$var$ReleaseVariableModal(this.page);
118
+ }
119
+ }
120
+ class $2d8ab26bb7c4ceb5$var$ReleaseVariableModal extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
121
+ async expectValueToBe(value) {
122
+ await (0, $hOLA6$expect)(this.page.locator("#modal .variable-value input")).toHaveValue(value);
123
+ }
124
+ async close() {
125
+ await this.page.locator("#modal .modal-header button.close").click();
126
+ }
127
+ }
128
+
129
+
130
+ class $6100b25ffc426db0$export$f43492e8ac3c566 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
131
+ async openTriggers() {
132
+ await this.openSubPage("Triggers");
133
+ return new (0, $862f65268e488e83$export$fb932093f944abe4)(this.page);
134
+ }
135
+ async abort(comment = "Abort for testing") {
136
+ await this.page.locator("action-toolbar button", {
137
+ hasText: "Abort"
138
+ }).click();
139
+ await this.page.locator(".modal textarea").fill(comment);
140
+ await this.page.locator(".modal .continue").click();
141
+ }
142
+ getPhase(phaseName) {
143
+ return new $6100b25ffc426db0$var$Phase(this.page, phaseName);
144
+ }
145
+ async start() {
146
+ await this.page.locator("action-toolbar button", {
147
+ hasText: "Start"
148
+ }).click();
149
+ await this.page.locator(".modal button.primary").click();
150
+ }
151
+ async waitForTaskCompleted(taskTitle) {
152
+ await (0, $hOLA6$expect)(this.page.locator(".task.completed").getByText(taskTitle, {
153
+ exact: true
154
+ })).toBeVisible();
155
+ }
156
+ async waitForTaskFailed(taskTitle) {
157
+ await (0, $hOLA6$expect)(this.page.locator(".task.failed").getByText(taskTitle, {
158
+ exact: true
159
+ })).toBeVisible();
160
+ }
161
+ /**
162
+ * @deprecated Don't use this, use new TaskDrawer
163
+ */ async openCustomScriptTaskModal(taskName) {
164
+ await this.page.locator(".task-header").getByText(taskName).click();
165
+ return new (0, $aaf14e80ae835616$export$b66cc3708c7bd4a4)(this.page);
166
+ }
167
+ async openVariables() {
168
+ await this.openReleaseMenu("Variables");
169
+ return new (0, $2d8ab26bb7c4ceb5$export$a87f0ae8695e74be)(this.page);
170
+ }
171
+ async openReleaseMenu(menuItem) {
172
+ await this.page.locator(`navigation-sidebar ul li`).getByText(menuItem, {
173
+ exact: true
174
+ }).click();
175
+ }
176
+ async openSubPage(subpage) {
177
+ await this.page.locator("ul.side-nav li", {
178
+ hasText: subpage
179
+ }).click();
180
+ }
181
+ }
182
+ class $6100b25ffc426db0$var$Phase extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
183
+ constructor(page, phaseName){
184
+ super(page);
185
+ this.phaseLocator = page.locator(".phase", {
186
+ hasText: phaseName
187
+ });
188
+ }
189
+ async addTask(taskName, taskGroup, taskType) {
190
+ await this.phaseLocator.getByText("Add task").click();
191
+ await this.phaseLocator.locator(".quick-title").fill(taskName);
192
+ await this.phaseLocator.locator(".xlr-ctx-menu-toggle").click();
193
+ await this.page.locator(`.xlr-ctx-menu-item`).getByTitle(taskGroup, {
194
+ exact: true
195
+ }).scrollIntoViewIfNeeded();
196
+ await this.page.locator(`.xlr-ctx-menu-item`).getByTitle(taskGroup, {
197
+ exact: true
198
+ }).hover();
199
+ await this.page.locator(`.xlr-ctx-menu.active`).getByTitle(taskType, {
200
+ exact: true
201
+ }).click();
202
+ await this.phaseLocator.locator(".quick-controls-container a").getByText("Add", {
203
+ exact: true
204
+ }).click();
205
+ }
206
+ }
207
+
208
+
209
+ class $e72552cbf941ecfa$export$b8a61e5c71402559 {
210
+ constructor(page){
211
+ this.page = page;
212
+ }
213
+ async openTemplate(id) {
214
+ return this.openReleaseOrTemplate(id, false);
215
+ }
216
+ async openRelease(id) {
217
+ return this.openReleaseOrTemplate(id, true);
218
+ }
219
+ async openReleaseOrTemplate(id, release) {
220
+ const url = release ? "releases" : "templates";
221
+ await this.page.goto(`./#/${url}/${id}`);
222
+ await this.page.waitForSelector("#release");
223
+ return new (0, $6100b25ffc426db0$export$f43492e8ac3c566)(this.page);
224
+ }
225
+ }
226
+
227
+
228
+
229
+
230
+ class $ccd46c191f81b177$export$f14c0e3f98d164c0 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
231
+ async login(userName, password) {
232
+ await this.page.goto("./");
233
+ await (0, $hOLA6$expect)(this.page).toHaveTitle("Digital.ai Release");
234
+ await this.page.locator("#inputLogin").fill(userName);
235
+ await this.page.locator("#inputPassword").fill(password);
236
+ await this.page.locator("button[type='submit']").click();
237
+ await (0, $hOLA6$expect)(this.page.locator("#releases-content")).toBeVisible();
238
+ }
239
+ async logout() {
240
+ await this.page.locator("button.dot-avatar").click();
241
+ await this.page.getByText("Log out").click();
242
+ }
243
+ }
244
+
245
+
246
+
247
+
248
+ class $c313b10398604df2$export$1533b625ec0c75e2 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
249
+ async goToApplicationsPage() {
250
+ await this.page.goto("./#/applications");
251
+ await (0, $hOLA6$expect)(this.page).toHaveTitle("Applications - Digital.ai Release");
252
+ return this;
253
+ }
254
+ async addNewApplication(applicationName) {
255
+ await this.page.locator(`//button[normalize-space()='New application']`).click();
256
+ await this.page.locator(`input[placeholder='Add name...']`).type(applicationName);
257
+ await this.page.locator(`//button[normalize-space()='Save']`).click();
258
+ return this;
259
+ }
260
+ async verifyApplicationisCreated(applicationName) {
261
+ await this.page.waitForSelector(`div[title='${applicationName}'] strong`);
262
+ return this;
263
+ }
264
+ async createApplicationAndLinkEnvironment(environmentName, applicationName) {
265
+ await this.page.locator(`//button[normalize-space()='New application']`).click();
266
+ await this.page.locator(`input[placeholder='Add name...']`).type(applicationName);
267
+ await this.page.locator("input[placeholder='Filter environment name...']").type(environmentName);
268
+ await this.page.locator(`div[title='${environmentName}']`).click();
269
+ await this.page.locator(`//button[normalize-space()='Save']`).click();
270
+ await this.page.locator("i.xl-icon.close-icon").click();
271
+ return this;
272
+ }
273
+ }
274
+
275
+
276
+
277
+
278
+ class $6720a523bcb1cce0$export$3cac5fd37ae64b91 extends (0, $9626bc9256ce31f7$export$2b65d1d97338f32b) {
279
+ async openPersonalAccessTokenPage() {
280
+ // await this.page.locator("button.dot-avatar").click()
281
+ // await this.page.locator("//div[normalize-space()='Access tokens']").click()
282
+ await this.page.goto("./#/personal-access-token");
283
+ await (0, $hOLA6$expect)(this.page).toHaveTitle("Access tokens / Personal settings - Digital.ai Release");
284
+ return this;
285
+ }
286
+ async addNewToken(tokenName) {
287
+ //await expect(this.page).toHaveTitle('Access tokens / Personal settings - Digital.ai Release')
288
+ await this.page.locator("#tokenText").fill(tokenName);
289
+ await this.page.locator("button[type='submit']").click();
290
+ return this;
291
+ }
292
+ }
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+ const $f86fbaaa8b4e8c61$export$45f0aca2596a2bb3 = function() {
301
+ const RELEASE_TYPE = "xlrelease.Release";
302
+ const PHASE_TYPE = "xlrelease.Phase";
303
+ const TEAM_TYPE = "xlrelease.Team";
304
+ const TASK_TYPE = "xlrelease.Task";
305
+ const COMMENT_TYPE = "xlrelease.Comment";
306
+ const CONDITION_TYPE = "xlrelease.GateCondition";
307
+ const DEPENDENCY_TYPE = "xlrelease.Dependency";
308
+ const LINK_TYPE = "xlrelease.Link";
309
+ const ATTACHMENT_TYPE = "xlrelease.Attachment";
310
+ const DASHBOARD_TYPE = "xlrelease.Dashboard";
311
+ const _TRIGGER_TYPE = "xlrelease.ReleaseTrigger";
312
+ const JIRA_TYPE = "jira.CreateIssue";
313
+ const DEFAULT_TASK_OWNER = "Itchy";
314
+ const processTasks = (task, container, index)=>{
315
+ if ((0, $hOLA6$lodashisUndefined)(task.type)) task.type = TASK_TYPE;
316
+ task.id = task.id || `${container.id}/Task${index}`;
317
+ if ((0, $hOLA6$lodashisUndefined)(task.owner) && task.type !== JIRA_TYPE) task.owner = DEFAULT_TASK_OWNER;
318
+ if (task.owner === null) delete task.owner;
319
+ (0, $hOLA6$lodasheach)(task.conditions, function(condition, idx) {
320
+ condition.type = CONDITION_TYPE;
321
+ condition.id = `${task.id}/GateCondition${idx}`;
322
+ });
323
+ (0, $hOLA6$lodasheach)(task.dependencies, function(dependency, idx) {
324
+ dependency.type = DEPENDENCY_TYPE;
325
+ dependency.id = `${task.id}/Dependency${idx}`;
326
+ });
327
+ (0, $hOLA6$lodasheach)(task.links, function(link, idx) {
328
+ link.type = LINK_TYPE;
329
+ link.id = `${task.id}/Link${idx}`;
330
+ });
331
+ (0, $hOLA6$lodasheach)(task.comments, function(comment, idx) {
332
+ comment.type = COMMENT_TYPE;
333
+ comment.id = `${task.id}/Comment${idx}`;
334
+ });
335
+ (0, $hOLA6$lodasheach)(task.tasks, function(subTask, idx) {
336
+ processTasks(subTask, task, idx);
337
+ });
338
+ (0, $hOLA6$lodasheach)(task.templateVariables, function(variable, idx) {
339
+ (0, $hOLA6$lodashdefaults)(variable, getVariableEntity(variable.value, variable.key, task.id, idx));
340
+ });
341
+ (0, $hOLA6$lodasheach)(task.attachments, function(attachment, idx) {
342
+ attachment.type = ATTACHMENT_TYPE;
343
+ attachment.id = `${task.id}/Attachment${idx}`;
344
+ });
345
+ if (task.pythonScript) {
346
+ const pythonScript = task.pythonScript;
347
+ pythonScript.id = `${task.id}/PythonScript`;
348
+ pythonScript.customScriptTask = task.id;
349
+ }
350
+ };
351
+ const processPhases = (phase, release, index)=>{
352
+ phase.type = PHASE_TYPE;
353
+ phase.id = `${release.id}/Phase${index}`;
354
+ (0, $hOLA6$lodashforEach)(phase.tasks, (task, idx)=>{
355
+ processTasks(task, phase, idx);
356
+ });
357
+ };
358
+ const getVariableEntity = (value, key, containerId, index, password)=>{
359
+ const keyNoSyntax = key.replace("${", "").replace("}", "");
360
+ return {
361
+ title: "",
362
+ id: `${containerId}/Variable${index}`,
363
+ key: keyNoSyntax,
364
+ requiresValue: true,
365
+ showOnReleaseStart: true,
366
+ type: password ? "xlrelease.PasswordStringVariable" : "xlrelease.StringVariable",
367
+ value: value
368
+ };
369
+ };
370
+ const getValueProviderConfigurationEntity = function(containerId) {
371
+ return {
372
+ id: `${containerId}/valueProvider`,
373
+ variable: containerId
374
+ };
375
+ };
376
+ const getDashboardExtension = (dashboard, releaseId)=>{
377
+ const dashboardExtension = {
378
+ id: `${releaseId}/summary`,
379
+ type: DASHBOARD_TYPE,
380
+ tiles: []
381
+ };
382
+ if (dashboard.tiles) (0, $hOLA6$lodashforEach)(dashboard.tiles, function(tile, index) {
383
+ dashboardExtension.tiles.push(getTileEntity(tile, `${releaseId}/summary`, index));
384
+ });
385
+ return dashboardExtension;
386
+ };
387
+ function getTileEntity(tile, containerId, index) {
388
+ tile.id = tile.id || `${containerId}/Tile${index}`;
389
+ return tile;
390
+ }
391
+ return function(release) {
392
+ release.type = RELEASE_TYPE;
393
+ if (release.id.indexOf("Applications/") === -1) release.id = `Applications/${release.id}`;
394
+ if (release.startDate) release.queryableStartDate = release.startDate;
395
+ else if (release.scheduledStartDate) release.queryableStartDate = release.scheduledStartDate;
396
+ if (release.endDate) release.queryableEndDate = release.endDate;
397
+ else if (release.dueDate) release.queryableEndDate = release.dueDate;
398
+ if ((0, $hOLA6$lodashisUndefined)(release.owner)) release.owner = "Itchy"; // default release manager
399
+ (0, $hOLA6$lodashforEach)(release.phases, function(phase, index) {
400
+ processPhases(phase, release, index);
401
+ });
402
+ (0, $hOLA6$lodashforEach)(release.teams, function(team, index) {
403
+ team.type = TEAM_TYPE;
404
+ team.id = `${release.id}/Team${index}`;
405
+ });
406
+ (0, $hOLA6$lodashforEach)(release.attachments, function(attachment, index) {
407
+ attachment.type = ATTACHMENT_TYPE;
408
+ attachment.id = `${release.id}/Attachment${index}`;
409
+ });
410
+ (0, $hOLA6$lodashforEach)(release.variables, function(variable, index) {
411
+ (0, $hOLA6$lodashdefaults)(variable, getVariableEntity(variable.value, variable.key, release.id, index));
412
+ if (variable.valueProvider) (0, $hOLA6$lodashdefaults)(variable.valueProvider, getValueProviderConfigurationEntity(variable.id));
413
+ });
414
+ (0, $hOLA6$lodashforEach)((0, $hOLA6$lodashtoPairs)(release.variableValues), function(keyValue, index) {
415
+ if (!release.variables) release.variables = [];
416
+ release.variables.push(getVariableEntity(keyValue[1], keyValue[0], release.id, 1000 + index));
417
+ release.variableValues = undefined;
418
+ });
419
+ (0, $hOLA6$lodashforEach)((0, $hOLA6$lodashtoPairs)(release.passwordVariableValues), function(keyValue, index) {
420
+ if (!release.variables) release.variables = [];
421
+ release.variables.push(getVariableEntity(keyValue[1], keyValue[0], release.id, 1500 + index, true));
422
+ release.passwordVariableValues = undefined;
423
+ });
424
+ if (release.summary) {
425
+ release.extensions = [
426
+ getDashboardExtension(release.summary, release.id)
427
+ ];
428
+ release.summary = undefined;
429
+ }
430
+ };
431
+ }();
432
+
433
+
434
+
435
+ const $80c3ae34677b4324$var$adminHeaders = {
436
+ Authorization: "Basic YWRtaW46YWRtaW4=",
437
+ Cookie: "XSRF-TOKEN=1;",
438
+ "X-XSRF-TOKEN": "1"
439
+ };
440
+ const $80c3ae34677b4324$export$e0969da9b8fb378d = (0, $hOLA6$test).extend({
441
+ fixtures: async ({ request: request , page: page }, use)=>{
442
+ const fixtures = new $80c3ae34677b4324$var$Fixtures(request, page);
443
+ await use(fixtures);
444
+ return fixtures;
445
+ },
446
+ loginPage: async ({ page: page }, use)=>{
447
+ const loginPage = new (0, $ccd46c191f81b177$export$f14c0e3f98d164c0)(page);
448
+ await use(loginPage);
449
+ return loginPage;
450
+ },
451
+ applicationPage: async ({ page: page }, use)=>{
452
+ const applicationPage = new (0, $c313b10398604df2$export$1533b625ec0c75e2)(page);
453
+ await use(applicationPage);
454
+ return applicationPage;
455
+ },
456
+ personalAccessTokenPage: async ({ page: page }, use)=>{
457
+ const personalAccessTokenPage = new (0, $6720a523bcb1cce0$export$3cac5fd37ae64b91)(page);
458
+ await use(personalAccessTokenPage);
459
+ return personalAccessTokenPage;
460
+ },
461
+ navigation: async ({ page: page }, use)=>{
462
+ const navigationPage = new (0, $e72552cbf941ecfa$export$b8a61e5c71402559)(page);
463
+ await use(navigationPage);
464
+ return navigationPage;
465
+ }
466
+ });
467
+ class $80c3ae34677b4324$var$Fixtures {
468
+ releaseIds = [];
469
+ triggerIds = [];
470
+ configurationIds = [];
471
+ constructor(request, page){
472
+ this.request = request;
473
+ this.page = page;
474
+ }
475
+ release(release) {
476
+ this.initDefaults(release);
477
+ this.releaseIds.push(release.id);
478
+ return this.deleteRelease(release.id).then(()=>this.deleteArchivedRelease(release.id)).then(()=>this.doPost("fixtures/release", release));
479
+ }
480
+ configuration(ci) {
481
+ this.configurationIds.push(ci.id);
482
+ return this.doPost("fixtures/shared", [
483
+ ci
484
+ ]);
485
+ }
486
+ trigger(trigger) {
487
+ this.triggerIds.push(trigger.id);
488
+ return this.doPost("fixtures/trigger", trigger);
489
+ }
490
+ deleteArchivedRelease(id) {
491
+ const releaseId = id.includes("Applications/") ? id : `Applications/${id}`;
492
+ return this.doDelete("fixtures/cis", [
493
+ {
494
+ id: releaseId,
495
+ type: "xlrelease.Release"
496
+ }
497
+ ]);
498
+ }
499
+ deleteRelease(id) {
500
+ const releaseId = id.includes("Applications/") ? id : `Applications/${id}`;
501
+ return this.doDelete(`fixtures/${releaseId}`);
502
+ }
503
+ deleteTrigger(id) {
504
+ return this.doDelete(`fixtures/trigger/${id}`);
505
+ }
506
+ deleteConfiguration(id) {
507
+ return this.doDelete(`fixtures/shared`, [
508
+ id
509
+ ]);
510
+ }
511
+ cleanAll() {
512
+ const promises = [];
513
+ for (const releaseId of this.releaseIds.reverse())promises.push(this.deleteRelease(releaseId));
514
+ for (const triggerId of this.triggerIds)promises.push(this.deleteTrigger(triggerId));
515
+ for (const confId of this.configurationIds)promises.push(this.deleteConfiguration(confId));
516
+ this.releaseIds = [];
517
+ this.triggerIds = [];
518
+ this.configurationIds = [];
519
+ return Promise.all(promises);
520
+ }
521
+ async waitForReleaseStarted(releaseTitle) {
522
+ await (0, $hOLA6$expect)(async ()=>{
523
+ const resp = await this.doPost("releases/search", {
524
+ inProgress: true,
525
+ paused: true,
526
+ failing: true,
527
+ failed: true,
528
+ title: releaseTitle
529
+ });
530
+ const page = await resp.json();
531
+ await (0, $hOLA6$expect)(page.cis.length).toBeGreaterThan(0);
532
+ }).toPass();
533
+ }
534
+ async waitForFirstPoll(triggerId) {
535
+ await (0, $hOLA6$expect)(async ()=>{
536
+ const resp = await this.doGet(`api/v1/triggers/${triggerId}`);
537
+ const trigger = await resp.json();
538
+ await (0, $hOLA6$expect)((0, $hOLA6$lodashisNil)(trigger.triggerState)).toBe(false);
539
+ }).toPass();
540
+ }
541
+ exec(path) {
542
+ return new Promise((resolve, reject)=>{
543
+ (0, $hOLA6$execFile)(path, (error)=>{
544
+ if (error === null) return resolve();
545
+ else return reject();
546
+ });
547
+ });
548
+ }
549
+ getFakeApiUrl() {
550
+ return this.getEnvVariable("ENV_FAKE_API") || "http://localhost:5517";
551
+ }
552
+ getEnvVariable(name) {
553
+ return $hOLA6$env[name];
554
+ }
555
+ async setFeatures(features) {
556
+ return this.doPut("/settings/features", features);
557
+ }
558
+ doPost(url, body) {
559
+ return this.request.post(url, {
560
+ data: body,
561
+ headers: $80c3ae34677b4324$var$adminHeaders
562
+ });
563
+ }
564
+ doPut(url, body) {
565
+ return this.request.put(url, {
566
+ data: body,
567
+ headers: $80c3ae34677b4324$var$adminHeaders
568
+ });
569
+ }
570
+ doGet(url) {
571
+ return this.request.get(url, {
572
+ headers: $80c3ae34677b4324$var$adminHeaders
573
+ });
574
+ }
575
+ doDelete(url, body) {
576
+ return this.request.delete(url, {
577
+ data: body,
578
+ headers: $80c3ae34677b4324$var$adminHeaders
579
+ });
580
+ }
581
+ initDefaults(ci) {
582
+ (0, $f86fbaaa8b4e8c61$export$45f0aca2596a2bb3)(ci);
583
+ }
584
+ }
585
+
586
+
587
+
588
+
589
+ export {$80c3ae34677b4324$export$e0969da9b8fb378d as test};
590
+ //# sourceMappingURL=module.js.map