rafalf
rafalf

Reputation: 435

is it possible to test web app using Xcui?

I am looking into Xcode and Xcui for web app and cannot get it work. to start up recording, build or whatsoever it needs a valid executable which I don't have since i am not building an app. is there any way to launch Safari as the app and then record it and run tests? i know there's Appium and other tools but wondering if it's possible and if so I would be keen to implement some in swift.

Upvotes: 0

Views: 331

Answers (2)

Deepjyot Kaur
Deepjyot Kaur

Reputation: 71

As far as XCUI testing is concerned, it was basically made to test the integration flow of an iOS app. As a result it can ONLY test native view controllers. As far as the web view is concerned, it should be tested at the web level and not at the application level.

Upvotes: 0

h.w.powers
h.w.powers

Reputation: 860

NOTE: This is a super hacky way to get it done:

I think you would have to create a quick application that holds a web view in the app, that launches to your respective web page.

  • You can write automated tests for this app which will simply land you on your web page
  • You will not have access to elements, like table views, cells, or anything in the XCUIelement tree
  • You will have to do everything based on frames and coordinates

You can determine where all your elements are and set them up as variables and call them like this:

`let myButton = XCUIApplication().windows.element(boundBy: 0).coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.30))`

myButton.tap()

Not ideal but if you want to use swift to learn and move things around its possible

Upvotes: 1

Related Questions