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.

78 lines
2.4 KiB

// Copyright © 2015 Abhishek Banthia
import XCTest
class CopyToClipboardTests: XCTestCase {
var app: XCUIApplication!
override func setUp() {
continueAfterFailure = false
app = XCUIApplication()
app.launch()
3 years ago
if app.tables["FloatingTableView"].exists == false {
app.tapMenubarIcon()
app.buttons["Pin"].click()
}
}
override func tearDownWithError() throws {
app = nil
}
func testFullCopy() throws {
3 years ago
let cell = app.tables["FloatingTableView"].cells.firstMatch
2 years ago
let customLabel = cell.staticTexts["CustomNameLabelForCell"]
guard let value = customLabel.value else { return }
3 years ago
let time = cell.staticTexts["ActualTime"].value ?? "Nil Value"
2 years ago
let expectedValue = "\(value) - \(time)"
3 years ago
// Tap to copy!
cell.click()
let actualValue = NSPasteboard.general.string(forType: .string) ?? "Empty Pasteboard"
XCTAssert(expectedValue == actualValue,
"Clipboard value (\(actualValue)) doesn't match expected result: \(expectedValue)")
3 years ago
3 years ago
// Test full copy
let cellCount = app.tables["FloatingTableView"].cells.count
var clipboardValue: [String] = []
for cellIndex in 0 ..< cellCount {
let cell = app.tables["FloatingTableView"].cells.element(boundBy: cellIndex)
let time = cell.staticTexts["ActualTime"].value ?? "Nil Value"
clipboardValue.append("\(time)")
}
app.buttons["Share"].click()
}
func testModernSlider() {
if app.buttons["FloatingPin"].exists {
app.buttons["FloatingPin"].click()
}
app.tapMenubarIcon()
let modernSliderExists = app.collectionViews["ModernSlider"].exists
app.buttons["Preferences"].click()
let appearanceTab = app.toolbars.buttons.element(boundBy: 1)
appearanceTab.click()
let miscTab = app.tabs.element(boundBy: 1)
miscTab.click()
if modernSliderExists {
app.radioGroups["FutureSlider"].radioButtons["Legacy"].click()
} else {
app.radioGroups["FutureSlider"].radioButtons["Modern"].click()
}
app.tapMenubarIcon()
let newFloatingSliderExists = app.collectionViews["ModernSlider"].exists
XCTAssertNotEqual(newFloatingSliderExists, modernSliderExists)
}
}