@sapui5/sap.fe.test 1.116.0 → 1.118.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.
@@ -509,12 +509,27 @@ sap.ui.predefine("sap/fe/test/CollaborationClient", ["sap/fe/core/controllerexte
509
509
  },
510
510
  iCheckDefaultUserRemovedLock: function (sPropertyPath) {
511
511
  return OpaBuilder.create(this).check(function () {
512
- return CollaborationAPI.checkReceived({
512
+ // Check that we have received an UNLOCK without a CHANGE
513
+ return !CollaborationAPI.checkReceived({
514
+ userID: "DEFAULT_USER",
515
+ userAction: Activity.Change,
516
+ clientContent: sPropertyPath
517
+ }, false) && CollaborationAPI.checkReceived({
513
518
  userID: "DEFAULT_USER",
514
519
  userAction: Activity.Unlock,
515
520
  clientContent: sPropertyPath
516
521
  });
517
- }).description(`Remote session received unlock notification for${sPropertyPath}`).execute();
522
+ }).description(`Remote session received unlock without change notification for${sPropertyPath}`).execute();
523
+ },
524
+ iCheckValueIsLockedByDefaultUser: function (sPropertyPath) {
525
+ return OpaBuilder.create(this).check(function () {
526
+ return CollaborationAPI.checkLockedByOther(sPropertyPath);
527
+ }).description(`On remote session, property ${sPropertyPath} is currently locked by another user`).execute();
528
+ },
529
+ iCheckValueIsNotLockedByDefaultUser: function (sPropertyPath) {
530
+ return OpaBuilder.create(this).check(function () {
531
+ return !CollaborationAPI.checkLockedByOther(sPropertyPath);
532
+ }).description(`On remote session, property ${sPropertyPath} is not locked by another user`).execute();
518
533
  },
519
534
  iCheckDefaultUserLeftDraft: function () {
520
535
  return OpaBuilder.create(this).check(function () {
@@ -712,6 +727,7 @@ sap.ui.predefine("sap/fe/test/FeMocks", ["@sap-ux/jest-mock-ui5/dist/generic", "
712
727
  function mockListReportController() {
713
728
  // manually add ListReportController.controller functions since I am unable to import the prototype
714
729
  const listReport = {
730
+ _getApplyAutomaticallyOnVariant: jest.fn(),
715
731
  _getFilterBarControl: jest.fn(),
716
732
  _getControls: jest.fn(),
717
733
  _isFilterBarHidden: jest.fn(),
@@ -722,6 +738,7 @@ sap.ui.predefine("sap/fe/test/FeMocks", ["@sap-ux/jest-mock-ui5/dist/generic", "
722
738
  _shouldAutoTriggerSearch: jest.fn(),
723
739
  _getTable: jest.fn(),
724
740
  getExtensionAPI: jest.fn(),
741
+ getFilterBarSelectionVariant: jest.fn(),
725
742
  getChartControl: jest.fn(),
726
743
  editFlow: mock(EditFlow)
727
744
  };
@@ -1788,12 +1805,13 @@ sap.ui.predefine("sap/fe/test/JestFlexibilityHelper", [], function () {
1788
1805
  * SAP UI development toolkit for HTML5 (SAPUI5)
1789
1806
  * (c) Copyright 2009-2023 SAP SE. All rights reserved
1790
1807
  */
1791
- sap.ui.predefine("sap/fe/test/JestTemplatingHelper", ["@sap/cds-compiler", "fs", "@prettier/plugin-xml", "path", "prettier", "sap/base/Log", "sap/base/util/LoaderExtensions", "sap/base/util/merge", "sap/fe/core/converters/ConverterContext", "sap/fe/core/services/SideEffectsServiceFactory", "sap/fe/core/TemplateModel", "sap/fe/test/UI5MockHelper", "sap/ui/base/BindingParser", "sap/ui/base/ManagedObjectMetadata", "sap/ui/core/Component", "sap/ui/core/InvisibleText", "sap/ui/core/util/serializer/Serializer", "sap/ui/core/util/XMLPreprocessor", "sap/ui/fl/apply/_internal/flexState/FlexState", "sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor", "sap/ui/fl/initial/_internal/Storage", "sap/ui/fl/Utils", "sap/ui/model/json/JSONModel", "sap/ui/model/odata/v4/lib/_MetadataRequestor", "sap/ui/model/odata/v4/ODataMetaModel", "xpath", "./JestFlexibilityHelper"], function (compiler, fs, plugin, path, prettier, Log, LoaderExtensions, merge, ConverterContext, SideEffectsFactory, TemplateModel, UI5MockHelper, BindingParser, ManagedObjectMetadata, Component, InvisibleText, Serializer, XMLPreprocessor, FlexState, XmlPreprocessor, AppStorage, Utils, JSONModel, _MetadataRequestor, ODataMetaModel, xpath, JestFlexibilityHelper) {
1808
+ sap.ui.predefine("sap/fe/test/JestTemplatingHelper", ["@sap/cds-compiler", "fs", "@prettier/plugin-xml", "path", "prettier", "sap/base/Log", "sap/base/util/LoaderExtensions", "sap/base/util/merge", "sap/fe/core/buildingBlocks/BuildingBlockTemplateProcessor", "sap/fe/core/converters/ConverterContext", "sap/fe/core/services/SideEffectsServiceFactory", "sap/fe/core/TemplateModel", "sap/fe/test/UI5MockHelper", "sap/ui/base/BindingParser", "sap/ui/base/ManagedObject", "sap/ui/base/ManagedObjectMetadata", "sap/ui/core/Component", "sap/ui/core/InvisibleText", "sap/ui/core/util/serializer/Serializer", "sap/ui/core/util/XMLPreprocessor", "sap/ui/core/XMLTemplateProcessor", "sap/ui/fl/apply/_internal/flexState/FlexState", "sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor", "sap/ui/fl/initial/_internal/Storage", "sap/ui/fl/Utils", "sap/ui/model/json/JSONModel", "sap/ui/model/odata/v4/lib/_MetadataRequestor", "sap/ui/model/odata/v4/ODataMetaModel", "xpath", "./JestFlexibilityHelper"], function (compiler, fs, plugin, path, prettier, Log, LoaderExtensions, merge, BuildingBlockTemplateProcessor, ConverterContext, SideEffectsFactory, TemplateModel, UI5MockHelper, BindingParser, ManagedObject, ManagedObjectMetadata, Component, InvisibleText, Serializer, XMLPreprocessor, XMLTemplateProcessor, FlexState, XmlPreprocessor, AppStorage, Utils, JSONModel, _MetadataRequestor, ODataMetaModel, xpath, JestFlexibilityHelper) {
1792
1809
  "use strict";
1793
1810
 
1794
1811
  var _exports = {};
1795
1812
  var createFlexibilityChangesObject = JestFlexibilityHelper.createFlexibilityChangesObject;
1796
1813
  var createMockResourceModel = UI5MockHelper.createMockResourceModel;
1814
+ var parseXMLString = BuildingBlockTemplateProcessor.parseXMLString;
1797
1815
  var format = prettier.format;
1798
1816
  // eslint-disable-next-line @typescript-eslint/no-var-requires
1799
1817
  const formatXml = require("xml-formatter");
@@ -2409,6 +2427,36 @@ sap.ui.predefine("sap/fe/test/JestTemplatingHelper", ["@sap/cds-compiler", "fs",
2409
2427
  };
2410
2428
  }
2411
2429
  _exports.createAwaiter = createAwaiter;
2430
+ function renderBuildingBlockWithModels(buildingBlock, models) {
2431
+ return ManagedObject.runWithPreprocessors(() => {
2432
+ return buildingBlock.getContent();
2433
+ }, {
2434
+ settings: function (controlSettings) {
2435
+ controlSettings.models = models;
2436
+ return controlSettings;
2437
+ }
2438
+ });
2439
+ }
2440
+ _exports.renderBuildingBlockWithModels = renderBuildingBlockWithModels;
2441
+ function registerMockFragments() {
2442
+ for (var _len2 = arguments.length, fragments = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2443
+ fragments[_key2] = arguments[_key2];
2444
+ }
2445
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2446
+ const originalLoadTemplate = XMLTemplateProcessor.loadTemplatePromise;
2447
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2448
+ const loadTemplateStub = jest.spyOn(XMLTemplateProcessor, "loadTemplatePromise");
2449
+ loadTemplateStub.mockImplementation((templateName, extension) => {
2450
+ for (const fragment of fragments) {
2451
+ if (fragment.name === templateName) {
2452
+ return parseXMLString(fragment.content)[0];
2453
+ }
2454
+ }
2455
+ return originalLoadTemplate(templateName, extension);
2456
+ });
2457
+ return loadTemplateStub;
2458
+ }
2459
+ _exports.registerMockFragments = registerMockFragments;
2412
2460
  return _exports;
2413
2461
  }, false);
2414
2462
  /*!
@@ -5701,6 +5749,9 @@ sap.ui.predefine("sap/fe/test/UI5MockHelper", ["@sap-ux/jest-mock-ui5/dist/gener
5701
5749
 
5702
5750
  // Default behavior
5703
5751
  mocked.mock.getParameter.mockImplementation(name => mocked._params[name]);
5752
+ mocked.mock.getParameters.mockImplementation(() => {
5753
+ return mocked._params;
5754
+ });
5704
5755
  return mocked;
5705
5756
  }
5706
5757
  /**
@@ -6131,14 +6182,13 @@ sap.ui.predefine(
6131
6182
  }
6132
6183
  });
6133
6184
  }
6134
-
6135
6185
  var uri = new URL(oTargetManifest["sap.app"].dataSources.mainService.uri, document.location);
6136
6186
  var sUser = oUriParams.get("user");
6137
6187
  if (sUser) {
6138
6188
  uri.searchParams.set("user", sUser);
6139
6189
  }
6140
6190
 
6141
- oTargetManifest["sap.app"].dataSources.mainService.uri = uri.toString();
6191
+ oTargetManifest["sap.app"].dataSources.mainService.uri = uri.toString().replace(document.location, "");
6142
6192
 
6143
6193
  return oTargetManifest;
6144
6194
  };
@@ -7053,6 +7103,7 @@ sap.ui.predefine("sap/fe/test/api/CollaborationAPI", ["sap/base/Log", "sap/fe/co
7053
7103
  _oModel: undefined,
7054
7104
  _lockedPropertyPath: "",
7055
7105
  _internalModel: undefined,
7106
+ _receivedLocks: [],
7056
7107
  /**
7057
7108
  * Open an existing collaborative draft with a new user, and creates a 'ghost client' for this user.
7058
7109
  *
@@ -7073,7 +7124,7 @@ sap.ui.predefine("sap/fe/test/api/CollaborationAPI", ["sap/base/Log", "sap/fe/co
7073
7124
  id: userID,
7074
7125
  name: userName,
7075
7126
  initialName: userName
7076
- }, webSocketBaseURL, sDraftUUID, serviceUrl, this._internalModel, this._onMessageReceived.bind(this), true);
7127
+ }, webSocketBaseURL, sDraftUUID, serviceUrl, this._internalModel, this._onMessageReceived.bind(this), {}, true);
7077
7128
  this._rootPath = oContext.getPath();
7078
7129
  this._oModel = oContext.getModel();
7079
7130
  },
@@ -7081,16 +7132,20 @@ sap.ui.predefine("sap/fe/test/api/CollaborationAPI", ["sap/base/Log", "sap/fe/co
7081
7132
  * Checks if the ghost client has received a given message.
7082
7133
  *
7083
7134
  * @param message The message content to be looked for
7135
+ * @param resetHistory If true, reset history of received messages
7084
7136
  * @returns True if a previously received message matches the content
7085
7137
  */
7086
7138
  checkReceived: function (message) {
7139
+ let resetHistory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
7087
7140
  if (this._lastReceivedMessages.length === 0) {
7088
7141
  return false;
7089
7142
  }
7090
7143
  const found = this._lastReceivedMessages.some(receivedMessage => {
7091
7144
  return (!message.userID || message.userID === receivedMessage.userID) && (!message.userAction || message.userAction === receivedMessage.userAction) && (!message.clientContent || message.clientContent === receivedMessage.clientContent);
7092
7145
  });
7093
- this._lastReceivedMessages = []; // reset history to avoid finding the same message twice
7146
+ if (resetHistory) {
7147
+ this._lastReceivedMessages = []; // by default, reset history to avoid finding the same message twice
7148
+ }
7094
7149
 
7095
7150
  return found;
7096
7151
  },
@@ -7140,6 +7195,7 @@ sap.ui.predefine("sap/fe/test/api/CollaborationAPI", ["sap/base/Log", "sap/fe/co
7140
7195
  oPropertyBinding.setValue(value);
7141
7196
  oContextBinding.attachEventOnce("patchCompleted", () => {
7142
7197
  broadcastCollaborationMessage(Activity.Change, `${this._rootPath}/${sPropertyPath}`, this._internalModel);
7198
+ this.unlockField();
7143
7199
  this._lockedPropertyPath = "";
7144
7200
  });
7145
7201
  }).catch(function (err) {
@@ -7189,6 +7245,15 @@ sap.ui.predefine("sap/fe/test/api/CollaborationAPI", ["sap/base/Log", "sap/fe/co
7189
7245
  });
7190
7246
  }
7191
7247
  },
7248
+ /**
7249
+ * Checks if a property has been locked by another user.
7250
+ *
7251
+ * @param objectPath
7252
+ * @returns True if locked
7253
+ */
7254
+ checkLockedByOther: function (objectPath) {
7255
+ return this._receivedLocks.includes(objectPath);
7256
+ },
7192
7257
  // /////////////////////////////
7193
7258
  // Private methods
7194
7259
 
@@ -7209,9 +7274,25 @@ sap.ui.predefine("sap/fe/test/api/CollaborationAPI", ["sap/base/Log", "sap/fe/co
7209
7274
  */
7210
7275
  _onMessageReceived: function (message) {
7211
7276
  message.userAction = message.userAction || message.clientAction;
7277
+ if (!message.clientContent) {
7278
+ message.clientContent = "";
7279
+ }
7212
7280
  this._lastReceivedMessages.push(message);
7213
- if (message.userAction === Activity.Join) {
7214
- broadcastCollaborationMessage(Activity.JoinEcho, this._lockedPropertyPath ? `${this._rootPath}/${this._lockedPropertyPath}` : undefined, this._internalModel);
7281
+ switch (message.userAction) {
7282
+ case Activity.Join:
7283
+ broadcastCollaborationMessage(Activity.JoinEcho, this._lockedPropertyPath ? `${this._rootPath}/${this._lockedPropertyPath}` : undefined, this._internalModel);
7284
+ break;
7285
+ case Activity.JoinEcho:
7286
+ case Activity.Lock:
7287
+ this._receivedLocks.push(...message.clientContent.split("|"));
7288
+ break;
7289
+ case Activity.Unlock:
7290
+ this._receivedLocks = this._receivedLocks.filter(lock => {
7291
+ return !message.clientContent.split("|").includes(lock);
7292
+ });
7293
+ break;
7294
+ default:
7295
+ // Nothing
7215
7296
  }
7216
7297
  }
7217
7298
  };
@@ -15627,8 +15708,8 @@ sap.ui.predefine(
15627
15708
 
15628
15709
  */
15629
15710
  sap.ui.predefine(
15630
- "sap/fe/test/builder/MdcFieldBuilder", ["./FEBuilder", "sap/ui/test/OpaBuilder", "sap/ui/mdc/enum/FieldDisplay", "sap/fe/test/Utils", "sap/ui/mdc/enum/ConditionValidated"],
15631
- function (FEBuilder, OpaBuilder, FieldDisplay, Utils, ConditionValidated) {
15711
+ "sap/fe/test/builder/MdcFieldBuilder", ["./FEBuilder", "sap/ui/mdc/enums/FieldDisplay", "sap/fe/test/Utils", "sap/ui/mdc/enums/ConditionValidated"],
15712
+ function (FEBuilder, FieldDisplay, Utils, ConditionValidated) {
15632
15713
  "use strict";
15633
15714
 
15634
15715
  var VALUE_DESCRIPTION_PATTERN = /(.+?) \((.+?)\)/;
@@ -15655,7 +15736,7 @@ sap.ui.predefine(
15655
15736
  /**
15656
15737
  * This function checks the current value against expected values with respect to the display type.
15657
15738
  *
15658
- * @param {sap.ui.mdc.enum.FieldDisplay} sDisplay The type of display
15739
+ * @param {sap.ui.mdc.enums.FieldDisplay} sDisplay The type of display
15659
15740
  * @param {any} oExpectedValue
15660
15741
  * @param {any} oExpectedDescription
15661
15742
  * @param {any} vActualValue
@@ -17085,6 +17166,10 @@ sap.ui.predefine(
17085
17166
  },
17086
17167
  cellValue: function (vColumn, vExpectedValue) {
17087
17168
  return function (oRow) {
17169
+ if (oRow.isA("sap.m.GroupHeaderListItem")) {
17170
+ // don´t check grouping rows
17171
+ return null;
17172
+ }
17088
17173
  var oCellField = TableBuilder.Row.Matchers.cell(vColumn)(oRow);
17089
17174
  while (oCellField.isA("sap.fe.macros.MacroAPI")) {
17090
17175
  oCellField = oCellField.getContent();
@@ -18151,12 +18236,12 @@ sap.ui.predefine("sap/fe/test/library", ["sap/ui/core/Core", "sap/ui/core/librar
18151
18236
  controls: [],
18152
18237
  elements: [],
18153
18238
  // eslint-disable-next-line no-template-curly-in-string
18154
- version: "1.116.0",
18239
+ version: "1.118.0",
18155
18240
  noLibraryCSS: true
18156
18241
  });
18157
18242
  return thisLib;
18158
18243
  }, false);
18159
18244
  sap.ui.require.preload({
18160
- "sap/fe/test/manifest.json":'{"_version":"1.21.0","sap.app":{"id":"sap.fe.test","type":"library","embeds":[],"applicationVersion":{"version":"1.116.0"},"title":"UI5 library: sap.fe.test","description":"UI5 library: sap.fe.test","resources":"resources.json","offline":true},"sap.ui":{"technology":"UI5","supportedThemes":[]},"sap.ui5":{"dependencies":{"libs":{"sap.ui.core":{}}},"library":{"i18n":false,"content":{"controls":[],"elements":[],"types":[],"interfaces":[]}}}}'
18245
+ "sap/fe/test/manifest.json":'{"_version":"1.21.0","sap.app":{"id":"sap.fe.test","type":"library","embeds":[],"applicationVersion":{"version":"1.118.0"},"title":"UI5 library: sap.fe.test","description":"UI5 library: sap.fe.test","resources":"resources.json","offline":true},"sap.ui":{"technology":"UI5","supportedThemes":[]},"sap.ui5":{"dependencies":{"libs":{"sap.ui.core":{}}},"library":{"i18n":false,"content":{"controls":[],"elements":[],"types":[],"interfaces":[]}}}}'
18161
18246
  });
18162
18247
  //# sourceMappingURL=library-preload.js.map