Last active
August 13, 2022 15:32
-
-
Save lando2319/81102e774b8c0ef4e838ea1d033c1c6d to your computer and use it in GitHub Desktop.
UI Testing on different devices was causing the order to be different, big devices would be "10, 6", small devices would be "6, 10", I wanted it to check for either.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func assertStringEqualsEitherOrder(labelToTest: String, baseLabel:String, checkLabel:String) -> Bool { | |
| if labelToTest == "\(baseLabel), \(checkLabel)" { return true } | |
| if labelToTest == "\(checkLabel), \(baseLabel)" { return true } | |
| return false | |
| } | |
| // example usage | |
| assert( | |
| assertStringEqualsEitherOrder( | |
| labelToTest: app.buttons["place10"].label, | |
| baseLabel: "10", | |
| checkLabel: "6" | |
| ) | |
| ) | |
| assert( | |
| assertStringEqualsEitherOrder( | |
| labelToTest: app.buttons["place10"].label, | |
| baseLabel: "NINE", | |
| checkLabel: "50, 5" // Odds and Flat | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment