-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Editor View Tests #1564
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
Editor View Tests #1564
Conversation
After further investigation, there's some issues with snapshotting NSViews with SwiftUI views. The reason tests are failing right now on this PR is the test runner runs at a different resolution than my machine. To fix this we need a different method for snapshotting NSViews. Either this could be merged into swift-snapshot-testing (or something like it) or we fork that repository and add the necessary requirements for our tests. |
Got a few tests passing 💪 I'll be able to pick this up in a few days |
Closing in favor of implementing automation tests now that #1804 is open. We can do snapshot tests for small components, and automation tests for workflows. |
Description
Creates tests for the editor view,
this is a prerequisite PR for the fix for #1545.This also adds back a few tests that were previously removed,and adds content to the CodeEditUITests target.I've also added a few helper functions for future UI tests that may require snapshot testing or a test workspace to use.It's also important to note the separation between tests. There's tests for the editor view in both the CodeEditTests target and the CodeEditUITests target. The CodeEditTests target performs tests that can be done without user interaction. For example, creating an editor layout with a certain selection or split layout is done in this target. However for testing the focus button and that focusing a tab correctly displays in a workspace environment, the CodeEditUITests target is used as it can perform interaction.
I've also added small helpers in the CodeEditUITests target to do two things:- Disable sandboxing in the UI Testing app (to allow snapshots to be saved and accessed)- Create a consistent screenshot of an element query (often the snapshot method returns inconsistently sized images that appear exactly the same but are different).Also in this PR:
CommandLine
for checking if the app is being run in debug mode. These checks are only enabled in a debug build. These options should be used in interactive UI tests when they're added back.A note about the previous draft status
Instead of waiting for a (as of writing) 3 year old PR to be merged into the snapshot testing library, I've written a small wrapper that generates a consistent image for an
NSView
or SwiftUIView
regardless of what resolution a machine is running on. This results in snapshots that are 1/2 the quality as they were before, but will be deterministic moving forward.Related Issues
Checklist
Screenshots
No UI Changes