Skip to content

UI test target support #975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

UI test target support #975

wants to merge 10 commits into from

Conversation

stephencelis
Copy link
Member

When Snapshot Testing added Swift Testing support, it unfortunately broke the ability to use the library in UI test targets, which are incompatible with Swift Testing, and Apple does not appear provide the tools to statically bracket code in UI test targets.

To alleviate the issue, this PR divides Snapshot Testing functionality between a few modules so that a new UISnapshotTesting target can be introduced and depended on instead.

Swift Testing is not compatible with UITest targets at the moment, but
unfortunately `#if canImport` still returns `true`, making it difficult
to ship libraries that provide tools for both `Testing` and `XCTest`,
like the `assertSnapshot`. The previous workarounds we relied on have
stopped working, and so we need a new approach.

In this PR we have introduced a forwards-compatible `SnapshotUITesting`
module that does not rely on any imports of `Testing` internally. We can
then introduce Swift Testing support in the `SnapshotTesting` module,
instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants