@sap_oss/wdio-qmate-service 1.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/.eslintignore +3 -0
- package/.eslintrc.yml +33 -0
- package/.reuse/dep5 +29 -0
- package/LICENSE +201 -0
- package/LICENSES/Apache-2.0.txt +73 -0
- package/README.md +20 -0
- package/docs/contact.md +10 -0
- package/docs/doc.md +5188 -0
- package/docs/gettingStarted/selectors.md +168 -0
- package/docs/gettingStarted/setup.md +8 -0
- package/docs/index.md +14 -0
- package/docs/style/custom.css +24 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +171 -0
- package/lib/index.js.map +1 -0
- package/lib/reuse/authenticator/authConfig.d.ts +54 -0
- package/lib/reuse/authenticator/authConfig.js +55 -0
- package/lib/reuse/authenticator/authConfig.js.map +1 -0
- package/lib/reuse/authenticator/authHandler.d.ts +6 -0
- package/lib/reuse/authenticator/authHandler.js +37 -0
- package/lib/reuse/authenticator/authHandler.js.map +1 -0
- package/lib/reuse/authenticator/basicUrlAuthenticator.d.ts +2 -0
- package/lib/reuse/authenticator/basicUrlAuthenticator.js +36 -0
- package/lib/reuse/authenticator/basicUrlAuthenticator.js.map +1 -0
- package/lib/reuse/authenticator/customAuthenticator.d.ts +2 -0
- package/lib/reuse/authenticator/customAuthenticator.js +60 -0
- package/lib/reuse/authenticator/customAuthenticator.js.map +1 -0
- package/lib/reuse/authenticator/formAuthenticator.d.ts +2 -0
- package/lib/reuse/authenticator/formAuthenticator.js +57 -0
- package/lib/reuse/authenticator/formAuthenticator.js.map +1 -0
- package/lib/reuse/authenticator/plainAuthenticator.d.ts +2 -0
- package/lib/reuse/authenticator/plainAuthenticator.js +20 -0
- package/lib/reuse/authenticator/plainAuthenticator.js.map +1 -0
- package/lib/reuse/data/authenticators.json +16 -0
- package/lib/reuse/helper/clientsideUI5scripts.d.ts +1 -0
- package/lib/reuse/helper/clientsideUI5scripts.js +388 -0
- package/lib/reuse/helper/clientsideUI5scripts.js.map +1 -0
- package/lib/reuse/helper/jsDocGen.d.ts +1 -0
- package/lib/reuse/helper/jsDocGen.js +45 -0
- package/lib/reuse/helper/jsDocGen.js.map +1 -0
- package/lib/reuse/index.d.ts +5 -0
- package/lib/reuse/index.js +89 -0
- package/lib/reuse/index.js.map +1 -0
- package/lib/reuse/modules/common/Common.d.ts +12 -0
- package/lib/reuse/modules/common/Common.js +21 -0
- package/lib/reuse/modules/common/Common.js.map +1 -0
- package/lib/reuse/modules/common/assertion.d.ts +65 -0
- package/lib/reuse/modules/common/assertion.js +91 -0
- package/lib/reuse/modules/common/assertion.js.map +1 -0
- package/lib/reuse/modules/common/constants/date.constants.d.ts +8 -0
- package/lib/reuse/modules/common/constants/date.constants.js +13 -0
- package/lib/reuse/modules/common/constants/date.constants.js.map +1 -0
- package/lib/reuse/modules/common/constants/userInteraction.constants.d.ts +9 -0
- package/lib/reuse/modules/common/constants/userInteraction.constants.js +14 -0
- package/lib/reuse/modules/common/constants/userInteraction.constants.js.map +1 -0
- package/lib/reuse/modules/common/date.d.ts +84 -0
- package/lib/reuse/modules/common/date.js +164 -0
- package/lib/reuse/modules/common/date.js.map +1 -0
- package/lib/reuse/modules/common/navigation.d.ts +26 -0
- package/lib/reuse/modules/common/navigation.js +56 -0
- package/lib/reuse/modules/common/navigation.js.map +1 -0
- package/lib/reuse/modules/common/types/date.types.d.ts +2 -0
- package/lib/reuse/modules/common/types/date.types.js +3 -0
- package/lib/reuse/modules/common/types/date.types.js.map +1 -0
- package/lib/reuse/modules/common/userInteraction.d.ts +104 -0
- package/lib/reuse/modules/common/userInteraction.js +199 -0
- package/lib/reuse/modules/common/userInteraction.js.map +1 -0
- package/lib/reuse/modules/nonUi5/NonUi5.d.ts +12 -0
- package/lib/reuse/modules/nonUi5/NonUi5.js +21 -0
- package/lib/reuse/modules/nonUi5/NonUi5.js.map +1 -0
- package/lib/reuse/modules/nonUi5/assertion.d.ts +62 -0
- package/lib/reuse/modules/nonUi5/assertion.js +127 -0
- package/lib/reuse/modules/nonUi5/assertion.js.map +1 -0
- package/lib/reuse/modules/nonUi5/constants/userInteraction.constants.d.ts +6 -0
- package/lib/reuse/modules/nonUi5/constants/userInteraction.constants.js +11 -0
- package/lib/reuse/modules/nonUi5/constants/userInteraction.constants.js.map +1 -0
- package/lib/reuse/modules/nonUi5/element.d.ts +286 -0
- package/lib/reuse/modules/nonUi5/element.js +639 -0
- package/lib/reuse/modules/nonUi5/element.js.map +1 -0
- package/lib/reuse/modules/nonUi5/navigation.d.ts +17 -0
- package/lib/reuse/modules/nonUi5/navigation.js +44 -0
- package/lib/reuse/modules/nonUi5/navigation.js.map +1 -0
- package/lib/reuse/modules/nonUi5/userInteraction.d.ts +170 -0
- package/lib/reuse/modules/nonUi5/userInteraction.js +415 -0
- package/lib/reuse/modules/nonUi5/userInteraction.js.map +1 -0
- package/lib/reuse/modules/service/Service.d.ts +8 -0
- package/lib/reuse/modules/service/Service.js +17 -0
- package/lib/reuse/modules/service/Service.js.map +1 -0
- package/lib/reuse/modules/service/odata.d.ts +177 -0
- package/lib/reuse/modules/service/odata.js +347 -0
- package/lib/reuse/modules/service/odata.js.map +1 -0
- package/lib/reuse/modules/service/rest.d.ts +66 -0
- package/lib/reuse/modules/service/rest.js +168 -0
- package/lib/reuse/modules/service/rest.js.map +1 -0
- package/lib/reuse/modules/service/soap.d.ts +0 -0
- package/lib/reuse/modules/service/soap.js +2 -0
- package/lib/reuse/modules/service/soap.js.map +1 -0
- package/lib/reuse/modules/ui5/Ui5.d.ts +34 -0
- package/lib/reuse/modules/ui5/Ui5.js +41 -0
- package/lib/reuse/modules/ui5/Ui5.js.map +1 -0
- package/lib/reuse/modules/ui5/assertion.d.ts +183 -0
- package/lib/reuse/modules/ui5/assertion.js +493 -0
- package/lib/reuse/modules/ui5/assertion.js.map +1 -0
- package/lib/reuse/modules/ui5/confirmationDialog.d.ts +86 -0
- package/lib/reuse/modules/ui5/confirmationDialog.js +145 -0
- package/lib/reuse/modules/ui5/confirmationDialog.js.map +1 -0
- package/lib/reuse/modules/ui5/constants/mockserver.constants.d.ts +4 -0
- package/lib/reuse/modules/ui5/constants/mockserver.constants.js +9 -0
- package/lib/reuse/modules/ui5/constants/mockserver.constants.js.map +1 -0
- package/lib/reuse/modules/ui5/control.d.ts +84 -0
- package/lib/reuse/modules/ui5/control.js +132 -0
- package/lib/reuse/modules/ui5/control.js.map +1 -0
- package/lib/reuse/modules/ui5/date.d.ts +48 -0
- package/lib/reuse/modules/ui5/date.js +153 -0
- package/lib/reuse/modules/ui5/date.js.map +1 -0
- package/lib/reuse/modules/ui5/element.d.ts +160 -0
- package/lib/reuse/modules/ui5/element.js +349 -0
- package/lib/reuse/modules/ui5/element.js.map +1 -0
- package/lib/reuse/modules/ui5/errorDialog.d.ts +39 -0
- package/lib/reuse/modules/ui5/errorDialog.js +65 -0
- package/lib/reuse/modules/ui5/errorDialog.js.map +1 -0
- package/lib/reuse/modules/ui5/footerBar.d.ts +153 -0
- package/lib/reuse/modules/ui5/footerBar.js +240 -0
- package/lib/reuse/modules/ui5/footerBar.js.map +1 -0
- package/lib/reuse/modules/ui5/mockserver.d.ts +154 -0
- package/lib/reuse/modules/ui5/mockserver.js +665 -0
- package/lib/reuse/modules/ui5/mockserver.js.map +1 -0
- package/lib/reuse/modules/ui5/navigation.d.ts +103 -0
- package/lib/reuse/modules/ui5/navigation.js +275 -0
- package/lib/reuse/modules/ui5/navigation.js.map +1 -0
- package/lib/reuse/modules/ui5/navigationBar.d.ts +48 -0
- package/lib/reuse/modules/ui5/navigationBar.js +141 -0
- package/lib/reuse/modules/ui5/navigationBar.js.map +1 -0
- package/lib/reuse/modules/ui5/qunit.d.ts +17 -0
- package/lib/reuse/modules/ui5/qunit.js +52 -0
- package/lib/reuse/modules/ui5/qunit.js.map +1 -0
- package/lib/reuse/modules/ui5/session.d.ts +117 -0
- package/lib/reuse/modules/ui5/session.js +374 -0
- package/lib/reuse/modules/ui5/session.js.map +1 -0
- package/lib/reuse/modules/ui5/table.d.ts +61 -0
- package/lib/reuse/modules/ui5/table.js +188 -0
- package/lib/reuse/modules/ui5/table.js.map +1 -0
- package/lib/reuse/modules/ui5/types/mockserver.types.d.ts +2 -0
- package/lib/reuse/modules/ui5/types/mockserver.types.js +3 -0
- package/lib/reuse/modules/ui5/types/mockserver.types.js.map +1 -0
- package/lib/reuse/modules/ui5/userInteraction.d.ts +304 -0
- package/lib/reuse/modules/ui5/userInteraction.js +690 -0
- package/lib/reuse/modules/ui5/userInteraction.js.map +1 -0
- package/lib/reuse/modules/util/Util.d.ts +22 -0
- package/lib/reuse/modules/util/Util.js +27 -0
- package/lib/reuse/modules/util/Util.js.map +1 -0
- package/lib/reuse/modules/util/browser.d.ts +167 -0
- package/lib/reuse/modules/util/browser.js +367 -0
- package/lib/reuse/modules/util/browser.js.map +1 -0
- package/lib/reuse/modules/util/console.d.ts +56 -0
- package/lib/reuse/modules/util/console.js +152 -0
- package/lib/reuse/modules/util/console.js.map +1 -0
- package/lib/reuse/modules/util/constants/formatter.constants.d.ts +11 -0
- package/lib/reuse/modules/util/constants/formatter.constants.js +16 -0
- package/lib/reuse/modules/util/constants/formatter.constants.js.map +1 -0
- package/lib/reuse/modules/util/data.d.ts +36 -0
- package/lib/reuse/modules/util/data.js +87 -0
- package/lib/reuse/modules/util/data.js.map +1 -0
- package/lib/reuse/modules/util/file.d.ts +55 -0
- package/lib/reuse/modules/util/file.js +159 -0
- package/lib/reuse/modules/util/file.js.map +1 -0
- package/lib/reuse/modules/util/formatter.d.ts +90 -0
- package/lib/reuse/modules/util/formatter.js +210 -0
- package/lib/reuse/modules/util/formatter.js.map +1 -0
- package/lib/reuse/modules/util/function.d.ts +48 -0
- package/lib/reuse/modules/util/function.js +161 -0
- package/lib/reuse/modules/util/function.js.map +1 -0
- package/lib/reuse/modules/util/system.d.ts +17 -0
- package/lib/reuse/modules/util/system.js +58 -0
- package/lib/reuse/modules/util/system.js.map +1 -0
- package/lib/reuse/modules/util/types/formatter.types.d.ts +2 -0
- package/lib/reuse/modules/util/types/formatter.types.js +3 -0
- package/lib/reuse/modules/util/types/formatter.types.js.map +1 -0
- package/lib/scripts/clientsideUI5scripts.d.ts +1 -0
- package/lib/scripts/clientsideUI5scripts.js +315 -0
- package/lib/scripts/clientsideUI5scripts.js.map +1 -0
- package/lib/scripts/dataExchange/dataExchange.d.ts +1 -0
- package/lib/scripts/dataExchange/dataExchange.js +224 -0
- package/lib/scripts/dataExchange/dataExchange.js.map +1 -0
- package/lib/scripts/dataExchange/dataExchangeUtil.d.ts +63 -0
- package/lib/scripts/dataExchange/dataExchangeUtil.js +211 -0
- package/lib/scripts/dataExchange/dataExchangeUtil.js.map +1 -0
- package/lib/scripts/hooks/after.d.ts +8 -0
- package/lib/scripts/hooks/after.js +30 -0
- package/lib/scripts/hooks/after.js.map +1 -0
- package/lib/scripts/hooks/before.d.ts +8 -0
- package/lib/scripts/hooks/before.js +38 -0
- package/lib/scripts/hooks/before.js.map +1 -0
- package/lib/scripts/hooks/beforeSession.d.ts +8 -0
- package/lib/scripts/hooks/beforeSession.js +37 -0
- package/lib/scripts/hooks/beforeSession.js.map +1 -0
- package/lib/scripts/hooks/onComplete.d.ts +9 -0
- package/lib/scripts/hooks/onComplete.js +31 -0
- package/lib/scripts/hooks/onComplete.js.map +1 -0
- package/lib/scripts/hooks/onPrepare.d.ts +6 -0
- package/lib/scripts/hooks/onPrepare.js +36 -0
- package/lib/scripts/hooks/onPrepare.js.map +1 -0
- package/lib/scripts/hooks/utils/addLocatorCommands.d.ts +2 -0
- package/lib/scripts/hooks/utils/addLocatorCommands.js +193 -0
- package/lib/scripts/hooks/utils/addLocatorCommands.js.map +1 -0
- package/lib/scripts/hooks/utils/browserLog.d.ts +2 -0
- package/lib/scripts/hooks/utils/browserLog.js +39 -0
- package/lib/scripts/hooks/utils/browserLog.js.map +1 -0
- package/lib/scripts/hooks/utils/dataExchangeCommands.d.ts +9 -0
- package/lib/scripts/hooks/utils/dataExchangeCommands.js +46 -0
- package/lib/scripts/hooks/utils/dataExchangeCommands.js.map +1 -0
- package/lib/scripts/hooks/utils/decryption.d.ts +13 -0
- package/lib/scripts/hooks/utils/decryption.js +90 -0
- package/lib/scripts/hooks/utils/decryption.js.map +1 -0
- package/lib/scripts/hooks/utils/lib.d.ts +4 -0
- package/lib/scripts/hooks/utils/lib.js +330 -0
- package/lib/scripts/hooks/utils/lib.js.map +1 -0
- package/lib/scripts/hooks/utils/locatorCommands.d.ts +10 -0
- package/lib/scripts/hooks/utils/locatorCommands.js +216 -0
- package/lib/scripts/hooks/utils/locatorCommands.js.map +1 -0
- package/lib/scripts/locators/qmateLocator.d.ts +1 -0
- package/lib/scripts/locators/qmateLocator.js +1384 -0
- package/lib/scripts/locators/qmateLocator.js.map +1 -0
- package/lib/scripts/locators/uiveri5Locator.d.ts +1 -0
- package/lib/scripts/locators/uiveri5Locator.js +21 -0
- package/lib/scripts/locators/uiveri5Locator.js.map +1 -0
- package/mkdocs.yml +53 -0
- package/package.json +152 -0
- package/test/.eslintrc.yml +6 -0
- package/test/authenticator/package.json +13 -0
- package/test/authenticator/staticLogin/configCustom.js +22 -0
- package/test/authenticator/staticLogin/configCustomViaConfig.js +20 -0
- package/test/authenticator/staticLogin/configFiori.js +19 -0
- package/test/authenticator/staticLogin/configPlain.js +17 -0
- package/test/authenticator/staticLogin/configSapCloud.js +18 -0
- package/test/authenticator/staticLogin/html/custom.html +10 -0
- package/test/authenticator/staticLogin/html/fiori.html +10 -0
- package/test/authenticator/staticLogin/html/home.html +7 -0
- package/test/authenticator/staticLogin/html/sapCloud.html +10 -0
- package/test/authenticator/staticLogin/specs/custom.spec.js +6 -0
- package/test/authenticator/staticLogin/specs/customViaConfig.spec.js +10 -0
- package/test/authenticator/staticLogin/specs/fiori.spec.js +6 -0
- package/test/authenticator/staticLogin/specs/plain.spec.js +64 -0
- package/test/authenticator/staticLogin/specs/sapCloud.spec.js +6 -0
- package/test/authenticator/staticLogin/staticServerConfig.js +20 -0
- package/test/authenticator/systemLogin/configCustom.js +26 -0
- package/test/authenticator/systemLogin/configFiori.js +24 -0
- package/test/authenticator/systemLogin/configPlain.js +22 -0
- package/test/authenticator/systemLogin/configSapCloud.js +24 -0
- package/test/authenticator/systemLogin/specs/custom.spec.js +13 -0
- package/test/authenticator/systemLogin/specs/fiori.spec.js +12 -0
- package/test/authenticator/systemLogin/specs/plain.spec.js +21 -0
- package/test/authenticator/systemLogin/specs/sapCloud.spec.js +13 -0
- package/test/core/README.md +17 -0
- package/test/core/dataExchange/config.export.js +56 -0
- package/test/core/dataExchange/config.import.js +47 -0
- package/test/core/dataExchange/config.js +52 -0
- package/test/core/dataExchange/config.parallel.group.js +61 -0
- package/test/core/dataExchange/config.parallel.js +58 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/dummy1.txt +0 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/purchase-orders/Limit-Purchase-Order.json +29 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/purchase-orders/ServicePurchaseOrder.2Items.json +67 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/purchaseRequisition_HI.json +31 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/subfolder/LimitPurchaseOrder.json +29 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/subfolder/PurchaseOrderItems.json +58 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/subfolder/PurchaseOrderWithScheduline.json +27 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/subfolder/ServiceAndMaterialPurchaseOrder.json +65 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/subfolder/ServicePurchaseOrder.json +39 -0
- package/test/core/dataExchange/data/another/folder/data/anotherFolder/subfolder/ServicePurchaseOrder2Items.json +67 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/data.json +5 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/dummy1.txt +0 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/dummy2.txt +0 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/empty.json +0 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/purchaseRequisition.json +31 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/supplierInvoice.json +17 -0
- package/test/core/dataExchange/data/my/folder/data/qs9/webUser.json +6 -0
- package/test/core/dataExchange/data/ui/moreDataFolder/anotherUser.json +6 -0
- package/test/core/dataExchange/data/ui/user.json +6 -0
- package/test/core/dataExchange/data/ui/webUser.json +6 -0
- package/test/core/dataExchange/specs/export.fast.spec.js +48 -0
- package/test/core/dataExchange/specs/export.slow.spec.js +50 -0
- package/test/core/dataExchange/specs/export.spec.js +103 -0
- package/test/core/dataExchange/specs/import.spec.js +144 -0
- package/test/core/dataExchange/specs/importExport.spec.js +196 -0
- package/test/core/dataExchange/utils.js +160 -0
- package/test/core/functional/README.md +30 -0
- package/test/core/functional/chaining/chaining.test.js +137 -0
- package/test/core/functional/chaining/test.conf.js +31 -0
- package/test/core/functional/locators/ancestorProperties.test.js +99 -0
- package/test/core/functional/locators/childProperties.test.js +40 -0
- package/test/core/functional/locators/descendantProperties.test.js +107 -0
- package/test/core/functional/locators/domProperties.test.js +60 -0
- package/test/core/functional/locators/elementProperties.test.js +114 -0
- package/test/core/functional/locators/mixedProperties.test.js +170 -0
- package/test/core/functional/locators/parentProperties.test.js +47 -0
- package/test/core/functional/locators/siblingProperties.test.js +120 -0
- package/test/core/functional/locators/test.locator.conf.js +38 -0
- package/test/core/functional/locators/utils.js +6 -0
- package/test/core/functional/nativeBrowser/runInBrowser.test.js +111 -0
- package/test/core/functional/nativeBrowser/test.conf.js +31 -0
- package/test/core/functional/nonUi5/basic.test.js +10 -0
- package/test/core/functional/nonUi5/getWithDomElement.test.js +51 -0
- package/test/core/functional/nonUi5/getWithDomElements.test.js +141 -0
- package/test/core/functional/nonUi5/test.conf.js +32 -0
- package/test/core/functional/ui5Properties/getAggregations.test.js +102 -0
- package/test/core/functional/ui5Properties/getAssociations.test.js +24 -0
- package/test/core/functional/ui5Properties/getBindingInfos.test.js +71 -0
- package/test/core/functional/ui5Properties/getProperties.test.js +226 -0
- package/test/core/functional/ui5Properties/test.conf.js +16 -0
- package/test/core/functional/uiveri5/sample.test.js +61 -0
- package/test/core/functional/uiveri5/test.conf.js +31 -0
- package/test/core/package-lock.json +0 -0
- package/test/core/package.json +12 -0
- package/test/core/testIntegration/config.js +17 -0
- package/test/core/testIntegration/configMultiCombo.js +17 -0
- package/test/core/testIntegration/configTable.js +18 -0
- package/test/core/testIntegration/filters1.spec.js +1849 -0
- package/test/core/testIntegration/multicombobox.spec.js +134 -0
- package/test/core/testIntegration/table.spec.js +80 -0
- package/test/helper/configurations/base.conf.js +43 -0
- package/test/helper/configurations/chrome.conf.js +47 -0
- package/test/helper/configurations/chrome.headless.conf.js +45 -0
- package/test/helper/configurations/sauce.labs.conf.js +37 -0
- package/test/helper/configurations/sauce.labs.tunnel.conf.js +39 -0
- package/test/helper/sleeper.js +19 -0
- package/test/helper/utils.js +15 -0
- package/test/helper/website/buttons.html +85 -0
- package/test/helper/website/checkBox.html +83 -0
- package/test/helper/website/dragAndDropFailing.html +83 -0
- package/test/helper/website/dragAndDropWdioExample.html +41 -0
- package/test/helper/website/dropdown.html +78 -0
- package/test/helper/website/forms.html +82 -0
- package/test/helper/website/hiddenAndVisible.html +60 -0
- package/test/helper/website/main.css +36 -0
- package/test/helper/website/scrollPage.html +261 -0
- package/test/helper/website/style.css +52 -0
- package/test/helper/website/tables.html +140 -0
- package/test/helper/website/waitForElements.html +73 -0
- package/test/reuse/common/assertion/expectDefined.spec.js +11 -0
- package/test/reuse/common/assertion/expectEqual.spec.js +52 -0
- package/test/reuse/common/assertion/expectFalse.spec.js +9 -0
- package/test/reuse/common/assertion/expectTrue.spec.js +9 -0
- package/test/reuse/common/assertion/expectUndefined.spec.js +11 -0
- package/test/reuse/common/assertion/expectUnequal.spec.js +25 -0
- package/test/reuse/common/assertion/expectUrlToBe.spec.js +27 -0
- package/test/reuse/common/assertion/test.assertion.conf.js +59 -0
- package/test/reuse/common/date/calculate.spec.js +163 -0
- package/test/reuse/common/date/getNextMonth.spec.js +105 -0
- package/test/reuse/common/date/getNextYear.spec.js +72 -0
- package/test/reuse/common/date/getPreviousMonth.spec.js +71 -0
- package/test/reuse/common/date/getPreviousYear.spec.js +72 -0
- package/test/reuse/common/date/getSpecific.spec.js +63 -0
- package/test/reuse/common/date/getToday.spec.js +78 -0
- package/test/reuse/common/date/getTomorrow.spec.js +72 -0
- package/test/reuse/common/date/test.date.conf.js +19 -0
- package/test/reuse/common/date/utils.js +6 -0
- package/test/reuse/common/navigation/navigateToUrl.spec.js +28 -0
- package/test/reuse/common/navigation/navigateToUrlAndRetry.spec.js +27 -0
- package/test/reuse/common/navigation/test.navigation.conf.js +25 -0
- package/test/reuse/common/userInteraction/clearAndFillActive.spec.js +100 -0
- package/test/reuse/common/userInteraction/clearAndFillActiveAndRetry.spec.js +106 -0
- package/test/reuse/common/userInteraction/fillActive.spec.js +230 -0
- package/test/reuse/common/userInteraction/fillActiveAndRetry.spec.js +172 -0
- package/test/reuse/common/userInteraction/pressKey.spec.js +105 -0
- package/test/reuse/common/userInteraction/test.userInteraction.conf.js +53 -0
- package/test/reuse/nonUi5/assertion/expectAttributeToBe.spec.js +45 -0
- package/test/reuse/nonUi5/assertion/expectAttributeToContain.spec.js +43 -0
- package/test/reuse/nonUi5/assertion/expectToBeNotVisible.spec.js +37 -0
- package/test/reuse/nonUi5/assertion/expectToBeVisible.spec.js +63 -0
- package/test/reuse/nonUi5/assertion/expectValueToBe.spec.js +25 -0
- package/test/reuse/nonUi5/assertion/test.assertion.conf.js +60 -0
- package/test/reuse/nonUi5/assertion/test.assertion.sauceLabs.conf.js +64 -0
- package/test/reuse/nonUi5/element/getAllDisplayed.spec.js +39 -0
- package/test/reuse/nonUi5/element/getAttributeValue.spec.js +58 -0
- package/test/reuse/nonUi5/element/getByChild.spec.js +70 -0
- package/test/reuse/nonUi5/element/getByClass.spec.js +64 -0
- package/test/reuse/nonUi5/element/getByCss.spec.js +65 -0
- package/test/reuse/nonUi5/element/getByCssContainingText.spec.js +83 -0
- package/test/reuse/nonUi5/element/getById.spec.js +35 -0
- package/test/reuse/nonUi5/element/getByName.spec.js +30 -0
- package/test/reuse/nonUi5/element/getByParent.spec.js +71 -0
- package/test/reuse/nonUi5/element/getByXPath.spec.js +30 -0
- package/test/reuse/nonUi5/element/getValue.spec.js +51 -0
- package/test/reuse/nonUi5/element/highlight.spec.js +18 -0
- package/test/reuse/nonUi5/element/isPresent.spec.js +39 -0
- package/test/reuse/nonUi5/element/isPresentByCss.spec.js +73 -0
- package/test/reuse/nonUi5/element/isPresentByXPath.spec.js +31 -0
- package/test/reuse/nonUi5/element/setInnerHTML.spec.js +23 -0
- package/test/reuse/nonUi5/element/test.element.conf.js +55 -0
- package/test/reuse/nonUi5/element/test.element.sauceLabs.conf.js +58 -0
- package/test/reuse/nonUi5/element/waitForAll.spec.js +24 -0
- package/test/reuse/nonUi5/element/waitToBeClickable.spec.js +24 -0
- package/test/reuse/nonUi5/element/waitToBePresent.spec.js +32 -0
- package/test/reuse/nonUi5/element/waitToBeVisible.spec.js +36 -0
- package/test/reuse/nonUi5/navigation/navigateToApplication.spec.js +13 -0
- package/test/reuse/nonUi5/navigation/test.navigation.conf.js +14 -0
- package/test/reuse/nonUi5/userInteraction/checkAttributeAndValue.spec.js +135 -0
- package/test/reuse/nonUi5/userInteraction/clear.spec.js +43 -0
- package/test/reuse/nonUi5/userInteraction/clearAndFill.spec.js +51 -0
- package/test/reuse/nonUi5/userInteraction/clearAndFillAndRetry.spec.js +58 -0
- package/test/reuse/nonUi5/userInteraction/clearAndRetry.spec.js +43 -0
- package/test/reuse/nonUi5/userInteraction/click.spec.js +60 -0
- package/test/reuse/nonUi5/userInteraction/clickAndRetry.spec.js +60 -0
- package/test/reuse/nonUi5/userInteraction/clickElementInSvg.spec.js +24 -0
- package/test/reuse/nonUi5/userInteraction/doubleClick.spec.js +22 -0
- package/test/reuse/nonUi5/userInteraction/dragAndDrop.spec.js +40 -0
- package/test/reuse/nonUi5/userInteraction/fill.spec.js +37 -0
- package/test/reuse/nonUi5/userInteraction/fillAndRetry.spec.js +39 -0
- package/test/reuse/nonUi5/userInteraction/mouseOverElement.spec.js +36 -0
- package/test/reuse/nonUi5/userInteraction/moveCursorAndClick.spec.js +24 -0
- package/test/reuse/nonUi5/userInteraction/rightClick.spec.js +13 -0
- package/test/reuse/nonUi5/userInteraction/scrollToElement.spec.js +35 -0
- package/test/reuse/nonUi5/userInteraction/test.userInteraction.conf.js +72 -0
- package/test/reuse/nonUi5/userInteraction/test.userInteraction.sauceLabs.conf.js +78 -0
- package/test/reuse/service/rest/db.json +8 -0
- package/test/reuse/service/rest/delete.spec.js +20 -0
- package/test/reuse/service/rest/get.spec.js +19 -0
- package/test/reuse/service/rest/init.spec.js +35 -0
- package/test/reuse/service/rest/patch.spec.js +29 -0
- package/test/reuse/service/rest/post.spec.js +37 -0
- package/test/reuse/service/rest/test.rest.conf.js +18 -0
- package/test/reuse/ui5/assertion/expectAttributeToBe.spec.js +106 -0
- package/test/reuse/ui5/assertion/expectAttributeToContain.spec.js +78 -0
- package/test/reuse/ui5/assertion/expectBindingContextPathToBe.spec.js +103 -0
- package/test/reuse/ui5/assertion/expectBindingPathToBe.spec.js +164 -0
- package/test/reuse/ui5/assertion/expectMessageToastTextToBe.spec.js +43 -0
- package/test/reuse/ui5/assertion/expectTextToBe.spec.js +39 -0
- package/test/reuse/ui5/assertion/expectToBeEnabled.spec.js +90 -0
- package/test/reuse/ui5/assertion/expectToBeNotEnabled.spec.js +62 -0
- package/test/reuse/ui5/assertion/expectToBeNotVisible.spec.js +52 -0
- package/test/reuse/ui5/assertion/expectToBeVisible.spec.js +69 -0
- package/test/reuse/ui5/assertion/expectToBeVisibleInViewport.spec.js +49 -0
- package/test/reuse/ui5/assertion/expectValidationError.spec.js +54 -0
- package/test/reuse/ui5/assertion/expectValidationSuccess.spec.js +53 -0
- package/test/reuse/ui5/assertion/expectValueToBe.spec.js +57 -0
- package/test/reuse/ui5/assertion/expectValueToBeDefined.spec.js +35 -0
- package/test/reuse/ui5/assertion/test.assertion.conf.js +28 -0
- package/test/reuse/ui5/assertion/test.assertion.sauceLab.conf.js +37 -0
- package/test/reuse/ui5/confirmationDialog/clickCancel.spec.js +88 -0
- package/test/reuse/ui5/confirmationDialog/clickCreate.spec.js +3 -0
- package/test/reuse/ui5/confirmationDialog/clickDelete.spec.js +89 -0
- package/test/reuse/ui5/confirmationDialog/clickNo.spec.js +96 -0
- package/test/reuse/ui5/confirmationDialog/clickOk.spec.js +66 -0
- package/test/reuse/ui5/confirmationDialog/clickRevokeApproval.spec.js +3 -0
- package/test/reuse/ui5/confirmationDialog/clickYes.spec.js +70 -0
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.conf.js +20 -0
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.sauceLab.conf.js +29 -0
- package/test/reuse/ui5/control/execute.spec.js +29 -0
- package/test/reuse/ui5/control/getAggregationProperty.spec.js +29 -0
- package/test/reuse/ui5/control/getAssociationProperty.spec.js +1 -0
- package/test/reuse/ui5/control/getBindingContextPathProperty.spec.js +30 -0
- package/test/reuse/ui5/control/getProperty.spec.js +30 -0
- package/test/reuse/ui5/control/getPropertyBinding.spec.js +30 -0
- package/test/reuse/ui5/control/test.control.conf.js +19 -0
- package/test/reuse/ui5/control/test.control.sauceLab.conf.js +30 -0
- package/test/reuse/ui5/date/fillRange.spec.js +53 -0
- package/test/reuse/ui5/date/pick.spec.js +136 -0
- package/test/reuse/ui5/date/pickRange.spec.js +143 -0
- package/test/reuse/ui5/date/test.date.conf.js +14 -0
- package/test/reuse/ui5/date/test.date.sauceLab.conf.js +26 -0
- package/test/reuse/ui5/element/getAllDisplayed.spec.js +71 -0
- package/test/reuse/ui5/element/getBindingValue.spec.js +78 -0
- package/test/reuse/ui5/element/getByChild.spec.js +124 -0
- package/test/reuse/ui5/element/getByParent.spec.js +134 -0
- package/test/reuse/ui5/element/getByText.spec.js +67 -0
- package/test/reuse/ui5/element/getDisplayed.spec.js +82 -0
- package/test/reuse/ui5/element/getId.spec.js +72 -0
- package/test/reuse/ui5/element/getPropertyValue.spec.js +91 -0
- package/test/reuse/ui5/element/highlight.spec.js +46 -0
- package/test/reuse/ui5/element/isVisible.spec.js +68 -0
- package/test/reuse/ui5/element/test.element.conf.js +22 -0
- package/test/reuse/ui5/element/test.element.sauceLab.conf.js +33 -0
- package/test/reuse/ui5/errorDialog/clickClose.spec.js +31 -0
- package/test/reuse/ui5/errorDialog/expectToBeVisible.spec.js +30 -0
- package/test/reuse/ui5/errorDialog/test.errorDialog.conf.js +13 -0
- package/test/reuse/ui5/errorDialog/test.errorDialog.sauceLab.conf.js +26 -0
- package/test/reuse/ui5/formatter/addRemoveLeadingZeros.spec.js +18 -0
- package/test/reuse/ui5/formatter/extractNumberFromString.spec.js +34 -0
- package/test/reuse/ui5/formatter/formatDate.spec.js +103 -0
- package/test/reuse/ui5/formatter/test.formatter.conf.js +14 -0
- package/test/reuse/ui5/formatter/test.formatter.sauceLab.conf.js +24 -0
- package/test/reuse/ui5/mockserver_qunit/Component.js +23 -0
- package/test/reuse/ui5/mockserver_qunit/LICENSE.txt +957 -0
- package/test/reuse/ui5/mockserver_qunit/NOTICE.txt +1 -0
- package/test/reuse/ui5/mockserver_qunit/controller/App.controller.js +37 -0
- package/test/reuse/ui5/mockserver_qunit/controller/BaseController.js +30 -0
- package/test/reuse/ui5/mockserver_qunit/controller/Home.controller.js +27 -0
- package/test/reuse/ui5/mockserver_qunit/controller/NotFound.controller.js +34 -0
- package/test/reuse/ui5/mockserver_qunit/controller/employee/Employee.controller.js +64 -0
- package/test/reuse/ui5/mockserver_qunit/controller/employee/EmployeeList.controller.js +22 -0
- package/test/reuse/ui5/mockserver_qunit/controller/employee/Resume.controller.js +83 -0
- package/test/reuse/ui5/mockserver_qunit/controller/employee/overview/EmployeeOverview.controller.js +11 -0
- package/test/reuse/ui5/mockserver_qunit/controller/employee/overview/EmployeeOverviewContent.controller.js +192 -0
- package/test/reuse/ui5/mockserver_qunit/i18n/i18n.properties +42 -0
- package/test/reuse/ui5/mockserver_qunit/index.html +21 -0
- package/test/reuse/ui5/mockserver_qunit/initMockServer.js +16 -0
- package/test/reuse/ui5/mockserver_qunit/localService/metadata.xml +61 -0
- package/test/reuse/ui5/mockserver_qunit/localService/mockdata/Employees.json +155 -0
- package/test/reuse/ui5/mockserver_qunit/localService/mockdata/Resumes.json +65 -0
- package/test/reuse/ui5/mockserver_qunit/localService/mockserver.js +146 -0
- package/test/reuse/ui5/mockserver_qunit/localService/mockserverLoadAllData.js +75 -0
- package/test/reuse/ui5/mockserver_qunit/manifest.json +169 -0
- package/test/reuse/ui5/mockserver_qunit/test/flpSandboxMockServer.html +63 -0
- package/test/reuse/ui5/mockserver_qunit/test/flpSandboxMockServerAllData.html +68 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/config.js +92 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/qunitExecution/specs/runQUnitTests.spec.js +14 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testDisplayNotFound/data/setup.json +11 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testDisplayNotFound/specs/testDisplayNotFound.spec.js +71 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testShowEmployeeList/data/mock/Employees.json +204 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testShowEmployeeList/data/mock/Resumes.json +114 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testShowEmployeeList/data/setup.json +11 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testShowEmployeeList/data/testShowEmployeeList.json +1 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/testShowEmployeeList/specs/testShowEmployeeList.spec.js +118 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/utils/constants.js +25 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/utils/mockDataMapper.js +23 -0
- package/test/reuse/ui5/mockserver_qunit/test/qmate/ui/utils/mockHelper.js +222 -0
- package/test/reuse/ui5/mockserver_qunit/test/unit/allTests.js +6 -0
- package/test/reuse/ui5/mockserver_qunit/test/unit/unitTests.qunit.html +38 -0
- package/test/reuse/ui5/mockserver_qunit/test/unit/utils/Conversions.js +13 -0
- package/test/reuse/ui5/mockserver_qunit/view/App.view.xml +9 -0
- package/test/reuse/ui5/mockserver_qunit/view/Home.view.xml +12 -0
- package/test/reuse/ui5/mockserver_qunit/view/NotFound.view.xml +11 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/Employee.view.xml +52 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/EmployeeList.view.xml +24 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/Resume.view.xml +35 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/ResumeHobbies.view.xml +3 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/ResumeNotes.view.xml +3 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/ResumeProjects.view.xml +3 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/overview/EmployeeOverview.view.xml +13 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/overview/EmployeeOverviewContent.view.xml +43 -0
- package/test/reuse/ui5/mockserver_qunit/view/employee/overview/EmployeeOverviewTop.view.xml +3 -0
- package/test/reuse/ui5/navigation/closePopups.spec.js +16 -0
- package/test/reuse/ui5/navigation/expectUnsupportedNavigationPopup.spec.js +81 -0
- package/test/reuse/ui5/navigation/navigateToApplication.spec.js +148 -0
- package/test/reuse/ui5/navigation/navigateToApplicationAndRetry.spec.js +153 -0
- package/test/reuse/ui5/navigation/navigateToApplicationWithQueryParams.spec.js +63 -0
- package/test/reuse/ui5/navigation/navigateToApplicationWithQueryParamsAndRetry.spec.js +64 -0
- package/test/reuse/ui5/navigation/navigateToSystemAndApplication.spec.js +45 -0
- package/test/reuse/ui5/navigation/navigateToSystemAndApplicationAndRetry.spec.js +43 -0
- package/test/reuse/ui5/navigation/test.navigation.conf.js +17 -0
- package/test/reuse/ui5/navigation/test.navigation.sauceLab.conf.js +33 -0
- package/test/reuse/ui5/navigation/test.navigation.static.conf.js +34 -0
- package/test/reuse/ui5/navigation/test.navigation.static.sauceLab.conf.js +41 -0
- package/test/reuse/ui5/navigation/website/main.css +36 -0
- package/test/reuse/ui5/navigation/website/main.html +50 -0
- package/test/reuse/ui5/navigationBar/clickBack.spec.js +38 -0
- package/test/reuse/ui5/navigationBar/clickUserIcon.spec.js +36 -0
- package/test/reuse/ui5/navigationBar/expectPageTitle.spec.js +22 -0
- package/test/reuse/ui5/navigationBar/expectShellHeader.spec.js +22 -0
- package/test/reuse/ui5/navigationBar/test.navigationBar.conf.js +17 -0
- package/test/reuse/ui5/navigationBar/test.navigationBar.sauceLab.conf.js +28 -0
- package/test/reuse/ui5/session/login.spec.js +78 -0
- package/test/reuse/ui5/session/loginFiori.spec.js +52 -0
- package/test/reuse/ui5/session/loginSapCloud.spec.js +51 -0
- package/test/reuse/ui5/session/logout.spec.js +48 -0
- package/test/reuse/ui5/session/switchUser.spec.js +48 -0
- package/test/reuse/ui5/session/test.session.conf.js +20 -0
- package/test/reuse/ui5/session/test.session.sauceLab.conf.js +29 -0
- package/test/reuse/ui5/table/clickSettingsButton.spec.js +58 -0
- package/test/reuse/ui5/table/sortColumnAscending.spec.js +84 -0
- package/test/reuse/ui5/table/sortColumnDescending.spec.js +84 -0
- package/test/reuse/ui5/table/test.table.conf.js +14 -0
- package/test/reuse/ui5/table/test.table.sauceLab.conf.js +25 -0
- package/test/reuse/ui5/table/test.table.sauceLab.tunnel.conf.js +25 -0
- package/test/reuse/ui5/userInteraction/clear.spec.js +75 -0
- package/test/reuse/ui5/userInteraction/clearAndFill.spec.js +157 -0
- package/test/reuse/ui5/userInteraction/clearAndFillAndRetry.spec.js +132 -0
- package/test/reuse/ui5/userInteraction/clearAndFillSmartFieldInput.spec.js +73 -0
- package/test/reuse/ui5/userInteraction/clearAndRetry.spec.js +57 -0
- package/test/reuse/ui5/userInteraction/click.spec.js +73 -0
- package/test/reuse/ui5/userInteraction/clickAndRetry.spec.js +52 -0
- package/test/reuse/ui5/userInteraction/clickSelectArrow.spec.js +87 -0
- package/test/reuse/ui5/userInteraction/clickSelectArrowAndRetry.spec.js +147 -0
- package/test/reuse/ui5/userInteraction/clickTab.spec.js +59 -0
- package/test/reuse/ui5/userInteraction/doubleClick.spec.js +73 -0
- package/test/reuse/ui5/userInteraction/dragAndDrop.spec.js +34 -0
- package/test/reuse/ui5/userInteraction/fill.spec.js +114 -0
- package/test/reuse/ui5/userInteraction/fillAndRetry.spec.js +120 -0
- package/test/reuse/ui5/userInteraction/mouseOverElement.spec.js +55 -0
- package/test/reuse/ui5/userInteraction/openF4Help.spec.js +56 -0
- package/test/reuse/ui5/userInteraction/rightClick.spec.js +72 -0
- package/test/reuse/ui5/userInteraction/scrollToElement.spec.js +89 -0
- package/test/reuse/ui5/userInteraction/searchFor.spec.js +155 -0
- package/test/reuse/ui5/userInteraction/selectBox.spec.js +128 -0
- package/test/reuse/ui5/userInteraction/selectCombobox.spec.js +115 -0
- package/test/reuse/ui5/userInteraction/selectMultiComboBox.spec.js +155 -0
- package/test/reuse/ui5/userInteraction/test.userInteraction.conf.js +35 -0
- package/test/reuse/ui5/userInteraction/test.userInteraction.sauceLab.conf.js +46 -0
- package/test/reuse/util/browser/back.spec.js +32 -0
- package/test/reuse/util/browser/clearBrowser.spec.js +35 -0
- package/test/reuse/util/browser/executeScript.spec.js +49 -0
- package/test/reuse/util/browser/getBaseUrl.spec.js +13 -0
- package/test/reuse/util/browser/getBrowserName.spec.js +18 -0
- package/test/reuse/util/browser/getCurrentUrl.spec.js +34 -0
- package/test/reuse/util/browser/getCurrentWindow.spec.js +42 -0
- package/test/reuse/util/browser/getUI5Version.spec.js +31 -0
- package/test/reuse/util/browser/logCurrentUrl.spec.js +23 -0
- package/test/reuse/util/browser/refresh.spec.js +52 -0
- package/test/reuse/util/browser/setBaseUrl.spec.js +13 -0
- package/test/reuse/util/browser/switchToDefaultContent.spec.js +34 -0
- package/test/reuse/util/browser/switchToIframe.spec.js +29 -0
- package/test/reuse/util/browser/switchToNewWindow.spec.js +142 -0
- package/test/reuse/util/browser/switchToWindow.spec.js +57 -0
- package/test/reuse/util/browser/test.browser.conf.js +27 -0
- package/test/reuse/util/data/data/test.json +3 -0
- package/test/reuse/util/data/data/test.secure.json +11 -0
- package/test/reuse/util/data/decrypt.spec.js +15 -0
- package/test/reuse/util/data/getData.spec.js +15 -0
- package/test/reuse/util/data/getSecureData.spec.js +57 -0
- package/test/reuse/util/data/test.data.conf.js +22 -0
- package/test/reuse/util/file/file.spec.js +90 -0
- package/test/reuse/util/file/pdfParser.spec.js +55 -0
- package/test/reuse/util/file/test.file.conf.js +15 -0
- package/test/reuse/util/file/testFiles/sample.pdf +198 -0
- package/test/reuse/util/file/testFiles/test.txt +5 -0
- package/test/reuse/util/file/testFiles/test2.txt +2 -0
- package/test/reuse/util/formatter/addRemoveLeadingZeros.spec.js +38 -0
- package/test/reuse/util/formatter/extractNumberFromString.spec.js +67 -0
- package/test/reuse/util/formatter/formatDate.spec.js +150 -0
- package/test/reuse/util/formatter/sliceStringAfter.spec.js +62 -0
- package/test/reuse/util/formatter/sliceStringAt.spec.js +62 -0
- package/test/reuse/util/formatter/stringifyJSON.spec.js +24 -0
- package/test/reuse/util/formatter/test.formatter.conf.js +20 -0
- package/test/reuse/util/formatter/trimString.spec.js +37 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-undef */
|
|
3
|
+
var functions = {};
|
|
4
|
+
functions.execQUnits = function (mScriptParams, done) {
|
|
5
|
+
if (QUnit) {
|
|
6
|
+
QUnit.config.current = true;
|
|
7
|
+
QUnit.start();
|
|
8
|
+
QUnit.done(function (details) {
|
|
9
|
+
const msg = "Total: " + details.total + "," + " Failed: " + details.failed + "," + " Passed: " + details.passed + "," + " Runtime: " + details.runtime;
|
|
10
|
+
console.log(msg);
|
|
11
|
+
if (details.failed > 0) {
|
|
12
|
+
done(null);
|
|
13
|
+
}
|
|
14
|
+
done(msg);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
functions.loadMockData = function (mScriptParams, done) {
|
|
19
|
+
if (!mScriptParams.responsePath)
|
|
20
|
+
throw new Error("Please give a valid file path");
|
|
21
|
+
try {
|
|
22
|
+
var oData = null;
|
|
23
|
+
var isText = mScriptParams.isText;
|
|
24
|
+
var responsePath = mScriptParams.responsePath;
|
|
25
|
+
if (isText && isText !== "false") {
|
|
26
|
+
var oResponse = jQuery.sap.sjax({
|
|
27
|
+
url: responsePath,
|
|
28
|
+
dataType: "text"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
oResponse = jQuery.sap.sjax({
|
|
33
|
+
url: responsePath,
|
|
34
|
+
dataType: "json"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (oResponse.success) {
|
|
38
|
+
if (isText && isText !== "false" && oResponse.data) {
|
|
39
|
+
oData = oResponse.data;
|
|
40
|
+
}
|
|
41
|
+
else if (oResponse.data.d) {
|
|
42
|
+
if (oResponse.data.d.results) {
|
|
43
|
+
oData = oResponse.data.d.results;
|
|
44
|
+
}
|
|
45
|
+
else if (oResponse.data.d) {
|
|
46
|
+
// Function Import or single data
|
|
47
|
+
oData = oResponse.data;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw new Error("The mock data are invalid");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (Array.isArray(oResponse.data)) {
|
|
55
|
+
oData = oResponse.data;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
throw new Error("The mock data could not be loaded due to wrong format!");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (isText && isText !== "false") {
|
|
62
|
+
return done(oData);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return done(oData);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
done();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw new Error("File could not be retrieved, details: " + error);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
functions.getUI5ControlProperty = function (mScriptParams) {
|
|
75
|
+
if (!mScriptParams.elementId || !mScriptParams.property)
|
|
76
|
+
throw new Error("Please give a valid element property with appropriate id");
|
|
77
|
+
try {
|
|
78
|
+
var oUI5Element = sap.ui.core.Element.registry.get(mScriptParams.elementId);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
throw new Error("Control could not be retrieved, details: " + error);
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
return oUI5Element.getProperty(mScriptParams.property);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
throw new Error("Not valid property name, please specify a valid property name, details:" + error);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
functions.getUI5AggregationProperty = function (mScriptParams) {
|
|
91
|
+
if (!mScriptParams.elementId || !mScriptParams.property)
|
|
92
|
+
throw new Error("Please give a valid element property with appropriate id");
|
|
93
|
+
try {
|
|
94
|
+
var oUI5Element = sap.ui.core.Element.registry.get(mScriptParams.elementId);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
throw new Error("Control could not be retrieved, details: " + error);
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
return oUI5Element.getAggregation(mScriptParams.property);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw new Error("Not valid property name, please specify a valid aggregation property name, details:" + error);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
functions.getUI5AssociationProperty = function (mScriptParams) {
|
|
107
|
+
if (!mScriptParams.elementId || !mScriptParams.property)
|
|
108
|
+
throw new Error("Please give a valid element property with appropriate id");
|
|
109
|
+
try {
|
|
110
|
+
var oUI5Element = sap.ui.core.Element.registry.get(mScriptParams.elementId);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
throw new Error("Control could not be retrieved, details: " + error);
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
return oUI5Element.getAssociation(mScriptParams.property);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
throw new Error("Not valid property name, please specify a valid associaion property name, details:" + error);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
functions.getControlBindingContextPath = function (mScriptParams) {
|
|
123
|
+
if (!mScriptParams.elementId)
|
|
124
|
+
throw new Error("Please give a valid element with appropriate id");
|
|
125
|
+
try {
|
|
126
|
+
var oUI5Element = sap.ui.core.Element.registry.get(mScriptParams.elementId);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new Error("Control could not be retrieved, details: " + error);
|
|
130
|
+
}
|
|
131
|
+
if (!oUI5Element)
|
|
132
|
+
return null;
|
|
133
|
+
var bindingContexts = jQuery.extend({}, oUI5Element.oPropagatedProperties && oUI5Element.oPropagatedProperties.oBindingContexts, oUI5Element.oBindingContexts, oUI5Element.mElementBindingContexts);
|
|
134
|
+
// reduce object to non-empty contexts
|
|
135
|
+
bindingContexts = Object.keys(bindingContexts).reduce(function (finalContexts, key) {
|
|
136
|
+
if (bindingContexts[key]) {
|
|
137
|
+
finalContexts[key] = bindingContexts[key];
|
|
138
|
+
}
|
|
139
|
+
return finalContexts;
|
|
140
|
+
}, {});
|
|
141
|
+
if (bindingContexts && Object.keys(bindingContexts).length > 0) {
|
|
142
|
+
var aKeys = Object.keys(bindingContexts);
|
|
143
|
+
for (let index = 0; index < aKeys.length; index++) {
|
|
144
|
+
const oBindingContext = bindingContexts[aKeys[index]];
|
|
145
|
+
if (oBindingContext &&
|
|
146
|
+
oBindingContext.getPath &&
|
|
147
|
+
oBindingContext.getPath())
|
|
148
|
+
return oBindingContext.getPath();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return null;
|
|
152
|
+
};
|
|
153
|
+
functions.getControlPropertyBinding = function (mScriptParams) {
|
|
154
|
+
if (!mScriptParams.elementId || !mScriptParams.property)
|
|
155
|
+
throw new Error("Please give a valid element property with appropriate id");
|
|
156
|
+
try {
|
|
157
|
+
var oControl = sap.ui.core.Element.registry.get(mScriptParams.elementId);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
throw new Error("Control could not be retrieved, details: " + error);
|
|
161
|
+
}
|
|
162
|
+
var aBindingInfos = [];
|
|
163
|
+
var aBindingInfoParts = oControl.getBindingInfo(mScriptParams.property).parts;
|
|
164
|
+
if (aBindingInfoParts && aBindingInfoParts.length > 0) {
|
|
165
|
+
//console.log("Binding length has property--------> "+ sPropKey+ ", " + aBindingInfoParts.length);
|
|
166
|
+
for (var i = 0; i < aBindingInfoParts.length; i++) {
|
|
167
|
+
var sModel = "";
|
|
168
|
+
//console.log("Binding parts path--------> "+ aBindingInfoParts[i].path);
|
|
169
|
+
if (!aBindingInfoParts[i].path)
|
|
170
|
+
continue;
|
|
171
|
+
if (aBindingInfoParts[i].model)
|
|
172
|
+
sModel = aBindingInfoParts[i].model;
|
|
173
|
+
aBindingInfos.push({
|
|
174
|
+
model: sModel,
|
|
175
|
+
path: aBindingInfoParts[i].path
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
var sBindingDataStr = oControl.getBindingInfo(sPropKey).path;
|
|
181
|
+
if (sBindingDataStr) {
|
|
182
|
+
aBindingInfos.push({
|
|
183
|
+
model: "",
|
|
184
|
+
path: sBindingDataStr
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return aBindingInfos;
|
|
189
|
+
};
|
|
190
|
+
functions.loadUI5CoreAndAutowaiter = function () {
|
|
191
|
+
if (!window.findBusyIndicator) {
|
|
192
|
+
window.findBusyIndicator = function () {
|
|
193
|
+
return Boolean(Array.from(document.getElementsByClassName("sapMBusyIndicator")).find(function (elem) {
|
|
194
|
+
var rect = elem.getBoundingClientRect();
|
|
195
|
+
return (rect.x > 0 || rect.y > 0) && rect.width > 0 && rect.height > 0;
|
|
196
|
+
}));
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
// First check if already everything loaded
|
|
201
|
+
if (window.RecordReplay && !window.findBusyIndicator()) {
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
if (window.sap &&
|
|
205
|
+
window.sap.ui.getCore &&
|
|
206
|
+
window.sap.ui.getCore() &&
|
|
207
|
+
!window.sap.ui.getCore().isLocked() &&
|
|
208
|
+
!window.sap.ui.getCore().getUIDirty() &&
|
|
209
|
+
document.readyState === "complete") {
|
|
210
|
+
// Always check for busy indicators
|
|
211
|
+
if (window.findBusyIndicator()) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return new Promise(function (res, rej) {
|
|
215
|
+
sap.ui.require([
|
|
216
|
+
"sap/ui/test/RecordReplay"
|
|
217
|
+
], function (RecordReplay) {
|
|
218
|
+
// Attach RecordReplay globally
|
|
219
|
+
if (RecordReplay) {
|
|
220
|
+
window.RecordReplay = RecordReplay;
|
|
221
|
+
res(!window.findBusyIndicator());
|
|
222
|
+
}
|
|
223
|
+
res(false);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (oError) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
functions.loadUI5Page = function (mScriptParams) {
|
|
233
|
+
if (!window.findBusyIndicator) {
|
|
234
|
+
window.findBusyIndicator = function () {
|
|
235
|
+
return Boolean(Array.from(document.getElementsByClassName("sapMBusyIndicator")).find(function (elem) {
|
|
236
|
+
var rect = elem.getBoundingClientRect();
|
|
237
|
+
return (rect.x > 0 || rect.y > 0) && rect.width > 0 && rect.height > 0;
|
|
238
|
+
}));
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
// Always check for busy indicators
|
|
242
|
+
if (window.findBusyIndicator()) {
|
|
243
|
+
return false;
|
|
244
|
+
}
|
|
245
|
+
return window.RecordReplay.waitForUI5({
|
|
246
|
+
timeout: mScriptParams.waitForUI5Timeout,
|
|
247
|
+
interval: mScriptParams.waitForUI5PollingInterval
|
|
248
|
+
}).then(function () {
|
|
249
|
+
return (!window.findBusyIndicator());
|
|
250
|
+
}).catch(function (err) {
|
|
251
|
+
return false;
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
functions.waitForAngular = function (rootSelector, interval, callback) {
|
|
255
|
+
var findBusyIndicator = function () {
|
|
256
|
+
return Boolean(Array.from(document.getElementsByClassName("sapMBusyIndicator")).find(function (elem) {
|
|
257
|
+
var rect = elem.getBoundingClientRect();
|
|
258
|
+
return (rect.x > 0 || rect.y > 0) && rect.width > 0 && rect.height > 0;
|
|
259
|
+
}));
|
|
260
|
+
};
|
|
261
|
+
function waitForRendered() {
|
|
262
|
+
if (window.sap &&
|
|
263
|
+
window.sap.ui.getCore &&
|
|
264
|
+
window.sap.ui.getCore() &&
|
|
265
|
+
!window.sap.ui.getCore().isLocked() &&
|
|
266
|
+
!window.sap.ui.getCore().getUIDirty() &&
|
|
267
|
+
!findBusyIndicator() && // comment out in case of invisible busyIndicator (i.e. My Inbox) to prevent test getting stuck
|
|
268
|
+
document.readyState == "complete") {
|
|
269
|
+
callback();
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
window.setTimeout(waitForRendered, interval);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function waitForFirstRendered(cb) {
|
|
276
|
+
if (window.sap &&
|
|
277
|
+
window.sap.ui.getCore &&
|
|
278
|
+
window.sap.ui.getCore() &&
|
|
279
|
+
!window.sap.ui.getCore().isLocked() &&
|
|
280
|
+
!window.sap.ui.getCore().getUIDirty() &&
|
|
281
|
+
!findBusyIndicator() && // comment out in case of invisible busyIndicator (i.e. My Inbox) to prevent test getting stuck
|
|
282
|
+
document.readyState == "complete") {
|
|
283
|
+
window.setTimeout(waitForRendered, interval);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
window.setTimeout(waitForFirstRendered, interval);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
window.setTimeout(function () {
|
|
290
|
+
waitForFirstRendered();
|
|
291
|
+
}, interval);
|
|
292
|
+
};
|
|
293
|
+
/* Publish all the functions as strings to pass to WebDriver's
|
|
294
|
+
* exec[Async]Script. In addition, also include a script that will
|
|
295
|
+
* install all the functions on window (for debugging.)
|
|
296
|
+
*
|
|
297
|
+
* We also wrap any exceptions thrown by a clientSideScripts function
|
|
298
|
+
* that is not an instance of the Error type into an Error type. If we
|
|
299
|
+
* don't do so, then the resulting stack trace is completely unhelpful
|
|
300
|
+
* and the exception message is just 'unknown error.' These types of
|
|
301
|
+
* exceptins are the common case for dart2js code. This wrapping gives
|
|
302
|
+
* us the Dart stack trace and exception message.
|
|
303
|
+
*/
|
|
304
|
+
var util = require("util");
|
|
305
|
+
var scriptsList = [];
|
|
306
|
+
var scriptFmt = ("try { return (%s).apply(this, arguments); }\n" +
|
|
307
|
+
"catch(e) { throw (e instanceof Error) ? e : new Error(e); }");
|
|
308
|
+
for (var fnName in functions) {
|
|
309
|
+
if (functions.hasOwnProperty(fnName)) {
|
|
310
|
+
exports[fnName] = util.format(scriptFmt, functions[fnName]);
|
|
311
|
+
scriptsList.push(util.format("%s: %s", fnName, functions[fnName]));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.installInBrowser = (util.format("window.clientSideScripts = {%s};", scriptsList.join(", ")));
|
|
315
|
+
//# sourceMappingURL=clientsideUI5scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientsideUI5scripts.js","source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B,IAAI,WAAW,GAAG,EAAE,CAAC;AACrB,IAAI,SAAS,GAAG,CACd,+CAA+C;IAC7C,6DAA6D,CAAC,CAAC;AACnE,KAAK,IAAI,MAAM,IAAI,SAAS,EAAE;IAC5B,IAAI,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;QACpC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5D,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACpE;CACF;AAED,OAAO,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC,MAAM,CACrC,kCAAkC,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
/* eslint-disable no-console */
|
|
16
|
+
/**
|
|
17
|
+
* @class importExportData
|
|
18
|
+
* Import data to be used in test specs from JSON files, or folders.
|
|
19
|
+
* Export data to JSON files.
|
|
20
|
+
*/
|
|
21
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
22
|
+
const path_1 = __importDefault(require("path"));
|
|
23
|
+
const dataExchangeUtil_1 = __importDefault(require("./dataExchangeUtil"));
|
|
24
|
+
class DataExchange {
|
|
25
|
+
/**
|
|
26
|
+
* @function readParams
|
|
27
|
+
* @description read the import and export params in the config file
|
|
28
|
+
* @example await readParams();
|
|
29
|
+
*/
|
|
30
|
+
readParams() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (!browser.config.params) {
|
|
33
|
+
//nothing to do
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!browser.params) {
|
|
37
|
+
browser.params = browser.config.params;
|
|
38
|
+
}
|
|
39
|
+
const importParams = browser.params.import || {};
|
|
40
|
+
// import
|
|
41
|
+
// read folders, and subfolders if directory, otherwise read file
|
|
42
|
+
const params = Object.keys(importParams);
|
|
43
|
+
for (let i = 0; i < params.length; i++) {
|
|
44
|
+
const param = params[i];
|
|
45
|
+
// adjust file path if relative
|
|
46
|
+
const fileOrDir = dataExchangeUtil_1.default.getFileAbsPath(importParams[param]);
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const isFileReadable = yield dataExchangeUtil_1.default.isReadable(fileOrDir);
|
|
49
|
+
if (isFileReadable) {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
yield dataExchangeUtil_1.default.readData(fileOrDir, [param]);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
delete importParams[param];
|
|
55
|
+
console.warn(`"${fileOrDir}" does not exist or is not readable. Please check path or permissions.`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// for export, create folders and files if not present
|
|
59
|
+
// copy filenames, since the user will overwrite browser.params.export with data
|
|
60
|
+
// the filenames are required to write the json data at end of session
|
|
61
|
+
const exportParams = browser.params.export;
|
|
62
|
+
if (!exportParams) {
|
|
63
|
+
// nothing to export
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
browser.params.exportDataFiles = Object.assign({}, exportParams);
|
|
67
|
+
// if export file has data, should that be used?
|
|
68
|
+
Object.keys(exportParams).forEach((param) => {
|
|
69
|
+
browser.params.export[param] = null;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
;
|
|
74
|
+
/**
|
|
75
|
+
* @function writeExportDataInTmpFile
|
|
76
|
+
* @description write the data in browser.params.export into temporary files. The data
|
|
77
|
+
* in these temporary files will be merged after all instances complete
|
|
78
|
+
* @example await writeExportDataInTmpFile();
|
|
79
|
+
*/
|
|
80
|
+
writeExportDataInTmpFile() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
if (!browser.params || !browser.params.exportDataFiles) {
|
|
83
|
+
// no export data files in config.js, nothing to do
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!process.env.TMP_EXPORT_PATH) {
|
|
87
|
+
console.warn("Unexpected error - process.env.TMP_EXPORT_PATH not defined");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!browser.params.export) {
|
|
91
|
+
console.warn("Unexpected error - browser.params.export not defined, no export data to be written out");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const date = new Date().getTime();
|
|
95
|
+
const keyFileWithPath = path_1.default.join(process.env.TMP_EXPORT_PATH, date + ".exportDataFiles");
|
|
96
|
+
try {
|
|
97
|
+
yield dataExchangeUtil_1.default.outputJson(keyFileWithPath, browser.params.exportDataFiles, { spaces: 2 });
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.warn(`Could not write export key data in tmp file ${keyFileWithPath}`);
|
|
101
|
+
console.warn(err);
|
|
102
|
+
}
|
|
103
|
+
const keys = Object.keys(browser.params.exportDataFiles);
|
|
104
|
+
//use for loop so all files get written before promise is resolved
|
|
105
|
+
for (let i = 0; i < keys.length; i++) {
|
|
106
|
+
const param = keys[i];
|
|
107
|
+
const fileWithPath = path_1.default.join(process.env.TMP_EXPORT_PATH, param + "." + date);
|
|
108
|
+
const data = browser.params.export[param] || {};
|
|
109
|
+
try {
|
|
110
|
+
yield fs_extra_1.default.outputJson(fileWithPath, data, { spaces: 2 });
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
console.warn(`Could not write export data in tmp file ${fileWithPath}`);
|
|
114
|
+
console.warn(err);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
;
|
|
120
|
+
/**
|
|
121
|
+
* @function writeExportData
|
|
122
|
+
* @description write the data in browser.params.export into the assigned files. Reads the temporary
|
|
123
|
+
* files and merges the data.
|
|
124
|
+
* @example await writeExportData();
|
|
125
|
+
*/
|
|
126
|
+
writeExportData() {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
if (!process.env.TMP_EXPORT_PATH) {
|
|
129
|
+
console.warn("Unexpected error - process.env.TMP_EXPORT_PATH not defined");
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
let files;
|
|
133
|
+
try {
|
|
134
|
+
files = yield fs_extra_1.default.readdir(process.env.TMP_EXPORT_PATH);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.warn(`Could not read export data in tmp folder ${process.env.TMP_EXPORT_PATH}`);
|
|
138
|
+
console.warn(err);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
files.sort();
|
|
142
|
+
const exportData = {};
|
|
143
|
+
let exportDataFiles = {};
|
|
144
|
+
// loop through the files in sequence, for loop ensures all files are
|
|
145
|
+
// read before we go to the next step
|
|
146
|
+
for (const file of files) {
|
|
147
|
+
const fileWithPath = path_1.default.resolve(process.env.TMP_EXPORT_PATH, file);
|
|
148
|
+
try {
|
|
149
|
+
const data = yield dataExchangeUtil_1.default.readJson(fileWithPath);
|
|
150
|
+
// if no data (empty object or array) don't do anything
|
|
151
|
+
if (!data || Object.keys(data).length <= 0) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const match = file.match(/^[0-9]+\.exportDataFiles$/);
|
|
155
|
+
const keyMatch = file.match(/^(.*)\.[0-9]+$/);
|
|
156
|
+
if (match) {
|
|
157
|
+
exportDataFiles = data;
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
if (keyMatch && keyMatch.length > 1) {
|
|
161
|
+
const key = keyMatch[1];
|
|
162
|
+
if (key) {
|
|
163
|
+
// if array join the elements
|
|
164
|
+
if (Array.isArray(data) && (!exportData[key] || Array.isArray(exportData[key]))) {
|
|
165
|
+
if (exportData[key]) {
|
|
166
|
+
exportData[key] = [...exportData[key], ...data];
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
exportData[key] = [...data];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else if (Array.isArray(data) && !exportData[key] && !Array.isArray(exportData[key])) {
|
|
173
|
+
console.warn(`Unexpected array and non array data for export key ${key}`);
|
|
174
|
+
exportData[key] = Object.assign(Object.assign({}, exportData[key]), data);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
exportData[key] = Object.assign(Object.assign({}, exportData[key]), data);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
console.warn(`Unexpected error - temporary export file ${fileWithPath} does not have timestamp in its name`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
console.warn(`Could not read export data in tmp file ${fileWithPath}`);
|
|
188
|
+
console.warn(err);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const keys = Object.keys(exportDataFiles);
|
|
192
|
+
// use for loop to make sure all files are written before we remove the tmp folder
|
|
193
|
+
for (const param of keys) {
|
|
194
|
+
let fileWithPath = exportDataFiles[param];
|
|
195
|
+
if (!fileWithPath) {
|
|
196
|
+
console.warn(`Unexpected error - no file name for key ${param}`);
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
// adjust relative file paths
|
|
200
|
+
fileWithPath = dataExchangeUtil_1.default.getFileAbsPath(fileWithPath);
|
|
201
|
+
const data = exportData[param];
|
|
202
|
+
try {
|
|
203
|
+
yield dataExchangeUtil_1.default.outputJson(fileWithPath, data, { spaces: 2 });
|
|
204
|
+
}
|
|
205
|
+
catch (err) {
|
|
206
|
+
console.warn(`Could not write export data to file, make sure that ${fileWithPath} is valid and writable`);
|
|
207
|
+
console.warn(err);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
// remove tmp folder, ignore if this call fails
|
|
212
|
+
yield fs_extra_1.default.remove(process.env.TMP_EXPORT_PATH);
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
console.warn(`Could not remove temporary folder ${process.env.TMP_EXPORT_PATH}`);
|
|
216
|
+
console.warn(err);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
;
|
|
221
|
+
}
|
|
222
|
+
;
|
|
223
|
+
module.exports = new DataExchange();
|
|
224
|
+
//# sourceMappingURL=dataExchange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataExchange.js","sourceRoot":"","sources":["../../../src/scripts/dataExchange/dataExchange.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B;;;;GAIG;AACH,wDAAyB;AACzB,gDAAwB;AACxB,0EAAsD;AAEtD,MAAM,YAAY;IAEhB;;;;OAIG;IAEG,UAAU;;YAEd,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;gBAC1B,eAAe;gBACf,OAAO;aACR;YACD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;gBACnB,OAAO,CAAC,MAAM,GA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C9C;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,CAAC,IAAI,CAAC,qCAAqC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;gBAEjF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACnB;QAEH,CAAC;KAAA;IAAA,CAAC;CAEH;AAAA,CAAC;AACF,MAAM,CAAC,OAAO,GAAG,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
declare class DataExchangeUtil {
|
|
2
|
+
/**
|
|
3
|
+
* @function getFileAbsPath
|
|
4
|
+
* @param {string} fileWithPath - file with relative or absolute file path
|
|
5
|
+
* @return {string} the file with absolute file path
|
|
6
|
+
* @example await getFileAbsPath("./data/myfolder/po.json");
|
|
7
|
+
*/
|
|
8
|
+
getFileAbsPath(fileWithPath: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* @function isReadable - checks if file is present and readable
|
|
11
|
+
* @param {string} filename - file name with full path
|
|
12
|
+
* @return {Boolean} - true if file is readable, false if file is not present or not readable
|
|
13
|
+
*/
|
|
14
|
+
isReadable(filename: string): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* @function readJson - reads JSON data from a file. This method has been added, since unlike fs-extra.readJson, this
|
|
17
|
+
* one handles empty JSON files. It returns null object if file is empty.
|
|
18
|
+
* @param {string} filename - file name with full path
|
|
19
|
+
* @return {object} - the JSON data
|
|
20
|
+
* @throws {*} - throws an error if file is not readable, or if data is not valid JSON
|
|
21
|
+
*/
|
|
22
|
+
readJson(filename: string): Promise<object>;
|
|
23
|
+
/**
|
|
24
|
+
* @function outputJson - writes JSON data into a file. This method has been added, since unlike fs-extra.outputJson, this
|
|
25
|
+
* one writes an empty file if JSON data is null or if empty object.
|
|
26
|
+
* fs-extra.outputJson is used internally, which will create the file and output directory if required.
|
|
27
|
+
* @param {string} fileWithPath - file name with full path
|
|
28
|
+
* @param {object} data - the JSON data
|
|
29
|
+
* @param {object} options - options, e.g. {spaces: 2} to pretty print JSON
|
|
30
|
+
* @throws {*} - throws an error if file is not writable
|
|
31
|
+
*/
|
|
32
|
+
outputJson(fileWithPath: string, data: object, options?: object): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* @function readData - read import data and assign the values to browser.params.import
|
|
35
|
+
* if params is ["po"] then data read from file or folder will be assigned to browser.params.import.po
|
|
36
|
+
* @param {string} fileOrDir - file or directory with full path
|
|
37
|
+
* @param {string[]} params - the keys under which data should be stored
|
|
38
|
+
*/
|
|
39
|
+
readData(fileOrDir: string, params: string[]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* @function readFolder - read json files in specified folder and any subfolders under it
|
|
42
|
+
* if params = ["test1", "purchaseRequisition"] then the data read from folder will be
|
|
43
|
+
* assigned to browser.params.import.test1.purchaseRequisition
|
|
44
|
+
* if file "data1.json" is present in the folder, then the data from this json file will go
|
|
45
|
+
* under browser.params.import.test1.purchaseRequisition.data1, the file prefix is used as key
|
|
46
|
+
* if subfolder "testsubfolder1" is encountered, then the file data will go under
|
|
47
|
+
* browser.params.import.test1.purchaseRequisition.testsubfolder1, the subfolder name is used as key
|
|
48
|
+
* @param {string} folder - folder with complete path
|
|
49
|
+
* @param {string[]} params - the keys hierarchy under which data should be stored
|
|
50
|
+
*/
|
|
51
|
+
readFolder(folder: string, params: string[]): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* @function readFile
|
|
54
|
+
* reads json data in the specified file and assigns to browser.params.import
|
|
55
|
+
* if params = ["test1", "purchaseRequisition"] then the data read from file will be
|
|
56
|
+
* assigned to browser.params.import.test1.purchaseRequisition
|
|
57
|
+
* @param {string} filename - file to be read, includes path
|
|
58
|
+
* @param {string[]} params - the keys hierarchy under which data should be stored
|
|
59
|
+
*/
|
|
60
|
+
readFile(filename: string, params: string[]): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
declare const _default: DataExchangeUtil;
|
|
63
|
+
export default _default;
|