From 0ff1ad6d20bf922495eb2c7a332410f61d610f8c Mon Sep 17 00:00:00 2001 From: Olena Stepaniuk Date: Mon, 23 Dec 2024 16:24:10 +0200 Subject: [PATCH] feat: add web view test case --- .../InternalTestApp.xcodeproj/project.pbxproj | 6 ++ .../Model/TestCasesManager.swift | 5 ++ .../Resources/Base.lproj/Main.storyboard | 66 ++++++++++++++++++- ...rsalCreativeTestingWebViewController.swift | 32 +++++++++ 4 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/OriginalAPI/PrebidUniversalCreativeTestingWebViewController.swift diff --git a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj index 53eaca23a..aa9b01b76 100644 --- a/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj +++ b/InternalTestApp/InternalTestApp.xcodeproj/project.pbxproj @@ -41,6 +41,8 @@ 53514CEE2D08416B00A480C0 /* CustomRendererBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53514CDE2D08416B00A480C0 /* CustomRendererBannerController.swift */; }; 535ADDFB2D19731000DB888F /* PrebidUniversalCreativeTestingGAMController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535ADDFA2D19731000DB888F /* PrebidUniversalCreativeTestingGAMController.swift */; }; 535ADDFC2D19731000DB888F /* PrebidUniversalCreativeTestingGAMController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535ADDFA2D19731000DB888F /* PrebidUniversalCreativeTestingGAMController.swift */; }; + 535ADDFE2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535ADDFD2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift */; }; + 535ADDFF2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535ADDFD2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift */; }; 5397BD142936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5397BD132936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift */; }; 5397BD26293760F500ABDA22 /* PrebidOriginalAPIDisplayInterstitialController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5397BD25293760F500ABDA22 /* PrebidOriginalAPIDisplayInterstitialController.swift */; }; 5397BD2A29376C9700ABDA22 /* PrebidOriginalAPIVideoRewardedController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5397BD2929376C9700ABDA22 /* PrebidOriginalAPIVideoRewardedController.swift */; }; @@ -396,6 +398,7 @@ 53514CDE2D08416B00A480C0 /* CustomRendererBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererBannerController.swift; sourceTree = ""; }; 53514CDF2D08416B00A480C0 /* CustomRendererInterstitialController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomRendererInterstitialController.swift; sourceTree = ""; }; 535ADDFA2D19731000DB888F /* PrebidUniversalCreativeTestingGAMController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidUniversalCreativeTestingGAMController.swift; sourceTree = ""; }; + 535ADDFD2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidUniversalCreativeTestingWebViewController.swift; sourceTree = ""; }; 5397BD132936185400ABDA22 /* PrebidOriginalAPIDisplayBannerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIDisplayBannerController.swift; sourceTree = ""; }; 5397BD25293760F500ABDA22 /* PrebidOriginalAPIDisplayInterstitialController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIDisplayInterstitialController.swift; sourceTree = ""; }; 5397BD2929376C9700ABDA22 /* PrebidOriginalAPIVideoRewardedController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrebidOriginalAPIVideoRewardedController.swift; sourceTree = ""; }; @@ -750,6 +753,7 @@ 539F961329DEF2670061E7A5 /* PrebidOriginalAPIVideoInterstitialController.swift */, 5397BD2929376C9700ABDA22 /* PrebidOriginalAPIVideoRewardedController.swift */, 535ADDFA2D19731000DB888F /* PrebidUniversalCreativeTestingGAMController.swift */, + 535ADDFD2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift */, ); path = OriginalAPI; sourceTree = ""; @@ -1614,6 +1618,7 @@ 53ED2FF629798104007D13EE /* BaseConfigurationController.swift in Sources */, 53ED2FF729798104007D13EE /* NativeAsset+Extensions.swift in Sources */, 53ED2FF829798104007D13EE /* PrebidGAMNativeAdController.swift in Sources */, + 535ADDFE2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift in Sources */, 53ED2FF929798104007D13EE /* PrebidOriginalAPIVideoInstreamViewController.swift in Sources */, 53ED2FFA29798104007D13EE /* PrebidAdMobBannerViewController.swift in Sources */, 53ED2FFB29798104007D13EE /* ConfigurableViewController.swift in Sources */, @@ -1715,6 +1720,7 @@ 5B209B4A21075E0A00C0F5CE /* BaseConfigurationController.swift in Sources */, 92C4E60B27A2F5D900738370 /* NativeAsset+Extensions.swift in Sources */, 92102C6127B0F2FE003F12B2 /* PrebidGAMNativeAdController.swift in Sources */, + 535ADDFF2D19A62C00DB888F /* PrebidUniversalCreativeTestingWebViewController.swift in Sources */, 5397BD322937895700ABDA22 /* PrebidOriginalAPIVideoInstreamViewController.swift in Sources */, 92E92502276B299F002B57F3 /* PrebidAdMobBannerViewController.swift in Sources */, 5BCCA3D62136D2E800DA3B5A /* ConfigurableViewController.swift in Sources */, diff --git a/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift b/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift index a7177a290..e47137e5e 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift +++ b/InternalTestApp/PrebidMobileDemoRendering/Model/TestCasesManager.swift @@ -486,6 +486,11 @@ struct TestCaseManager { setupCustomParams(for: bannerController.prebidConfigId) }), + TestCase(title: "Prebid Universal Creative (WebView)", + tags: [.banner, .originalAPI, .server], + exampleVCStoryboardID: "PrebidUniversalCreativeTestingWebViewController", + configurationClosure: { vc in }), + // MARK: ---- Native (Original API) TestCase(title: "Native Banner (GAM Original) [OK, PUC]", diff --git a/InternalTestApp/PrebidMobileDemoRendering/Resources/Base.lproj/Main.storyboard b/InternalTestApp/PrebidMobileDemoRendering/Resources/Base.lproj/Main.storyboard index 571f4d114..94081ba36 100644 --- a/InternalTestApp/PrebidMobileDemoRendering/Resources/Base.lproj/Main.storyboard +++ b/InternalTestApp/PrebidMobileDemoRendering/Resources/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -376,6 +376,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/OriginalAPI/PrebidUniversalCreativeTestingWebViewController.swift b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/OriginalAPI/PrebidUniversalCreativeTestingWebViewController.swift new file mode 100644 index 000000000..417bdf9ea --- /dev/null +++ b/InternalTestApp/PrebidMobileDemoRendering/ViewControllers/Adapters/Prebid/OriginalAPI/PrebidUniversalCreativeTestingWebViewController.swift @@ -0,0 +1,32 @@ +/*   Copyright 2018-2024 Prebid.org, Inc. + +  Licensed under the Apache License, Version 2.0 (the "License"); +  you may not use this file except in compliance with the License. +  You may obtain a copy of the License at + +  http://www.apache.org/licenses/LICENSE-2.0 + +  Unless required by applicable law or agreed to in writing, software +  distributed under the License is distributed on an "AS IS" BASIS, +  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +  See the License for the specific language governing permissions and +  limitations under the License. +  */ + +import UIKit +import WebKit + +final class PrebidUniversalCreativeTestingWebViewController: UIViewController { + + @IBOutlet weak var webView: WKWebView! + @IBOutlet weak var textField: UITextField! + + @IBAction func onOpenURLPressed(_ sender: Any) { + guard let urlString = textField.text, let url = URL(string: "http://\(urlString)") else { + return + } + + let request = URLRequest(url: url) + webView.load(request) + } +}