Skip to content

Commit 5fa0aaa

Browse files
W-11091826 Manage Expenditures Component (#78)
* W-11091826 Manage Expenditures Component * fix failing robot tests * clean up lint Co-authored-by: salesforce-org-metaci[bot] <53311887+salesforce-org-metaci[bot]@users.noreply.github.com>
1 parent 6ebc3db commit 5fa0aaa

7 files changed

Lines changed: 52 additions & 8 deletions

File tree

force-app/main/default/lwc/manageExpenditures/manageExpenditures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const REFRESH_LABEL = "Refresh List";
3636
const SAVE_UPDATES_LABEL = "Save Updates";
3737
const LOADING_ALTERNATIVE_TEXT = "Loading";
3838

39-
export default class ManageExpenditures extends LightningElement(LightningElement) {
39+
export default class ManageExpenditures extends LightningElement {
4040
labels = {
4141
isNotDisbursement: {
4242
warningBanner: {

robot/OutboundFundsNPSP/doc/Keywords.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,20 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">
285285
</td>
286286
</tr>
287287

288+
<tr class="kwrow" id="OutboundFundsNPSP.py.Select Tab">
289+
<td class="kwname">Select Tab</td>
290+
<td class="kwargs">
291+
<i>title</i>
292+
</td>
293+
<td class="kwdoc">
294+
<p>
295+
Switch between different tabs on a record page
296+
like Related, Details, News, Activity and Chatter
297+
Pass title of the tab
298+
</p>
299+
</td>
300+
</tr>
301+
288302
<tr
289303
class="kwrow"
290304
id="OutboundFundsNPSP.py.Generate New String"

robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
import random
33
import string
44
import warnings
5+
import time
56

67
from BaseObjects import BaseOutboundFundsNPSPPage
78
from robot.libraries.BuiltIn import RobotNotRunningError
8-
from locators_52 import outboundfundsnpsp_lex_locators as locators_52
9+
from locators_54 import outboundfundsnpsp_lex_locators as locators_54
910
from locators_51 import outboundfundsnpsp_lex_locators as locators_51
1011
from cumulusci.robotframework.utils import selenium_retry, capture_screenshot_on_error
1112

1213
locators_by_api_version = {
1314
51.0: locators_51, # Spring '21
14-
52.0: locators_52, # Summer '21
15+
54.0: locators_54,
1516
}
1617
# will get populated in _init_locators
1718
outboundfundsnpsp_lex_locators = {}
@@ -240,6 +241,30 @@ def verify_row_count(self, value):
240241
value, count
241242
)
242243

244+
@capture_screenshot_on_error
245+
def select_tab(self, title):
246+
""" Switch between different tabs on a record page like Related, Details, News, Activity and Chatter
247+
Pass title of the tab
248+
"""
249+
tab_found = False
250+
locators = outboundfundsnpsp_lex_locators["tabs"].values()
251+
for i in locators:
252+
locator = i.format(title)
253+
if self.check_if_element_exists(locator):
254+
print(locator)
255+
buttons = self.selenium.get_webelements(locator)
256+
for button in buttons:
257+
print(button)
258+
if button.is_displayed():
259+
print("button displayed is {}".format(button))
260+
self.salesforce._focus(button)
261+
button.click()
262+
time.sleep(5)
263+
tab_found = True
264+
break
265+
266+
assert tab_found, "tab not found"
267+
243268
@capture_screenshot_on_error
244269
def select_value_from_picklist(self, dropdown, value):
245270
"""Select given value in the dropdown field"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
""" Locators for Spring '21 """
22

3-
from locators_52 import outboundfundsnpsp_lex_locators
3+
from locators_54 import outboundfundsnpsp_lex_locators
44
import copy
55

66
outboundfundsnpsp_lex_locators = copy.deepcopy(outboundfundsnpsp_lex_locators)

robot/OutboundFundsNPSP/resources/locators_52.py renamed to robot/OutboundFundsNPSP/resources/locators_54.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Summer '21 locators
1+
# Spring '22 locators
22
outboundfundsnpsp_lex_locators = {
33
"app_launcher": {
44
"view_all_button": "//button[text()='View All']",
@@ -13,7 +13,7 @@
1313
"edit_title": "//h2[contains(@class, 'title') and text()='{}']",
1414
"list": "//div[contains(@class,'forcePageBlockSectionRow')]/div[contains(@class,'forcePageBlockItem')]/div[contains(@class,'slds-hint-parent')]/div[@class='slds-form-element__control']/div[.//span[text()='{}']][//div[contains(@class,'uiMenu')]//a[@class='select']]",
1515
"text_field": "//div[contains(@class, 'uiInput')][.//label[contains(@class, 'uiLabel')][.//span[text()='{}']]]//*[self::input or self::textarea]",
16-
"dropdown_field": "//lightning-combobox[./label[text()='{}']]/div//input[contains(@class,'combobox__input')]",
16+
"dropdown_field": "//lightning-combobox[./label[text()='{}']]/div//button[contains(@class,'slds-combobox__input')]",
1717
"dropdown_popup": "//div[contains(@class, 'slds-dropdown-trigger')]/div[contains(@class, 'slds-listbox')]",
1818
"dropdown_value": "//div[contains(@class,'slds-listbox')]//lightning-base-combobox-item//span[text()='{}']",
1919
"dd_selection": "//lightning-base-combobox-item[@data-value='{}']",
@@ -39,6 +39,10 @@
3939
"verify_header": "//div[contains(@class, 'entityNameTitle')]",
4040
"verify_details": "//div[contains(@class, 'slds-form-element')][.//span[text()='{}']]//following-sibling::div[.//span[contains(@class, 'test-id__field-value')]]/span",
4141
},
42+
"tabs": {
43+
"tab": "//div[@class='uiTabBar']/ul[@class='tabs__nav']/li[contains(@class,'uiTabItem')]/a[@class='tabHeader']/span[contains(text(), '{}')]",
44+
"spl-tab": "//div[@class='slds-tabs_default']//ul[@class='slds-tabs_default__nav']/li[contains(@class,'slds-tabs_default__item')]/a[text()= '{}']",
45+
},
4246
"related": {
4347
"title": '//div[contains(@class, "slds-card")]/header[.//span[@title="{}"]]',
4448
"button": "//div[contains(@class, 'forceRelatedListSingleContainer')][.//img][.//span[@title='{}']]//a[@title='{}']",

robot/OutboundFundsNPSP/tests/browser/Requirements/Requirements.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ Add a Requirement on a Funding Request
4545
Click Save
4646
wait until modal is closed
4747
Click Related List Link With Text ${req_name}
48+
Select Tab Details
4849
Validate Field Value Requirement Name contains ${req_name}
4950
Validate Field Value Primary Contact contains ${contact}[Name]

robot/OutboundFundsNPSP/tests/create_contact.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ Validate Contact
4141
Page Should Contain ${first_name} ${last_name}
4242
# Validate via API
4343
&{contact} = Salesforce Get Contact ${contact_id}
44-
Should Be Equal ${first_name} &{contact}[FirstName]
45-
Should Be Equal ${last_name} &{contact}[LastName]
44+
Should Be Equal ${first_name} ${contact['FirstName']}
45+
Should Be Equal ${last_name} ${contact['LastName']}

0 commit comments

Comments
 (0)