Search code examples
xcodexcode-ui-testingstorekitxcode12

How to use SKTestSession in UI tests? Xcode 12 GM


I added SKTestSession in my UI tests and it loads my .storekit file ok, at least that's what it says. But my store related code cannot be tested because SKProductsRequest never succeeds nor fails. Looks like it doesn't work at all. I use Xcode 12 GM atm.

Here's my code in UI tests' setUpWithError():

if session == nil {
    do {
        session = try SKTestSession(configurationFileNamed: "StoreConfiguration")
    } catch (let e) {
        print("Error: \(e)")
    }
}

Where session is a varin my test class.

When I just run project with .storekit set up in scheme it works just OK. But fails when it comes to UI tests.

So, how to make SKTestSession work in my UI tests?


Solution

  • My bad: I never implemented SKProductsRequestDelegate's method request:didFailWithError: so I got no error. Now I get the error and gonna post another question about it.