Skip to content

Commit

Permalink
Test image selection and reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
bcylin committed Jul 12, 2017
1 parent b0265ee commit 0bbeeb5
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Example/UITests/UITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,47 @@ class UITests: XCTestCase {
cancelButton.tap()
}

func testImageSelections() {
showImagePicker(named: "Default appearance")

let collectionViewsQuery = app.collectionViews
let first = collectionViewsQuery.children(matching: .cell).element(boundBy: 0)
let second = collectionViewsQuery.children(matching: .cell).element(boundBy: 1)
let third = collectionViewsQuery.children(matching: .cell).element(boundBy: 2)
let forth = collectionViewsQuery.children(matching: .cell).element(boundBy: 3)
let fifth = collectionViewsQuery.children(matching: .cell).element(boundBy: 4)

// Select and deselect an image
first.tap()
XCTAssert(first.staticTexts["1"].exists)
XCTAssertTrue(doneButton.isEnabled)

first.tap()
XCTAssertFalse(first.staticTexts["1"].exists)
XCTAssertFalse(doneButton.isEnabled)

// Select images in sequence
second.tap()
XCTAssert(second.staticTexts["1"].exists)

third.tap()
XCTAssert(third.staticTexts["2"].exists)

forth.tap()
XCTAssert(forth.staticTexts["3"].exists)

// Reorder selections
third.tap()
XCTAssert(second.staticTexts["1"].exists)
XCTAssert(forth.staticTexts["2"].exists)

third.tap()
XCTAssert(third.staticTexts["3"].exists)

fifth.tap()
XCTAssert(fifth.staticTexts["4"].exists)

doneButton.tap()
}

}

0 comments on commit 0bbeeb5

Please sign in to comment.