-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: add storage ui launch tests #1821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright 2025 Google LLC | ||
| // | ||
| // 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 XCTest | ||
|
|
||
| final class StorageExample__iOS__UITests: XCTestCase { | ||
|
|
||
| override func setUpWithError() throws { | ||
| // Put setup code here. This method is called before the invocation of each test method in the class. | ||
|
|
||
| // In UI tests it is usually best to stop immediately when a failure occurs. | ||
| continueAfterFailure = false | ||
|
|
||
| // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. | ||
| } | ||
|
|
||
| override func tearDownWithError() throws { | ||
| // Put teardown code here. This method is called after the invocation of each test method in the class. | ||
| } | ||
|
Comment on lines
+28
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| @MainActor | ||
| func testExample() throws { | ||
| // UI tests must launch the application that they test. | ||
| let app = XCUIApplication() | ||
| app.launch() | ||
|
|
||
| // Use XCTAssert and related functions to verify your tests produce the correct results. | ||
| } | ||
|
Comment on lines
+32
to
+39
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This placeholder test should be improved. The name @MainActor
func testAppLaunchesSuccessfully() throws {
let app = XCUIApplication()
app.launch()
XCTAssertTrue(app.exists)
} |
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright 2025 Google LLC | ||
| // | ||
| // 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 XCTest | ||
|
|
||
| final class StorageExample__iOS__UITestsLaunchTests: XCTestCase { | ||
|
|
||
| override class var runsForEachTargetApplicationUIConfiguration: Bool { | ||
| true | ||
| } | ||
|
|
||
| override func setUpWithError() throws { | ||
| continueAfterFailure = false | ||
| } | ||
|
Comment on lines
+23
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| @MainActor | ||
| func testLaunch() throws { | ||
| let app = XCUIApplication() | ||
| app.launch() | ||
|
|
||
| // Insert steps here to perform after app launch but before taking a screenshot, | ||
| // such as logging into a test account or navigating somewhere in the app | ||
|
Comment on lines
+32
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| let attachment = XCTAttachment(screenshot: app.screenshot()) | ||
| attachment.name = "Launch Screen" | ||
| attachment.lifetime = .keepAlways | ||
| add(attachment) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boilerplate comments should be removed to improve readability. Also, it's required to call
super.setUpWithError()when overriding this method.