This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[webview_flutter] Add iOS integration tests
- Loading branch information
Showing
7 changed files
with
268 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## NEXT | ||
|
||
* Add iOS UI integration test target. | ||
|
||
## 2.0.8 | ||
|
||
* Migrate maven repository from jcenter to mavenCentral. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 133 additions & 44 deletions
177
packages/webview_flutter/example/ios/Runner.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
...ebview_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/RunnerUITests.xcscheme
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
packages/webview_flutter/example/ios/RunnerTests/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
98 changes: 98 additions & 0 deletions
98
packages/webview_flutter/example/ios/RunnerUITests/FLTWebViewUITests.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
@import XCTest; | ||
@import os.log; | ||
|
||
@interface FLTWebViewUITests : XCTestCase | ||
@property(nonatomic, strong) XCUIApplication* app; | ||
@end | ||
|
||
@implementation FLTWebViewUITests | ||
|
||
- (void)setUp { | ||
self.continueAfterFailure = NO; | ||
|
||
self.app = [[XCUIApplication alloc] init]; | ||
[self.app launch]; | ||
} | ||
|
||
- (void)testUserAgent { | ||
XCUIApplication* app = self.app; | ||
XCUIElement* menu = app.buttons[@"Show menu"]; | ||
if (![menu waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find menu"); | ||
} | ||
[menu tap]; | ||
|
||
XCUIElement* userAgent = app.buttons[@"Show user agent"]; | ||
if (![userAgent waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find Show user agent"); | ||
} | ||
NSPredicate* userAgentPredicate = [NSPredicate predicateWithFormat:@"label BEGINSWITH 'User Agent: Mozilla/5.0 (iPhone; '"]; | ||
XCUIElement* userAgentPopUp = [app.otherElements elementMatchingPredicate:userAgentPredicate]; | ||
XCTAssertFalse(userAgentPopUp.exists); | ||
[userAgent tap]; | ||
if (![userAgentPopUp waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find user agent pop up"); | ||
} | ||
} | ||
|
||
- (void)testCache { | ||
XCUIApplication* app = self.app; | ||
XCUIElement* menu = app.buttons[@"Show menu"]; | ||
if (![menu waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find menu"); | ||
} | ||
[menu tap]; | ||
|
||
XCUIElement* clearCache = app.buttons[@"Clear cache"]; | ||
if (![clearCache waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find Clear cache"); | ||
} | ||
[clearCache tap]; | ||
|
||
[menu tap]; | ||
|
||
XCUIElement* listCache = app.buttons[@"List cache"]; | ||
if (![listCache waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find List cache"); | ||
} | ||
[listCache tap]; | ||
|
||
XCUIElement* emptyCachePopup = app.otherElements[@"{\"cacheKeys\":[],\"localStorage\":{}}"]; | ||
if (![emptyCachePopup waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find empty cache pop up"); | ||
} | ||
|
||
[menu tap]; | ||
XCUIElement* addCache = app.buttons[@"Add to cache"]; | ||
if (![addCache waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find Add to cache"); | ||
} | ||
[addCache tap]; | ||
[menu tap]; | ||
|
||
if (![listCache waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find List cache"); | ||
} | ||
[listCache tap]; | ||
|
||
XCUIElement* cachePopup = app.otherElements[@"{\"cacheKeys\":[\"test_caches_entry\"],\"localStorage\":{\"test_localStorage\":\"dummy_entry\"}}"]; | ||
if (![cachePopup waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find cache pop up"); | ||
} | ||
} | ||
|
||
@end |