Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 723463b

Browse files
committed
[video_player] Add iOS unit and UI tests
1 parent 737110c commit 723463b

File tree

10 files changed

+398
-24
lines changed

10 files changed

+398
-24
lines changed

packages/video_player/video_player/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Add iOS unit and UI integration test targets.
4+
15
## 2.1.5
26

37
* Update example code in README to fix broken url.

packages/video_player/video_player/example/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32+
target 'RunnerTests' do
33+
inherit! :search_paths
34+
end
3235
end
3336

3437
post_install do |installer|

packages/video_player/video_player/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 250 additions & 23 deletions
Large diffs are not rendered by default.

packages/video_player/video_player/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/video_player/video_player/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@
3737
</BuildableReference>
3838
</MacroExpansion>
3939
<Testables>
40+
<TestableReference
41+
skipped = "NO">
42+
<BuildableReference
43+
BuildableIdentifier = "primary"
44+
BlueprintIdentifier = "F7151F3926603ECA0028CB91"
45+
BuildableName = "RunnerTests.xctest"
46+
BlueprintName = "RunnerTests"
47+
ReferencedContainer = "container:Runner.xcodeproj">
48+
</BuildableReference>
49+
</TestableReference>
50+
<TestableReference
51+
skipped = "NO">
52+
<BuildableReference
53+
BuildableIdentifier = "primary"
54+
BlueprintIdentifier = "F7151F2B26603EBD0028CB91"
55+
BuildableName = "RunnerUITests.xctest"
56+
BlueprintName = "RunnerUITests"
57+
ReferencedContainer = "container:Runner.xcodeproj">
58+
</BuildableReference>
59+
</TestableReference>
4060
</Testables>
4161
</TestAction>
4262
<LaunchAction
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
@import video_player;
6+
@import XCTest;
7+
8+
@interface VideoPlayerTests : XCTestCase
9+
@end
10+
11+
@implementation VideoPlayerTests
12+
13+
- (void)testPlugin {
14+
FLTVideoPlayerPlugin* plugin = [[FLTVideoPlayerPlugin alloc] init];
15+
XCTAssertNotNil(plugin);
16+
}
17+
18+
@end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
@import os.log;
6+
@import XCTest;
7+
8+
@interface VideoPlayerUITests : XCTestCase
9+
@property(nonatomic, strong) XCUIApplication* app;
10+
@end
11+
12+
@implementation VideoPlayerUITests
13+
14+
- (void)setUp {
15+
self.continueAfterFailure = NO;
16+
17+
self.app = [[XCUIApplication alloc] init];
18+
[self.app launch];
19+
}
20+
21+
- (void)testTabs {
22+
XCUIApplication* app = self.app;
23+
24+
XCUIElement* remoteTab = [app.otherElements elementMatchingPredicate:[NSPredicate predicateWithFormat:@"selected == YES"]];
25+
if (![remoteTab waitForExistenceWithTimeout:30.0]) {
26+
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
27+
XCTFail(@"Failed due to not able to find selected Remote tab");
28+
}
29+
XCTAssertTrue([remoteTab.label containsString:@"Remote"]);
30+
31+
for (NSString* tabName in @[@"Asset", @"List example"]) {
32+
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"label BEGINSWITH %@", tabName];
33+
XCUIElement* unselectedTab = [app.staticTexts elementMatchingPredicate:predicate];
34+
if (![unselectedTab waitForExistenceWithTimeout:30.0]) {
35+
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
36+
XCTFail(@"Failed due to not able to find unselected %@ tab", tabName);
37+
}
38+
XCTAssertFalse(unselectedTab.isSelected);
39+
[unselectedTab tap];
40+
41+
XCUIElement* selectedTab = [app.otherElements elementMatchingPredicate:[NSPredicate predicateWithFormat:@"label BEGINSWITH %@", tabName]];
42+
if (![selectedTab waitForExistenceWithTimeout:30.0]) {
43+
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
44+
XCTFail(@"Failed due to not able to find selected %@ tab", tabName);
45+
}
46+
XCTAssertTrue(selectedTab.isSelected);
47+
}
48+
}
49+
50+
@end

0 commit comments

Comments
 (0)