Skip to content

Add support for adding the view hierarchy description as an attachment#1330

Merged
amorde merged 3 commits intomasterfrom
amorde/attach-view-hierarchy-on-failure
Jul 2, 2025
Merged

Add support for adding the view hierarchy description as an attachment#1330
amorde merged 3 commits intomasterfrom
amorde/attach-view-hierarchy-on-failure

Conversation

@amorde
Copy link
Copy Markdown
Contributor

@amorde amorde commented Jul 2, 2025

Adds an environment variable KIF_ATTACHVIEWTREEONFAILURE which, when set to YES, will attach a View Hierarchy.txt attachment to the test results.

The contents are the same as the view hierarchy description that gets printed when KIF_PRINTVIEWTREEONFAILURE is set.

Screenshot 2025-07-02 at 12 42 06 PM

@amorde amorde requested review from congt, kyleve and mjohnson12 July 2, 2025 19:42
printf("%s", [self viewHierarchyDescription].UTF8String);
}

+ (NSString *)viewHierarchyDescription {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

almost all of the changes in this file are to update the print methods to support returning an NSString instead of printing directly via printf

if(traits == UIAccessibilityTraitNone) {
printf("none");
didPrintOne = true;
[components addObject:@"none"];
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while here I simplified the logic a bit to get rid of the didPrintOne = true; stuff

@amorde amorde marked this pull request as ready for review July 2, 2025 19:44
@amorde amorde requested a review from dnkoutso July 2, 2025 19:51
Copy link
Copy Markdown
Contributor

@square-tomb square-tomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. A couple possible copy/paste errors noted.

amorde and others added 2 commits July 2, 2025 13:23
Co-authored-by: Tom Brow <106167956+square-tomb@users.noreply.github.com>
Co-authored-by: Tom Brow <106167956+square-tomb@users.noreply.github.com>
@amorde amorde merged commit ab2dc3d into master Jul 2, 2025
5 checks passed
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.

4 participants