Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI Tests] Examine / address flakiness in History tests. #1551

Merged
merged 11 commits into from
Jan 25, 2024
4 changes: 2 additions & 2 deletions .buildkite/commands/build-and-ui-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ if [[ $TESTS_EXIT_STATUS -ne 0 ]]; then
fi

echo "--- 📦 Zipping test results"
cd build/results/ && zip -rq Simplenote.xcresult.zip Simplenote.xcresult && cd -
cd build/results/ && zip -rq SimplenoteUITests.xcresult.zip SimplenoteUITests.xcresult && cd -

echo "--- 🚦 Report Tests Status"
if [[ $TESTS_EXIT_STATUS -eq 0 ]]; then
echo "Unit Tests seems to have passed (exit code 0). All good 👍"
echo "UI Tests seems to have passed (exit code 0). All good 👍"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! =D

else
echo "The UI Tests, ran during the '🛠️ Build and Test' step above, have failed."
echo "For more details about the failed tests, check the Buildkite annotation, the logs under the '🛠️ Build and Test' section and the \`.xcresult\` and test reports in Buildkite artifacts."
Expand Down
8 changes: 7 additions & 1 deletion SimplenoteUITests/EmailLogin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ class EmailLogin {
class func open() {
app.buttons[UID.Button.logIn].waitForIsHittable()
app.buttons[UID.Button.logIn].tap()

app.buttons[UID.Button.logInWithEmail].waitForIsHittable()
app.buttons[UID.Button.logInWithEmail].tap()
}
Expand Down Expand Up @@ -38,6 +37,7 @@ class EmailLogin {
enterPassword(enteredValue: password)
app.buttons[UID.Button.logIn].tap()
handleSavePasswordPrompt()
waitForSpinnerToDisappear()
Copy link
Contributor Author

@pachlava pachlava Jan 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a part of the fix, and not necessary, but it does not hurt, and does not occupy much time, since the function waits for the spinner to disappear. So, if the spinner was not there in the first place, it will be completed really fast.

}

class func enterEmail(enteredValue: String) {
Expand All @@ -60,4 +60,10 @@ class EmailLogin {
app.buttons["Not Now"].tap()
}
}

class func waitForSpinnerToDisappear() {
let predicate = NSPredicate(format: "exists == false && isHittable == false")
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: app.staticTexts["In progress"])
XCTWaiter().wait(for: [ expectation ], timeout: 10)
}
}
1 change: 1 addition & 0 deletions SimplenoteUITests/SimplenoteUITestsHistory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class SimplenoteUISmokeTestsHistory: XCTestCase {

override class func setUp() {
app.launch()
EmailLogin.handleSavePasswordPrompt()
getToAllNotes()
let _ = attemptLogOut()
EmailLogin.open()
Expand Down