From b87050a16d83de4be8140a8f0b9266e65df3c7ac Mon Sep 17 00:00:00 2001 From: Valeriu Popa Date: Thu, 21 Dec 2023 16:33:09 +0200 Subject: [PATCH 1/6] privacy configuration --- .../project.pbxproj | 2 + .../Sources/PrivacyInfo.xcprivacy | 102 ++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 CriteoPublisherSdk/Sources/PrivacyInfo.xcprivacy diff --git a/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj b/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj index 5eb94c29..f0374aa5 100644 --- a/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj +++ b/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj @@ -746,6 +746,7 @@ A83BB59629BB1F77002A63B6 /* CRLogUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CRLogUtil.h; sourceTree = ""; }; A83BB59729BB1F77002A63B6 /* CRLogUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CRLogUtil.m; sourceTree = ""; }; A83BB59A29BF6B3F002A63B6 /* MRAIDURLHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRAIDURLHandler.swift; sourceTree = ""; }; + A863B2D02B345281006E6476 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; A879179229A7230F00A3B798 /* CRMRAIDHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CRMRAIDHandler.swift; sourceTree = ""; }; A879179529A771CF00A3B798 /* SwiftExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExtensions.swift; sourceTree = ""; }; A8ABDE442ACC31DA00E82CDE /* CR_SKAdNetworkHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CR_SKAdNetworkHandler.h; sourceTree = ""; }; @@ -1749,6 +1750,7 @@ E1F2736621B5F08D00A2FBFA /* Sources */ = { isa = PBXGroup; children = ( + A863B2D02B345281006E6476 /* PrivacyInfo.xcprivacy */, 46E3EE1B254867E900F01C88 /* Public */, 25BD5B5A2220D16D004DE311 /* Info.plist */, E1F2738A21BB12C300A2FBFA /* Criteo.m */, diff --git a/CriteoPublisherSdk/Sources/PrivacyInfo.xcprivacy b/CriteoPublisherSdk/Sources/PrivacyInfo.xcprivacy new file mode 100644 index 00000000..82762009 --- /dev/null +++ b/CriteoPublisherSdk/Sources/PrivacyInfo.xcprivacy @@ -0,0 +1,102 @@ + + + + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeEmailAddress + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeDeviceID + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeProductInteraction + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeAdvertisingData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeThirdPartyAdvertising + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypeCrashData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + NSPrivacyCollectedDataTypePurposeAnalytics + + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePerformanceData + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + NSPrivacyCollectedDataTypePurposeAnalytics + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryUserDefaults + NSPrivacyAccessedAPITypeReasons + + CA92.1 + + + + NSPrivacyTrackingDomains + + www.criteo.com + bidder.criteo.com + gum.criteo.com + + NSPrivacyTracking + + + From 8519a7306263538875ec035a16dc9b27b1c4d170 Mon Sep 17 00:00:00 2001 From: Valeriu Popa Date: Fri, 22 Dec 2023 10:42:47 +0200 Subject: [PATCH 2/6] fixed failing test --- .../UnitTests/Network/CR_BidRequestSerializerSwiftTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CriteoPublisherSdk/Tests/UnitTests/Network/CR_BidRequestSerializerSwiftTests.swift b/CriteoPublisherSdk/Tests/UnitTests/Network/CR_BidRequestSerializerSwiftTests.swift index dea1bee2..f400cf6e 100644 --- a/CriteoPublisherSdk/Tests/UnitTests/Network/CR_BidRequestSerializerSwiftTests.swift +++ b/CriteoPublisherSdk/Tests/UnitTests/Network/CR_BidRequestSerializerSwiftTests.swift @@ -99,7 +99,7 @@ class CR_BidRequestSerializerSwiftTests: XCTestCase { XCTAssertEqual(user?["ext"] as? NSDictionary, NSDictionary()) XCTAssertEqual( user?["skAdNetwork"] as? NSDictionary, - ["versions": ["2.0", "2.1", "2.2"], "skAdNetworkIds": ["hs6bdukanm.skadnetwork"]] as? NSDictionary) + ["versions": ["2.0", "2.1", "2.2", "3.0"], "skAdNetworkIds": ["hs6bdukanm.skadnetwork"]] as? NSDictionary) } func testBodyWithUsPrivacyConsentString() { From 2aa4c42b2b2f4515dd930f52e3d828f286b1a683 Mon Sep 17 00:00:00 2001 From: Valeriu Popa Date: Fri, 22 Dec 2023 11:59:45 +0200 Subject: [PATCH 3/6] split test suite in 3 plans and run them in different actions --- .github/workflows/test.yml | 150 +++++++++--- .../project.pbxproj | 16 +- .../xcschemes/CriteoPublisherSdk.xcscheme | 21 -- .../CriteoPublisherSdkMC0.xctestplan | 20 +- .../CriteoPublisherSdkMC1.xctestplan | 40 +--- .../CriteoPublisherSdkMC2.xctestplan | 51 +---- .../CriteoPublisherSdkMC3.xctestplan | 214 ----------------- .../CriteoPublisherSdkMC4.xctestplan | 214 ----------------- .../CriteoPublisherSdkMC5.xctestplan | 212 ----------------- .../CriteoPublisherSdkMC6.xctestplan | 214 ----------------- .../CriteoPublisherSdkMC7.xctestplan | 215 ------------------ .../CriteoPublisherSdkMC8.xctestplan | 213 ----------------- .../CriteoPublisherSdkMC9.xctestplan | 212 ----------------- fastlane/Fastfile | 47 ++++ fastlane/README.md | 15 ++ 15 files changed, 210 insertions(+), 1644 deletions(-) delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC3.xctestplan delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC4.xctestplan delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC5.xctestplan delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC6.xctestplan delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC7.xctestplan delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC8.xctestplan delete mode 100644 CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC9.xctestplan diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 432c5c40..4bc70967 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,65 +1,163 @@ name: Test on: - push: + push: branches: - - main - - feature/* - pull_request: - workflow_dispatch: + - main + - feature/* + pull_request: + workflow_dispatch: env: - DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer jobs: - test: + test_0: runs-on: macos-latest steps: - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - - name: Ruby & Bundle setup + - name: Ruby & Bundle setup uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 - bundler-cache: true + ruby-version: 2.6 + bundler-cache: true - - name: Cocoapods cache + - name: Cocoapods cache uses: actions/cache@v3 with: - path: Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: | + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | ${{ runner.os }}-pods- - - name: Cocoapods install + - name: Cocoapods install run: | bundle exec fastlane run cocoapods - - name: Setup Java 11 + - name: Setup Java 11 uses: actions/setup-java@v3 with: - distribution: 'temurin' - java-version: '11' + distribution: 'temurin' + java-version: '11' - - name: WireMock setup + - name: WireMock setup run: | curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s bundle exec iostrust add ./wiremock/cert/wiremock.crt java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & - - name: Format check + - name: Format check run: | bundle exec fastlane format_check - - name: Test + - name: Test run: | - bundle exec fastlane test + bundle exec fastlane test_0 - - name: Tests reports upload + - name: Tests reports upload uses: actions/upload-artifact@v3 if: failure() with: - name: tests-reports - path: "fastlane/test_output" + name: tests-reports + path: "fastlane/test_output" + + test_1: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Ruby & Bundle setup + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + + - name: Cocoapods cache + uses: actions/cache@v3 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Cocoapods install + run: | + bundle exec fastlane run cocoapods + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: WireMock setup + run: | + curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s + bundle exec iostrust add ./wiremock/cert/wiremock.crt + java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & + + - name: Test + run: | + bundle exec fastlane test_1 + + - name: Tests reports upload + uses: actions/upload-artifact@v3 + if: failure() + with: + name: tests-reports + path: "fastlane/test_output" + + test_2: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Ruby & Bundle setup + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + + - name: Cocoapods cache + uses: actions/cache@v3 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Cocoapods install + run: | + bundle exec fastlane run cocoapods + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: WireMock setup + run: | + curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s + bundle exec iostrust add ./wiremock/cert/wiremock.crt + java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & + + - name: Test + run: | + bundle exec fastlane test_2 + + - name: Tests reports upload + uses: actions/upload-artifact@v3 + if: failure() + with: + name: tests-reports + path: "fastlane/test_output" + + diff --git a/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj b/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj index f0374aa5..5f92dbec 100644 --- a/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj +++ b/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/project.pbxproj @@ -729,14 +729,7 @@ A82D7DF12A04FEAB001302A8 /* CRMRAIDUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CRMRAIDUtils.swift; sourceTree = ""; }; A82D7DF32A0A3ED4001302A8 /* MRAIDUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRAIDUtilsTests.swift; sourceTree = ""; }; A82D7E1D2A20B28E001302A8 /* CriteoPublisherSdkMC1.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC1.xctestplan; sourceTree = ""; }; - A82D7E1E2A20B28E001302A8 /* CriteoPublisherSdkMC9.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC9.xctestplan; sourceTree = ""; }; - A82D7E1F2A20B28E001302A8 /* CriteoPublisherSdkMC4.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC4.xctestplan; sourceTree = ""; }; - A82D7E202A20B28E001302A8 /* CriteoPublisherSdkMC3.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC3.xctestplan; sourceTree = ""; }; - A82D7E212A20B28E001302A8 /* CriteoPublisherSdkMC6.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC6.xctestplan; sourceTree = ""; }; - A82D7E222A20B28E001302A8 /* CriteoPublisherSdkMC8.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC8.xctestplan; sourceTree = ""; }; - A82D7E232A20B28E001302A8 /* CriteoPublisherSdkMC5.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC5.xctestplan; sourceTree = ""; }; A82D7E242A20B28E001302A8 /* CriteoPublisherSdkMC0.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC0.xctestplan; sourceTree = ""; }; - A82D7E252A20B28E001302A8 /* CriteoPublisherSdkMC7.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC7.xctestplan; sourceTree = ""; }; A82D7E262A20B28E001302A8 /* CriteoPublisherSdkMC2.xctestplan */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CriteoPublisherSdkMC2.xctestplan; sourceTree = ""; }; A83BB58929BAEB69002A63B6 /* ActionRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionRepresentable.swift; sourceTree = ""; }; A83BB58B29BAEBC9002A63B6 /* MRAIDLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRAIDLog.swift; sourceTree = ""; }; @@ -1576,15 +1569,8 @@ A82D7E1C2A20B28E001302A8 /* TestPlans */ = { isa = PBXGroup; children = ( - A82D7E1D2A20B28E001302A8 /* CriteoPublisherSdkMC1.xctestplan */, - A82D7E1E2A20B28E001302A8 /* CriteoPublisherSdkMC9.xctestplan */, - A82D7E1F2A20B28E001302A8 /* CriteoPublisherSdkMC4.xctestplan */, - A82D7E202A20B28E001302A8 /* CriteoPublisherSdkMC3.xctestplan */, - A82D7E212A20B28E001302A8 /* CriteoPublisherSdkMC6.xctestplan */, - A82D7E222A20B28E001302A8 /* CriteoPublisherSdkMC8.xctestplan */, - A82D7E232A20B28E001302A8 /* CriteoPublisherSdkMC5.xctestplan */, A82D7E242A20B28E001302A8 /* CriteoPublisherSdkMC0.xctestplan */, - A82D7E252A20B28E001302A8 /* CriteoPublisherSdkMC7.xctestplan */, + A82D7E1D2A20B28E001302A8 /* CriteoPublisherSdkMC1.xctestplan */, A82D7E262A20B28E001302A8 /* CriteoPublisherSdkMC2.xctestplan */, ); path = TestPlans; diff --git a/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/xcshareddata/xcschemes/CriteoPublisherSdk.xcscheme b/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/xcshareddata/xcschemes/CriteoPublisherSdk.xcscheme index 89b66d87..7b67f03b 100644 --- a/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/xcshareddata/xcschemes/CriteoPublisherSdk.xcscheme +++ b/CriteoPublisherSdk/CriteoPublisherSdk.xcodeproj/xcshareddata/xcschemes/CriteoPublisherSdk.xcscheme @@ -38,33 +38,12 @@ - - - - - - - - - - - - - - Date: Fri, 22 Dec 2023 12:06:16 +0200 Subject: [PATCH 4/6] added separate actions --- .github/workflows/test.yml | 163 ----------------------------------- .github/workflows/test_0.yml | 65 ++++++++++++++ .github/workflows/test_1.yml | 65 ++++++++++++++ .github/workflows/test_2.yml | 65 ++++++++++++++ 4 files changed, 195 insertions(+), 163 deletions(-) delete mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/test_0.yml create mode 100644 .github/workflows/test_1.yml create mode 100644 .github/workflows/test_2.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 4bc70967..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,163 +0,0 @@ -name: Test - -on: - push: - branches: - - main - - feature/* - pull_request: - workflow_dispatch: - -env: - DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer - -jobs: - test_0: - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Ruby & Bundle setup - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6 - bundler-cache: true - - - name: Cocoapods cache - uses: actions/cache@v3 - with: - path: Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-pods- - - - name: Cocoapods install - run: | - bundle exec fastlane run cocoapods - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '11' - - - name: WireMock setup - run: | - curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s - bundle exec iostrust add ./wiremock/cert/wiremock.crt - java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & - - - name: Format check - run: | - bundle exec fastlane format_check - - - name: Test - run: | - bundle exec fastlane test_0 - - - name: Tests reports upload - uses: actions/upload-artifact@v3 - if: failure() - with: - name: tests-reports - path: "fastlane/test_output" - - test_1: - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Ruby & Bundle setup - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6 - bundler-cache: true - - - name: Cocoapods cache - uses: actions/cache@v3 - with: - path: Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-pods- - - - name: Cocoapods install - run: | - bundle exec fastlane run cocoapods - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '11' - - - name: WireMock setup - run: | - curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s - bundle exec iostrust add ./wiremock/cert/wiremock.crt - java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & - - - name: Test - run: | - bundle exec fastlane test_1 - - - name: Tests reports upload - uses: actions/upload-artifact@v3 - if: failure() - with: - name: tests-reports - path: "fastlane/test_output" - - test_2: - runs-on: macos-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Ruby & Bundle setup - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.6 - bundler-cache: true - - - name: Cocoapods cache - uses: actions/cache@v3 - with: - path: Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-pods- - - - name: Cocoapods install - run: | - bundle exec fastlane run cocoapods - - - name: Setup Java 11 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '11' - - - name: WireMock setup - run: | - curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s - bundle exec iostrust add ./wiremock/cert/wiremock.crt - java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & - - - name: Test - run: | - bundle exec fastlane test_2 - - - name: Tests reports upload - uses: actions/upload-artifact@v3 - if: failure() - with: - name: tests-reports - path: "fastlane/test_output" - - diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml new file mode 100644 index 00000000..bc511fbd --- /dev/null +++ b/.github/workflows/test_0.yml @@ -0,0 +1,65 @@ +name: Test_0 + +on: + push: + branches: + - main + - feature/* + pull_request: + workflow_dispatch: + +env: + DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer + +jobs: + test: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Ruby & Bundle setup + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + + - name: Cocoapods cache + uses: actions/cache@v3 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Cocoapods install + run: | + bundle exec fastlane run cocoapods + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: WireMock setup + run: | + curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s + bundle exec iostrust add ./wiremock/cert/wiremock.crt + java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & + + - name: Format check + run: | + bundle exec fastlane format_check + + - name: Test + run: | + bundle exec fastlane test_0 + + - name: Tests reports upload + uses: actions/upload-artifact@v3 + if: failure() + with: + name: tests-reports + path: "fastlane/test_output" diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml new file mode 100644 index 00000000..ffd23bdf --- /dev/null +++ b/.github/workflows/test_1.yml @@ -0,0 +1,65 @@ +name: Test_1 + +on: + push: + branches: + - main + - feature/* + pull_request: + workflow_dispatch: + +env: + DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer + +jobs: + test: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Ruby & Bundle setup + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + + - name: Cocoapods cache + uses: actions/cache@v3 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Cocoapods install + run: | + bundle exec fastlane run cocoapods + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: WireMock setup + run: | + curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s + bundle exec iostrust add ./wiremock/cert/wiremock.crt + java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & + + - name: Format check + run: | + bundle exec fastlane format_check + + - name: Test + run: | + bundle exec fastlane test_1 + + - name: Tests reports upload + uses: actions/upload-artifact@v3 + if: failure() + with: + name: tests-reports + path: "fastlane/test_output" diff --git a/.github/workflows/test_2.yml b/.github/workflows/test_2.yml new file mode 100644 index 00000000..6d299d8a --- /dev/null +++ b/.github/workflows/test_2.yml @@ -0,0 +1,65 @@ +name: Test_2 + +on: + push: + branches: + - main + - feature/* + pull_request: + workflow_dispatch: + +env: + DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer + +jobs: + test: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Ruby & Bundle setup + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 + bundler-cache: true + + - name: Cocoapods cache + uses: actions/cache@v3 + with: + path: Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Cocoapods install + run: | + bundle exec fastlane run cocoapods + + - name: Setup Java 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: WireMock setup + run: | + curl https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-standalone/2.27.0/wiremock-jre8-standalone-2.27.0.jar -o wiremock.jar -s + bundle exec iostrust add ./wiremock/cert/wiremock.crt + java -jar wiremock.jar --https-port 9099 --root-dir wiremock --https-keystore wiremock/cert/wiremock.jks --keystore-password password --verbose --global-response-templating & + + - name: Format check + run: | + bundle exec fastlane format_check + + - name: Test + run: | + bundle exec fastlane test_2 + + - name: Tests reports upload + uses: actions/upload-artifact@v3 + if: failure() + with: + name: tests-reports + path: "fastlane/test_output" From ca7339c45c91c42631cb3dc52abfd5366e25057d Mon Sep 17 00:00:00 2001 From: Valeriu Popa Date: Fri, 22 Dec 2023 12:28:37 +0200 Subject: [PATCH 5/6] updated test plans --- .../Sources/MRAID/MessageHandlers/MRAIDMessaheHandler.swift | 6 +++--- .../Tests/TestPlans/CriteoPublisherSdkMC2.xctestplan | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CriteoPublisherSdk/Sources/MRAID/MessageHandlers/MRAIDMessaheHandler.swift b/CriteoPublisherSdk/Sources/MRAID/MessageHandlers/MRAIDMessaheHandler.swift index fb860a2a..fadedc85 100644 --- a/CriteoPublisherSdk/Sources/MRAID/MessageHandlers/MRAIDMessaheHandler.swift +++ b/CriteoPublisherSdk/Sources/MRAID/MessageHandlers/MRAIDMessaheHandler.swift @@ -25,9 +25,9 @@ public protocol MRAIDMessageHandlerDelegate: AnyObject { } public struct MRAIDMessageHandler { - private unowned var logHandler: MRAIDLogHandler - private unowned var urlHandler: MRAIDURLHandler - public unowned var delegate: MRAIDMessageHandlerDelegate! + private var logHandler: MRAIDLogHandler + private var urlHandler: MRAIDURLHandler + public var delegate: MRAIDMessageHandlerDelegate! public init(logHandler: MRAIDLogHandler, urlHandler: MRAIDURLHandler) { self.logHandler = logHandler diff --git a/CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC2.xctestplan b/CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC2.xctestplan index 4b00adaa..813aa42d 100644 --- a/CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC2.xctestplan +++ b/CriteoPublisherSdk/Tests/TestPlans/CriteoPublisherSdkMC2.xctestplan @@ -30,7 +30,9 @@ "CRBannerViewTests\/testAllowNavigationActionPolicyForWebView", "CRBannerViewTests\/testWithRendering", "CRInterstitialDelegateTests\/testCacheHasAdButAdContentFetchFailed", + "CRInterstitialDelegateTests\/testInterstitialAdFetchFail", "CRInterstitialDelegateTests\/testInterstitialDidReceiveAd", + "CRInterstitialDelegateTests\/testInterstitialLoadFailWhenBidIsNil", "CRInterstitialDelegateTests\/testInterstitialWillAndDidAppear", "CRInterstitialDelegateTests\/testInterstitialWillandDidDisappear", "CRInterstitialDelegateTests\/testNoDelegateMethodCalledInDecidePolicyForNavigationResponse", @@ -163,6 +165,7 @@ "CR_RegistrationFunctionalTests\/test_givenCriteoInitWithBanner_whenRegisterTwice_thenOneCBDCall", "CR_RegistrationFunctionalTests\/test_givenCriteoInitWithInterstitial_whenRegisterTwice_thenOneCBDCall", "CR_RegistrationFunctionalTests\/test_givenCriteoInitWithNative_whenRegisterTwice_thenOneCBDCall", + "CR_StandaloneBannerFunctionalTests", "CR_StandaloneBannerFunctionalTests\/test_givenBannerWithAppStoreClickUrl_whenClickUrl_thenOpenStoreKitController", "CR_StandaloneBannerFunctionalTests\/test_givenBannerWithGoodAdUnitId_whenLoadAd_thenAdIsLoadedProperly", "CR_URLResolverTests\/testResolutionToAppStoreURLWithRedirects", From c858aac86dbb63f596347c74218827673b478c5e Mon Sep 17 00:00:00 2001 From: Valeriu Popa Date: Wed, 27 Dec 2023 10:21:42 +0200 Subject: [PATCH 6/6] banner tests update --- .../UnitTests/Standalone/CRBannerViewTests.m | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/CriteoPublisherSdk/Tests/UnitTests/Standalone/CRBannerViewTests.m b/CriteoPublisherSdk/Tests/UnitTests/Standalone/CRBannerViewTests.m index 709be407..2a56a0f6 100644 --- a/CriteoPublisherSdk/Tests/UnitTests/Standalone/CRBannerViewTests.m +++ b/CriteoPublisherSdk/Tests/UnitTests/Standalone/CRBannerViewTests.m @@ -57,6 +57,7 @@ @interface CRBannerViewTests : XCTestCase @property(strong, nonatomic) Criteo *criteo; @property(strong, nonatomic) CR_IntegrationRegistry *integrationRegistry; @property(nonatomic, strong) id loggingMock; +@property(strong, nonatomic) CRBannerView *bannerView; @end @implementation CRBannerViewTests @@ -84,6 +85,7 @@ - (void)tearDown { // Not sure why this is needed but without this testWithRendering is failing. // Maybe this come from OCMock not handling properly partial mock ??? self.criteo = nil; + self.bannerView = nil; [self.loggingMock stopMocking]; } @@ -105,10 +107,10 @@ - (void)testBannerSuccess { [webViewLoadedExpectation fulfill]; }); - CRBannerView *bannerView = [self bannerViewWithWebView:mockWebView]; + _bannerView = [self bannerViewWithWebView:mockWebView]; OCMVerify([self.loggingMock logMessage:[self checkMessageContainsString:@"Initializing"]]); - [bannerView loadAdWithContext:self.contextData]; + [_bannerView loadAdWithContext:self.contextData]; OCMVerify([self.loggingMock logMessage:[self checkMessageContainsString:@"Loading"]]); OCMVerify([self.loggingMock logMessage:[self checkMessageContainsString:@"Received"]]); @@ -122,10 +124,9 @@ - (void)testBannerSuccess { - (void)testWebViewAddedToViewHierarchy { MockWKWebView *mockWebView = [MockWKWebView new]; + _bannerView = [self bannerViewWithWebView:mockWebView addWebView:YES]; - CRBannerView *bannerView = [self bannerViewWithWebView:mockWebView addWebView:YES]; - - XCTAssertEqual(mockWebView, bannerView.subviews[0]); + XCTAssertEqual(mockWebView, _bannerView.subviews[0]); } - (void)testWithRendering { @@ -134,9 +135,9 @@ - (void)testWithRendering { CR_CdbBid *bid = [self cdbBidWithDisplayUrl:@"-"]; [self mockCriteoWithAdUnit:self.expectedCacheAdUnit respondBid:bid]; - CRBannerView *bannerView = [self bannerViewWithWebView:realWebView]; + _bannerView = [self bannerViewWithWebView:realWebView]; realWebView.navigationDelegate = self; - [bannerView loadAdWithContext:self.contextData]; + [_bannerView loadAdWithContext:self.contextData]; XCTestExpectation __block *marginExpectation = [self expectationWithDescription:@"WebView body has 0px margin"]; @@ -180,8 +181,8 @@ - (void)testBannerFail { WKWebView *realWebView = [WKWebView new]; [self mockCriteoWithAdUnit:self.expectedCacheAdUnit respondBid:nil]; - CRBannerView *bannerView = [self bannerViewWithWebView:realWebView]; - [bannerView loadAdWithContext:self.contextData]; + _bannerView = [self bannerViewWithWebView:realWebView]; + [_bannerView loadAdWithContext:self.contextData]; OCMVerify([self.loggingMock logMessage:[OCMArg checkWithBlock:^BOOL(CR_LogMessage *logMessage) { return [logMessage.tag isEqualToString:@"BannerView"] && [logMessage.message containsString:@"Failed"] && @@ -199,11 +200,11 @@ - (void)testAllowNavigationActionPolicyForWebView { /* Allow navigation Types other than Links from Mainframes in WebView. eg: Clicking images inside tag generates WKNavigationTypeOther */ - CRBannerView *bannerView = [self bannerViewWithWebView:nil]; + _bannerView = [self bannerViewWithWebView:nil]; WKNavigationAction *mockNavigationAction = OCMStrictClassMock([WKNavigationAction class]); OCMStub(mockNavigationAction.navigationType).andReturn(WKNavigationTypeOther); - [bannerView webView:nil + [_bannerView webView:nil decidePolicyForNavigationAction:mockNavigationAction decisionHandler:^(WKNavigationActionPolicy actionPolicy) { XCTAssertEqual(actionPolicy, WKNavigationActionPolicyAllow); @@ -216,7 +217,7 @@ - (void)testAllowNavigationActionPolicyForWebView { OCMStub([mockFrame isMainFrame]).andReturn(YES); NSURLRequest *request = [[NSURLRequest alloc] init]; OCMStub(mockNavigationAction.request).andReturn(request); - [bannerView webView:nil + [_bannerView webView:nil decidePolicyForNavigationAction:mockNavigationAction decisionHandler:^(WKNavigationActionPolicy actionPolicy) { XCTAssertEqual(actionPolicy, WKNavigationActionPolicyAllow); @@ -237,8 +238,8 @@ - (void)testCancelNavigationActionPolicyForWebView { XCTestExpectation *openInBrowserExpectation = [self expectationWithDescription:@"URL opened in browser expectation"]; - CRBannerView *bannerView = [self bannerViewWithWebView:nil]; - [bannerView webView:nil + _bannerView = [self bannerViewWithWebView:nil]; + [_bannerView webView:nil decidePolicyForNavigationAction:mockNavigationAction decisionHandler:^(WKNavigationActionPolicy actionPolicy) { XCTAssertEqual(actionPolicy, WKNavigationActionPolicyCancel); @@ -270,8 +271,8 @@ - (void)testCreateWebViewWithConfiguration { XCTestExpectation *openInBrowserExpectation = [self expectationWithDescription:@"URL opened in browser expectation"]; - CRBannerView *bannerView = [self bannerViewWithWebView:realWebView]; - [bannerView webView:realWebView + _bannerView = [self bannerViewWithWebView:realWebView]; + [_bannerView webView:realWebView createWebViewWithConfiguration:nil forNavigationAction:mockNavigationAction windowFeatures:nil]; @@ -297,8 +298,8 @@ - (void)testDisplayAdWithDataSuccess { [webViewLoadedExpectation fulfill]; }); - CRBannerView *bannerView = [self bannerViewWithWebView:mockWebView]; - [bannerView loadAdWithDisplayData:TEST_DISPLAY_URL]; + _bannerView = [self bannerViewWithWebView:mockWebView]; + [_bannerView loadAdWithDisplayData:TEST_DISPLAY_URL]; [self cr_waitForExpectations:@[ webViewLoadedExpectation ]]; OCMVerifyAll(mockWebView); @@ -322,14 +323,13 @@ - (void)testLoadingWithBidSuccess { CR_CdbBid *cdbBid = [self cdbBidWithDisplayUrl:TEST_DISPLAY_URL]; CRBid *bid = [[CRBid alloc] initWithCdbBid:cdbBid adUnit:self.adUnit]; - CRBannerView *bannerView = - [[CRBannerView alloc] initWithFrame:CGRectMake(13.0f, 17.0f, 47.0f, 57.0f) - criteo:self.criteo - webView:mockWebView - addWebView:NO - adUnit:nil - urlOpener:self.urlOpener]; - [bannerView loadAdWithBid:bid]; + _bannerView = [[CRBannerView alloc] initWithFrame:CGRectMake(13.0f, 17.0f, 47.0f, 57.0f) + criteo:self.criteo + webView:mockWebView + addWebView:NO + adUnit:nil + urlOpener:self.urlOpener]; + [_bannerView loadAdWithBid:bid]; [self cr_waitForExpectations:@[ webViewLoadedExpectation ]]; OCMVerifyAll(mockWebView); @@ -355,8 +355,8 @@ - (void)testTemplatingFromConfig { CR_CdbBid *cdbBid = [self cdbBidWithDisplayUrl:displayURL]; CRBid *bid = [[CRBid alloc] initWithCdbBid:cdbBid adUnit:self.adUnit]; - CRBannerView *bannerView = [self bannerViewWithWebView:mockWebView]; - [bannerView loadAdWithBid:bid]; + _bannerView = [self bannerViewWithWebView:mockWebView]; + [_bannerView loadAdWithBid:bid]; [self cr_waitForExpectations:@[ webViewLoadedExpectation ]]; OCMVerifyAll(mockWebView); @@ -378,13 +378,13 @@ - (CRBannerView *)testbannerViewWithMRAID:(BOOL)mraidFlag { } - (void)testMRAIDOffOnConfig { - CRBannerView *bannerView = [self testbannerViewWithMRAID:NO]; - XCTAssertNil(bannerView.mraidHandler); + _bannerView = [self testbannerViewWithMRAID:NO]; + XCTAssertNil(_bannerView.mraidHandler); } - (void)testMRAIDActiveOnConfig { - CRBannerView *bannerView = [self testbannerViewWithMRAID:YES]; - XCTAssertNotNil(bannerView.mraidHandler); + _bannerView = [self testbannerViewWithMRAID:YES]; + XCTAssertNotNil(_bannerView.mraidHandler); } #pragma mark - Private