From 1384f3c70cab1ef26f3372f7cb4a20b9e7e8e6f7 Mon Sep 17 00:00:00 2001 From: Illia Kharebashvili Date: Thu, 9 Nov 2023 23:13:35 +0200 Subject: [PATCH 1/4] Feat: changed "element" property, added complete information about element --- WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m index 4faaed1ae..32dbebf4f 100644 --- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m @@ -369,12 +369,14 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames if (nil != auditTypeValue) { auditType = valuesToNamesMap[auditTypeValue] ?: [auditTypeValue stringValue]; } + id snapshot = [extractIssueProperty(issue, @"element") lastSnapshot]; + NSDictionary *element = snapshot ? [self.class dictionaryForElement:snapshot recursive:NO] : @{}; + [resultArray addObject:@{ @"detailedDescription": extractIssueProperty(issue, @"detailedDescription") ?: @"", @"compactDescription": extractIssueProperty(issue, @"compactDescription") ?: @"", @"auditType": auditType, - @"element": [extractIssueProperty(issue, @"element") description] ?: @"", - @"elementDescription": [extractIssueProperty(issue, @"element") debugDescription] ?: @"", + @"element": element ?: @{}, }]; return YES; }; From 152e9de1c876872b319c37bf48acb3dec9d29095 Mon Sep 17 00:00:00 2001 From: Illia Kharebashvili Date: Fri, 10 Nov 2023 11:17:49 +0200 Subject: [PATCH 2/4] Returned the previous accessibility result fields, changed the snapshot receiving method --- .../Categories/XCUIApplication+FBHelpers.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m index 32dbebf4f..4c406c3f0 100644 --- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m @@ -369,14 +369,16 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames if (nil != auditTypeValue) { auditType = valuesToNamesMap[auditTypeValue] ?: [auditTypeValue stringValue]; } - id snapshot = [extractIssueProperty(issue, @"element") lastSnapshot]; - NSDictionary *element = snapshot ? [self.class dictionaryForElement:snapshot recursive:NO] : @{}; - + id snapshot = [extractIssueProperty(issue, @"element") fb_takeSnapshot]; + NSDictionary *elementObject = snapshot ? [self.class dictionaryForElement:snapshot recursive:NO] : @{}; + [resultArray addObject:@{ @"detailedDescription": extractIssueProperty(issue, @"detailedDescription") ?: @"", @"compactDescription": extractIssueProperty(issue, @"compactDescription") ?: @"", @"auditType": auditType, - @"element": element ?: @{}, + @"element": [extractIssueProperty(issue, @"element") description] ?: @"", + @"elementDescription": [extractIssueProperty(issue, @"element") debugDescription] ?: @"", + @"elementObject": elementObject ?: @{}, }]; return YES; }; From b9a3ed092975b9c8c49d65f0b788971f90124e96 Mon Sep 17 00:00:00 2001 From: Ilia Kharebashvili Date: Tue, 14 Nov 2023 16:08:01 +0200 Subject: [PATCH 3/4] Moved extracting the element into a separate variable --- WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m index 4c406c3f0..f3058755f 100644 --- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m @@ -369,15 +369,18 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames if (nil != auditTypeValue) { auditType = valuesToNamesMap[auditTypeValue] ?: [auditTypeValue stringValue]; } - id snapshot = [extractIssueProperty(issue, @"element") fb_takeSnapshot]; + + id extractedElement = extractIssueProperty(issue, @"element"); + + id snapshot = [extractedElement fb_takeSnapshot]; NSDictionary *elementObject = snapshot ? [self.class dictionaryForElement:snapshot recursive:NO] : @{}; [resultArray addObject:@{ @"detailedDescription": extractIssueProperty(issue, @"detailedDescription") ?: @"", @"compactDescription": extractIssueProperty(issue, @"compactDescription") ?: @"", @"auditType": auditType, - @"element": [extractIssueProperty(issue, @"element") description] ?: @"", - @"elementDescription": [extractIssueProperty(issue, @"element") debugDescription] ?: @"", + @"element": [extractedElement description] ?: @"", + @"elementDescription": [extractedElement debugDescription] ?: @"", @"elementObject": elementObject ?: @{}, }]; return YES; From 2a0d657506db1539c41df119da8337ae4de5be2e Mon Sep 17 00:00:00 2001 From: Ilia Kharebashvili Date: Thu, 16 Nov 2023 11:49:33 +0200 Subject: [PATCH 4/4] Minor refactoring, property names changed. --- WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m index f3058755f..2656de7d6 100644 --- a/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m @@ -372,8 +372,8 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames id extractedElement = extractIssueProperty(issue, @"element"); - id snapshot = [extractedElement fb_takeSnapshot]; - NSDictionary *elementObject = snapshot ? [self.class dictionaryForElement:snapshot recursive:NO] : @{}; + id elementSnapshot = [extractedElement fb_takeSnapshot]; + NSDictionary *elementAttributes = elementSnapshot ? [self.class dictionaryForElement:elementSnapshot recursive:NO] : @{}; [resultArray addObject:@{ @"detailedDescription": extractIssueProperty(issue, @"detailedDescription") ?: @"", @@ -381,7 +381,7 @@ - (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray *)keyNames @"auditType": auditType, @"element": [extractedElement description] ?: @"", @"elementDescription": [extractedElement debugDescription] ?: @"", - @"elementObject": elementObject ?: @{}, + @"elementAttributes": elementAttributes ?: @{}, }]; return YES; };