Post

Replies

Boosts

Views

Activity

XCTEST a bit trouble on not seeing the statusbar
Hi, I am working on an agent app. The app has a menubarextra. var body: some Scene { MenuBarExtra( "menubarextra", systemImage: "star") { Button("Item 1") { } Button("Item 2") { } Button("Item 3") { } } } I am going to write xctest to click on the icon i created and want to click on the menu next. func testExample() throws { // UI tests must launch the application that they test. let app = XCUIApplication() app.launch() let menuBarsQuery = XCUIApplication().menuBars let favouriteStatusItem = menuBarsQuery.statusItems["Favourite"] favouriteStatusItem.click() menuBarsQuery.menuItems["Item 1"].click() // Use XCTAssert and related functions to verify your tests produce the correct results. } There is a small problem. When the app is not a agent app, the app will start with with its own menu bar. If i am currently on fullscreen, it will swap to the desktop and the menubar will be showing the app's menu bar. In this case, I can see the menubarextra. The test will pass then. When it is in agent app, the above behaviour will not happen. Once I run the test with fullscreen mode of xcode, my screen will still stay on xcode and the statusbar will not be showing. Then the test will response error: -[swiftuitestUITests.MenubarExtraTests testExample] : Element StatusItem, {{1080.0, 6.5}, {34.5, 24.0}}, title: 'Favourite' is not hittable The only solution I can found at the moment is to leave fullscreen first, then run the test. In xctest, is there any way to force the statusbar to show first? Thank you!
1
0
186
4w
Does the tier-0 in app purchase still exist?
Hi, I am looking for a way to implement X-day free trial and then the feature would be locked. User should purchase the in app purchase to unlock the feature after trial period if they wish to continue to use it. From the older post, I can see other people suggest non-consumable tier-0 IAP will should cost nothing. From app store connect, I am not able to find 0 dollar as an option. I can see in apple's storekit documentation. There are officially a free trial subscription. I don't believe this can fit in my use case. Is anyone still able to create free in app purchase ?
0
0
204
Jan ’25