Skip to content

Commit a7f973b

Browse files
chore: Apply format to the XML source (#316)
1 parent c4cf8a5 commit a7f973b

File tree

1 file changed

+9
-9
lines changed
  • WebDriverAgentMac/WebDriverAgentLib/Utilities

1 file changed

+9
-9
lines changed

WebDriverAgentMac/WebDriverAgentLib/Utilities/FBXPath.m

+9-9
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ + (nullable NSString *)xmlStringWithRootElement:(XCUIElement *)root
114114
return nil;
115115
}
116116

117-
return [self xmlRepresentationWithRootElement:snapshot].XMLString;
117+
return [[self xmlRepresentationWithSnapshot:snapshot] XMLStringWithOptions:NSXMLNodePrettyPrint];
118118
}
119119

120120
+ (NSArray<XCUIElement *> *)matchesWithRootElement:(XCUIElement *)root
@@ -130,8 +130,8 @@ + (nullable NSString *)xmlStringWithRootElement:(XCUIElement *)root
130130
userInfo:@{}];
131131
}
132132

133-
NSXMLElement *rootElement = [self writeXmlWithRootSnapshot:snapshot
134-
indexPath:[AMSnapshotUtils hashWithSnapshot:snapshot]];
133+
NSXMLElement *rootElement = [self makeXmlWithRootSnapshot:snapshot
134+
indexPath:[AMSnapshotUtils hashWithSnapshot:snapshot]];
135135
NSArray<__kindof NSXMLNode *> *matches = [rootElement nodesForXPath:xpathQuery error:&error];
136136
if (nil == matches) {
137137
@throw [NSException exceptionWithName:FBInvalidXPathException
@@ -186,9 +186,9 @@ + (NSArray *)collectMatchingElementsWithNodes:(NSArray<__kindof NSXMLNode *> *)n
186186
: matchingElements.copy;
187187
}
188188

189-
+ (NSXMLDocument *)xmlRepresentationWithRootElement:(id<XCUIElementSnapshot>)root
189+
+ (NSXMLDocument *)xmlRepresentationWithSnapshot:(id<XCUIElementSnapshot>)root
190190
{
191-
NSXMLElement *rootElement = [self writeXmlWithRootSnapshot:root indexPath:nil];
191+
NSXMLElement *rootElement = [self makeXmlWithRootSnapshot:root indexPath:nil];
192192
NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithRootElement:rootElement];
193193
[xmlDoc setVersion:@"1.0"];
194194
[xmlDoc setCharacterEncoding:@"UTF-8"];
@@ -214,8 +214,8 @@ + (void)recordElementAttributes:(NSXMLElement *)node
214214
}
215215
}
216216

217-
+ (NSXMLElement *)writeXmlWithRootSnapshot:(id<XCUIElementSnapshot>)root
218-
indexPath:(nullable NSString *)indexPath
217+
+ (NSXMLElement *)makeXmlWithRootSnapshot:(id<XCUIElementSnapshot>)root
218+
indexPath:(nullable NSString *)indexPath
219219
{
220220
NSString *type = [FBElementTypeTransformer stringWithElementType:root.elementType];
221221
NSXMLElement *rootElement = [NSXMLElement elementWithName:type];
@@ -228,8 +228,8 @@ + (NSXMLElement *)writeXmlWithRootSnapshot:(id<XCUIElementSnapshot>)root
228228
NSString *newIndexPath = (indexPath != nil)
229229
? [AMSnapshotUtils hashWithSnapshot:childSnapshot]
230230
: nil;
231-
NSXMLElement *childElement = [self writeXmlWithRootSnapshot:childSnapshot
232-
indexPath:newIndexPath];
231+
NSXMLElement *childElement = [self makeXmlWithRootSnapshot:childSnapshot
232+
indexPath:newIndexPath];
233233
[rootElement addChild:childElement];
234234
}
235235
return rootElement;

0 commit comments

Comments
 (0)