This repository was 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.7k
[quick_actions]Migrate the XCUITests to Swift #6425
Merged
auto-submit
merged 2 commits into
flutter:main
from
hellohuanlin:quick_actions_migrate_xcuitest
Oct 4, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
99 changes: 0 additions & 99 deletions
99
packages/quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.m
This file was deleted.
Oops, something went wrong.
96 changes: 96 additions & 0 deletions
96
packages/quick_actions/quick_actions_ios/example/ios/RunnerUITests/RunnerUITests.swift
This file contains hidden or 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,96 @@ | ||
| // 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 | ||
|
|
||
| private let elementWaitingTime: TimeInterval = 30 | ||
|
|
||
| class RunnerUITests: XCTestCase { | ||
|
|
||
| private var exampleApp: XCUIApplication! | ||
|
|
||
| override func setUp() { | ||
| super.setUp() | ||
| self.continueAfterFailure = false | ||
| exampleApp = XCUIApplication() | ||
| } | ||
|
|
||
| override func tearDown() { | ||
| super.tearDown() | ||
| exampleApp.terminate() | ||
| exampleApp = nil | ||
| } | ||
|
|
||
| func testQuickActionWithFreshStart() { | ||
| let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") | ||
| let quickActionsAppIcon = springboard.icons["quick_actions_example"] | ||
| if !quickActionsAppIcon.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the example app from springboard with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| quickActionsAppIcon.press(forDuration: 2) | ||
|
|
||
| let actionTwo = springboard.buttons["Action two"] | ||
| if !actionTwo.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the actionTwo button from springboard with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| actionTwo.tap() | ||
|
|
||
| let actionTwoConfirmation = exampleApp.otherElements["action_two"] | ||
| if !actionTwoConfirmation.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the actionTwoConfirmation in the app with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| XCTAssert(actionTwoConfirmation.exists) | ||
| } | ||
|
|
||
| func testQuickActionWhenAppIsInBackground() { | ||
| exampleApp.launch() | ||
|
|
||
| let actionsReady = exampleApp.otherElements["actions ready"] | ||
|
|
||
| if !actionsReady.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the actionsReady in the app with \(elementWaitingTime) seconds. App debug description: \(exampleApp.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| XCUIDevice.shared.press(.home) | ||
|
|
||
| let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard") | ||
| let quickActionsAppIcon = springboard.icons["quick_actions_example"] | ||
| if !quickActionsAppIcon.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the example app from springboard with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| quickActionsAppIcon.press(forDuration: 2) | ||
|
|
||
| let actionOne = springboard.buttons["Action one"] | ||
| if !actionOne.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the actionOne button from springboard with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| actionOne.tap() | ||
|
|
||
| let actionOneConfirmation = exampleApp.otherElements["action_one"] | ||
| if !actionOneConfirmation.waitForExistence(timeout: elementWaitingTime) { | ||
| XCTFail( | ||
| "Failed due to not able to find the actionOneConfirmation in the app with \(elementWaitingTime) seconds. Springboard debug description: \(springboard.debugDescription)" | ||
| ) | ||
| } | ||
|
|
||
| XCTAssert(actionOneConfirmation.exists) | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.