ios - Firebase 上 iOS 的 Flutter 集成测试?

标签 ios flutter firebase-test-lab

是否可以在 Firebase 上运行 Flutter 集成测试?似乎有关于此的相互矛盾的信息 - 一些消息来源说它可能,但在 the documentation ,iOS 部分似乎仅用于在您自己的设备上进行测试。
Firebase 要求上传 XCT 测试包。如何为 Flutter 项目获取/创建它?

最佳答案

首先在 Xcode 中打开你的 ios 模块,如下面的 ss。
enter image description here
现在你可以自由地用 Swift 编写很酷的 XCode UI 测试了。例如,我在这里为您的应用程序放置一个 Firebase 登录测试,也许您希望使用。

import XCTest
import UIKit
import Firebase

class LoginTestUITests: XCTestCase {

    var app: XCUIApplication!
    
    func testLogin() {
        continueAfterFailure = false
        app = XCUIApplication()
        app.launch()
        wait(for: 2)
        passLogin()
        wait(for: 5)
     // after your login you can add some methods here according to your app flow
    }
}

extension LoginTestUITests {

func passLogin() {
    
    //put your logic here        
    
}
// this is a pretty cool extension waiting according to input for a while coming the data from backend etc.
extension XCTestCase {
    func wait(for duration: TimeInterval) {
        let waitExpectation = expectation(description: "Waiting")
        
        let when = DispatchTime.now() + duration
        DispatchQueue.main.asyncAfter(deadline: when) {
            waitExpectation.fulfill()
        }
        // I use a buffer here to avoid flakiness with Timer on CI
        waitForExpectations(timeout: duration + 0.5)
    }
}

关于ios - Firebase 上 iOS 的 Flutter 集成测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66042050/

相关文章:

ios - 将 NSMutableArray 从一个 View Controller 复制到另一个 View Controller ?

ios - 以编程方式重置对屏幕位置的约束

Flutter:如何使 ListView 对指针事件透明(但不是其非透明内容)?

android - 如何将 firebase 测试实验室与 circleci 集成

android - 由于缺少方法导致的预启动报告失败(在 com.google.android.apps.mtaas.crawler-1/base.apk 中)

ios - TableView 捕捉到最后一个单元格的底部而不是 TableFooterView

ios - UIPageViewController页面里面的UIScrollView滚动问题

flutter - 如何在Flutter中为TextField使用BeveledRectangleBorder

flutter - Flutter 中是否可以在没有 MaterialApp 的情况下使用 GridView?

android - Firebase - 如何使用将在 firebase 测试实验室上运行的命令行运行特定的 Android UI 测试类?