Skip to content

Commit

Permalink
Releases/v0.11.0 (#27)
Browse files Browse the repository at this point in the history
* fix: applications embedding the SDK can now be launched via test action on tvOS simulator when running on Apple Silicon devices.

Remove tvOS simulator arm64 architecture exclusion

* chore: add tvOS example application
  • Loading branch information
andrewjl-mux authored Sep 11, 2023
1 parent f452379 commit 2fbf09f
Show file tree
Hide file tree
Showing 294 changed files with 15,724 additions and 1,401 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ on:
jobs:
tests:
name: Test the SDK with a Demo App
runs-on: macos-latest
runs-on: macos-13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Link to older simulator(s)
run: |
echo "Creating Runtimes folder if needed..."
sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes
echo "Creating symlink of the iOS 14.1 runtime..."
sudo ln -s /Applications/Xcode_12.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 14.1.simruntime
- name: Run tests
run: "./run-tests.sh"

7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Example/DemoApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class ViewController: UIViewController, IMAAdsLoaderDelegate, IMAAdsManagerDeleg

setUpContentPlayer(mediaUrl: VOD_TEST_URL_STEVE)
setUpAdsLoader()
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated);
requestAds()
player?.play()
}

Expand Down Expand Up @@ -115,11 +120,6 @@ class ViewController: UIViewController, IMAAdsLoaderDelegate, IMAAdsManagerDeleg
adsLoader.requestAds(with: request)
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated);
requestAds()
}

func showContentPlayer() {
self.addChild(playerViewController)
playerViewController.view.frame = self.view.bounds
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
95 changes: 78 additions & 17 deletions Example/DemoAppUITests/DemoAppUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,97 @@ final class DemoAppUITests: XCTestCase {

// Set this key to your environment key to have the tests generate data on your dashboard
let UI_TEST_ENV_KEY = "tr4q3qahs0gflm8b1c75h49ln";


var launchedApplication: XCUIApplication?

override func setUpWithError() throws {
continueAfterFailure = false
}

func testImaSdk() throws {

let app = XCUIApplication()
app.launchEnvironment = [
"ENV_KEY": UI_TEST_ENV_KEY
]
app.activate()
app.launch()

let waitForLaunchAndPreroll = XCTestExpectation(description: "Wait for launch (~5 sec) and preroll (10 sec)")
let launchAndPrerollResult = XCTWaiter.wait(for: [waitForLaunchAndPreroll], timeout: 15.0)
if(launchAndPrerollResult != XCTWaiter.Result.timedOut) {

launchedApplication = app
}

func testAdPlayback() throws {

guard let launchedApplication else {
XCTFail("Failed to launch application")
return
}

let launchWaitResult = launchedApplication.wait(
for: XCUIApplication.State.runningForeground,
timeout: 10.0
)

XCTAssertTrue(
launchWaitResult,
"Application is not running in foreground and cannot receive tap events."
)

// TODO: Check if a preroll ad is actually present
let waitForLaunchAndPreroll = XCTestExpectation(
description: "Wait for launch (~5 sec) and preroll (10 sec)"
)
let launchAndPrerollResult = XCTWaiter.wait(
for: [waitForLaunchAndPreroll],
timeout: 15.0
)
if (launchAndPrerollResult != XCTWaiter.Result.timedOut) {
XCTFail("interrupted while playing")
}

let playerViewElement = app.otherElements["AVPlayerView"]
let playerViewElement = launchedApplication.otherElements["AVPlayerView"]

let playerViewElementExistenceResult = playerViewElement.waitForExistence(
timeout: 10.0
)

XCTAssertTrue(
playerViewElementExistenceResult,
"AVPlayerView never came into existence."
)

XCTAssertTrue(
playerViewElement.isHittable,
"AVPlayerView cannot be clicked, tapped, or pressed. It is either offscreen, covered by another element or is not present in view hierarchy"
)

playerViewElement.tap()

let skipForwardButton = app.buttons["Skip Forward"]

let skipForwardButton = launchedApplication.buttons["Skip Forward"]

let skipForwardButtonExistenceResult = skipForwardButton.waitForExistence(
timeout: 10.0
)

XCTAssertTrue(
skipForwardButtonExistenceResult,
"Skip forward button never came into existence"
)

XCTAssertTrue(
skipForwardButton.isHittable,
"AVPlayer skip forward button cannot be clicked, tapped, or pressed. It is either offscreen, covered by another element or is not present in view hierarchy"
)

skipForwardButton.tap()
let waitForMidroll = XCTWaiter.wait(for: [XCTestExpectation(description: "Wait for Midroll (30s)")], timeout: 30.0)
if(waitForMidroll != XCTWaiter.Result.timedOut) {

// TODO: Check if a midroll ad is actually present
let midrollExpectation = XCTestExpectation(
description: "Wait for Midroll (40s)"
)
let waitForMidroll = XCTWaiter.wait(
for: [midrollExpectation],
timeout: 40.0
)
if (waitForMidroll != XCTWaiter.Result.timedOut) {
XCTFail("interrupted while waiting for midroll")
}
let waitForALittleMore = XCTWaiter.wait(for: [XCTestExpectation(description: "Wait 10 more seconds")], timeout: 10.0)
if(waitForALittleMore != XCTWaiter.Result.timedOut) {
XCTFail("play interrupted")
}
}
}
41 changes: 41 additions & 0 deletions Example/MUXSDKIMATVOSExample/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// AppDelegate.swift
// MUXSDKIMATVOSExample
//
// Created by AJ Barinov on 9/1/23.
// Copyright © 2023 Dylan Jhaveri. All rights reserved.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"images" : [
{
"idiom" : "tv"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"layers" : [
{
"filename" : "Front.imagestacklayer"
},
{
"filename" : "Middle.imagestacklayer"
},
{
"filename" : "Back.imagestacklayer"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"idiom" : "tv",
"scale" : "1x"
},
{
"idiom" : "tv",
"scale" : "2x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 2fbf09f

Please sign in to comment.