You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.7 KiB

4 years ago
// Copyright © 2015 Abhishek Banthia
import XCTest
class PermissionsTests: XCTestCase {
var app: XCUIApplication!
override func setUp() {
super.setUp()
continueAfterFailure = false
app = XCUIApplication()
app.launch()
}
func testAcceptingCalendarPermissions() {
app.tapMenubarIcon()
3 years ago
app/*@START_MENU_TOKEN@*/ .buttons["Preferences"]/*[[".dialogs[\"Clocker Panel\"].buttons[\"Preferences\"]",".buttons[\"Preferences\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ .click()
3 years ago
4 years ago
let clockerWindow = app.windows["Clocker"]
3 years ago
4 years ago
// Check Permissions first
let permissionsTab = clockerWindow.toolbars.buttons["Permissions"]
permissionsTab.click()
3 years ago
4 years ago
let grantButton = clockerWindow.buttons["CalendarGrantAccessButton"].firstMatch
3 years ago
4 years ago
if grantButton.title == "Granted" || grantButton.title == "Denied" {
return
}
3 years ago
4 years ago
let calendarButton = clockerWindow.toolbars.buttons["Calendar"]
calendarButton.click()
3 years ago
4 years ago
let showUpcomingEventView = clockerWindow.staticTexts["UpcomingEventView"]
XCTAssertFalse(showUpcomingEventView.isHittable)
3 years ago
4 years ago
clockerWindow.buttons["Grant Access"].click()
clockerWindow.buttons["CalendarGrantAccessButton"].firstMatch.click()
3 years ago
4 years ago
addUIInterruptionMonitor(withDescription: "Calendars Access") { alert -> Bool in
let alertButton = alert.buttons["OK"]
if alertButton.exists {
alertButton.tap()
return true
}
return false
}
3 years ago
4 years ago
calendarButton.click()
XCTAssertTrue(showUpcomingEventView.isHittable)
}
3 years ago
4 years ago
func testAcceptingRemindersPermissions() {
app.tapMenubarIcon()
3 years ago
app/*@START_MENU_TOKEN@*/ .buttons["Preferences"]/*[[".dialogs[\"Clocker Panel\"].buttons[\"Preferences\"]",".buttons[\"Preferences\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ .click()
3 years ago
4 years ago
let clockerWindow = app.windows["Clocker"]
3 years ago
4 years ago
// Check Permissions first
let permissionsTab = clockerWindow.toolbars.buttons["Permissions"]
permissionsTab.click()
3 years ago
4 years ago
let grantButton = clockerWindow.buttons["RemindersGrantAccessButton"].firstMatch
3 years ago
4 years ago
if grantButton.title == "Granted" || grantButton.title == "Denied" {
return
}
3 years ago
4 years ago
clockerWindow.buttons["RemindersGrantAccessButton"].firstMatch.click()
3 years ago
4 years ago
addUIInterruptionMonitor(withDescription: "Reminders Access") { alert -> Bool in
let alertButton = alert.buttons["OK"]
if alertButton.exists {
alertButton.tap()
return true
}
return false
}
}
}