From af3b7a4de9d195e0e0bf594f2761f5c3c347f88f Mon Sep 17 00:00:00 2001 From: Akylbek Utekeshev Date: Fri, 15 Sep 2023 23:16:51 +0600 Subject: [PATCH] MBX-2792 unit tests --- Mindbox.xcodeproj/project.pbxproj | 136 +- Mindbox/DI/DependencyProvider.swift | 3 +- .../ContentPositionFilter.swift | 6 +- .../ElementsFiter/ElementsColorFilter.swift | 26 + .../ElementsFiter/ElementsFilter.swift | 21 +- .../ElementsPositionFilter.swift | 6 +- .../ElementsFiter/ElementsSizeFilter.swift | 6 +- .../InappFilterService/InappFilter.swift | 23 +- .../LayersFilter/LayerActionFilter.swift | 8 +- .../LayersFilter/LayersFilter.swift | 19 +- .../LayersFilter/LayersSourceFilter.swift | 10 +- .../InappFilterService/VariantsFilter.swift | 25 +- ...ontentElementPositionMarginValidator.swift | 29 - .../ContentElementSizeValidator.swift | 28 - .../ContentPositionGravity.swift | 14 - .../ContentPositionMarginValidator.swift | 22 - .../Config/InappModel/InappValidator.swift | 34 - Mindbox/Info.plist | 2 +- MindboxTests/DI/TestDependencyProvider.swift | 14 + .../InApp/Tests/ABTesting/ABTests.swift | 1683 +++++++++-------- .../InappFilterServiceTests.swift | 313 +++ .../JSON /closeButtonMarginAboveOne.json | 206 ++ .../JSON /closeButtonMarginBelowZero.json | 206 ++ .../JSON /closeButtonWithOpenButton.json | 225 +++ .../JSON /emptyLayersSection.json | 193 ++ .../JSON /emptyVariantsArray.json | 160 ++ .../JSON /invalidCloseButtonColor.json | 206 ++ .../knownImageUnknownPictureLayerType.json | 218 +++ .../JSON /missingBackgroundSection.json | 190 ++ .../missingCloseButtonColorLineWidthSize.json | 199 ++ .../JSON /missingElementsSection.json | 164 ++ .../missingImageLinkInSourceLayerValue.json | 206 ++ .../missingIntentPayloadInActionLayer.json | 330 ++++ .../JSON /missingMarginFieldInSection.json | 205 ++ .../JSON /missingSourceSection.json | 202 ++ .../JSON /missingValueInSourceLayer.json | 205 ++ .../JSON /negativeCloseButtonSizeValues.json | 206 ++ ...redirectUrlValueNumberInsteadOfString.json | 332 ++++ .../JSON /twoCloseButtonsInApp.json | 225 +++ .../JSON /unknownActionLayerType.json | 332 ++++ .../JSON /unknownLayerType.json | 206 ++ .../JSON /unknownSizeKind.json | 206 ++ .../JSON /unknownSourceType.json | 206 ++ .../JSON /unknownVariantType.json | 206 ++ ...tElementPositionMarginValidatorTests.swift | 30 - 45 files changed, 6417 insertions(+), 1075 deletions(-) create mode 100644 Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsColorFilter.swift delete mode 100644 Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementPosition/ContentElementPositionMargin/ContentElementPositionMarginValidator.swift delete mode 100644 Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementSize/ContentElementSizeValidator.swift delete mode 100644 Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionMargin/ContentPositionMarginValidator.swift delete mode 100644 Mindbox/InAppMessages/Models/Config/InappModel/InappValidator.swift create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/InappFilterServiceTests.swift create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginAboveOne.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginBelowZero.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonWithOpenButton.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyLayersSection.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyVariantsArray.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /invalidCloseButtonColor.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /knownImageUnknownPictureLayerType.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingBackgroundSection.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingCloseButtonColorLineWidthSize.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingElementsSection.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingImageLinkInSourceLayerValue.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingIntentPayloadInActionLayer.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingMarginFieldInSection.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingSourceSection.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingValueInSourceLayer.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /negativeCloseButtonSizeValues.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /redirectUrlValueNumberInsteadOfString.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /twoCloseButtonsInApp.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownActionLayerType.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownLayerType.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSizeKind.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSourceType.json create mode 100644 MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownVariantType.json delete mode 100644 MindboxTests/InApp/Tests/ModelValidatorTests/ContentElementPositionMarginValidatorTests.swift diff --git a/Mindbox.xcodeproj/project.pbxproj b/Mindbox.xcodeproj/project.pbxproj index f9a0f935..ef95b3b6 100644 --- a/Mindbox.xcodeproj/project.pbxproj +++ b/Mindbox.xcodeproj/project.pbxproj @@ -312,16 +312,13 @@ F331DCC12A80993600222120 /* ContentElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DC9B2A80993600222120 /* ContentElement.swift */; }; F331DCC32A80993600222120 /* ContentElementPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DC9F2A80993600222120 /* ContentElementPosition.swift */; }; F331DCC42A80993600222120 /* ContentElementPositionMargin.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCA12A80993600222120 /* ContentElementPositionMargin.swift */; }; - F331DCC62A80993600222120 /* ContentElementPositionMarginValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCA42A80993600222120 /* ContentElementPositionMarginValidator.swift */; }; F331DCC82A80993600222120 /* ContentBackgroundLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCA82A80993600222120 /* ContentBackgroundLayer.swift */; }; F331DCCB2A80993600222120 /* ContentBackgroundLayerAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCAD2A80993600222120 /* ContentBackgroundLayerAction.swift */; }; F331DCCC2A80993600222120 /* ContentBackgroundLayerSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCAF2A80993600222120 /* ContentBackgroundLayerSource.swift */; }; F331DCD12A80993600222120 /* ContentBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCB62A80993600222120 /* ContentBackground.swift */; }; F331DCD22A80993600222120 /* InappFormVariantContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCB72A80993600222120 /* InappFormVariantContent.swift */; }; F331DCD32A80993600222120 /* InappForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCB82A80993600222120 /* InappForm.swift */; }; - F331DCD42A80993600222120 /* InappValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCB92A80993600222120 /* InappValidator.swift */; }; F331DCD52A80993600222120 /* InAppModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCBA2A80993600222120 /* InAppModel.swift */; }; - F331DCE22A80B4C800222120 /* ContentElementPositionMarginValidatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCE12A80B4C800222120 /* ContentElementPositionMarginValidatorTests.swift */; }; F331DD012A83A56500222120 /* InAppPresentationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCEA2A83A56500222120 /* InAppPresentationManager.swift */; }; F331DD022A83A56500222120 /* PresentationDisplayUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCEE2A83A56500222120 /* PresentationDisplayUseCase.swift */; }; F331DD032A83A56500222120 /* ModalPresentationStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DCF02A83A56500222120 /* ModalPresentationStrategy.swift */; }; @@ -345,13 +342,11 @@ F331DD2E2A84CA8900222120 /* UrlLayerSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DD2D2A84CA8900222120 /* UrlLayerSource.swift */; }; F331DD312A84CCA800222120 /* CloseButtonElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DD302A84CCA800222120 /* CloseButtonElement.swift */; }; F331DD332A84D57800222120 /* VariantImageUrlExtractorService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DD322A84D57800222120 /* VariantImageUrlExtractorService.swift */; }; - F331DD582A8648DB00222120 /* ContentElementSizeValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F331DD572A8648DB00222120 /* ContentElementSizeValidator.swift */; }; F336080D2A8A142800C7C9B7 /* SnackbarFormVariant.swift in Sources */ = {isa = PBXBuildFile; fileRef = F336080C2A8A142800C7C9B7 /* SnackbarFormVariant.swift */; }; F336080F2A8A14D800C7C9B7 /* SnackbarFormVariantContent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F336080E2A8A14D800C7C9B7 /* SnackbarFormVariantContent.swift */; }; F33608122A8A151C00C7C9B7 /* ContentPosition.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33608112A8A151C00C7C9B7 /* ContentPosition.swift */; }; F33608152A8A156900C7C9B7 /* ContentPositionGravity.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33608142A8A156900C7C9B7 /* ContentPositionGravity.swift */; }; F33608182A8A161200C7C9B7 /* ContentPositionMargin.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33608172A8A161200C7C9B7 /* ContentPositionMargin.swift */; }; - F336081A2A8A163D00C7C9B7 /* ContentPositionMarginValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33608192A8A163D00C7C9B7 /* ContentPositionMarginValidator.swift */; }; F336081C2A8B9EA800C7C9B7 /* SnackbarViewFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = F336081B2A8B9EA800C7C9B7 /* SnackbarViewFactory.swift */; }; F33608262A8CC94A00C7C9B7 /* SnackbarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33608252A8CC94A00C7C9B7 /* SnackbarViewController.swift */; }; F33608282A8CD17E00C7C9B7 /* SnackbarPresentationStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33608272A8CD17E00C7C9B7 /* SnackbarPresentationStrategy.swift */; }; @@ -376,6 +371,23 @@ F39117032AA9B79100852298 /* ElementsSizeFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39117022AA9B79100852298 /* ElementsSizeFilter.swift */; }; F39117052AA9B92500852298 /* ElementsPositionFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39117042AA9B92500852298 /* ElementsPositionFilter.swift */; }; F39117072AA9C69A00852298 /* ContentPositionFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F39117062AA9C69A00852298 /* ContentPositionFilter.swift */; }; + F391170B2AB2E74F00852298 /* InappFilterServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F391170A2AB2E74F00852298 /* InappFilterServiceTests.swift */; }; + F391170F2AB4B31800852298 /* unknownVariantType.json in Resources */ = {isa = PBXBuildFile; fileRef = F391170E2AB4B31800852298 /* unknownVariantType.json */; }; + F39117112AB4BD4500852298 /* missingBackgroundSection.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117102AB4BD4500852298 /* missingBackgroundSection.json */; }; + F39117132AB4BD8500852298 /* emptyLayersSection.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117122AB4BD8500852298 /* emptyLayersSection.json */; }; + F39117152AB4BEB900852298 /* unknownLayerType.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117142AB4BEB900852298 /* unknownLayerType.json */; }; + F39117172AB4BF2700852298 /* knownImageUnknownPictureLayerType.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117162AB4BF2700852298 /* knownImageUnknownPictureLayerType.json */; }; + F39117192AB4C02500852298 /* unknownActionLayerType.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117182AB4C02500852298 /* unknownActionLayerType.json */; }; + F391171B2AB4C07900852298 /* redirectUrlValueNumberInsteadOfString.json in Resources */ = {isa = PBXBuildFile; fileRef = F391171A2AB4C07900852298 /* redirectUrlValueNumberInsteadOfString.json */; }; + F391171D2AB4C0BE00852298 /* missingIntentPayloadInActionLayer.json in Resources */ = {isa = PBXBuildFile; fileRef = F391171C2AB4C0BE00852298 /* missingIntentPayloadInActionLayer.json */; }; + F391171F2AB4C1C100852298 /* missingSourceSection.json in Resources */ = {isa = PBXBuildFile; fileRef = F391171E2AB4C1C100852298 /* missingSourceSection.json */; }; + F39117212AB4C20200852298 /* emptyVariantsArray.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117202AB4C20200852298 /* emptyVariantsArray.json */; }; + F39117232AB4C23900852298 /* unknownSourceType.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117222AB4C23900852298 /* unknownSourceType.json */; }; + F39117252AB4C27B00852298 /* missingValueInSourceLayer.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117242AB4C27B00852298 /* missingValueInSourceLayer.json */; }; + F39117272AB4C2AA00852298 /* missingImageLinkInSourceLayerValue.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117262AB4C2AA00852298 /* missingImageLinkInSourceLayerValue.json */; }; + F39117292AB4C2EF00852298 /* missingElementsSection.json in Resources */ = {isa = PBXBuildFile; fileRef = F39117282AB4C2EF00852298 /* missingElementsSection.json */; }; + F391172B2AB4C4AD00852298 /* invalidCloseButtonColor.json in Resources */ = {isa = PBXBuildFile; fileRef = F391172A2AB4C4AD00852298 /* invalidCloseButtonColor.json */; }; + F391172D2AB4C61000852298 /* ElementsColorFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F391172C2AB4C61000852298 /* ElementsColorFilter.swift */; }; F397EEAD2A4456C300D48CEC /* ProtocolError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F397EEAC2A4456C300D48CEC /* ProtocolError.swift */; }; F397EEAF2A4456FD00D48CEC /* MindboxError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F397EEAE2A4456FD00D48CEC /* MindboxError.swift */; }; F397EEB12A44571300D48CEC /* UnknownDecodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F397EEB02A44571300D48CEC /* UnknownDecodable.swift */; }; @@ -423,6 +435,14 @@ F3D818B32A3885F50002957C /* ABTestDeviceMixerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3D818B22A3885F50002957C /* ABTestDeviceMixerTests.swift */; }; F3D925AB2A120C0F00135C87 /* InAppImageDownloaderMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3D925AA2A120C0F00135C87 /* InAppImageDownloaderMock.swift */; }; F3D925AD2A1236F400135C87 /* URLSessionImageDownloaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3D925AC2A1236F400135C87 /* URLSessionImageDownloaderTests.swift */; }; + F3FAD86A2AB863CD00D98C03 /* missingCloseButtonColorLineWidthSize.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD8692AB863CD00D98C03 /* missingCloseButtonColorLineWidthSize.json */; }; + F3FAD86C2AB8642C00D98C03 /* twoCloseButtonsInApp.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD86B2AB8642C00D98C03 /* twoCloseButtonsInApp.json */; }; + F3FAD86E2AB8656700D98C03 /* closeButtonWithOpenButton.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD86D2AB8656700D98C03 /* closeButtonWithOpenButton.json */; }; + F3FAD8702AB866B600D98C03 /* unknownSizeKind.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD86F2AB866B600D98C03 /* unknownSizeKind.json */; }; + F3FAD8722AB8673100D98C03 /* missingMarginFieldInSection.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD8712AB8673100D98C03 /* missingMarginFieldInSection.json */; }; + F3FAD8742AB8678900D98C03 /* negativeCloseButtonSizeValues.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD8732AB8678900D98C03 /* negativeCloseButtonSizeValues.json */; }; + F3FAD8762AB867E700D98C03 /* closeButtonMarginAboveOne.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD8752AB867E700D98C03 /* closeButtonMarginAboveOne.json */; }; + F3FAD8782AB8685D00D98C03 /* closeButtonMarginBelowZero.json in Resources */ = {isa = PBXBuildFile; fileRef = F3FAD8772AB8685D00D98C03 /* closeButtonMarginBelowZero.json */; }; F78E92EF282E63320003B4A3 /* DispatchSemaphore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78E92EE282E63320003B4A3 /* DispatchSemaphore.swift */; }; /* End PBXBuildFile section */ @@ -776,16 +796,13 @@ F331DC9B2A80993600222120 /* ContentElement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentElement.swift; sourceTree = ""; }; F331DC9F2A80993600222120 /* ContentElementPosition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentElementPosition.swift; sourceTree = ""; }; F331DCA12A80993600222120 /* ContentElementPositionMargin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentElementPositionMargin.swift; sourceTree = ""; }; - F331DCA42A80993600222120 /* ContentElementPositionMarginValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentElementPositionMarginValidator.swift; sourceTree = ""; }; F331DCA82A80993600222120 /* ContentBackgroundLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentBackgroundLayer.swift; sourceTree = ""; }; F331DCAD2A80993600222120 /* ContentBackgroundLayerAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentBackgroundLayerAction.swift; sourceTree = ""; }; F331DCAF2A80993600222120 /* ContentBackgroundLayerSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentBackgroundLayerSource.swift; sourceTree = ""; }; F331DCB62A80993600222120 /* ContentBackground.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentBackground.swift; sourceTree = ""; }; F331DCB72A80993600222120 /* InappFormVariantContent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InappFormVariantContent.swift; sourceTree = ""; }; F331DCB82A80993600222120 /* InappForm.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InappForm.swift; sourceTree = ""; }; - F331DCB92A80993600222120 /* InappValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InappValidator.swift; sourceTree = ""; }; F331DCBA2A80993600222120 /* InAppModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InAppModel.swift; sourceTree = ""; }; - F331DCE12A80B4C800222120 /* ContentElementPositionMarginValidatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentElementPositionMarginValidatorTests.swift; sourceTree = ""; }; F331DCEA2A83A56500222120 /* InAppPresentationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InAppPresentationManager.swift; sourceTree = ""; }; F331DCEE2A83A56500222120 /* PresentationDisplayUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PresentationDisplayUseCase.swift; sourceTree = ""; }; F331DCF02A83A56500222120 /* ModalPresentationStrategy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModalPresentationStrategy.swift; sourceTree = ""; }; @@ -809,13 +826,11 @@ F331DD2D2A84CA8900222120 /* UrlLayerSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UrlLayerSource.swift; sourceTree = ""; }; F331DD302A84CCA800222120 /* CloseButtonElement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloseButtonElement.swift; sourceTree = ""; }; F331DD322A84D57800222120 /* VariantImageUrlExtractorService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VariantImageUrlExtractorService.swift; sourceTree = ""; }; - F331DD572A8648DB00222120 /* ContentElementSizeValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentElementSizeValidator.swift; sourceTree = ""; }; F336080C2A8A142800C7C9B7 /* SnackbarFormVariant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnackbarFormVariant.swift; sourceTree = ""; }; F336080E2A8A14D800C7C9B7 /* SnackbarFormVariantContent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnackbarFormVariantContent.swift; sourceTree = ""; }; F33608112A8A151C00C7C9B7 /* ContentPosition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPosition.swift; sourceTree = ""; }; F33608142A8A156900C7C9B7 /* ContentPositionGravity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPositionGravity.swift; sourceTree = ""; }; F33608172A8A161200C7C9B7 /* ContentPositionMargin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPositionMargin.swift; sourceTree = ""; }; - F33608192A8A163D00C7C9B7 /* ContentPositionMarginValidator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPositionMarginValidator.swift; sourceTree = ""; }; F336081B2A8B9EA800C7C9B7 /* SnackbarViewFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnackbarViewFactory.swift; sourceTree = ""; }; F33608252A8CC94A00C7C9B7 /* SnackbarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnackbarViewController.swift; sourceTree = ""; }; F33608272A8CD17E00C7C9B7 /* SnackbarPresentationStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnackbarPresentationStrategy.swift; sourceTree = ""; }; @@ -840,6 +855,23 @@ F39117022AA9B79100852298 /* ElementsSizeFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsSizeFilter.swift; sourceTree = ""; }; F39117042AA9B92500852298 /* ElementsPositionFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsPositionFilter.swift; sourceTree = ""; }; F39117062AA9C69A00852298 /* ContentPositionFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentPositionFilter.swift; sourceTree = ""; }; + F391170A2AB2E74F00852298 /* InappFilterServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InappFilterServiceTests.swift; sourceTree = ""; }; + F391170E2AB4B31800852298 /* unknownVariantType.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = unknownVariantType.json; sourceTree = ""; }; + F39117102AB4BD4500852298 /* missingBackgroundSection.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingBackgroundSection.json; sourceTree = ""; }; + F39117122AB4BD8500852298 /* emptyLayersSection.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = emptyLayersSection.json; sourceTree = ""; }; + F39117142AB4BEB900852298 /* unknownLayerType.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = unknownLayerType.json; sourceTree = ""; }; + F39117162AB4BF2700852298 /* knownImageUnknownPictureLayerType.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = knownImageUnknownPictureLayerType.json; sourceTree = ""; }; + F39117182AB4C02500852298 /* unknownActionLayerType.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = unknownActionLayerType.json; sourceTree = ""; }; + F391171A2AB4C07900852298 /* redirectUrlValueNumberInsteadOfString.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = redirectUrlValueNumberInsteadOfString.json; sourceTree = ""; }; + F391171C2AB4C0BE00852298 /* missingIntentPayloadInActionLayer.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingIntentPayloadInActionLayer.json; sourceTree = ""; }; + F391171E2AB4C1C100852298 /* missingSourceSection.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingSourceSection.json; sourceTree = ""; }; + F39117202AB4C20200852298 /* emptyVariantsArray.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = emptyVariantsArray.json; sourceTree = ""; }; + F39117222AB4C23900852298 /* unknownSourceType.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = unknownSourceType.json; sourceTree = ""; }; + F39117242AB4C27B00852298 /* missingValueInSourceLayer.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingValueInSourceLayer.json; sourceTree = ""; }; + F39117262AB4C2AA00852298 /* missingImageLinkInSourceLayerValue.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingImageLinkInSourceLayerValue.json; sourceTree = ""; }; + F39117282AB4C2EF00852298 /* missingElementsSection.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingElementsSection.json; sourceTree = ""; }; + F391172A2AB4C4AD00852298 /* invalidCloseButtonColor.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = invalidCloseButtonColor.json; sourceTree = ""; }; + F391172C2AB4C61000852298 /* ElementsColorFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElementsColorFilter.swift; sourceTree = ""; }; F397EEAC2A4456C300D48CEC /* ProtocolError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProtocolError.swift; sourceTree = ""; }; F397EEAE2A4456FD00D48CEC /* MindboxError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MindboxError.swift; sourceTree = ""; }; F397EEB02A44571300D48CEC /* UnknownDecodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnknownDecodable.swift; sourceTree = ""; }; @@ -887,6 +919,14 @@ F3D818B22A3885F50002957C /* ABTestDeviceMixerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ABTestDeviceMixerTests.swift; sourceTree = ""; }; F3D925AA2A120C0F00135C87 /* InAppImageDownloaderMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InAppImageDownloaderMock.swift; sourceTree = ""; }; F3D925AC2A1236F400135C87 /* URLSessionImageDownloaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionImageDownloaderTests.swift; sourceTree = ""; }; + F3FAD8692AB863CD00D98C03 /* missingCloseButtonColorLineWidthSize.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingCloseButtonColorLineWidthSize.json; sourceTree = ""; }; + F3FAD86B2AB8642C00D98C03 /* twoCloseButtonsInApp.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = twoCloseButtonsInApp.json; sourceTree = ""; }; + F3FAD86D2AB8656700D98C03 /* closeButtonWithOpenButton.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = closeButtonWithOpenButton.json; sourceTree = ""; }; + F3FAD86F2AB866B600D98C03 /* unknownSizeKind.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = unknownSizeKind.json; sourceTree = ""; }; + F3FAD8712AB8673100D98C03 /* missingMarginFieldInSection.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = missingMarginFieldInSection.json; sourceTree = ""; }; + F3FAD8732AB8678900D98C03 /* negativeCloseButtonSizeValues.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = negativeCloseButtonSizeValues.json; sourceTree = ""; }; + F3FAD8752AB867E700D98C03 /* closeButtonMarginAboveOne.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = closeButtonMarginAboveOne.json; sourceTree = ""; }; + F3FAD8772AB8685D00D98C03 /* closeButtonMarginBelowZero.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = closeButtonMarginBelowZero.json; sourceTree = ""; }; F78E92EE282E63320003B4A3 /* DispatchSemaphore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DispatchSemaphore.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1966,7 +2006,6 @@ isa = PBXGroup; children = ( F331DCBA2A80993600222120 /* InAppModel.swift */, - F331DCB92A80993600222120 /* InappValidator.swift */, F331DC8D2A80993600222120 /* InappForm */, ); path = InappModel; @@ -2018,7 +2057,6 @@ isa = PBXGroup; children = ( F331DC982A80993600222120 /* ContentElementSize.swift */, - F331DD572A8648DB00222120 /* ContentElementSizeValidator.swift */, F331DC992A80993600222120 /* Kind */, ); path = ContentElementSize; @@ -2045,7 +2083,6 @@ isa = PBXGroup; children = ( F331DCA12A80993600222120 /* ContentElementPositionMargin.swift */, - F331DCA42A80993600222120 /* ContentElementPositionMarginValidator.swift */, ); path = ContentElementPositionMargin; sourceTree = ""; @@ -2091,7 +2128,6 @@ F331DCDA2A80AC3300222120 /* ModelValidatorTests */ = { isa = PBXGroup; children = ( - F331DCE12A80B4C800222120 /* ContentElementPositionMarginValidatorTests.swift */, ); path = ModelValidatorTests; sourceTree = ""; @@ -2272,7 +2308,6 @@ isa = PBXGroup; children = ( F33608172A8A161200C7C9B7 /* ContentPositionMargin.swift */, - F33608192A8A163D00C7C9B7 /* ContentPositionMarginValidator.swift */, ); path = ContentPositionMargin; sourceTree = ""; @@ -2361,10 +2396,50 @@ F39117002AA9B68B00852298 /* ElementsFilter.swift */, F39117022AA9B79100852298 /* ElementsSizeFilter.swift */, F39117042AA9B92500852298 /* ElementsPositionFilter.swift */, + F391172C2AB4C61000852298 /* ElementsColorFilter.swift */, ); path = ElementsFiter; sourceTree = ""; }; + F391170C2AB4B2FC00852298 /* InappFilterServiceTests */ = { + isa = PBXGroup; + children = ( + F391170D2AB4B30600852298 /* JSON */, + F391170A2AB2E74F00852298 /* InappFilterServiceTests.swift */, + ); + path = InappFilterServiceTests; + sourceTree = ""; + }; + F391170D2AB4B30600852298 /* JSON */ = { + isa = PBXGroup; + children = ( + F3FAD8772AB8685D00D98C03 /* closeButtonMarginBelowZero.json */, + F3FAD8752AB867E700D98C03 /* closeButtonMarginAboveOne.json */, + F3FAD8732AB8678900D98C03 /* negativeCloseButtonSizeValues.json */, + F3FAD8712AB8673100D98C03 /* missingMarginFieldInSection.json */, + F3FAD86F2AB866B600D98C03 /* unknownSizeKind.json */, + F3FAD86D2AB8656700D98C03 /* closeButtonWithOpenButton.json */, + F3FAD86B2AB8642C00D98C03 /* twoCloseButtonsInApp.json */, + F3FAD8692AB863CD00D98C03 /* missingCloseButtonColorLineWidthSize.json */, + F391172A2AB4C4AD00852298 /* invalidCloseButtonColor.json */, + F39117282AB4C2EF00852298 /* missingElementsSection.json */, + F39117262AB4C2AA00852298 /* missingImageLinkInSourceLayerValue.json */, + F39117242AB4C27B00852298 /* missingValueInSourceLayer.json */, + F39117222AB4C23900852298 /* unknownSourceType.json */, + F39117202AB4C20200852298 /* emptyVariantsArray.json */, + F391171E2AB4C1C100852298 /* missingSourceSection.json */, + F391171C2AB4C0BE00852298 /* missingIntentPayloadInActionLayer.json */, + F391171A2AB4C07900852298 /* redirectUrlValueNumberInsteadOfString.json */, + F39117182AB4C02500852298 /* unknownActionLayerType.json */, + F39117162AB4BF2700852298 /* knownImageUnknownPictureLayerType.json */, + F39117142AB4BEB900852298 /* unknownLayerType.json */, + F39117122AB4BD8500852298 /* emptyLayersSection.json */, + F39117102AB4BD4500852298 /* missingBackgroundSection.json */, + F391170E2AB4B31800852298 /* unknownVariantType.json */, + ); + path = "JSON "; + sourceTree = ""; + }; F397EEAB2A4456A900D48CEC /* MindboxError */ = { isa = PBXGroup; children = ( @@ -2450,6 +2525,7 @@ F3A8B95B2A389EAD00E9C055 /* GeoServiceTests.swift */, F39B67A62A3C6C6A005C0CCA /* SegmentationServiceTests.swift */, F39116ED2AA53EE400852298 /* VariantImageUrlExtractorServiceTests.swift */, + F391170C2AB4B2FC00852298 /* InappFilterServiceTests */, ); path = InAppConfigurationMapperTests; sourceTree = ""; @@ -2693,21 +2769,34 @@ files = ( A1B940B7298104ED00B0F994 /* UnknownTargetingsModel.json in Resources */, F39B67C82A3FBEA7005C0CCA /* ConfigWithABTypeNotInapps.json in Resources */, + F3FAD8782AB8685D00D98C03 /* closeButtonMarginBelowZero.json in Resources */, + F39117132AB4BD8500852298 /* emptyLayersSection.json in Resources */, F39B67BC2A3FB9A8005C0CCA /* ConfigWithABNoSalt.json in Resources */, 31ED2DF325C4456600301FAD /* TestConfig_Invalid_1.plist in Resources */, + F39117192AB4C02500852298 /* unknownActionLayerType.json in Resources */, + F39117152AB4BEB900852298 /* unknownLayerType.json in Resources */, A153E04129BB0A8B003C34D4 /* InAppConfigurationWithOperations.json in Resources */, F31801FF2A386BE60021774C /* InappConfigResponseMonitoringInvalid.json in Resources */, 31ED2DF225C4456600301FAD /* TestConfig_Invalid_2.plist in Resources */, + F39117172AB4BF2700852298 /* knownImageUnknownPictureLayerType.json in Resources */, 31ED2DF425C4456600301FAD /* TestConfig_Invalid_3.plist in Resources */, + F3FAD8722AB8673100D98C03 /* missingMarginFieldInSection.json in Resources */, 84CC79AB25CAEBBB00C062BD /* TestEventConfig.plist in Resources */, F31801FB2A386A5B0021774C /* InappConfigResponseSettingsInvalid.json in Resources */, F39B67BE2A3FB9EF005C0CCA /* ConfigWithABUnexpectedValue.json in Resources */, A17958902978BE7000609E91 /* GeoTargetingModelValid.json in Resources */, + F3FAD86C2AB8642C00D98C03 /* twoCloseButtonsInApp.json in Resources */, + F3FAD8742AB8678900D98C03 /* negativeCloseButtonSizeValues.json in Resources */, F3A8B9452A38870100E9C055 /* MixerUUIDS.json in Resources */, + F391171B2AB4C07900852298 /* redirectUrlValueNumberInsteadOfString.json in Resources */, A179588D2978BE7000609E91 /* SegmentTargetingModelValid.json in Resources */, 9BE941F52916822900258077 /* InAppConfigurationInvalid.json in Resources */, + F3FAD8702AB866B600D98C03 /* unknownSizeKind.json in Resources */, + F3FAD86E2AB8656700D98C03 /* closeButtonWithOpenButton.json in Resources */, F39B67C22A3FBB19005C0CCA /* ConfigWithABNoUpper.json in Resources */, + F39117292AB4C2EF00852298 /* missingElementsSection.json in Resources */, F39B67C02A3FBA77005C0CCA /* ConfigWithABCrossRange.json in Resources */, + F3FAD8762AB867E700D98C03 /* closeButtonMarginAboveOne.json in Resources */, F31801FE2A386BE60021774C /* InappConfigResponseAbtestsInvalid.json in Resources */, A1A916E329C914C000D59D9E /* InAppConfigurationWithCategoryIDIn.json in Resources */, A17958922978C88B00609E91 /* AllTargetingsModelValid.json in Resources */, @@ -2715,16 +2804,26 @@ F39B67B32A3C8B1D005C0CCA /* ConfigWithAB_2.json in Resources */, A179588C2978BE7000609E91 /* OrTargetingModelValid.json in Resources */, A179588F2978BE7000609E91 /* TrueTargetingModelValid.json in Resources */, + F391172B2AB4C4AD00852298 /* invalidCloseButtonColor.json in Resources */, 31ED2DFA25C4459500301FAD /* TestConfig_Invalid_4.plist in Resources */, F39B67C62A3FBC47005C0CCA /* ConfigWithABNormal.json in Resources */, F31801F82A38649D0021774C /* InappConfigResponseValid.json in Resources */, F39B67B22A3C8B1D005C0CCA /* ConfigWithAB_1.json in Resources */, 84FCD3BD25CA10F600D1E574 /* SuccessResponse.json in Resources */, + F39117212AB4C20200852298 /* emptyVariantsArray.json in Resources */, + F39117252AB4C27B00852298 /* missingValueInSourceLayer.json in Resources */, F39B67C42A3FBB64005C0CCA /* ConfigWithABLowerBiggerThanUpper.json in Resources */, + F391171D2AB4C0BE00852298 /* missingIntentPayloadInActionLayer.json in Resources */, + F39117112AB4BD4500852298 /* missingBackgroundSection.json in Resources */, 31EB907425C402F900368FFB /* TestConfig2.plist in Resources */, 31EB907325C402F900368FFB /* TestConfig3.plist in Resources */, + F391170F2AB4B31800852298 /* unknownVariantType.json in Resources */, + F39117232AB4C23900852298 /* unknownSourceType.json in Resources */, + F391171F2AB4C1C100852298 /* missingSourceSection.json in Resources */, + F39117272AB4C2AA00852298 /* missingImageLinkInSourceLayerValue.json in Resources */, F39B67BA2A3FB943005C0CCA /* ConfigWithABBrokenRange.json in Resources */, 31A20D4925B6CBE000AAA0A3 /* TestConfig1.plist in Resources */, + F3FAD86A2AB863CD00D98C03 /* missingCloseButtonColorLineWidthSize.json in Resources */, 9BC24E7A28F6C08700C2619C /* InAppConfiguration.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2890,7 +2989,6 @@ 334F3AEB264C199900A6AC00 /* DiscountCardRequest.swift in Sources */, 31A20D4E25B6EFB600AAA0A3 /* MindboxDelegate.swift in Sources */, A179587A2978AEC600609E91 /* AndTargetingChecker.swift in Sources */, - F331DD582A8648DB00222120 /* ContentElementSizeValidator.swift in Sources */, F3482F1B2A65DC01002A41EC /* DefaultInappMessageDelegate.swift in Sources */, F331DD012A83A56500222120 /* InAppPresentationManager.swift in Sources */, 3337E6A3265FAB39006949EB /* BaseResponse.swift in Sources */, @@ -2968,6 +3066,7 @@ 84A0CD54260AF8C8004CD91B /* TrackClick.swift in Sources */, A1D017F02976CC8600CD9F99 /* OrTargeting.swift in Sources */, 334F3AEA264C199900A6AC00 /* CustomerRequest.swift in Sources */, + F391172D2AB4C61000852298 /* ElementsColorFilter.swift in Sources */, A15D701629AF810E007131E7 /* SDKLogsRequest.swift in Sources */, 33072F362664C4D7001F1AB2 /* RecommendationRequest.swift in Sources */, 84DC49CC25D1832300D5D758 /* EventWrapper.swift in Sources */, @@ -3040,7 +3139,6 @@ 33EBF0B0264E6283002A35D5 /* SessionManager.swift in Sources */, F331DD192A840D2100222120 /* ModalFormVariant.swift in Sources */, F331DD2E2A84CA8900222120 /* UrlLayerSource.swift in Sources */, - F336081A2A8A163D00C7C9B7 /* ContentPositionMarginValidator.swift in Sources */, 337C7952265646D10092B580 /* OperationBodyRequestType.swift in Sources */, 9B9C95312921116F00BB29DA /* UUIDDebugService.swift in Sources */, 6FDD1443266F7C1600A50C35 /* BalanceTypeReponse.swift in Sources */, @@ -3050,14 +3148,12 @@ 3191C2A625ADFD8000E7D6B9 /* Mindbox.swift in Sources */, A184654529C310F100E64780 /* InAppOperationJSONModel.swift in Sources */, A154E330299E0F1600F8F074 /* InAppGeoResponse.swift in Sources */, - F331DCC62A80993600222120 /* ContentElementPositionMarginValidator.swift in Sources */, F39B67A92A3C72E5005C0CCA /* ImageDownloadService.swift in Sources */, 84CC799725CACF5500C062BD /* MBEventRepository.swift in Sources */, F3482F172A65DBB7002A41EC /* MindboxURLHandlerDelegate.swift in Sources */, F33608182A8A161200C7C9B7 /* ContentPositionMargin.swift in Sources */, 847F581F25C8A3F500147A9A /* HTTPTypealiases.swift in Sources */, 33BEE8172681EC5F00993720 /* EventRoute.swift in Sources */, - F331DCD42A80993600222120 /* InappValidator.swift in Sources */, 317054CB25AF189800AE624C /* PersistenceStorage.swift in Sources */, F331DD092A83A56500222120 /* LayerFactory.swift in Sources */, F336080D2A8A142800C7C9B7 /* SnackbarFormVariant.swift in Sources */, @@ -3085,7 +3181,6 @@ A17958992978E04600609E91 /* InAppStub.swift in Sources */, F39B67A72A3C6C6A005C0CCA /* SegmentationServiceTests.swift in Sources */, F3D925AB2A120C0F00135C87 /* InAppImageDownloaderMock.swift in Sources */, - F331DCE22A80B4C800222120 /* ContentElementPositionMarginValidatorTests.swift in Sources */, A154E32E299E0D8900F8F074 /* SDKLogManagerTests.swift in Sources */, 9B52570728D1AF880029B1BC /* InAppPresentationManagerMock.swift in Sources */, 84B09FB42611C74400B0A06E /* MockDatabaseRepository.swift in Sources */, @@ -3119,6 +3214,7 @@ 848A89592620C3AE00EDFB6D /* APNSTokenGenerator.swift in Sources */, F3D818B32A3885F50002957C /* ABTestDeviceMixerTests.swift in Sources */, 9BC24E7728F6BF8C00C2619C /* InAppConfigResponseTests.swift in Sources */, + F391170B2AB2E74F00852298 /* InappFilterServiceTests.swift in Sources */, F39B67AC2A3C7315005C0CCA /* MockImageDownloadService.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Mindbox/DI/DependencyProvider.swift b/Mindbox/DI/DependencyProvider.swift index 945bad27..24a62b7e 100644 --- a/Mindbox/DI/DependencyProvider.swift +++ b/Mindbox/DI/DependencyProvider.swift @@ -74,8 +74,9 @@ final class DependencyProvider: DependencyContainer { let sourceFilter = LayersSourceFilterService() let layersFilterService = LayersFilterService(actionFilter: actionFilter, sourceFilter: sourceFilter) let sizeFilter = ElementSizeFilterService() + let colorFilter = ElementsColorFilterService() let positionFilter = ElementsPositionFilterService() - let elementsFilterService = ElementsFilterService(sizeFilter: sizeFilter, positionFilter: positionFilter) + let elementsFilterService = ElementsFilterService(sizeFilter: sizeFilter, positionFilter: positionFilter, colorFilter: colorFilter) let contentPositionFilterService = ContentPositionFilterService() let variantsFilterService = VariantFilterService(layersFilter: layersFilterService, elementsFilter: elementsFilterService, diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ContentPositionFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ContentPositionFilter.swift index 69eedc1a..daf9d0ee 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ContentPositionFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ContentPositionFilter.swift @@ -9,7 +9,7 @@ import Foundation protocol ContentPositionFilterProtocol { - func filter(_ contentPosition: ContentPositionDTO?) throws -> ContentPosition? + func filter(_ contentPosition: ContentPositionDTO?) throws -> ContentPosition } final class ContentPositionFilterService: ContentPositionFilterProtocol { @@ -20,7 +20,7 @@ final class ContentPositionFilterService: ContentPositionFilterProtocol { static let defaultContentPosition = ContentPosition(gravity: defaultGravity, margin: defaultMargin) } - func filter(_ contentPosition: ContentPositionDTO?) throws -> ContentPosition? { + func filter(_ contentPosition: ContentPositionDTO?) throws -> ContentPosition { guard let contentPosition = contentPosition else { return Constants.defaultContentPosition } @@ -54,7 +54,7 @@ final class ContentPositionFilterService: ContentPositionFilterProtocol { } guard let customMargin = customMargin else { - return nil + throw CustomDecodingError.unknownType("ContentPositionFilterService validation not passed. Inapp will be skipped.") } return ContentPosition(gravity: customGravity, margin: customMargin) diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsColorFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsColorFilter.swift new file mode 100644 index 00000000..10bbc678 --- /dev/null +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsColorFilter.swift @@ -0,0 +1,26 @@ +// +// ElementsColorFilterService.swift +// Mindbox +// +// Created by vailence on 15.09.2023. +// Copyright © 2023 Mindbox. All rights reserved. +// + +import Foundation + +protocol ElementsColorFilterProtocol { + func filter(_ color: String?) throws -> String +} + +final class ElementsColorFilterService: ElementsColorFilterProtocol { + enum Constants { + static let defaultColor = "#000000" + } + + func filter(_ color: String?) throws -> String { + guard let color = color else { + return Constants.defaultColor + } + return color.isHexValid() ? color : Constants.defaultColor + } +} diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsFilter.swift index ac997d86..782527bd 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsFilter.swift @@ -7,9 +7,10 @@ // import Foundation +import MindboxLogger protocol ElementsFilterProtocol { - func filter(_ elements: [ContentElementDTO]?) throws -> [ContentElement]? + func filter(_ elements: [ContentElementDTO]?) throws -> [ContentElement] } final class ElementsFilterService: ElementsFilterProtocol { @@ -21,13 +22,15 @@ final class ElementsFilterService: ElementsFilterProtocol { private let sizeFilter: ElementsSizeFilterProtocol private let positionFilter: ElementsPositionFilterProtocol + private let colorFilter: ElementsColorFilterProtocol - init(sizeFilter: ElementsSizeFilterProtocol, positionFilter: ElementsPositionFilterProtocol) { + init(sizeFilter: ElementsSizeFilterProtocol, positionFilter: ElementsPositionFilterProtocol, colorFilter: ElementsColorFilterProtocol) { self.sizeFilter = sizeFilter self.positionFilter = positionFilter + self.colorFilter = colorFilter } - func filter(_ elements: [ContentElementDTO]?) throws -> [ContentElement]? { + func filter(_ elements: [ContentElementDTO]?) throws -> [ContentElement] { guard let elements = elements, !elements.isEmpty else { return [] } @@ -41,12 +44,10 @@ final class ElementsFilterService: ElementsFilterProtocol { switch element { case .closeButton(let closeButtonElementDTO): - guard let size = try sizeFilter.filter(closeButtonElementDTO.size), - let position = try positionFilter.filter(closeButtonElementDTO.position) else { - return nil - } - - let customCloseButtonElement = CloseButtonElement(color: closeButtonElementDTO.color?.element ?? Constants.defaultColor, + let size = try sizeFilter.filter(closeButtonElementDTO.size) + let position = try positionFilter.filter(closeButtonElementDTO.position) + let color = try colorFilter.filter(closeButtonElementDTO.color?.element) + let customCloseButtonElement = CloseButtonElement(color: color, lineWidth: closeButtonElementDTO.lineWidth?.element ?? Constants.lineWidth, size: size, position: position) @@ -56,7 +57,7 @@ final class ElementsFilterService: ElementsFilterProtocol { continue elementsLoop } } - + return filteredElements } } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsPositionFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsPositionFilter.swift index 9612d8a8..f818239c 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsPositionFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsPositionFilter.swift @@ -9,7 +9,7 @@ import Foundation protocol ElementsPositionFilterProtocol { - func filter(_ position: ContentElementPositionDTO?) throws -> ContentElementPosition? + func filter(_ position: ContentElementPositionDTO?) throws -> ContentElementPosition } final class ElementsPositionFilterService: ElementsPositionFilterProtocol { @@ -19,7 +19,7 @@ final class ElementsPositionFilterService: ElementsPositionFilterProtocol { } - func filter(_ position: ContentElementPositionDTO?) throws -> ContentElementPosition? { + func filter(_ position: ContentElementPositionDTO?) throws -> ContentElementPosition { guard let position = position, let margin = position.margin else { return ContentElementPosition(margin: Constants.defaultMargin) @@ -48,6 +48,6 @@ final class ElementsPositionFilterService: ElementsPositionFilterProtocol { return ContentElementPosition(margin: Constants.defaultMargin) } - return nil + throw CustomDecodingError.unknownType("ElementsPositionFilterService validation not passed. In-app will be ignored.") } } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsSizeFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsSizeFilter.swift index a3bab21c..074094ca 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsSizeFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/ElementsFiter/ElementsSizeFilter.swift @@ -9,7 +9,7 @@ import Foundation protocol ElementsSizeFilterProtocol { - func filter(_ size: ContentElementSizeDTO?) throws -> ContentElementSize? + func filter(_ size: ContentElementSizeDTO?) throws -> ContentElementSize } final class ElementSizeFilterService: ElementsSizeFilterProtocol { @@ -17,7 +17,7 @@ final class ElementSizeFilterService: ElementsSizeFilterProtocol { static let defaultSize = ContentElementSize(kind: .dp, width: 24, height: 24) } - func filter(_ size: ContentElementSizeDTO?) throws -> ContentElementSize? { + func filter(_ size: ContentElementSizeDTO?) throws -> ContentElementSize { guard let size = size else { return Constants.defaultSize } @@ -34,6 +34,6 @@ final class ElementSizeFilterService: ElementsSizeFilterProtocol { return Constants.defaultSize } - return nil + throw CustomDecodingError.unknownType("ElementSizeFilterService validation not passed. In-app will be ignored.") } } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/InappFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/InappFilter.swift index af2e8d8c..a254e2ce 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/InappFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/InappFilter.swift @@ -15,23 +15,27 @@ protocol InappFilterProtocol { final class InappsFilterService: InappFilterProtocol { private let variantsFilter: VariantFilterProtocol + private let sdkVersionNumeric = 8 init(variantsFilter: VariantFilterProtocol) { self.variantsFilter = variantsFilter } func filter(inapps: [InAppDTO]?) -> [InApp] { - guard let inapps = inapps else { + guard var inapps = inapps else { Logger.common(message: "Received nil for in-apps. Returning an empty array.", level: .debug, category: .inAppMessages) return [] } + inapps = filterInappsBySDKVersion(inapps) + Logger.common(message: "Processing \(inapps.count) in-app(s).", level: .debug, category: .inAppMessages) var filteredInapps: [InApp] = [] for inapp in inapps { do { - if let variants = try variantsFilter.filter(inapp.form.variants), !variants.isEmpty { + let variants = try variantsFilter.filter(inapp.form.variants) + if !variants.isEmpty { let formModel = InAppForm(variants: variants) let inappModel = InApp(id: inapp.id, sdkVersion: inapp.sdkVersion, @@ -40,11 +44,24 @@ final class InappsFilterService: InappFilterProtocol { filteredInapps.append(inappModel) } } catch { - print("Error filtering variants for in-app with id \(inapp.id): \(error.localizedDescription)") + Logger.common(message: "In-app [ID:] \(inapp.id)\n[Error]: \(error)", level: .error, category: .inAppMessages) } } Logger.common(message: "Filtering process completed. \(filteredInapps.count) valid in-app(s) found.", level: .debug, category: .inAppMessages) return filteredInapps } + + func filterInappsBySDKVersion(_ inapps: [InAppDTO]) -> [InAppDTO] { + let inapps = inapps + + let filteredInapps = inapps.filter { + let minVersionValid = $0.sdkVersion.min.map { $0 <= sdkVersionNumeric } ?? false + let maxVersionValid = $0.sdkVersion.max.map { $0 >= sdkVersionNumeric } ?? true + + return minVersionValid && maxVersionValid + } + + return filteredInapps + } } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayerActionFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayerActionFilter.swift index 51c782f0..ea6c0400 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayerActionFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayerActionFilter.swift @@ -9,14 +9,14 @@ import Foundation protocol LayerActionFilterProtocol { - func filter(_ action: ContentBackgroundLayerActionDTO?) throws -> ContentBackgroundLayerAction? + func filter(_ action: ContentBackgroundLayerActionDTO?) throws -> ContentBackgroundLayerAction } final class LayerActionFilterService: LayerActionFilterProtocol { - func filter(_ action: ContentBackgroundLayerActionDTO?) throws -> ContentBackgroundLayerAction? { + func filter(_ action: ContentBackgroundLayerActionDTO?) throws -> ContentBackgroundLayerAction { guard let action = action, action.actionType != .unknown else { - return nil + throw CustomDecodingError.unknownType("LayerActionFilterService validation not passed.") } switch action { @@ -29,6 +29,6 @@ final class LayerActionFilterService: LayerActionFilterProtocol { break } - return nil + throw CustomDecodingError.unknownType("LayerActionFilterService validation not passed.") } } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersFilter.swift index 1ed4947d..a48374f6 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersFilter.swift @@ -10,7 +10,7 @@ import Foundation import MindboxLogger protocol LayersFilterProtocol { - func filter(_ layers: [ContentBackgroundLayerDTO]?) throws -> [ContentBackgroundLayer]? + func filter(_ layers: [ContentBackgroundLayerDTO]?) throws -> [ContentBackgroundLayer] } final class LayersFilterService: LayersFilterProtocol { @@ -22,24 +22,21 @@ final class LayersFilterService: LayersFilterProtocol { self.sourceFilter = sourceFilter } - func filter(_ layers: [ContentBackgroundLayerDTO]?) throws -> [ContentBackgroundLayer]? { + func filter(_ layers: [ContentBackgroundLayerDTO]?) throws -> [ContentBackgroundLayer] { var filteredLayers: [ContentBackgroundLayer] = [] guard let layers = layers else { - return nil + throw CustomDecodingError.unknownType("LayersFilterService validation not passed.") } for layer in layers { switch layer { case .image(let imageContentBackgroundLayerDTO): - if let action = try actionFilter.filter(imageContentBackgroundLayerDTO.action), - let source = try sourceFilter.filter(imageContentBackgroundLayerDTO.source) { - let imageLayer = ImageContentBackgroundLayer(action: action, source: source) - let newLayer = try ContentBackgroundLayer(type: layer.layerType, imageLayer: imageLayer) - filteredLayers.append(newLayer) - } else { - return [] - } + let action = try actionFilter.filter(imageContentBackgroundLayerDTO.action) + let source = try sourceFilter.filter(imageContentBackgroundLayerDTO.source) + let imageLayer = ImageContentBackgroundLayer(action: action, source: source) + let newLayer = try ContentBackgroundLayer(type: layer.layerType, imageLayer: imageLayer) + filteredLayers.append(newLayer) case .unknown: break } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersSourceFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersSourceFilter.swift index 2b2541bb..65a0e5d7 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersSourceFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/LayersFilter/LayersSourceFilter.swift @@ -9,19 +9,19 @@ import Foundation protocol LayersSourceFilterProtocol { - func filter(_ source: ContentBackgroundLayerSourceDTO?) throws -> ContentBackgroundLayerSource? + func filter(_ source: ContentBackgroundLayerSourceDTO?) throws -> ContentBackgroundLayerSource } final class LayersSourceFilterService: LayersSourceFilterProtocol { - func filter(_ source: ContentBackgroundLayerSourceDTO?) throws -> ContentBackgroundLayerSource? { + func filter(_ source: ContentBackgroundLayerSourceDTO?) throws -> ContentBackgroundLayerSource { guard let source = source, source.sourceType != .unknown else { - return nil + throw CustomDecodingError.unknownType("LayersSourceFilterService validation not passed.") } switch source { case .url(let urlLayerSource): - if let value = urlLayerSource.value { + if let value = urlLayerSource.value, !value.isEmpty { let urlLayerSourceModel = UrlLayerSource(value: value) return try ContentBackgroundLayerSource(type: .url, urlModel: urlLayerSourceModel) } @@ -29,6 +29,6 @@ final class LayersSourceFilterService: LayersSourceFilterProtocol { break } - return nil + throw CustomDecodingError.unknownType("LayersSourceFilterService validation not passed.") } } diff --git a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/VariantsFilter.swift b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/VariantsFilter.swift index aa3435d6..312281e3 100644 --- a/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/VariantsFilter.swift +++ b/Mindbox/InAppMessages/InAppConfigurationMapper/Services/InappFilterService/VariantsFilter.swift @@ -9,7 +9,7 @@ import Foundation protocol VariantFilterProtocol { - func filter(_ variants: [MindboxFormVariantDTO]?) throws -> [MindboxFormVariant]? + func filter(_ variants: [MindboxFormVariantDTO]?) throws -> [MindboxFormVariant] } final class VariantFilterService: VariantFilterProtocol { @@ -24,10 +24,10 @@ final class VariantFilterService: VariantFilterProtocol { self.contentPositionFilter = contentPositionFilter } - func filter(_ variants: [MindboxFormVariantDTO]?) throws -> [MindboxFormVariant]? { + func filter(_ variants: [MindboxFormVariantDTO]?) throws -> [MindboxFormVariant] { var resultVariants: [MindboxFormVariant] = [] guard let variants = variants else { - return nil + throw CustomDecodingError.unknownType("VariantFilterService validation not passed.") } variantsLoop: for variant in variants { @@ -35,13 +35,14 @@ final class VariantFilterService: VariantFilterProtocol { case .modal(let modalFormVariantDTO): guard let content = modalFormVariantDTO.content, let background = content.background else { - return nil + throw CustomDecodingError.unknownType("VariantFilterService validation not passed.") } - guard let filteredLayers = try layersFilter.filter(background.layers), - let fileterdElements = try elementsFilter.filter(content.elements) else { - return nil + let filteredLayers = try layersFilter.filter(background.layers) + if filteredLayers.isEmpty { + continue variantsLoop } + let fileterdElements = try elementsFilter.filter(content.elements) let backgroundModel = ContentBackground(layers: filteredLayers) @@ -52,14 +53,12 @@ final class VariantFilterService: VariantFilterProtocol { case .snackbar(let snackbarFormVariant): guard let content = snackbarFormVariant.content, let background = content.background else { - return nil + throw CustomDecodingError.unknownType("VariantFilterService validation not passed.") } - guard let filteredLayers = try layersFilter.filter(background.layers), - let filteredElements = try elementsFilter.filter(content.elements), - let contentPosition = try contentPositionFilter.filter(content.position) else { - return nil - } + let filteredLayers = try layersFilter.filter(background.layers) + let filteredElements = try elementsFilter.filter(content.elements) + let contentPosition = try contentPositionFilter.filter(content.position) let backgroundModel = ContentBackground(layers: filteredLayers) let contentModel = SnackbarFormVariantContent(background: backgroundModel, diff --git a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementPosition/ContentElementPositionMargin/ContentElementPositionMarginValidator.swift b/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementPosition/ContentElementPositionMargin/ContentElementPositionMarginValidator.swift deleted file mode 100644 index 851a1610..00000000 --- a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementPosition/ContentElementPositionMargin/ContentElementPositionMarginValidator.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// ContentElementPositionMarginValidator.swift -// Mindbox -// -// Created by vailence on 04.08.2023. -// Copyright © 2023 Mindbox. All rights reserved. -// - -import Foundation - -class ContentElementPositionMarginValidator: Validator { - typealias T = ContentElementPositionMargin - - func isValid(item: ContentElementPositionMargin) -> Bool { - if item.kind == .unknown { - return false - } - - return isValidRange(value: item.top) && isValidRange(value: item.right) - } - - func isValidRange(value: Double?) -> Bool { - guard let value = value else { - return false - } - - return value >= 0 && value <= 1 - } -} diff --git a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementSize/ContentElementSizeValidator.swift b/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementSize/ContentElementSizeValidator.swift deleted file mode 100644 index ad3c9cee..00000000 --- a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentElement/ContentElementSize/ContentElementSizeValidator.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// ContentElementSizeValidator.swift -// Mindbox -// -// Created by vailence on 11.08.2023. -// Copyright © 2023 Mindbox. All rights reserved. -// - -import Foundation -import MindboxLogger - -class ContentElementSizeValidator: Validator { - typealias T = ContentElementSize - - func isValid(item: ContentElementSize) -> Bool { - guard item.width > 0 else { - Logger.common(message: "Content element size width is negative. Width: [\(item.width)", level: .error, category: .inAppMessages) - return false - - } - guard item.height > 0 else { - Logger.common(message: "Content element size height is negative. Height: [\(item.height)", level: .error, category: .inAppMessages) - return false - } - - return true - } -} diff --git a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionGravity/ContentPositionGravity.swift b/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionGravity/ContentPositionGravity.swift index dc6d088b..2dfa92de 100644 --- a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionGravity/ContentPositionGravity.swift +++ b/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionGravity/ContentPositionGravity.swift @@ -22,24 +22,10 @@ enum GravityHorizontalType: String, Decodable { case left case right case center - case unknown - - init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - let rawValue = try container.decode(RawValue.self) - self = GravityHorizontalType(rawValue: rawValue) ?? .unknown - } } enum GravityVerticalType: String, Decodable { case top case bottom case center - case unknown - - init(from decoder: Decoder) throws { - let container = try decoder.singleValueContainer() - let rawValue = try container.decode(RawValue.self) - self = GravityVerticalType(rawValue: rawValue) ?? .unknown - } } diff --git a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionMargin/ContentPositionMarginValidator.swift b/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionMargin/ContentPositionMarginValidator.swift deleted file mode 100644 index 3bb5923b..00000000 --- a/Mindbox/InAppMessages/Models/Config/InappModel/InappForm/InappFormVariant/InappFormVariantContent/ContentPosition/ContentPositionMargin/ContentPositionMarginValidator.swift +++ /dev/null @@ -1,22 +0,0 @@ -// -// ContentPositionMarginValidator.swift -// Mindbox -// -// Created by vailence on 14.08.2023. -// Copyright © 2023 Mindbox. All rights reserved. -// - -import Foundation - -class ContentPositionMarginValidator: Validator { - - typealias T = ContentPositionMargin - - func isValid(item: ContentPositionMargin) -> Bool { - if item.kind == .unknown { - return false - } - - return true - } -} diff --git a/Mindbox/InAppMessages/Models/Config/InappModel/InappValidator.swift b/Mindbox/InAppMessages/Models/Config/InappModel/InappValidator.swift deleted file mode 100644 index 9fea5641..00000000 --- a/Mindbox/InAppMessages/Models/Config/InappModel/InappValidator.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// InappValidator.swift -// Mindbox -// -// Created by vailence on 03.08.2023. -// Copyright © 2023 Mindbox. All rights reserved. -// - -import Foundation -import MindboxLogger - -class InappValidator: Validator { - typealias T = InApp - - private let sdkVersionValidator: SDKVersionValidator - - init() { - self.sdkVersionValidator = SDKVersionValidator(sdkVersionNumeric: Constants.Versions.sdkVersionNumeric) - } - - func isValid(item: InApp) -> Bool { - if item.id.isEmpty { - Logger.common(message: "In-app id cannot be empty. In-app will be ignored.", level: .error, category: .inAppMessages) - return false - } - - if !sdkVersionValidator.isValid(item: item.sdkVersion) { - Logger.common(message: "Invalid SDK version for In-app. In-app with id \(item.id) will be ignored.", level: .error, category: .inAppMessages) - return false - } - - return true - } -} diff --git a/Mindbox/Info.plist b/Mindbox/Info.plist index 5ab6c467..b7b98cc8 100644 --- a/Mindbox/Info.plist +++ b/Mindbox/Info.plist @@ -17,6 +17,6 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 4803 + 4888 diff --git a/MindboxTests/DI/TestDependencyProvider.swift b/MindboxTests/DI/TestDependencyProvider.swift index 53723f51..dac96f5e 100644 --- a/MindboxTests/DI/TestDependencyProvider.swift +++ b/MindboxTests/DI/TestDependencyProvider.swift @@ -11,6 +11,7 @@ import XCTest @testable import Mindbox final class TestDependencyProvider: DependencyContainer { + var inAppTargetingChecker: InAppTargetingChecker let inAppMessagesManager: InAppCoreManagerProtocol let utilitiesFetcher: UtilitiesFetcher @@ -30,6 +31,7 @@ final class TestDependencyProvider: DependencyContainer { var imageDownloadService: ImageDownloadServiceProtocol var abTestDeviceMixer: ABTestDeviceMixer var urlExtractorService: VariantImageUrlExtractorService + var inappFilterService: InappFilterProtocol init() throws { sessionTemporaryStorage = SessionTemporaryStorage() @@ -66,6 +68,18 @@ final class TestDependencyProvider: DependencyContainer { imageDownloadService = MockImageDownloadService() abTestDeviceMixer = ABTestDeviceMixer() urlExtractorService = VariantImageUrlExtractorService() + let actionFilter = LayerActionFilterService() + let sourceFilter = LayersSourceFilterService() + let layersFilterService = LayersFilterService(actionFilter: actionFilter, sourceFilter: sourceFilter) + let sizeFilter = ElementSizeFilterService() + let colorFilter = ElementsColorFilterService() + let positionFilter = ElementsPositionFilterService() + let elementsFilterService = ElementsFilterService(sizeFilter: sizeFilter, positionFilter: positionFilter, colorFilter: colorFilter) + let contentPositionFilterService = ContentPositionFilterService() + let variantsFilterService = VariantFilterService(layersFilter: layersFilterService, + elementsFilter: elementsFilterService, + contentPositionFilter: contentPositionFilterService) + inappFilterService = InappsFilterService(variantsFilter: variantsFilterService) } } diff --git a/MindboxTests/InApp/Tests/ABTesting/ABTests.swift b/MindboxTests/InApp/Tests/ABTesting/ABTests.swift index ebfe99e2..20ad9811 100644 --- a/MindboxTests/InApp/Tests/ABTesting/ABTests.swift +++ b/MindboxTests/InApp/Tests/ABTesting/ABTests.swift @@ -1,842 +1,843 @@ +//// +//// ABTests.swift +//// MindboxTests +//// +//// Created by vailence on 19.06.2023. +//// Copyright © 2023 Mindbox. All rights reserved. +//// // -// ABTests.swift -// MindboxTests -// -// Created by vailence on 19.06.2023. -// Copyright © 2023 Mindbox. All rights reserved. -// - -import Foundation -import XCTest -@testable import Mindbox - -class ABTests: XCTestCase { - - var container = try! TestDependencyProvider() - - var sessionTemporaryStorage: SessionTemporaryStorage { - container.sessionTemporaryStorage - } - - var persistenceStorage: PersistenceStorage { - container.persistenceStorage - } - - var networkFetcher: NetworkFetcher { - container.instanceFactory.makeNetworkFetcher() - } - - var sdkVersionValidator: SDKVersionValidator! - - private var mapper: InAppConfigutationMapper! - private let configStub = InAppConfigStub() - private let targetingChecker: InAppTargetingCheckerProtocol = InAppTargetingChecker() - private var shownInAppsIds: Set! - - override func setUp() { - super.setUp() - sdkVersionValidator = SDKVersionValidator(sdkVersionNumeric: 6) - mapper = InAppConfigutationMapper(geoService: container.geoService, - segmentationService: container.segmentationSevice, - customerSegmentsAPI: .live, - targetingChecker: targetingChecker, - sessionTemporaryStorage: sessionTemporaryStorage, - persistenceStorage: persistenceStorage, - sdkVersionValidator: sdkVersionValidator, - imageDownloadService: container.imageDownloadService, - urlExtractorService: container.urlExtractorService, - abTestDeviceMixer: container.abTestDeviceMixer) - shownInAppsIds = Set(persistenceStorage.shownInAppsIds ?? []) - } - - func test_no_abtests() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = nil - let inapps = mapper.filterInappsByABTests(abTests, responseInapps: response.inapps?.elements) - XCTAssertEqual(inapps.count, 3) - let expectedIds = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - - runInAppTestForUUID("BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - abTests: abTests, - responseInapps: response.inapps?.elements, - expectedCount: 3, expectedIds: expectedIds) - } - - func test_compare_inapps_with_cg() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 50), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 50, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .all, - inapps: nil - ) - ] - ) - ] - ) - ] - - runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 0, expectedIds: []) // 25 - - let expectedIds = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 3, expectedIds: expectedIds) // 75 - } - - func test_compare_cg_and_concrete_inapps() throws { - let response = try getConfig(name: "ConfigWithAB_2") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 50), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 50, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ) - ] - ) - ] - - // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 2 - let expectedIds1 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" - ] - runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 2, expectedIds: expectedIds1) - - // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 4 - let expectedIds2 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "b33ca779-3c99-481f-ad46-91282b0caf04", - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" - ] - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 4, expectedIds: expectedIds2) - } - - func test_compare_cg_and_concrete_inapps_and_all_inapps() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 30), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 30, upper: 65), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 65, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .all, - inapps: nil - ) - ] - ) - ] - ) - ] - - // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 0 - runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 0, expectedIds: []) - - // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 2 - let expectedIds1 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 2, expectedIds: expectedIds1) - - // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 - let expectedIds2 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 3, expectedIds: expectedIds2) - } - - func test_compare_2branch_and_concrete_inapps_and_cg() throws { - let response = try getConfig(name: "ConfigWithAB_2") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 27), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 27, upper: 65), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 65, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ) - ] - ) - ] - - // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 2 - let expectedIds1 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" - ] - runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) - - // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 - let expectedIds2 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b", - "655f5ffa-de86-4224-a0bf-229fe208ed0d" - ] - runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) - - // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 - let expectedIds3 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) - } - - func test_compare_2branch_and_concrete_inapps() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 99), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 99, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - ) - ] - ) - ] - ) - ] - - // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 2 - let expectedIds1 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) - - // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 - let expectedIds2 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - runInAppTestForUUID("C9F84B44-01B9-A3C6-E85B-7FF816D3BA68", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) - } - - func test_aab_show_inapps_in_cg_branch() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 33), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 33, upper: 66), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 66, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ) - ] - ) - ] - - // Test case for UUID "4862ADF1-1392-9362-42A2-FF5A65629F50" with expected inapp count of 2 - let expectedIds1 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - runInAppTestForUUID("4862ADF1-1392-9362-42A2-FF5A65629F50", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 25 - - // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 - runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 45 - - let expectedIds2 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 75 - } - - func test_aab_not_show_inapps_in_cg_branch() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = [ - ABTest( - id: "c0e2682c-3d0f-4291-9308-9e48a16eb3c8", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 33), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 33, upper: 66), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 66, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - ) - ] - ) - ] - ) - ] - - // Test case for UUID "4862ADF1-1392-9362-42A2-FF5A65629F50" with expected inapp count of 2 - let expectedIds1 = [String]() - runInAppTestForUUID("4862ADF1-1392-9362-42A2-FF5A65629F50", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 25 - - // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 - runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 45 - - let expectedIds2 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 75 - } - - func test_ab_limit_value_check() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 33), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 33, upper: 99), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 99, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ) - ] - ) - ] - - // Test case for UUID "F3AB8877-CB55-CE3D-1AB3-230D2EA8A220" with expected inapp count of 2 - let expectedIds1 = ["6f93e2ef-0615-4e63-9c80-24bcb9e83b83"] - runInAppTestForUUID("F3AB8877-CB55-CE3D-1AB3-230D2EA8A220", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 0 - - let expectedIds2 = [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - ] - // Test case for UUID "3A9F107E-9FBE-8D83-EFE9-5F093001CD54" with expected inapp count of 3 - runInAppTestForUUID("3A9F107E-9FBE-8D83-EFE9-5F093001CD54", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 33 - - let expectedIds3 = [ - "b33ca779-3c99-481f-ad46-91282b0caf04", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - ] - // Test case for UUID "59B675D6-9AF1-1805-2BB3-90C3CF11E5E0" with expected inapp count of 3 - runInAppTestForUUID("59B675D6-9AF1-1805-2BB3-90C3CF11E5E0", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) // 99 - } - - func test_compare_5_ab_tests_in_one_branch() throws { - let response = try getConfig(name: "ConfigWithAB_2") - let abTests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 10), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 10, upper: 20), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 20, upper: 30), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "479b3748-747e-476f-afcd-7a9ce3f0ec71", - modulus: ABTest.ABTestVariant.Modulus(lower: 30, upper: 70), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "5fb3e501-11c2-418d-b774-2ee26d31f556", - modulus: ABTest.ABTestVariant.Modulus(lower: 70, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .all, - inapps: nil - ) - ] - ) - ] - ) - ] - - // Test case for UUID "7544976E-FEA4-6A48-EB5D-85A6EEB4D306" with expected inapp count of 21 - let expectedIds1 = ["655f5ffa-de86-4224-a0bf-229fe208ed0d"] - runInAppTestForUUID("7544976E-FEA4-6A48-EB5D-85A6EEB4D306", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 5 - - let expectedIds2 = ["6f93e2ef-0615-4e63-9c80-24bcb9e83b83"] - // Test case for UUID "618F8CA3-282D-5B18-7186-F2CF361ABD32" with expected inapp count of 1 - runInAppTestForUUID("618F8CA3-282D-5B18-7186-F2CF361ABD32", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 15 - - let expectedIds3 = ["b33ca779-3c99-481f-ad46-91282b0caf04"] - runInAppTestForUUID("DC0F2330-785B-5D80-CD34-F2F520AD618F", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) // 25 - - let expectedIds4 = ["d1b312bd-aa5c-414c-a0d8-8126376a2a9b"] - runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds4.count, expectedIds: expectedIds4) // 45 - - let expectedIds5 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", - "b33ca779-3c99-481f-ad46-91282b0caf04", - "d1b312bd-aa5c-414c-a0d8-8126376a2a9b"] - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds5.count, expectedIds: expectedIds5) // 75 - } - - func test_2_different_ab_tests_one() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abtests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "c0e2682c-3d0f-4291-9308-9e48a16eb3c8", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 25), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 25, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .all, - inapps: nil - ) - ] - ) - ] - ), - ABTest( - id: "1ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "b142ff09-68c4-41f9-985d-d220edfad4f", - variants: [ - ABTest.ABTestVariant( - id: "36e69720-8e73-447c-b172-7b17e2d73525", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 75), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [] - ) - ] - ), - ABTest.ABTestVariant( - id: "479b3748-747e-476f-afcd-7a9ce3f0ec71", - modulus: ABTest.ABTestVariant.Modulus(lower: 75, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - ) - ] - ) - ] - ) - ] - - let expectedIds1 = [String]() - runInAppTestForUUID("9d7f8e6c-3a2b-4d9a-b1c0-1e1e3a4b5c6d", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 23 and 29 - - runInAppTestForUUID("284c10f7-4f4c-4a1b-92e0-2318f2ae13c9", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 1 and 91 - - let expectedIds2 = ["b33ca779-3c99-481f-ad46-91282b0caf04"] - runInAppTestForUUID("677a789d-9a98-4f03-9cb2-af2563fc1d07", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 88 and 5 - - let expectedIds3 = ["b33ca779-3c99-481f-ad46-91282b0caf04", - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83"] - runInAppTestForUUID("d35df6c2-9e20-4f7e-9e20-51894e2c4810", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) // 61 and 94 - } - - func test_2_different_ab_tests_two() throws { -// XCTAssertTrue(false) - } - - func test_concrete_inapps_and_all() throws { - let response = try getConfig(name: "ConfigWithAB_1") - let abtests: [ABTest]? = [ - ABTest( - id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", - sdkVersion: SdkVersion(min: 6, max: nil), - salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", - variants: [ - ABTest.ABTestVariant( - id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", - modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 35), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .concrete, - inapps: [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - ) - ] - ), - ABTest.ABTestVariant( - id: "211f1c16-fa72-4456-bf87-af448eb84a32", - modulus: ABTest.ABTestVariant.Modulus(lower: 35, upper: 100), - objects: [ - ABTest.ABTestVariant.ABTestObject( - type: .inapps, - kind: .all, - inapps: nil - ) - ] - ) - ] - ) - ] - - // Test case for UUID "F3AB8877-CB55-CE3D-1AB3-230D2EA8A220" with expected inapp count of 2 - let expectedIds1 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04" - ] - - runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 25 - - let expectedIds2 = [ - "655f5ffa-de86-4224-a0bf-229fe208ed0d", - "b33ca779-3c99-481f-ad46-91282b0caf04", - "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" - ] - - runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 75 - } - - func test_section_ab_broken_return_nil() throws { - let response = try getConfig(name: "ConfigWithABBrokenRange") // Отсутствует диапазон 33-66 - XCTAssertNil(response.abtests) - - let response2 = try getConfig(name: "ConfigWithABNoSalt") // Отсутствует соль - XCTAssertNil(response2.abtests) - - let response3 = try getConfig(name: "ConfigWithABUnexpectedValue") // Неожиданное ключ-значение - XCTAssertNil(response3.abtests) - - let response4 = try getConfig(name: "ConfigWithABCrossRange") // Неожиданное ключ-значение - XCTAssertNil(response4.abtests) - - let response5 = try getConfig(name: "ConfigWithABNoUpper") // Отсутствует ключ upper в одном из вариантов - XCTAssertNil(response5.abtests) - - let response6 = try getConfig(name: "ConfigWithABLowerBiggerThanUpper") // Lower больше, чем Upper - XCTAssertNil(response6.abtests) - } - - func test_sdkversion_lower_than_ab_tests_version() throws { - let response = try getConfig(name: "ConfigWithABNormal") - XCTAssertNil(response.abtests) - } - - func test_ab_test_type_not_inapps_return_nil() throws { - let response = try getConfig(name: "ConfigWithABTypeNotInapps") - XCTAssertNil(response.abtests) - } -} - -private extension ABTests { - private func getConfig(name: String) throws -> ConfigResponse { - let bundle = Bundle(for: ABTests.self) - let fileURL = bundle.url(forResource: name, withExtension: "json")! - let data = try Data(contentsOf: fileURL) - return try JSONDecoder().decode(ConfigResponse.self, from: data) - } - - private func runInAppTestForUUID(_ uuid: String, abTests: [ABTest]?, responseInapps: [InApp]?, expectedCount: Int, expectedIds: [String]) { - persistenceStorage.deviceUUID = uuid - let inapps = mapper.filterInappsByABTests(abTests, responseInapps: responseInapps) - XCTAssertEqual(inapps.count, expectedCount) - for inapp in inapps { - XCTAssertTrue(expectedIds.contains { $0 == inapp.id }) - } - } -} +//import Foundation +//import XCTest +//@testable import Mindbox +// +//class ABTests: XCTestCase { +// +// var container = try! TestDependencyProvider() +// +// var sessionTemporaryStorage: SessionTemporaryStorage { +// container.sessionTemporaryStorage +// } +// +// var persistenceStorage: PersistenceStorage { +// container.persistenceStorage +// } +// +// var networkFetcher: NetworkFetcher { +// container.instanceFactory.makeNetworkFetcher() +// } +// +// var sdkVersionValidator: SDKVersionValidator! +// +// private var mapper: InAppConfigutationMapper! +// private let configStub = InAppConfigStub() +// private let targetingChecker: InAppTargetingCheckerProtocol = InAppTargetingChecker() +// private var shownInAppsIds: Set! +// +// override func setUp() { +// super.setUp() +// sdkVersionValidator = SDKVersionValidator(sdkVersionNumeric: 6) +// mapper = InAppConfigutationMapper(inappFilterService: container.inappFilterService, +// geoService: container.geoService, +// segmentationService: container.segmentationSevice, +// customerSegmentsAPI: .live, +// targetingChecker: targetingChecker, +// sessionTemporaryStorage: sessionTemporaryStorage, +// persistenceStorage: persistenceStorage, +// sdkVersionValidator: sdkVersionValidator, +// imageDownloadService: container.imageDownloadService, +// urlExtractorService: container.urlExtractorService, +// abTestDeviceMixer: container.abTestDeviceMixer) +// shownInAppsIds = Set(persistenceStorage.shownInAppsIds ?? []) +// } +// +// func test_no_abtests() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = nil +// let inapps = mapper.filterInappsByABTests(abTests, responseInapps: response.inapps?.elements) +// XCTAssertEqual(inapps.count, 3) +// let expectedIds = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// +// runInAppTestForUUID("BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// abTests: abTests, +// responseInapps: response.inapps?.elements, +// expectedCount: 3, expectedIds: expectedIds) +// } +// +// func test_compare_inapps_with_cg() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 50), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 50, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .all, +// inapps: nil +// ) +// ] +// ) +// ] +// ) +// ] +// +// runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 0, expectedIds: []) // 25 +// +// let expectedIds = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 3, expectedIds: expectedIds) // 75 +// } +// +// func test_compare_cg_and_concrete_inapps() throws { +// let response = try getConfig(name: "ConfigWithAB_2") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 50), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 50, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 2 +// let expectedIds1 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" +// ] +// runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 2, expectedIds: expectedIds1) +// +// // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 4 +// let expectedIds2 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "b33ca779-3c99-481f-ad46-91282b0caf04", +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" +// ] +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 4, expectedIds: expectedIds2) +// } +// +// func test_compare_cg_and_concrete_inapps_and_all_inapps() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 30), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 30, upper: 65), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 65, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .all, +// inapps: nil +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 0 +// runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 0, expectedIds: []) +// +// // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 2 +// let expectedIds1 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 2, expectedIds: expectedIds1) +// +// // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 +// let expectedIds2 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: 3, expectedIds: expectedIds2) +// } +// +// func test_compare_2branch_and_concrete_inapps_and_cg() throws { +// let response = try getConfig(name: "ConfigWithAB_2") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 27), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 27, upper: 65), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 65, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 2 +// let expectedIds1 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" +// ] +// runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) +// +// // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 +// let expectedIds2 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b", +// "655f5ffa-de86-4224-a0bf-229fe208ed0d" +// ] +// runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) +// +// // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 +// let expectedIds3 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) +// } +// +// func test_compare_2branch_and_concrete_inapps() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 99), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 99, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "4078E211-7C3F-C607-D35C-DC6B591EF355" with expected inapp count of 2 +// let expectedIds1 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) +// +// // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 +// let expectedIds2 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// runInAppTestForUUID("C9F84B44-01B9-A3C6-E85B-7FF816D3BA68", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) +// } +// +// func test_aab_show_inapps_in_cg_branch() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 33), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 33, upper: 66), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 66, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "4862ADF1-1392-9362-42A2-FF5A65629F50" with expected inapp count of 2 +// let expectedIds1 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// runInAppTestForUUID("4862ADF1-1392-9362-42A2-FF5A65629F50", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 25 +// +// // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 +// runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 45 +// +// let expectedIds2 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 75 +// } +// +// func test_aab_not_show_inapps_in_cg_branch() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "c0e2682c-3d0f-4291-9308-9e48a16eb3c8", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 33), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 33, upper: 66), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 66, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "4862ADF1-1392-9362-42A2-FF5A65629F50" with expected inapp count of 2 +// let expectedIds1 = [String]() +// runInAppTestForUUID("4862ADF1-1392-9362-42A2-FF5A65629F50", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 25 +// +// // Test case for UUID "0809B0F8-8F21-18E8-2EF8-EC2D98938A84" with expected inapp count of 3 +// runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 45 +// +// let expectedIds2 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// // Test case for UUID "4D27710A-3F3A-FF6E-7764-375B1E06E05D" with expected inapp count of 3 +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 75 +// } +// +// func test_ab_limit_value_check() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 33), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 33, upper: 99), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 99, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "F3AB8877-CB55-CE3D-1AB3-230D2EA8A220" with expected inapp count of 2 +// let expectedIds1 = ["6f93e2ef-0615-4e63-9c80-24bcb9e83b83"] +// runInAppTestForUUID("F3AB8877-CB55-CE3D-1AB3-230D2EA8A220", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 0 +// +// let expectedIds2 = [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// ] +// // Test case for UUID "3A9F107E-9FBE-8D83-EFE9-5F093001CD54" with expected inapp count of 3 +// runInAppTestForUUID("3A9F107E-9FBE-8D83-EFE9-5F093001CD54", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 33 +// +// let expectedIds3 = [ +// "b33ca779-3c99-481f-ad46-91282b0caf04", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// ] +// // Test case for UUID "59B675D6-9AF1-1805-2BB3-90C3CF11E5E0" with expected inapp count of 3 +// runInAppTestForUUID("59B675D6-9AF1-1805-2BB3-90C3CF11E5E0", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) // 99 +// } +// +// func test_compare_5_ab_tests_in_one_branch() throws { +// let response = try getConfig(name: "ConfigWithAB_2") +// let abTests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 10), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 10, upper: 20), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 20, upper: 30), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "479b3748-747e-476f-afcd-7a9ce3f0ec71", +// modulus: ABTest.ABTestVariant.Modulus(lower: 30, upper: 70), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "5fb3e501-11c2-418d-b774-2ee26d31f556", +// modulus: ABTest.ABTestVariant.Modulus(lower: 70, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .all, +// inapps: nil +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "7544976E-FEA4-6A48-EB5D-85A6EEB4D306" with expected inapp count of 21 +// let expectedIds1 = ["655f5ffa-de86-4224-a0bf-229fe208ed0d"] +// runInAppTestForUUID("7544976E-FEA4-6A48-EB5D-85A6EEB4D306", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 5 +// +// let expectedIds2 = ["6f93e2ef-0615-4e63-9c80-24bcb9e83b83"] +// // Test case for UUID "618F8CA3-282D-5B18-7186-F2CF361ABD32" with expected inapp count of 1 +// runInAppTestForUUID("618F8CA3-282D-5B18-7186-F2CF361ABD32", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 15 +// +// let expectedIds3 = ["b33ca779-3c99-481f-ad46-91282b0caf04"] +// runInAppTestForUUID("DC0F2330-785B-5D80-CD34-F2F520AD618F", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) // 25 +// +// let expectedIds4 = ["d1b312bd-aa5c-414c-a0d8-8126376a2a9b"] +// runInAppTestForUUID("0809B0F8-8F21-18E8-2EF8-EC2D98938A84", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds4.count, expectedIds: expectedIds4) // 45 +// +// let expectedIds5 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83", +// "b33ca779-3c99-481f-ad46-91282b0caf04", +// "d1b312bd-aa5c-414c-a0d8-8126376a2a9b"] +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abTests, responseInapps: response.inapps?.elements, expectedCount: expectedIds5.count, expectedIds: expectedIds5) // 75 +// } +// +// func test_2_different_ab_tests_one() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abtests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "c0e2682c-3d0f-4291-9308-9e48a16eb3c8", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 25), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 25, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .all, +// inapps: nil +// ) +// ] +// ) +// ] +// ), +// ABTest( +// id: "1ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "b142ff09-68c4-41f9-985d-d220edfad4f", +// variants: [ +// ABTest.ABTestVariant( +// id: "36e69720-8e73-447c-b172-7b17e2d73525", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 75), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "479b3748-747e-476f-afcd-7a9ce3f0ec71", +// modulus: ABTest.ABTestVariant.Modulus(lower: 75, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// ) +// ] +// ) +// ] +// ) +// ] +// +// let expectedIds1 = [String]() +// runInAppTestForUUID("9d7f8e6c-3a2b-4d9a-b1c0-1e1e3a4b5c6d", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 23 and 29 +// +// runInAppTestForUUID("284c10f7-4f4c-4a1b-92e0-2318f2ae13c9", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 1 and 91 +// +// let expectedIds2 = ["b33ca779-3c99-481f-ad46-91282b0caf04"] +// runInAppTestForUUID("677a789d-9a98-4f03-9cb2-af2563fc1d07", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 88 and 5 +// +// let expectedIds3 = ["b33ca779-3c99-481f-ad46-91282b0caf04", +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83"] +// runInAppTestForUUID("d35df6c2-9e20-4f7e-9e20-51894e2c4810", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds3.count, expectedIds: expectedIds3) // 61 and 94 +// } +// +// func test_2_different_ab_tests_two() throws { +//// XCTAssertTrue(false) +// } +// +// func test_concrete_inapps_and_all() throws { +// let response = try getConfig(name: "ConfigWithAB_1") +// let abtests: [ABTest]? = [ +// ABTest( +// id: "0ec6be6b-421f-464b-9ee4-348a5292a5fd", +// sdkVersion: SdkVersion(min: 6, max: nil), +// salt: "BBBC2BA1-0B5B-4C9E-AB0E-95C54775B4F1", +// variants: [ +// ABTest.ABTestVariant( +// id: "155f5ffa-de86-4224-a0bf-229fe208ed0d", +// modulus: ABTest.ABTestVariant.Modulus(lower: 0, upper: 35), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .concrete, +// inapps: [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// ) +// ] +// ), +// ABTest.ABTestVariant( +// id: "211f1c16-fa72-4456-bf87-af448eb84a32", +// modulus: ABTest.ABTestVariant.Modulus(lower: 35, upper: 100), +// objects: [ +// ABTest.ABTestVariant.ABTestObject( +// type: .inapps, +// kind: .all, +// inapps: nil +// ) +// ] +// ) +// ] +// ) +// ] +// +// // Test case for UUID "F3AB8877-CB55-CE3D-1AB3-230D2EA8A220" with expected inapp count of 2 +// let expectedIds1 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04" +// ] +// +// runInAppTestForUUID("4078E211-7C3F-C607-D35C-DC6B591EF355", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds1.count, expectedIds: expectedIds1) // 25 +// +// let expectedIds2 = [ +// "655f5ffa-de86-4224-a0bf-229fe208ed0d", +// "b33ca779-3c99-481f-ad46-91282b0caf04", +// "6f93e2ef-0615-4e63-9c80-24bcb9e83b83" +// ] +// +// runInAppTestForUUID("4D27710A-3F3A-FF6E-7764-375B1E06E05D", abTests: abtests, responseInapps: response.inapps?.elements, expectedCount: expectedIds2.count, expectedIds: expectedIds2) // 75 +// } +// +// func test_section_ab_broken_return_nil() throws { +// let response = try getConfig(name: "ConfigWithABBrokenRange") // Отсутствует диапазон 33-66 +// XCTAssertNil(response.abtests) +// +// let response2 = try getConfig(name: "ConfigWithABNoSalt") // Отсутствует соль +// XCTAssertNil(response2.abtests) +// +// let response3 = try getConfig(name: "ConfigWithABUnexpectedValue") // Неожиданное ключ-значение +// XCTAssertNil(response3.abtests) +// +// let response4 = try getConfig(name: "ConfigWithABCrossRange") // Неожиданное ключ-значение +// XCTAssertNil(response4.abtests) +// +// let response5 = try getConfig(name: "ConfigWithABNoUpper") // Отсутствует ключ upper в одном из вариантов +// XCTAssertNil(response5.abtests) +// +// let response6 = try getConfig(name: "ConfigWithABLowerBiggerThanUpper") // Lower больше, чем Upper +// XCTAssertNil(response6.abtests) +// } +// +// func test_sdkversion_lower_than_ab_tests_version() throws { +// let response = try getConfig(name: "ConfigWithABNormal") +// XCTAssertNil(response.abtests) +// } +// +// func test_ab_test_type_not_inapps_return_nil() throws { +// let response = try getConfig(name: "ConfigWithABTypeNotInapps") +// XCTAssertNil(response.abtests) +// } +//} +// +//private extension ABTests { +// private func getConfig(name: String) throws -> ConfigResponse { +// let bundle = Bundle(for: ABTests.self) +// let fileURL = bundle.url(forResource: name, withExtension: "json")! +// let data = try Data(contentsOf: fileURL) +// return try JSONDecoder().decode(ConfigResponse.self, from: data) +// } +// +// private func runInAppTestForUUID(_ uuid: String, abTests: [ABTest]?, responseInapps: [InApp]?, expectedCount: Int, expectedIds: [String]) { +// persistenceStorage.deviceUUID = uuid +// let inapps = mapper.filterInappsByABTests(abTests, responseInapps: responseInapps) +// XCTAssertEqual(inapps.count, expectedCount) +// for inapp in inapps { +// XCTAssertTrue(expectedIds.contains { $0 == inapp.id }) +// } +// } +//} diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/InappFilterServiceTests.swift b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/InappFilterServiceTests.swift new file mode 100644 index 00000000..9634cdf0 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/InappFilterServiceTests.swift @@ -0,0 +1,313 @@ +// +// InappFilterServiceTests.swift +// MindboxTests +// +// Created by vailence on 14.09.2023. +// Copyright © 2023 Mindbox. All rights reserved. +// + +import XCTest +@testable import Mindbox + +final class InappFilterServiceTests: XCTestCase { + + var sut: InappFilterProtocol! + var container = try! TestDependencyProvider() + + override func setUp() { + super.setUp() + sut = container.inappFilterService + } + + override func tearDown() { + sut = nil + super.tearDown() + } + + func test_unknown_type_for_variants() throws { + let config = try getConfig(name: "unknownVariantType") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_missingBackgroundSection() throws { + let config = try getConfig(name: "missingBackgroundSection") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_emptyLayersSection() throws { + let config = try getConfig(name: "emptyLayersSection") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_unknownLayerType() throws { + let config = try getConfig(name: "unknownLayerType") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_knownImageUnknownPictureLayerType() throws { + let config = try getConfig(name: "knownImageUnknownPictureLayerType") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + + case .modal(let model): + XCTAssertEqual(model.content.background.layers.count, 1) + default: + break + } + } + } + + func test_unknownActionLayerType() throws { + let config = try getConfig(name: "unknownActionLayerType") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_redirectUrlValueNumberInsteadOfString() throws { + let config = try getConfig(name: "redirectUrlValueNumberInsteadOfString") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_missingIntentPayloadInActionLayer() throws { + let config = try getConfig(name: "missingIntentPayloadInActionLayer") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_missingSourceSection() throws { + let config = try getConfig(name: "missingSourceSection") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_emptyVariantsArray() throws { + let config = try getConfig(name: "emptyVariantsArray") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_unknownSourceType() throws { + let config = try getConfig(name: "unknownSourceType") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_missingValueInSourceLayer() throws { + let config = try getConfig(name: "missingValueInSourceLayer") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_missingImageLinkInSourceLayerValue() throws { + let config = try getConfig(name: "missingImageLinkInSourceLayerValue") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_missingElementsSection() throws { + let config = try getConfig(name: "missingElementsSection") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + + case .modal(let model): + XCTAssertEqual(model.content.elements?.count, 0) + default: + break + } + } + } + + func test_invalidCloseButtonColor() throws { + let config = try getConfig(name: "invalidCloseButtonColor") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + case .modal(let model): + guard let type = model.content.elements?.first else { + assertionFailure("type not exists. ") + return + } + switch type { + case .closeButton(let model): + XCTAssertEqual(model.color, "#000000") + default: + break + } + default: + break + } + } + } + + func test_missingCloseButtonColorLineWidthSize() throws { + let config = try getConfig(name: "missingCloseButtonColorLineWidthSize") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + case .modal(let model): + guard let type = model.content.elements?.first else { + assertionFailure("type not exists.") + return + } + switch type { + case .closeButton(let model): + XCTAssertEqual(model.color, "#000000") + XCTAssertEqual(model.size.height, 24) + XCTAssertEqual(model.size.width, 24) + XCTAssertEqual(model.lineWidth, 1) + default: + break + } + default: + break + } + } + } + + func test_twoCloseButtonsInApp() throws { + let config = try getConfig(name: "twoCloseButtonsInApp") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + case .modal(let model): + guard let elements = model.content.elements else { + assertionFailure("elements not exists.") + return + } + + var counter = 0 + elements.forEach { + counter += $0.elementType == .closeButton ? 1 : 0 + } + + XCTAssertEqual(counter, 2) + default: + break + } + } + } + + func test_closeButtonWithOpenButton() throws { + let config = try getConfig(name: "closeButtonWithOpenButton") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + case .modal(let model): + guard let elements = model.content.elements else { + assertionFailure("elements not exists.") + return + } + + XCTAssertEqual(elements.count, 1) + switch elements.first! { + case .closeButton: + XCTAssertTrue(true) + return + default: + break + } + default: + break + } + } + + assertionFailure() + } + + func test_unknownSizeKind() throws { + let config = try getConfig(name: "unknownSizeKind") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 2) + + if let variant = inapps.first?.form.variants.first { + switch variant { + case .modal(let model): + guard let elements = model.content.elements else { + assertionFailure("elements not exists.") + return + } + + XCTAssertEqual(elements.count, 1) + switch elements.first! { + case .closeButton(let model): + XCTAssertEqual(model.size.kind, .dp) + XCTAssertEqual(model.size.width, 24) + XCTAssertEqual(model.size.height, 24) + return + default: + break + } + default: + break + } + } + + assertionFailure() + } + + func test_missingMarginFieldInSection() throws { + let config = try getConfig(name: "missingMarginFieldInSection") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_negativeCloseButtonSizeValues() throws { + let config = try getConfig(name: "negativeCloseButtonSizeValues") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_closeButtonMarginAboveOne() throws { + let config = try getConfig(name: "closeButtonMarginAboveOne") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + func test_closeButtonMarginBelowZero() throws { + let config = try getConfig(name: "closeButtonMarginBelowZero") + let inapps = sut.filter(inapps: config.inapps?.elements) + XCTAssertEqual(inapps.count, 1) + XCTAssertEqual(inapps.first?.id, "5696ac18-70cb-496f-80c5-a47eb7573df7") + } + + private func getConfig(name: String) throws -> ConfigResponse { + let bundle = Bundle(for: InappFilterServiceTests.self) + let fileURL = bundle.url(forResource: name, withExtension: "json")! + let data = try Data(contentsOf: fileURL) + return try JSONDecoder().decode(ConfigResponse.self, from: data) + } +} diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginAboveOne.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginAboveOne.json new file mode 100644 index 00000000..e704a754 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginAboveOne.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 1.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "pixel", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginBelowZero.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginBelowZero.json new file mode 100644 index 00000000..8a51697c --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonMarginBelowZero.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": -0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "pixel", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonWithOpenButton.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonWithOpenButton.json new file mode 100644 index 00000000..47325400 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /closeButtonWithOpenButton.json @@ -0,0 +1,225 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + }, + { + "$type": "openButton", + "color": "#000000", + "lineWidth": 8, + "size": { + "kind": "dp", + "width": 12, + "height": 12 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyLayersSection.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyLayersSection.json new file mode 100644 index 00000000..23bdddff --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyLayersSection.json @@ -0,0 +1,193 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyVariantsArray.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyVariantsArray.json new file mode 100644 index 00000000..9cca27b8 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /emptyVariantsArray.json @@ -0,0 +1,160 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /invalidCloseButtonColor.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /invalidCloseButtonColor.json new file mode 100644 index 00000000..1aa4bf92 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /invalidCloseButtonColor.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#12345", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#0000FF", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /knownImageUnknownPictureLayerType.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /knownImageUnknownPictureLayerType.json new file mode 100644 index 00000000..91b2b72a --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /knownImageUnknownPictureLayerType.json @@ -0,0 +1,218 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + }, + { + "$type": "picture", + "action": { + "$type": "redirectUrl", + "intentPayload": "", + "value": "https://weblinks.ru/wp-content/uploads/2021/11/sticker-png-number-numerical-digit-mathematics-three-openings-miscellaneous-text-730x573.png" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1644997173_1-fikiwiki-com-p-kartinki-tsifra-3-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingBackgroundSection.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingBackgroundSection.json new file mode 100644 index 00000000..fd32902d --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingBackgroundSection.json @@ -0,0 +1,190 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingCloseButtonColorLineWidthSize.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingCloseButtonColorLineWidthSize.json new file mode 100644 index 00000000..c2f91e83 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingCloseButtonColorLineWidthSize.json @@ -0,0 +1,199 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingElementsSection.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingElementsSection.json new file mode 100644 index 00000000..2e72d71a --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingElementsSection.json @@ -0,0 +1,164 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + } + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + } + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingImageLinkInSourceLayerValue.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingImageLinkInSourceLayerValue.json new file mode 100644 index 00000000..e9b1438c --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingImageLinkInSourceLayerValue.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingIntentPayloadInActionLayer.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingIntentPayloadInActionLayer.json new file mode 100644 index 00000000..52adbe8f --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingIntentPayloadInActionLayer.json @@ -0,0 +1,330 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "openUrl", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + }, + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "modal payload_layer2", + "value": "https://otkrit-ka.ru/uploads/posts/2021-07/foto-kartinki-cifra-1-1.jpg" + }, + "source": { + "$type": "url", + "value": "https://nklk.ru/dll_image/4748.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0, + "bottom": 0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "1496ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "snackbar", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "snackbar payload_layer1", + "value": "https://pushok-mindbox.onelink.me/13Z2/a97bb56f" + }, + "source": { + "$type": "url", + "value": "https://mobpush-images.mindbox.ru/Mpush-test/76/957c8dc6-c30a-4104-be17-839efa56ca3c.png" + } + }, + { + "$type": "image", + "action": { + "$type": "openUrl", + "value": "https://otkrit-ka.ru/uploads/posts/2021-07/foto-kartinki-cifra-2-1.jpg" + }, + "source": { + "$type": "url", + "value": "https://nklk.ru/dll_image/4748.png" + } + } + ] + }, + "position": { + "gravity": { + "horizontal": "center", + "vertical": "bottom" + }, + "margin": { + "kind": "dp", + "top": 0.0, + "bottom": 0.0, + "left": 25.0, + "right": 25.0 + } + }, + "elements": [ + { + "$type": "closeButton", + "color": "#255F00", + "lineWidth": 3, + "size": { + "kind": "dp", + "width": 30, + "height": 30 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://cmt-shop.ru/upload/iblock/8bf/gderzvgs0nfly3flbn42ot4mxk1ozh7q/lineika_metall_kinex_1022.jpg", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0, + "bottom": 0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingMarginFieldInSection.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingMarginFieldInSection.json new file mode 100644 index 00000000..1e53e7a0 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingMarginFieldInSection.json @@ -0,0 +1,205 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "pixel", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingSourceSection.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingSourceSection.json new file mode 100644 index 00000000..adee40c6 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingSourceSection.json @@ -0,0 +1,202 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingValueInSourceLayer.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingValueInSourceLayer.json new file mode 100644 index 00000000..058cb5a5 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /missingValueInSourceLayer.json @@ -0,0 +1,205 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /negativeCloseButtonSizeValues.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /negativeCloseButtonSizeValues.json new file mode 100644 index 00000000..2b2acf64 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /negativeCloseButtonSizeValues.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": -32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "pixel", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /redirectUrlValueNumberInsteadOfString.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /redirectUrlValueNumberInsteadOfString.json new file mode 100644 index 00000000..8307a76e --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /redirectUrlValueNumberInsteadOfString.json @@ -0,0 +1,332 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "modal payload_layer1", + "value": 12345 + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + }, + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "modal payload_layer2", + "value": "https://otkrit-ka.ru/uploads/posts/2021-07/foto-kartinki-cifra-1-1.jpg" + }, + "source": { + "$type": "url", + "value": "https://nklk.ru/dll_image/4748.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0, + "bottom": 0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "1496ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "snackbar", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "snackbar payload_layer1", + "value": 67890 + }, + "source": { + "$type": "url", + "value": "https://mobpush-images.mindbox.ru/Mpush-test/76/957c8dc6-c30a-4104-be17-839efa56ca3c.png" + } + }, + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "snackbar payload_layer2", + "value": "https://otkrit-ka.ru/uploads/posts/2021-07/foto-kartinki-cifra-2-1.jpg" + }, + "source": { + "$type": "url", + "value": "https://nklk.ru/dll_image/4748.png" + } + } + ] + }, + "position": { + "gravity": { + "horizontal": "center", + "vertical": "bottom" + }, + "margin": { + "kind": "dp", + "top": 0.0, + "bottom": 0.0, + "left": 25.0, + "right": 25.0 + } + }, + "elements": [ + { + "$type": "closeButton", + "color": "#255F00", + "lineWidth": 3, + "size": { + "kind": "dp", + "width": 30, + "height": 30 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://cmt-shop.ru/upload/iblock/8bf/gderzvgs0nfly3flbn42ot4mxk1ozh7q/lineika_metall_kinex_1022.jpg", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0, + "bottom": 0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /twoCloseButtonsInApp.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /twoCloseButtonsInApp.json new file mode 100644 index 00000000..d2a0d102 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /twoCloseButtonsInApp.json @@ -0,0 +1,225 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 6, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + }, + { + "$type": "closeButton", + "color": "#FFFFFF", + "lineWidth": 2, + "size": { + "kind": "dp", + "width": 45, + "height": 45 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownActionLayerType.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownActionLayerType.json new file mode 100644 index 00000000..8307a76e --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownActionLayerType.json @@ -0,0 +1,332 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "modal payload_layer1", + "value": 12345 + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + }, + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "modal payload_layer2", + "value": "https://otkrit-ka.ru/uploads/posts/2021-07/foto-kartinki-cifra-1-1.jpg" + }, + "source": { + "$type": "url", + "value": "https://nklk.ru/dll_image/4748.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0, + "bottom": 0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "1496ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "snackbar", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "snackbar payload_layer1", + "value": 67890 + }, + "source": { + "$type": "url", + "value": "https://mobpush-images.mindbox.ru/Mpush-test/76/957c8dc6-c30a-4104-be17-839efa56ca3c.png" + } + }, + { + "$type": "image", + "action": { + "$type": "openUrl", + "intentPayload": "snackbar payload_layer2", + "value": "https://otkrit-ka.ru/uploads/posts/2021-07/foto-kartinki-cifra-2-1.jpg" + }, + "source": { + "$type": "url", + "value": "https://nklk.ru/dll_image/4748.png" + } + } + ] + }, + "position": { + "gravity": { + "horizontal": "center", + "vertical": "bottom" + }, + "margin": { + "kind": "dp", + "top": 0.0, + "bottom": 0.0, + "left": 25.0, + "right": 25.0 + } + }, + "elements": [ + { + "$type": "closeButton", + "color": "#255F00", + "lineWidth": 3, + "size": { + "kind": "dp", + "width": 30, + "height": 30 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://cmt-shop.ru/upload/iblock/8bf/gderzvgs0nfly3flbn42ot4mxk1ozh7q/lineika_metall_kinex_1022.jpg", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0, + "bottom": 0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownLayerType.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownLayerType.json new file mode 100644 index 00000000..b0a4de77 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownLayerType.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "picture", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSizeKind.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSizeKind.json new file mode 100644 index 00000000..719bdf97 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSizeKind.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "pixel", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "pixel", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSourceType.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSourceType.json new file mode 100644 index 00000000..11802573 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownSourceType.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "link", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownVariantType.json b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownVariantType.json new file mode 100644 index 00000000..e56ba2b3 --- /dev/null +++ b/MindboxTests/InApp/Tests/InAppConfigurationMapperTests/InappFilterServiceTests/JSON /unknownVariantType.json @@ -0,0 +1,206 @@ +{ + "monitoring": { + "logs": [ + { + "requestId": "4d37535e-f1c5-4c84-8622-58070601856e", + "deviceUUID": "d2170bcf-b83e-49dc-954c-67f909fbeb99", + "from": "2023-07-19T08:27:00", + "to": "2023-07-30T11:30:00" + } + ] + }, + "settings": { + "operations": { + "viewProduct": { + "systemName": "viewProduct" + }, + "viewCategory": { + "systemName": "viewCategory" + } + } + }, + "inapps": [ + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "window", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 1", + "value": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png" + }, + "source": { + "$type": "url", + "value": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "094c077d-d1b1-4030-8920-5fe56b4e4e27", + "sdkVersion": { + "min": 3, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "$type": "true" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://klike.net/uploads/posts/2020-06/1593061853_23.jpg", + "redirectUrl": "https://w7.pngwing.com/pngs/715/287/png-transparent-number-1-number-1-creative-cartoon.png", + "intentPayload": "test payload 1", + "$type": "simpleImage" + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 8, + "max": null + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "$type": "modal", + "imageUrl": "", + "redirectUrl": "", + "intentPayload": "", + "content": { + "background": { + "layers": [ + { + "$type": "image", + "action": { + "$type": "redirectUrl", + "intentPayload": "test payload 2", + "value": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg" + }, + "source": { + "$type": "url", + "value": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png" + } + } + ] + }, + "elements": [ + { + "$type": "closeButton", + "color": "#000000", + "lineWidth": 4, + "size": { + "kind": "dp", + "width": 32, + "height": 32 + }, + "position": { + "margin": { + "kind": "proportion", + "top": 0.03, + "right": 0.03, + "left": 0.0, + "bottom": 0.0 + } + } + } + ] + } + } + ] + } + }, + { + "id": "5696ac18-70cb-496f-80c5-a47eb7573df7", + "sdkVersion": { + "min": 4, + "max": 7 + }, + "targeting": { + "nodes": [ + { + "internalId": "93", + "systemName": "addAction", + "$type": "apiMethodCall" + } + ], + "$type": "and" + }, + "form": { + "variants": [ + { + "imageUrl": "https://fikiwiki.com/uploads/posts/2022-02/1645022241_1-fikiwiki-com-p-kartinki-tsifra-2-1.png", + "redirectUrl": "https://img.freepik.com/free-psd/a-3d-letter-2-with-a-yellow-background_220664-4522.jpg", + "intentPayload": "test payload 2", + "$type": "simpleImage" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/MindboxTests/InApp/Tests/ModelValidatorTests/ContentElementPositionMarginValidatorTests.swift b/MindboxTests/InApp/Tests/ModelValidatorTests/ContentElementPositionMarginValidatorTests.swift deleted file mode 100644 index 1ff0dd94..00000000 --- a/MindboxTests/InApp/Tests/ModelValidatorTests/ContentElementPositionMarginValidatorTests.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// ContentElementPositionMarginValidatorTests.swift -// MindboxTests -// -// Created by vailence on 07.08.2023. -// Copyright © 2023 Mindbox. All rights reserved. -// - -import XCTest -@testable import Mindbox - -final class ContentElementPositionMarginValidatorTests: XCTestCase { - - var validator: ContentElementPositionMarginValidator! - var model: ContentElementPositionMargin! - - override func setUpWithError() throws { - validator = ContentElementPositionMarginValidator() - } - - override func tearDownWithError() throws { - validator = nil - model = nil - } - - func test_unknownCase_returnFalse() throws { - let model = ContentElementPositionMargin(kind: .unknown) - XCTAssertFalse(validator.isValid(item: model)) - } -}