我已经阅读了一些关于chrome扩展的单元和e2e测试,但是还没有找到一种方法来为我的测试脚本提供完整的chrome API。
我需要能够保证,例如,在注销某些令牌被删除时,我不确定可以使用存根吗?
目前正在与Karma和Jasmine一起进行测试。我已尝试从扩展目录中的html文件中运行它们,但这只能让我访问api的一个子集...省略func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let iPadEntryViewController = storyboard.instantiateViewControllerWithIdentifier("iPadWrapperView") as! UIViewController
let iPhoneEntryViewController = storyboard.instantiateViewControllerWithIdentifier("iPhoneEntryPointView")as! UIViewController
if (UIDevice.currentDevice().userInterfaceIdiom == .Phone) {
self.window?.rootViewController = iPhoneEntryViewController
self.window?.makeKeyAndVisible()
println("Application will begin as iPhone app")
}
else {
self.window?.rootViewController = iPadEntryViewController
self.window?.makeKeyAndVisible()
println("Application will begin as iPad app")
}
return true
}
等部分......
我也是开发和测试的新手,所以可能有一个简单的解决方案。我想过尝试让Karma通过扩展本身启动,然后在后台页面中运行测试......这可能吗?如何配置Karma通过扩展名运行,而不是在新的浏览器窗口中运行所有测试文件?