Switch the CI to code 14 and the iOS 14 simulator, fix UI tests

This commit is contained in:
Stefan Ceriu
2022-10-26 13:27:26 +03:00
committed by Stefan Ceriu
parent 8334fa1e69
commit 7daa4f121e
8 changed files with 113 additions and 72 deletions
@@ -24,36 +24,45 @@ class TimelinePollUITests: MockScreenTestCase {
XCTAssert(app.staticTexts["Question"].exists)
XCTAssert(app.staticTexts["20 votes cast"].exists)
XCTAssert(app.buttons["First, 10 votes"].exists)
XCTAssertEqual(app.buttons["First, 10 votes"].value as! String, "50%")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Count"].label, "10 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption0Progress"].value as? String, "50%")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Count"].label, "5 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption1Progress"].value as? String, "25%")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Count"].label, "15 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption2Progress"].value as? String, "75%")
XCTAssert(app.buttons["Second, 5 votes"].exists)
XCTAssertEqual(app.buttons["Second, 5 votes"].value as! String, "25%")
app.buttons["PollAnswerOption0"].tap()
XCTAssert(app.buttons["Third, 15 votes"].exists)
XCTAssertEqual(app.buttons["Third, 15 votes"].value as! String, "75%")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Count"].label, "11 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption0Progress"].value as? String, "55%")
app.buttons["First, 10 votes"].tap()
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Count"].label, "4 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption1Progress"].value as? String, "20%")
XCTAssert(app.buttons["First, 11 votes"].exists)
XCTAssertEqual(app.buttons["First, 11 votes"].value as! String, "55%")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Count"].label, "15 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption2Progress"].value as? String, "75%")
XCTAssert(app.buttons["Second, 4 votes"].exists)
XCTAssertEqual(app.buttons["Second, 4 votes"].value as! String, "20%")
app.buttons["PollAnswerOption2"].tap()
XCTAssert(app.buttons["Third, 15 votes"].exists)
XCTAssertEqual(app.buttons["Third, 15 votes"].value as! String, "75%")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Count"].label, "10 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption0Progress"].value as? String, "50%")
app.buttons["Third, 15 votes"].tap()
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Count"].label, "4 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption1Progress"].value as? String, "20%")
XCTAssert(app.buttons["First, 10 votes"].exists)
XCTAssertEqual(app.buttons["First, 10 votes"].value as! String, "50%")
XCTAssert(app.buttons["Second, 4 votes"].exists)
XCTAssertEqual(app.buttons["Second, 4 votes"].value as! String, "20%")
XCTAssert(app.buttons["Third, 16 votes"].exists)
XCTAssertEqual(app.buttons["Third, 16 votes"].value as! String, "80%")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Count"].label, "16 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption2Progress"].value as? String, "80%")
}
func testOpenUndisclosedPoll() {
@@ -62,29 +71,29 @@ class TimelinePollUITests: MockScreenTestCase {
XCTAssert(app.staticTexts["Question"].exists)
XCTAssert(app.staticTexts["20 votes cast"].exists)
XCTAssert(!app.buttons["First, 10 votes"].exists)
XCTAssert(app.buttons["First"].exists)
XCTAssertTrue((app.buttons["First"].value as! String).isEmpty)
XCTAssert(!app.buttons["Second, 5 votes"].exists)
XCTAssert(app.buttons["Second"].exists)
XCTAssertTrue((app.buttons["Second"].value as! String).isEmpty)
XCTAssert(!app.buttons["Third, 15 votes"].exists)
XCTAssert(app.buttons["Third"].exists)
XCTAssertTrue((app.buttons["Third"].value as! String).isEmpty)
app.buttons["First"].tap()
XCTAssert(app.buttons["First"].exists)
XCTAssert(app.buttons["Second"].exists)
XCTAssert(app.buttons["Third"].exists)
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssert(!app.staticTexts["PollAnswerOption0Count"].exists)
XCTAssert(!app.progressIndicators["PollAnswerOption0Progress"].exists)
app.buttons["Third"].tap()
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssert(!app.staticTexts["PollAnswerOption1Count"].exists)
XCTAssert(!app.progressIndicators["PollAnswerOption1Progress"].exists)
XCTAssert(app.buttons["First"].exists)
XCTAssert(app.buttons["Second"].exists)
XCTAssert(app.buttons["Third"].exists)
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
XCTAssert(!app.staticTexts["PollAnswerOption2Count"].exists)
XCTAssert(!app.progressIndicators["PollAnswerOption2Progress"].exists)
app.buttons["PollAnswerOption0"].tap()
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
app.buttons["PollAnswerOption2"].tap()
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
}
func testClosedDisclosedPoll() {
@@ -100,25 +109,31 @@ class TimelinePollUITests: MockScreenTestCase {
private func checkClosedPoll() {
XCTAssert(app.staticTexts["Question"].exists)
XCTAssert(app.staticTexts["Final results based on 20 votes"].exists)
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Count"].label, "10 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption0Progress"].value as? String, "50%")
XCTAssert(app.buttons["First, 10 votes"].exists)
XCTAssertEqual(app.buttons["First, 10 votes"].value as! String, "50%")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Count"].label, "5 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption1Progress"].value as? String, "25%")
XCTAssert(app.buttons["Second, 5 votes"].exists)
XCTAssertEqual(app.buttons["Second, 5 votes"].value as! String, "25%")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Count"].label, "15 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption2Progress"].value as? String, "75%")
XCTAssert(app.buttons["Third, 15 votes"].exists)
XCTAssertEqual(app.buttons["Third, 15 votes"].value as! String, "75%")
app.buttons["PollAnswerOption0"].tap()
app.buttons["First, 10 votes"].tap()
XCTAssertEqual(app.staticTexts["PollAnswerOption0Label"].label, "First")
XCTAssertEqual(app.staticTexts["PollAnswerOption0Count"].label, "10 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption0Progress"].value as? String, "50%")
XCTAssert(app.buttons["First, 10 votes"].exists)
XCTAssertEqual(app.buttons["First, 10 votes"].value as! String, "50%")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Label"].label, "Second")
XCTAssertEqual(app.staticTexts["PollAnswerOption1Count"].label, "5 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption1Progress"].value as? String, "25%")
XCTAssert(app.buttons["Second, 5 votes"].exists)
XCTAssertEqual(app.buttons["Second, 5 votes"].value as! String, "25%")
XCTAssert(app.buttons["Third, 15 votes"].exists)
XCTAssertEqual(app.buttons["Third, 15 votes"].value as! String, "75%")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Label"].label, "Third")
XCTAssertEqual(app.staticTexts["PollAnswerOption2Count"].label, "15 votes")
XCTAssertEqual(app.progressIndicators["PollAnswerOption2Progress"].value as? String, "75%")
}
}