// C o p y r i g h t © 2 0 1 5 A b h i s h e k B a n t h i a
import XCTest
class CopyToClipboardTests : XCTestCase {
var app : XCUIApplication !
override func setUp ( ) {
continueAfterFailure = false
app = XCUIApplication ( )
app . launch ( )
// i f a p p . t a b l e s [ " F l o a t i n g T a b l e V i e w " ] . e x i s t s = = f a l s e {
// a p p . t a p M e n u b a r I c o n ( )
// a p p . b u t t o n s [ " P i n " ] . c l i c k ( )
// }
}
override func tearDownWithError ( ) throws {
app = nil
}
func testFullCopy ( ) throws {
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 customLabel = cell . staticTexts [ " CustomNameLabelForCell " ] . value ? ? " Nil Custom Label "
let time = cell . staticTexts [ " ActualTime " ] . value ? ? " Nil Value "
clipboardValue . append ( contentsOf : " \( customLabel ) - \( time ) \n " )
}
app . buttons [ " Share " ] . click ( )
app /* @ S T A R T _ M E N U _ T O K E N @ */ . menuItems [ " Copy All Times " ] /* [ [ " . d i a l o g s [ \ " C l o c k e r P a n e l \ " ] " , " . b u t t o n s [ \ " S h a r e \ " ] " , " . m e n u s . m e n u I t e m s [ \ " C o p y A l l T i m e s \ " ] " , " . m e n u I t e m s [ \ " C o p y A l l T i m e s \ " ] " ] , [ [ [ - 1 , 3 ] , [ - 1 , 2 ] , [ - 1 , 1 , 2 ] , [ - 1 , 0 , 1 ] ] , [ [ - 1 , 3 ] , [ - 1 , 2 ] , [ - 1 , 1 , 2 ] ] , [ [ - 1 , 3 ] , [ - 1 , 2 ] ] ] , [ 0 ] ] @ E N D _ M E N U _ T O K E N @ */ . click ( )
let clipboard = NSPasteboard . general . string ( forType : . string )
XCTAssert ( clipboardValue = = clipboard )
}
func testIndividualTimezoneCopy ( ) {
let cell = app . tables [ " FloatingTableView " ] . cells . firstMatch
let customLabel = cell . staticTexts [ " CustomNameLabelForCell " ] . value ? ? " Nil Custom Label "
let time = cell . staticTexts [ " ActualTime " ] . value ? ? " Nil Value "
let expectedValue = " \( customLabel ) - \( time ) "
// T a p t o c o p y !
cell . tap ( )
let clipboard = NSPasteboard . general . string ( forType : . string ) ? ? " Empty Pasteboard "
XCTAssert ( expectedValue = = clipboard , " Clipboard value ( \( clipboard ) ) doesn't match expected result " )
}
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 )
}
}