{"id":18259531,"url":"https://github.com/mruvim/ui-testing-swift","last_synced_at":"2025-04-08T23:39:21.373Z","repository":{"id":177396213,"uuid":"53074099","full_name":"mruvim/UI-Testing-Swift","owner":"mruvim","description":"Helpers for UI Testing in Xcode 7 (Swift)","archived":false,"fork":false,"pushed_at":"2016-03-09T00:54:26.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-14T18:27:02.587Z","etag":null,"topics":["swift","uitests"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mruvim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-03T18:40:05.000Z","updated_at":"2017-09-10T01:10:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3264682-36d8-454c-80b6-df531d6c5241","html_url":"https://github.com/mruvim/UI-Testing-Swift","commit_stats":null,"previous_names":["mruvim/ui-testing-swift"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruvim%2FUI-Testing-Swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruvim%2FUI-Testing-Swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruvim%2FUI-Testing-Swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mruvim%2FUI-Testing-Swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mruvim","download_url":"https://codeload.github.com/mruvim/UI-Testing-Swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247947822,"owners_count":21023058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["swift","uitests"],"created_at":"2024-11-05T10:38:35.721Z","updated_at":"2025-04-08T23:39:21.351Z","avatar_url":"https://github.com/mruvim.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# UI Testing Helpers (Swift)\nHelpers for UI Testing in Xcode 7 (Swift)\n\n\u003c/br\u003e\n\n##Check existance of\n\n###Static label \n\tlet application = XCUIApplication()\n\tlet label = application.staticTexts[\"label-accessibilityIdentifier\"]\n\tXCTAssertTrue(label.exists, \"Message for assert failure\")\n\n    \n###Image\n    let application = XCUIApplication()\n    let image = application.images[\"image-accessibilityIdentifier\"]\n    XCTAssertTrue(image.exists, \"Message for assert failure\")\n       \n    \n###Button\n\n    let application = XCUIApplication()\n    let button = application.buttons[\"button-accessibilityIdentifier\"]\n    XCTAssertTrue(button.exists, \"Message for assert failure\")\n    \n###Navigation title\n\n    let application = XCUIApplication()\n    let navigationBar = application.navigationBars[\"navbar-title\"]\n    XCTAssertTrue(navigationBar.exists, \"Message for assert failure\")\n    \n    \n \u003c/br\u003e  \n \u003c/br\u003e  \n \n \n  \n##Timing\n    \n###Wait for element to load\n\tlet element = ...\n\tlet kTimeoutSeconds = 10.0 // test fails after \n\tlet predicate = NSPredicate(format: \"exists == true\")\n\texpectationForPredicate(predicate, evaluatedWithObject:element, handler: nil)\n\twaitForExpectationsWithTimeout(kTimeoutSeconds, handler: nil)\n\n\n\n###Wait for specified time interval\n\n\textension XCTestCase {\n\t\n\t\tfunc waitForTimeInterval(interval:NSTimeInterval) -\u003e Void {   \n\t\t    let kTimeoutSeconds = ... // seconds before test fails, should be \u003e interval\n\t\t    let expectation = expectationWithDescription(\"Expectation\")\n\t\t    let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(interval * Double(NSEC_PER_SEC)))\n\t\t    dispatch_after(delayTime, dispatch_get_main_queue()) {\n\t\t        expectation.fulfill()\n\t\t    }\n\t\t    waitForExpectationsWithTimeout(kTimeoutSeconds, handler: nil)\n\t\t}\n\t}\n\t\n\u003c/br\u003e\n\n##Swipe\n\nSwipe gestures which can be used with scrollView based elements \n\n###Up\n       let scrollView = // scrollView based element\n       scrollView.swipeUp()\n       \n###Down\n       let scrollView = // scrollView based element\n       scrollView.swipeDown()\n       \n###Left\n       let scrollView = // scrollView based element\n       scrollView.swipeLeft()\n       \n###Right\n       let scrollView = // scrollView based element\n       scrollView.swipeRight()","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmruvim%2Fui-testing-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmruvim%2Fui-testing-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmruvim%2Fui-testing-swift/lists"}