0
私はmacOSのためのドキュメントベースのアプリケーションを開発しています。テストケースの開始時に既存のNSWindowを閉じるにはどうすればいいですか?XcodeでUIテスト中にNSWindowを閉じるには?
私はmacOSのためのドキュメントベースのアプリケーションを開発しています。テストケースの開始時に既存のNSWindowを閉じるにはどうすればいいですか?XcodeでUIテスト中にNSWindowを閉じるには?
これはトリックを行うコードです。私はそれを保存していない問題がありました。理由は分かりませんが、既存の文書を保存したい場合があるかもしれません。
var untitledWindow = app.windows["Untitled"]
if untitledWindow.exists {
untitledWindow.typeKey("w", modifierFlags:.command)
//untitledWindow.buttons[XCUIIdentifierCloseWindow].click() should work too
if untitledWindow.buttons["Save"].exists{
untitledWindow.buttons["Save"].click()
}
if untitledWindow.buttons["Replace"].exists {
untitledWindow.buttons["Replace"].click()
}
}