Install Font on Xcode Cloud UITests

Installing a Custom Font

This App with a custom FONT has been a long and windy road of learning... and it's not done teaching lessons - YET!

A quick backstory:  I attempted to configure an App some years ago with a custom font... but I guess I didn't do it correctly and never installed the custome font locally inside my App's project.  Which of course lead to my conclusion that it did NOT work.  So I came up with a cleaver workaround.

I decided without a custom font - I could use the SF Symbols custom symbol creations and configuration to work around the fonts not working.  This solution had some drawbacks that would take building an actual app and trying to test and use the App before I figured out - it was a poor workaround.

So I second guessed my SF Symbols workaround and tried a custom font ... again.  I guess a year is a long time, and this attempt I found great tutorials on font installation/configuration - and it worked!

It worked on my local machine and my personal iPhone.

It has yet to work on the Xcode Cloud UI-Test suite of machines.  And this is the story of fixing that - I hope!


The numerals 0-19 of the Kaktovik font I need in my calculator App.

Works on my machine

My UI Test ran just fine on the local MacBook M1.  These are the messages that Xcode Cloud is giving me today.

After I've attempted to install & configure the UI Test machines to have the custom font.  I think I did it wrong.  And I will have to double back and check all kinds of things.  So this seems like a good article to write up the learning I may do... you never know, I might pass this way again in the future.

When looking closely at the 4th failure - notice the character glyphs used... this is not my custom font character - looks to be a replacement for a not-found character.  A hint - I did it wrong.

Feedback

I've seen articles encouraging Feedback for issues with Swift and App development.  So after searching and not finding any relevant info on how to configure Xcode Cloud's servers for custome fonts before running UI Test, I thought this issue deserves Apple's attention.

Feedback Assistance: Does Xcode Cloud Build get the projects Fonts for running UI-Test? FB13328484

That seems like a straight forward question to me...

If the answer is no - why NOT?  And how do we developers install a font (or other resources in the project) into the Test Server on Apple's Cloud?

The Apple Dev Forum has one note about the same issue:  XCode Cloud Workflow not including custom fonts and a possible resolution.

"We resolved the issue. Since XCode build runs on a virtual environment we have made use of the "ci_pre_xcodebuild.sh" script file (placed under "ci_scripts" folder of the project) and copying all font files into "~/Library/Fonts" folder. This indirectly installed all the custom fonts in the target machine before the build is generated thus resolving all the font's used within the project (mainly via storyboard) to stay intact. Hope this helps in your projects and also make way to use the "xcode cloud" build workflow."

I tried a similar resolution but I don't feel it is working for me.

I wonder if it is the pre xcodebuild - or POST xcodebuild?  Going to try again.

Apple has created good documentation with examples - but does not address Fonts for UI Tests... yet.  In fact it appears to be missing the Unit Tests & UI Tests phase of Xcode Cloud altogether.  See image to the right.