@equinor/roma-framework 1.0.1 → 2.0.0
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/cypress.mjs +806 -0
- package/dev-portal/index.d.ts +17 -0
- package/dev-portal/lib/api/fetcher.d.ts +21 -0
- package/dev-portal/lib/api/ms-graph/api/group/find-group-members.d.ts +2 -0
- package/dev-portal/lib/api/ms-graph/api/user/find-user-by-shortname.d.ts +1 -0
- package/dev-portal/lib/api/ms-graph/api/user/find-users-by-mail.d.ts +4 -0
- package/dev-portal/lib/api/ms-graph/index.d.ts +10 -0
- package/dev-portal/lib/api/ms-graph/model/azure-response.d.ts +7 -0
- package/dev-portal/lib/api/ms-graph/model/error.d.ts +11 -0
- package/dev-portal/lib/api/roma/api/app-controller/app-controller.d.ts +121 -0
- package/dev-portal/lib/api/roma/api/category-controller/category-controller.d.ts +93 -0
- package/dev-portal/lib/api/roma/api/environment-controller/environment-controller.d.ts +26 -0
- package/dev-portal/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +50 -0
- package/dev-portal/lib/api/roma/api/roma-configuration-controller/roma-configuration-controller.d.ts +161 -0
- package/dev-portal/lib/api/roma/api/server-side-event-controller/server-side-event-controller.d.ts +20 -0
- package/dev-portal/lib/api/roma/api/service-controller/service-controller.d.ts +93 -0
- package/dev-portal/lib/api/roma/api/setting-controller/setting-controller.d.ts +260 -0
- package/dev-portal/lib/api/roma/index.d.ts +9 -0
- package/dev-portal/lib/api/roma/model/appDto.d.ts +19 -0
- package/dev-portal/lib/api/roma/model/categoryDto.d.ts +13 -0
- package/dev-portal/lib/api/roma/model/environmentDto.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/feedbackDetailsDto.d.ts +13 -0
- package/dev-portal/lib/api/roma/model/feedbackDto.d.ts +6 -0
- package/dev-portal/lib/api/roma/model/feedbackExpandedResponseDetailsDto.d.ts +13 -0
- package/dev-portal/lib/api/roma/model/feedbackExpandedResponseDto.d.ts +4 -0
- package/dev-portal/lib/api/roma/model/feedbackExpandedResponseIssueDto.d.ts +6 -0
- package/dev-portal/lib/api/roma/model/feedbackFeedbackDto.d.ts +13 -0
- package/dev-portal/lib/api/roma/model/feedbackPage.d.ts +19 -0
- package/dev-portal/lib/api/roma/model/feedbackResponseDto.d.ts +4 -0
- package/dev-portal/lib/api/roma/model/feedbackResponseIssueDto.d.ts +11 -0
- package/dev-portal/lib/api/roma/model/feedbackSolutionDto.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/getAllApps200.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/getAllCategories200.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/getAllRomaConfigurationTypes200Item.d.ts +11 -0
- package/dev-portal/lib/api/roma/model/getAllServices200.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/getSettingsByAppShortName200.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/getSettingsByUserId200.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/index.d.ts +38 -0
- package/dev-portal/lib/api/roma/model/listFeedbacksByCurrentUserParams.d.ts +17 -0
- package/dev-portal/lib/api/roma/model/pageableObject.d.ts +9 -0
- package/dev-portal/lib/api/roma/model/romaConfigurationDto.d.ts +7 -0
- package/dev-portal/lib/api/roma/model/romaConfigurationDtoValue.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/serverSentEventActivityLogDto.d.ts +8 -0
- package/dev-portal/lib/api/roma/model/serverSentEventStandardEventDto.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/serviceDto.d.ts +16 -0
- package/dev-portal/lib/api/roma/model/settingDto.d.ts +9 -0
- package/dev-portal/lib/api/roma/model/settingDtoValue.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/sortObject.d.ts +12 -0
- package/dev-portal/lib/api/roma/model/uploadBundleBody.d.ts +10 -0
- package/dev-portal/lib/api/roma/model/versionDto.d.ts +12 -0
- package/dev-portal/lib/api/roma/use-client.d.ts +34 -0
- package/dev-portal/lib/api/util.d.ts +1 -0
- package/dev-portal/lib/app-provider.d.ts +28 -0
- package/dev-portal/lib/dev-portal/AppLoader.d.ts +14 -0
- package/dev-portal/lib/dev-portal/AppViewer.d.ts +6 -0
- package/dev-portal/lib/dev-portal/EquinorLoader.d.ts +12 -0
- package/dev-portal/lib/dev-portal/ErrorViewer.d.ts +20 -0
- package/dev-portal/lib/dev-portal/Header.d.ts +2 -0
- package/dev-portal/lib/dev-portal/HeaderMenu.d.ts +4 -0
- package/dev-portal/lib/dev-portal/HttpErrorViewer.d.ts +13 -0
- package/dev-portal/lib/dev-portal/Navigation.d.ts +5 -0
- package/dev-portal/lib/dev-portal/PortalStyles.d.ts +1111 -0
- package/dev-portal/lib/dev-portal/PortalTypes.d.ts +13 -0
- package/dev-portal/lib/dev-portal/Root.d.ts +5 -0
- package/dev-portal/lib/dev-portal/SideSheets.d.ts +6 -0
- package/dev-portal/lib/dev-portal/config/AppClient.d.ts +19 -0
- package/dev-portal/lib/dev-portal/config/ServiceDiscoveryClient.d.ts +7 -0
- package/dev-portal/lib/dev-portal/config/config.d.ts +3 -0
- package/dev-portal/lib/dev-portal/config.d.ts +3 -0
- package/dev-portal/lib/dev-portal/index.d.ts +13 -0
- package/dev-portal/lib/dev-portal/logo.d.ts +2 -0
- package/dev-portal/lib/eds-event-provider.d.ts +6 -0
- package/dev-portal/lib/error-handlers/fallback-http-errors.d.ts +1 -0
- package/dev-portal/lib/error-handlers/http-error-handler.d.ts +11 -0
- package/dev-portal/lib/hooks/use-get-api-roles.d.ts +11 -0
- package/dev-portal/lib/hooks/use-has-api-role.d.ts +7 -0
- package/dev-portal/lib/hooks/use-manage-watch-list.d.ts +7 -0
- package/dev-portal/lib/hooks/use-watch-defaults.d.ts +100 -0
- package/dev-portal/lib/make-component.d.ts +12 -0
- package/dev-portal/lib/query/persister.d.ts +6 -0
- package/dev-portal/lib/style-provider.d.ts +7 -0
- package/dev-portal/lib/test-utils/modules.d.ts +113 -0
- package/dev-portal/lib/test-utils/roma-cypress-wrapper.d.ts +10 -0
- package/dev-portal/package.json +6 -1
- package/dev-portal/roma-framework.umd.js +19697 -12990
- package/index.d.ts +4 -0
- package/lib/api/ms-graph/api/group/find-group-members.d.ts +2 -2
- package/lib/api/ms-graph/api/user/find-user-by-shortname.d.ts +1 -1
- package/lib/api/ms-graph/api/user/find-users-by-mail.d.ts +4 -2
- package/lib/api/ms-graph/index.d.ts +1 -2
- package/lib/api/ms-graph/model/azure-response.d.ts +7 -0
- package/lib/api/roma/api/feedback-controller/feedback-controller.d.ts +22 -2
- package/lib/api/roma/model/feedbackExpandedResponseDetailsDto.d.ts +13 -0
- package/lib/api/roma/model/feedbackExpandedResponseDto.d.ts +4 -0
- package/lib/api/roma/model/feedbackExpandedResponseIssueDto.d.ts +6 -0
- package/lib/api/roma/model/feedbackPage.d.ts +19 -0
- package/lib/api/roma/model/index.d.ts +7 -0
- package/lib/api/roma/model/listFeedbacksByCurrentUserParams.d.ts +17 -0
- package/lib/api/roma/model/pageableObject.d.ts +9 -0
- package/lib/api/roma/model/sortObject.d.ts +12 -0
- package/lib/app-provider.d.ts +7 -11
- package/lib/dev-portal/HeaderMenu.d.ts +4 -0
- package/lib/dev-portal/PortalStyles.d.ts +1111 -0
- package/lib/dev-portal/PortalTypes.d.ts +13 -0
- package/lib/dev-portal/SideSheets.d.ts +6 -0
- package/lib/dev-portal/config/AppClient.d.ts +19 -0
- package/lib/dev-portal/config/ServiceDiscoveryClient.d.ts +7 -0
- package/lib/dev-portal/config/config.d.ts +3 -0
- package/lib/dev-portal/index.d.ts +1 -1
- package/lib/dev-portal/logo.d.ts +2 -0
- package/lib/error-handlers/fallback-http-errors.d.ts +1 -0
- package/lib/error-handlers/http-error-handler.d.ts +11 -0
- package/lib/hooks/use-get-api-roles.d.ts +3 -6
- package/lib/hooks/use-manage-watch-list.d.ts +7 -0
- package/lib/hooks/use-watch-defaults.d.ts +100 -0
- package/lib/test-utils/modules.d.ts +113 -0
- package/lib/test-utils/roma-cypress-wrapper.d.ts +10 -0
- package/package.json +6 -1
- package/roma-framework.mjs +4030 -5014
- package/router-CD1QGwNJ.mjs +5907 -0
- package/lib/api/ms-graph/model/group-membership.d.ts +0 -8
- package/lib/api/ms-graph/model/user.d.ts +0 -18
package/cypress.mjs
ADDED
|
@@ -0,0 +1,806 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FrameworkProvider } from "@equinor/fusion-framework-react";
|
|
3
|
+
import { ModuleProvider } from "@equinor/fusion-framework-react-module";
|
|
4
|
+
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
5
|
+
import { _ as __extends, S as Subscription, l as __spreadArray, m as __read, n as arrRemove, p as isScheduler, O as Observable, h as of, A as Action$2, k as from, B as BehaviorSubject, f as firstValueFrom, I as IntlProvider } from "./router-CD1QGwNJ.mjs";
|
|
6
|
+
import require$$0 from "react-dom";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
var dateTimestampProvider = {
|
|
9
|
+
now: function() {
|
|
10
|
+
return Date.now();
|
|
11
|
+
},
|
|
12
|
+
delegate: void 0
|
|
13
|
+
};
|
|
14
|
+
var Action$1 = function(_super) {
|
|
15
|
+
__extends(Action2, _super);
|
|
16
|
+
function Action2(scheduler, work) {
|
|
17
|
+
return _super.call(this) || this;
|
|
18
|
+
}
|
|
19
|
+
Action2.prototype.schedule = function(state, delay) {
|
|
20
|
+
return this;
|
|
21
|
+
};
|
|
22
|
+
return Action2;
|
|
23
|
+
}(Subscription);
|
|
24
|
+
var intervalProvider = {
|
|
25
|
+
setInterval: function(handler, timeout) {
|
|
26
|
+
var args = [];
|
|
27
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
28
|
+
args[_i - 2] = arguments[_i];
|
|
29
|
+
}
|
|
30
|
+
return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
|
|
31
|
+
},
|
|
32
|
+
clearInterval: function(handle) {
|
|
33
|
+
return clearInterval(handle);
|
|
34
|
+
},
|
|
35
|
+
delegate: void 0
|
|
36
|
+
};
|
|
37
|
+
var AsyncAction = function(_super) {
|
|
38
|
+
__extends(AsyncAction2, _super);
|
|
39
|
+
function AsyncAction2(scheduler, work) {
|
|
40
|
+
var _this = _super.call(this, scheduler, work) || this;
|
|
41
|
+
_this.scheduler = scheduler;
|
|
42
|
+
_this.work = work;
|
|
43
|
+
_this.pending = false;
|
|
44
|
+
return _this;
|
|
45
|
+
}
|
|
46
|
+
AsyncAction2.prototype.schedule = function(state, delay) {
|
|
47
|
+
var _a;
|
|
48
|
+
if (delay === void 0) {
|
|
49
|
+
delay = 0;
|
|
50
|
+
}
|
|
51
|
+
if (this.closed) {
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
this.state = state;
|
|
55
|
+
var id = this.id;
|
|
56
|
+
var scheduler = this.scheduler;
|
|
57
|
+
if (id != null) {
|
|
58
|
+
this.id = this.recycleAsyncId(scheduler, id, delay);
|
|
59
|
+
}
|
|
60
|
+
this.pending = true;
|
|
61
|
+
this.delay = delay;
|
|
62
|
+
this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);
|
|
63
|
+
return this;
|
|
64
|
+
};
|
|
65
|
+
AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay) {
|
|
66
|
+
if (delay === void 0) {
|
|
67
|
+
delay = 0;
|
|
68
|
+
}
|
|
69
|
+
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
|
|
70
|
+
};
|
|
71
|
+
AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay) {
|
|
72
|
+
if (delay === void 0) {
|
|
73
|
+
delay = 0;
|
|
74
|
+
}
|
|
75
|
+
if (delay != null && this.delay === delay && this.pending === false) {
|
|
76
|
+
return id;
|
|
77
|
+
}
|
|
78
|
+
if (id != null) {
|
|
79
|
+
intervalProvider.clearInterval(id);
|
|
80
|
+
}
|
|
81
|
+
return void 0;
|
|
82
|
+
};
|
|
83
|
+
AsyncAction2.prototype.execute = function(state, delay) {
|
|
84
|
+
if (this.closed) {
|
|
85
|
+
return new Error("executing a cancelled action");
|
|
86
|
+
}
|
|
87
|
+
this.pending = false;
|
|
88
|
+
var error = this._execute(state, delay);
|
|
89
|
+
if (error) {
|
|
90
|
+
return error;
|
|
91
|
+
} else if (this.pending === false && this.id != null) {
|
|
92
|
+
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
AsyncAction2.prototype._execute = function(state, _delay) {
|
|
96
|
+
var errored = false;
|
|
97
|
+
var errorValue;
|
|
98
|
+
try {
|
|
99
|
+
this.work(state);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
errored = true;
|
|
102
|
+
errorValue = e ? e : new Error("Scheduled action threw falsy error");
|
|
103
|
+
}
|
|
104
|
+
if (errored) {
|
|
105
|
+
this.unsubscribe();
|
|
106
|
+
return errorValue;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
AsyncAction2.prototype.unsubscribe = function() {
|
|
110
|
+
if (!this.closed) {
|
|
111
|
+
var _a = this, id = _a.id, scheduler = _a.scheduler;
|
|
112
|
+
var actions = scheduler.actions;
|
|
113
|
+
this.work = this.state = this.scheduler = null;
|
|
114
|
+
this.pending = false;
|
|
115
|
+
arrRemove(actions, this);
|
|
116
|
+
if (id != null) {
|
|
117
|
+
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
118
|
+
}
|
|
119
|
+
this.delay = null;
|
|
120
|
+
_super.prototype.unsubscribe.call(this);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return AsyncAction2;
|
|
124
|
+
}(Action$1);
|
|
125
|
+
var Scheduler = function() {
|
|
126
|
+
function Scheduler2(schedulerActionCtor, now) {
|
|
127
|
+
if (now === void 0) {
|
|
128
|
+
now = Scheduler2.now;
|
|
129
|
+
}
|
|
130
|
+
this.schedulerActionCtor = schedulerActionCtor;
|
|
131
|
+
this.now = now;
|
|
132
|
+
}
|
|
133
|
+
Scheduler2.prototype.schedule = function(work, delay, state) {
|
|
134
|
+
if (delay === void 0) {
|
|
135
|
+
delay = 0;
|
|
136
|
+
}
|
|
137
|
+
return new this.schedulerActionCtor(this, work).schedule(state, delay);
|
|
138
|
+
};
|
|
139
|
+
Scheduler2.now = dateTimestampProvider.now;
|
|
140
|
+
return Scheduler2;
|
|
141
|
+
}();
|
|
142
|
+
var AsyncScheduler = function(_super) {
|
|
143
|
+
__extends(AsyncScheduler2, _super);
|
|
144
|
+
function AsyncScheduler2(SchedulerAction, now) {
|
|
145
|
+
if (now === void 0) {
|
|
146
|
+
now = Scheduler.now;
|
|
147
|
+
}
|
|
148
|
+
var _this = _super.call(this, SchedulerAction, now) || this;
|
|
149
|
+
_this.actions = [];
|
|
150
|
+
_this._active = false;
|
|
151
|
+
return _this;
|
|
152
|
+
}
|
|
153
|
+
AsyncScheduler2.prototype.flush = function(action) {
|
|
154
|
+
var actions = this.actions;
|
|
155
|
+
if (this._active) {
|
|
156
|
+
actions.push(action);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
var error;
|
|
160
|
+
this._active = true;
|
|
161
|
+
do {
|
|
162
|
+
if (error = action.execute(action.state, action.delay)) {
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
} while (action = actions.shift());
|
|
166
|
+
this._active = false;
|
|
167
|
+
if (error) {
|
|
168
|
+
while (action = actions.shift()) {
|
|
169
|
+
action.unsubscribe();
|
|
170
|
+
}
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return AsyncScheduler2;
|
|
175
|
+
}(Scheduler);
|
|
176
|
+
var asyncScheduler = new AsyncScheduler(AsyncAction);
|
|
177
|
+
var async = asyncScheduler;
|
|
178
|
+
function isValidDate(value) {
|
|
179
|
+
return value instanceof Date && !isNaN(value);
|
|
180
|
+
}
|
|
181
|
+
function timer(dueTime, intervalOrScheduler, scheduler) {
|
|
182
|
+
if (scheduler === void 0) {
|
|
183
|
+
scheduler = async;
|
|
184
|
+
}
|
|
185
|
+
var intervalDuration = -1;
|
|
186
|
+
{
|
|
187
|
+
if (isScheduler(intervalOrScheduler)) {
|
|
188
|
+
scheduler = intervalOrScheduler;
|
|
189
|
+
} else {
|
|
190
|
+
intervalDuration = intervalOrScheduler;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return new Observable(function(subscriber) {
|
|
194
|
+
var due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
|
|
195
|
+
if (due < 0) {
|
|
196
|
+
due = 0;
|
|
197
|
+
}
|
|
198
|
+
var n = 0;
|
|
199
|
+
return scheduler.schedule(function() {
|
|
200
|
+
if (!subscriber.closed) {
|
|
201
|
+
subscriber.next(n++);
|
|
202
|
+
if (0 <= intervalDuration) {
|
|
203
|
+
this.schedule(void 0, intervalDuration);
|
|
204
|
+
} else {
|
|
205
|
+
subscriber.complete();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, due);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function interval(period, scheduler) {
|
|
212
|
+
if (scheduler === void 0) {
|
|
213
|
+
scheduler = asyncScheduler;
|
|
214
|
+
}
|
|
215
|
+
return timer(period, period, scheduler);
|
|
216
|
+
}
|
|
217
|
+
var client = {};
|
|
218
|
+
var m = require$$0;
|
|
219
|
+
if (process.env.NODE_ENV === "production") {
|
|
220
|
+
client.createRoot = m.createRoot;
|
|
221
|
+
client.hydrateRoot = m.hydrateRoot;
|
|
222
|
+
} else {
|
|
223
|
+
var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
224
|
+
client.createRoot = function(c, o) {
|
|
225
|
+
i.usingClientEntryPoint = true;
|
|
226
|
+
try {
|
|
227
|
+
return m.createRoot(c, o);
|
|
228
|
+
} finally {
|
|
229
|
+
i.usingClientEntryPoint = false;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
client.hydrateRoot = function(c, h, o) {
|
|
233
|
+
i.usingClientEntryPoint = true;
|
|
234
|
+
try {
|
|
235
|
+
return m.hydrateRoot(c, h, o);
|
|
236
|
+
} finally {
|
|
237
|
+
i.usingClientEntryPoint = false;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function getDisplayName(node, fallbackName = "Unknown") {
|
|
242
|
+
const type = node === null || node === void 0 ? void 0 : node.type;
|
|
243
|
+
if (!type) {
|
|
244
|
+
return fallbackName;
|
|
245
|
+
}
|
|
246
|
+
let displayName = null;
|
|
247
|
+
if (typeof type.displayName === "string") {
|
|
248
|
+
displayName = type.displayName;
|
|
249
|
+
}
|
|
250
|
+
if (!displayName) {
|
|
251
|
+
displayName = type.name || fallbackName;
|
|
252
|
+
}
|
|
253
|
+
const match = displayName.match(/^(.*) \[from (.*)\]$/);
|
|
254
|
+
if (match) {
|
|
255
|
+
const componentName = match[1];
|
|
256
|
+
const moduleName = match[2];
|
|
257
|
+
if (componentName && moduleName) {
|
|
258
|
+
if (moduleName === componentName || moduleName.startsWith(`${componentName}.`)) {
|
|
259
|
+
displayName = componentName;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return displayName;
|
|
264
|
+
}
|
|
265
|
+
const ROOT_SELECTOR = "[data-cy-root]";
|
|
266
|
+
const getContainerEl = () => {
|
|
267
|
+
const el = document.querySelector(ROOT_SELECTOR);
|
|
268
|
+
if (el) {
|
|
269
|
+
return el;
|
|
270
|
+
}
|
|
271
|
+
throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please add a root element with data-cy-root attribute to your "component-index.html" file so that Cypress can attach your component to the DOM.`);
|
|
272
|
+
};
|
|
273
|
+
function checkForRemovedStyleOptions(mountingOptions) {
|
|
274
|
+
for (const key of ["cssFile", "cssFiles", "style", "styles", "stylesheet", "stylesheets"]) {
|
|
275
|
+
if (mountingOptions[key]) {
|
|
276
|
+
Cypress.utils.throwErrByPath("mount.removed_style_mounting_options", key);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function setupHooks(optionalCallback) {
|
|
281
|
+
if (Cypress.testingType !== "component") {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
Cypress.Commands.overwrite("visit", () => {
|
|
285
|
+
throw new Error("cy.visit from a component spec is not allowed");
|
|
286
|
+
});
|
|
287
|
+
Cypress.Commands.overwrite("session", () => {
|
|
288
|
+
throw new Error("cy.session from a component spec is not allowed");
|
|
289
|
+
});
|
|
290
|
+
Cypress.Commands.overwrite("origin", () => {
|
|
291
|
+
throw new Error("cy.origin from a component spec is not allowed");
|
|
292
|
+
});
|
|
293
|
+
Cypress.on("test:before:after:run:async", () => {
|
|
294
|
+
optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
let mountCleanup;
|
|
298
|
+
const makeMountFn = (type, jsx2, options = {}, rerenderKey, internalMountOptions) => {
|
|
299
|
+
if (!internalMountOptions) {
|
|
300
|
+
throw Error("internalMountOptions must be provided with `render` and `reactDom` parameters");
|
|
301
|
+
}
|
|
302
|
+
if (options.alias) {
|
|
303
|
+
Cypress.utils.throwErrByPath("mount.alias", options.alias);
|
|
304
|
+
}
|
|
305
|
+
checkForRemovedStyleOptions(options);
|
|
306
|
+
mountCleanup = internalMountOptions.cleanup;
|
|
307
|
+
return cy.then(() => {
|
|
308
|
+
var _a, _b, _c;
|
|
309
|
+
const reactDomToUse = internalMountOptions.reactDom;
|
|
310
|
+
const el = getContainerEl();
|
|
311
|
+
if (!el) {
|
|
312
|
+
throw new Error([
|
|
313
|
+
`[@cypress/react] 🔥 Hmm, cannot find root element to mount the component. Searched for ${ROOT_SELECTOR}`
|
|
314
|
+
].join(" "));
|
|
315
|
+
}
|
|
316
|
+
const key = rerenderKey !== null && rerenderKey !== void 0 ? rerenderKey : (
|
|
317
|
+
// @ts-ignore provide unique key to the the wrapped component to make sure we are rerendering between tests
|
|
318
|
+
(((_c = (_b = (_a = Cypress === null || Cypress === void 0 ? void 0 : Cypress.mocha) === null || _a === void 0 ? void 0 : _a.getRunner()) === null || _b === void 0 ? void 0 : _b.test) === null || _c === void 0 ? void 0 : _c.title) || "") + Math.random()
|
|
319
|
+
);
|
|
320
|
+
const props = {
|
|
321
|
+
key
|
|
322
|
+
};
|
|
323
|
+
const reactComponent = React.createElement(options.strict ? React.StrictMode : React.Fragment, props, jsx2);
|
|
324
|
+
const userComponent = reactComponent.props.children;
|
|
325
|
+
internalMountOptions.render(reactComponent, el, reactDomToUse);
|
|
326
|
+
return cy.wrap(userComponent, { log: false }).then(() => {
|
|
327
|
+
return cy.wrap({
|
|
328
|
+
component: userComponent,
|
|
329
|
+
rerender: (newComponent) => makeMountFn("rerender", newComponent, options, key, internalMountOptions),
|
|
330
|
+
unmount: () => {
|
|
331
|
+
Cypress.utils.throwErrByPath("mount.unmount");
|
|
332
|
+
}
|
|
333
|
+
}, { log: false });
|
|
334
|
+
}).wait(0, { log: false }).then(() => {
|
|
335
|
+
if (options.log !== false) {
|
|
336
|
+
const componentName = getDisplayName(jsx2);
|
|
337
|
+
const jsxComponentName = `<${componentName} ... />`;
|
|
338
|
+
Cypress.log({
|
|
339
|
+
name: type,
|
|
340
|
+
type: "parent",
|
|
341
|
+
message: [jsxComponentName],
|
|
342
|
+
// @ts-ignore
|
|
343
|
+
$el: el.children.item(0),
|
|
344
|
+
consoleProps: () => {
|
|
345
|
+
return {
|
|
346
|
+
// @ts-ignore protect the use of jsx functional components use ReactNode
|
|
347
|
+
props: jsx2 === null || jsx2 === void 0 ? void 0 : jsx2.props,
|
|
348
|
+
description: type === "mount" ? "Mounts React component" : "Rerenders mounted React component",
|
|
349
|
+
home: "https://github.com/cypress-io/cypress"
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
const makeUnmountFn = (options) => {
|
|
358
|
+
return cy.then(() => {
|
|
359
|
+
var _a;
|
|
360
|
+
const wasUnmounted = mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
|
|
361
|
+
if (wasUnmounted && options.log) {
|
|
362
|
+
Cypress.log({
|
|
363
|
+
name: "unmount",
|
|
364
|
+
type: "parent",
|
|
365
|
+
message: [(_a = options.boundComponentMessage) !== null && _a !== void 0 ? _a : "Unmounted component"],
|
|
366
|
+
consoleProps: () => {
|
|
367
|
+
return {
|
|
368
|
+
description: "Unmounts React component",
|
|
369
|
+
parent: getContainerEl().parentNode,
|
|
370
|
+
home: "https://github.com/cypress-io/cypress"
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
};
|
|
377
|
+
const preMountCleanup = () => {
|
|
378
|
+
mountCleanup === null || mountCleanup === void 0 ? void 0 : mountCleanup();
|
|
379
|
+
};
|
|
380
|
+
setupHooks(preMountCleanup);
|
|
381
|
+
const debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
382
|
+
};
|
|
383
|
+
var debug_1 = debug;
|
|
384
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
385
|
+
const MAX_LENGTH$1 = 256;
|
|
386
|
+
const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
387
|
+
9007199254740991;
|
|
388
|
+
const MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
389
|
+
const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH$1 - 6;
|
|
390
|
+
const RELEASE_TYPES = [
|
|
391
|
+
"major",
|
|
392
|
+
"premajor",
|
|
393
|
+
"minor",
|
|
394
|
+
"preminor",
|
|
395
|
+
"patch",
|
|
396
|
+
"prepatch",
|
|
397
|
+
"prerelease"
|
|
398
|
+
];
|
|
399
|
+
var constants = {
|
|
400
|
+
MAX_LENGTH: MAX_LENGTH$1,
|
|
401
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
402
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
403
|
+
MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,
|
|
404
|
+
RELEASE_TYPES,
|
|
405
|
+
SEMVER_SPEC_VERSION,
|
|
406
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
407
|
+
FLAG_LOOSE: 2
|
|
408
|
+
};
|
|
409
|
+
function createCommonjsModule(fn) {
|
|
410
|
+
var module = { exports: {} };
|
|
411
|
+
return fn(module, module.exports), module.exports;
|
|
412
|
+
}
|
|
413
|
+
createCommonjsModule(function(module, exports) {
|
|
414
|
+
const {
|
|
415
|
+
MAX_SAFE_COMPONENT_LENGTH: MAX_SAFE_COMPONENT_LENGTH2,
|
|
416
|
+
MAX_SAFE_BUILD_LENGTH: MAX_SAFE_BUILD_LENGTH2,
|
|
417
|
+
MAX_LENGTH
|
|
418
|
+
} = constants;
|
|
419
|
+
exports = module.exports = {};
|
|
420
|
+
const re = exports.re = [];
|
|
421
|
+
const safeRe = exports.safeRe = [];
|
|
422
|
+
const src = exports.src = [];
|
|
423
|
+
const t = exports.t = {};
|
|
424
|
+
let R = 0;
|
|
425
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
426
|
+
const safeRegexReplacements = [
|
|
427
|
+
["\\s", 1],
|
|
428
|
+
["\\d", MAX_LENGTH],
|
|
429
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH2]
|
|
430
|
+
];
|
|
431
|
+
const makeSafeRegex = (value) => {
|
|
432
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
433
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
434
|
+
}
|
|
435
|
+
return value;
|
|
436
|
+
};
|
|
437
|
+
const createToken = (name, value, isGlobal) => {
|
|
438
|
+
const safe = makeSafeRegex(value);
|
|
439
|
+
const index = R++;
|
|
440
|
+
debug_1(name, index, value);
|
|
441
|
+
t[name] = index;
|
|
442
|
+
src[index] = value;
|
|
443
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
444
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
445
|
+
};
|
|
446
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
447
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
448
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
449
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
450
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
451
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
452
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
|
453
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
454
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
455
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
456
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
457
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
458
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
459
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
460
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
461
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
462
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
463
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
464
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
465
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
466
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
467
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
468
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH2}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH2}}))?`);
|
|
469
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
470
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
471
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
472
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
473
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
474
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
475
|
+
exports.tildeTrimReplace = "$1~";
|
|
476
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
477
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
478
|
+
createToken("LONECARET", "(?:\\^)");
|
|
479
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
480
|
+
exports.caretTrimReplace = "$1^";
|
|
481
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
482
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
483
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
484
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
485
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
486
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
487
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
488
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
489
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
490
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
491
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
492
|
+
});
|
|
493
|
+
let root;
|
|
494
|
+
const cleanup = () => {
|
|
495
|
+
if (root) {
|
|
496
|
+
root.unmount();
|
|
497
|
+
root = null;
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
return false;
|
|
501
|
+
};
|
|
502
|
+
function mount$1(jsx2, options = {}, rerenderKey) {
|
|
503
|
+
cleanup();
|
|
504
|
+
const internalOptions = {
|
|
505
|
+
reactDom: client,
|
|
506
|
+
render: (reactComponent, el) => {
|
|
507
|
+
if (!root) {
|
|
508
|
+
root = client.createRoot(el);
|
|
509
|
+
}
|
|
510
|
+
return root.render(reactComponent);
|
|
511
|
+
},
|
|
512
|
+
unmount: internalUnmount,
|
|
513
|
+
cleanup
|
|
514
|
+
};
|
|
515
|
+
return makeMountFn("mount", jsx2, Object.assign({ ReactDom: client }, options), rerenderKey, internalOptions);
|
|
516
|
+
}
|
|
517
|
+
function internalUnmount(options = { log: true }) {
|
|
518
|
+
return makeUnmountFn(options);
|
|
519
|
+
}
|
|
520
|
+
var Action = /* @__PURE__ */ ((Action2) => {
|
|
521
|
+
Action2["Pop"] = "POP";
|
|
522
|
+
Action2["Push"] = "PUSH";
|
|
523
|
+
Action2["Replace"] = "REPLACE";
|
|
524
|
+
return Action2;
|
|
525
|
+
})(Action || {});
|
|
526
|
+
class RomaMockedServiceDiscovery {
|
|
527
|
+
constructor() {
|
|
528
|
+
this.environment = {
|
|
529
|
+
type: "",
|
|
530
|
+
clientId: "",
|
|
531
|
+
services: []
|
|
532
|
+
};
|
|
533
|
+
this.configureClient = cy.stub().as("configureClient");
|
|
534
|
+
this.createClient = cy.stub().as("createClient.sd");
|
|
535
|
+
}
|
|
536
|
+
resolveService(key) {
|
|
537
|
+
return Promise.resolve({
|
|
538
|
+
name: "mocked_service_name",
|
|
539
|
+
key: "mocked_service_key",
|
|
540
|
+
url: "mocked_service_url",
|
|
541
|
+
uri: "mocked_service_url",
|
|
542
|
+
version: "mocked_service_version",
|
|
543
|
+
environment: "mocked_service_environment",
|
|
544
|
+
defaultScopes: []
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
async resolveServices() {
|
|
548
|
+
return this.environment.services;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
const _logger = {
|
|
552
|
+
get: (obj, property) => cy.log
|
|
553
|
+
};
|
|
554
|
+
const logger = new Proxy({}, _logger);
|
|
555
|
+
class RomaMockedAuthModule {
|
|
556
|
+
constructor() {
|
|
557
|
+
this.defaultAccount = {
|
|
558
|
+
homeAccountId: "mocked_home_account_id",
|
|
559
|
+
environment: "mocked_environment",
|
|
560
|
+
tenantId: "mocked_tenant_id",
|
|
561
|
+
username: "mocked_username",
|
|
562
|
+
localAccountId: "mocked_local_account_id",
|
|
563
|
+
name: "Mocked User"
|
|
564
|
+
};
|
|
565
|
+
this.defaultClient = {
|
|
566
|
+
acquireToken: (req) => Promise.resolve({
|
|
567
|
+
authority: "https://login.microsoftonline.com/mock",
|
|
568
|
+
uniqueId: "mocked_unique_id",
|
|
569
|
+
tenantId: "mocked_tenant_id",
|
|
570
|
+
scopes: req.scopes || [],
|
|
571
|
+
account: this.defaultAccount,
|
|
572
|
+
idToken: "mocked_id_token",
|
|
573
|
+
idTokenClaims: {},
|
|
574
|
+
accessToken: "mocked_access_token",
|
|
575
|
+
fromCache: false,
|
|
576
|
+
expiresOn: new Date(Date.now() + 3600 * 1e3),
|
|
577
|
+
// 1 hour from now
|
|
578
|
+
tokenType: "Bearer",
|
|
579
|
+
correlationId: "mocked_correlation_id"
|
|
580
|
+
}),
|
|
581
|
+
handleRedirectPromise: () => Promise.resolve(null),
|
|
582
|
+
login: () => Promise.resolve(),
|
|
583
|
+
account: {
|
|
584
|
+
homeAccountId: "mocked_home_account_id",
|
|
585
|
+
environment: "mocked_environment",
|
|
586
|
+
tenantId: "mocked_tenant_id",
|
|
587
|
+
username: "mocked_username",
|
|
588
|
+
localAccountId: "mocked_local_account_id",
|
|
589
|
+
name: "Mocked User"
|
|
590
|
+
},
|
|
591
|
+
setLogger: cy.stub().as("setLogger"),
|
|
592
|
+
getLogger: () => logger,
|
|
593
|
+
requestOrigin: ""
|
|
594
|
+
};
|
|
595
|
+
this.defaultConfig = {
|
|
596
|
+
tenantId: "mocked_tenant_id",
|
|
597
|
+
clientId: "mocked_client_id",
|
|
598
|
+
redirectUri: "https://mocked.redirect.uri",
|
|
599
|
+
config: {}
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
acquireAccessToken(req) {
|
|
603
|
+
return Promise.resolve(
|
|
604
|
+
"part1." + window.btoa('{"roles": ["role1", "role2", "TRADE_ASSISTANCE_READ"]}') + ".part3"
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
acquireToken(req) {
|
|
608
|
+
return Promise.resolve({
|
|
609
|
+
authority: "https://login.microsoftonline.com/mock",
|
|
610
|
+
uniqueId: "mocked_unique_id",
|
|
611
|
+
tenantId: "mocked_tenant_id",
|
|
612
|
+
scopes: req.scopes || [],
|
|
613
|
+
account: this.defaultAccount || null,
|
|
614
|
+
idToken: "mocked_id_token",
|
|
615
|
+
idTokenClaims: {},
|
|
616
|
+
accessToken: "mocked_access_token",
|
|
617
|
+
fromCache: false,
|
|
618
|
+
expiresOn: new Date(Date.now() + 3600 * 1e3),
|
|
619
|
+
// 1 hour from now
|
|
620
|
+
tokenType: "Bearer",
|
|
621
|
+
correlationId: "mocked_correlation_id"
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
createClient(name) {
|
|
625
|
+
return this.defaultClient;
|
|
626
|
+
}
|
|
627
|
+
getClient(name) {
|
|
628
|
+
return this.createClient(name);
|
|
629
|
+
}
|
|
630
|
+
handleRedirect() {
|
|
631
|
+
return Promise.resolve(null);
|
|
632
|
+
}
|
|
633
|
+
login() {
|
|
634
|
+
return Promise.resolve(void 0);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
class Navigator {
|
|
638
|
+
constructor() {
|
|
639
|
+
this.basename = "";
|
|
640
|
+
this.origin = "";
|
|
641
|
+
this.value = {
|
|
642
|
+
action: Action.Push,
|
|
643
|
+
location: null,
|
|
644
|
+
delta: null
|
|
645
|
+
};
|
|
646
|
+
this.location = null;
|
|
647
|
+
this.action = Action$2.Push;
|
|
648
|
+
this.createHref = cy.stub().as("createHref");
|
|
649
|
+
this.createURL = cy.stub().as("createURL");
|
|
650
|
+
this.encodeLocation = cy.stub().as("encodeLocation");
|
|
651
|
+
this.push = cy.stub().as("push");
|
|
652
|
+
this.replace = cy.stub().as("replace");
|
|
653
|
+
this.go = cy.stub().as("go");
|
|
654
|
+
this.listen = cy.stub().as("listen");
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
class RomaMockedNavigationModule {
|
|
658
|
+
constructor() {
|
|
659
|
+
this.dispose = cy.stub();
|
|
660
|
+
this.navigator = new Navigator();
|
|
661
|
+
this.path = { pathname: "string", search: "string", hash: "string" };
|
|
662
|
+
this.state$ = of({
|
|
663
|
+
action: Action.Push,
|
|
664
|
+
location: this.path
|
|
665
|
+
});
|
|
666
|
+
this.createHref = cy.stub().as("createHref.module");
|
|
667
|
+
this.createRouter = cy.stub().as("createRouter");
|
|
668
|
+
this.createURL = cy.stub().as("createURL.module");
|
|
669
|
+
this.push = cy.stub().as("push.module");
|
|
670
|
+
this.replace = cy.stub().as("replace.module");
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
class RomaMockedHttpClient {
|
|
674
|
+
hasClient() {
|
|
675
|
+
return true;
|
|
676
|
+
}
|
|
677
|
+
createClient() {
|
|
678
|
+
return {
|
|
679
|
+
fetch: (url, options) => {
|
|
680
|
+
return fetch(url.startsWith("/") ? url : `/${url}`, options);
|
|
681
|
+
},
|
|
682
|
+
fetch$(path, init) {
|
|
683
|
+
return from(this.fetch(path, init));
|
|
684
|
+
},
|
|
685
|
+
fetchAsync(path, args) {
|
|
686
|
+
return this.fetch(path, args);
|
|
687
|
+
},
|
|
688
|
+
async blob(path, args) {
|
|
689
|
+
const r = await fetch(path, args);
|
|
690
|
+
return await r.blob();
|
|
691
|
+
},
|
|
692
|
+
blob$(path, args) {
|
|
693
|
+
return from(this.blob(path, args));
|
|
694
|
+
},
|
|
695
|
+
async json(path, init) {
|
|
696
|
+
const r = await this.fetch(path, init);
|
|
697
|
+
return await r.json();
|
|
698
|
+
},
|
|
699
|
+
json$(path, init) {
|
|
700
|
+
return from(this.json(path, init));
|
|
701
|
+
},
|
|
702
|
+
jsonAsync(path, args) {
|
|
703
|
+
return this.json(path, args);
|
|
704
|
+
},
|
|
705
|
+
uri: ""
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
createCustomClient() {
|
|
709
|
+
return this.createClient();
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
class Connection {
|
|
713
|
+
constructor(messages = []) {
|
|
714
|
+
this.interval$ = interval(50);
|
|
715
|
+
this.setReadState = cy.stub().as("setReadState");
|
|
716
|
+
this.messageList = new BehaviorSubject(messages);
|
|
717
|
+
this.messageList$ = this.messageList;
|
|
718
|
+
}
|
|
719
|
+
async setAllRead() {
|
|
720
|
+
const currentValues = await firstValueFrom(this.messageList);
|
|
721
|
+
const newValues = [...currentValues].map((v) => ({ ...v, read: true }));
|
|
722
|
+
this.messageList.next(newValues);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
class RomaMockedSseModule {
|
|
726
|
+
constructor(messageList = []) {
|
|
727
|
+
this.messageList = messageList;
|
|
728
|
+
const connection = this.connect("activity");
|
|
729
|
+
this.connections = new Proxy(
|
|
730
|
+
{},
|
|
731
|
+
{
|
|
732
|
+
get: () => connection
|
|
733
|
+
}
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
connect(name) {
|
|
737
|
+
return new Connection(this.messageList ?? []);
|
|
738
|
+
}
|
|
739
|
+
createConnection(name, options) {
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
const RomaCypressWrapper = ({
|
|
743
|
+
children,
|
|
744
|
+
events
|
|
745
|
+
}) => {
|
|
746
|
+
const navigation = new RomaMockedNavigationModule();
|
|
747
|
+
const http = new RomaMockedHttpClient();
|
|
748
|
+
const auth = new RomaMockedAuthModule();
|
|
749
|
+
const serviceDiscovery = new RomaMockedServiceDiscovery();
|
|
750
|
+
const sse = new RomaMockedSseModule(events ?? []);
|
|
751
|
+
return /* @__PURE__ */ jsx(
|
|
752
|
+
FrameworkProvider,
|
|
753
|
+
{
|
|
754
|
+
value: {
|
|
755
|
+
modules: {
|
|
756
|
+
dispose: () => {
|
|
757
|
+
},
|
|
758
|
+
navigation,
|
|
759
|
+
sse,
|
|
760
|
+
http,
|
|
761
|
+
auth,
|
|
762
|
+
serviceDiscovery
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
children: /* @__PURE__ */ jsx(
|
|
766
|
+
ModuleProvider,
|
|
767
|
+
{
|
|
768
|
+
value: {
|
|
769
|
+
navigation,
|
|
770
|
+
http,
|
|
771
|
+
auth
|
|
772
|
+
},
|
|
773
|
+
children: /* @__PURE__ */ jsx(
|
|
774
|
+
QueryClientProvider,
|
|
775
|
+
{
|
|
776
|
+
client: new QueryClient({
|
|
777
|
+
defaultOptions: {
|
|
778
|
+
queries: {
|
|
779
|
+
staleTime: Infinity,
|
|
780
|
+
refetchInterval: false,
|
|
781
|
+
refetchIntervalInBackground: false,
|
|
782
|
+
refetchOnMount: false,
|
|
783
|
+
refetchOnReconnect: false,
|
|
784
|
+
refetchOnWindowFocus: false,
|
|
785
|
+
retry: false
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}),
|
|
789
|
+
children: /* @__PURE__ */ jsx(IntlProvider, { locale: "en-US", children })
|
|
790
|
+
}
|
|
791
|
+
)
|
|
792
|
+
}
|
|
793
|
+
)
|
|
794
|
+
}
|
|
795
|
+
);
|
|
796
|
+
};
|
|
797
|
+
const mount = (component, options = {}) => {
|
|
798
|
+
var _a;
|
|
799
|
+
return mount$1(
|
|
800
|
+
/* @__PURE__ */ jsx(RomaCypressWrapper, { events: (_a = options.moduleConfig) == null ? void 0 : _a.events, children: component }),
|
|
801
|
+
options
|
|
802
|
+
);
|
|
803
|
+
};
|
|
804
|
+
export {
|
|
805
|
+
mount
|
|
806
|
+
};
|