Skip to content

Commit

Permalink
Merge pull request #2812 from SFDO-Tooling/feature/robot_prerelease
Browse files Browse the repository at this point in the history
Feature/robot prerelease
  • Loading branch information
David Glick authored Aug 19, 2021
2 parents 0cd4dff + d2c8fbe commit 1c097ec
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 92 deletions.
24 changes: 11 additions & 13 deletions cumulusci/core/tests/test_salesforce_locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ class TestLocators(unittest.TestCase):
@mock.patch("cumulusci.robotframework.Salesforce.Salesforce.get_latest_api_version")
def test_locators_in_robot_context(self, get_latest_api_version):
"""Verify we can get locators for the current org api version"""
get_latest_api_version.return_value = 50.0
get_latest_api_version.return_value = 53.0

# This instantiates the robot library, mimicking a robot library import.
# We've mocked out the code that would otherwise throw an error since
# we're not running in the context of a robot test. The library should
# return the latest version of the locators.
sf = Salesforce()

expected = "cumulusci.robotframework.locators_50"
expected = "cumulusci.robotframework.locators_53"
actual = sf.locators_module.__name__
message = "expected to load '{}', actually loaded '{}'".format(expected, actual)
self.assertEqual(expected, actual, message)

pass

@mock.patch(
"robot.libraries.BuiltIn.BuiltIn.get_library_instance",
side_effect=RobotNotRunningError(),
Expand All @@ -50,8 +48,8 @@ def test_locators_outside_robot_context(self, builtin_mock):
message = "expected to load '{}', actually loaded '{}'".format(expected, actual)
self.assertEqual(expected, actual, message)

def test_locators_51(self):
"""Verify that locators_51 is a superset of the locators_50
def test_locators_53(self):
"""Verify that locators_53 is a superset of the locators_52
This test is far from perfect, but it should at least flag a
catastrophic error in how locators for a version that augments
Expand All @@ -61,16 +59,16 @@ def test_locators_51(self):
keys from 50.
"""
import cumulusci.robotframework.locators_50 as locators_50
import cumulusci.robotframework.locators_51 as locators_51
import cumulusci.robotframework.locators_52 as locators_52
import cumulusci.robotframework.locators_53 as locators_53

keys_50 = set(locators_50.lex_locators)
keys_51 = set(locators_51.lex_locators)
keys_50 = set(locators_52.lex_locators)
keys_51 = set(locators_53.lex_locators)

self.assertNotEqual(
id(locators_50.lex_locators),
id(locators_51.lex_locators),
"locators_50.lex_locators and locators_51.lex_locators are the same object",
id(locators_52.lex_locators),
id(locators_53.lex_locators),
"locators_52.lex_locators and locators_53.lex_locators are the same object",
)
self.assertTrue(len(keys_50) > 0)
self.assertTrue(keys_50.issubset(keys_51))
28 changes: 0 additions & 28 deletions cumulusci/robotframework/locators_50.py

This file was deleted.

27 changes: 0 additions & 27 deletions cumulusci/robotframework/locators_51.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
lex_locators = {
"actions": "css: ul.oneActionsRibbon",
"actions": "//runtime_platform_actions-actions-ribbon//ul|//ul[contains(concat(' "
"',normalize-space(@class),' '),' oneActionsRibbon ')]",
"app_launcher": {
"app_link": "//one-app-launcher-modal//one-app-launcher-app-tile//a[.='{}']",
"button": "//div[contains(@class,'appLauncher')]//button[//div[contains(@class,'slds-icon-waffle')]]",
Expand All @@ -14,21 +15,21 @@
"div.desktop.container.oneOne.oneAppLayoutHost[data-aura-rendered-by]",
"loading_box": "css: div.auraLoadingBox.oneLoadingBox",
"modal": {
"button": "//div[contains(@class,'uiModal')]//div[contains(@class, "
"'modal-footer') or contains(@class, "
"'inlineFooter')]//button[.//*[text()='{}']]",
"button": "//div[contains(@class,'uiModal')]//button[.='{}']",
"close": "css: button.slds-modal__close",
"error_messages": "css: div.pageLevelErrors ul.errorsList li",
"fade_in": "css: div.slds-fade-in-open",
"has_error": "css: div.pageLevelErrors",
"field_alert": "//div[contains(@class, 'forceFormPageError')]",
"has_error": "css: div.forceFormPageError",
"is_open": "css: div.uiModal div.panel.slds-modal",
"review_alert": "//a[@force-recordediterror_recordediterror and "
'text()="{}"]',
},
"object": {
"button": "css: ul.forceActionsContainer.oneActionsRibbon a[title='{title}']",
"field": "//div[contains(@class, "
"'uiInput')][.//label[contains(@class, "
"'uiLabel')][.//span[text()='{}']]]//*[self::input or "
"self::textarea]",
"button": "//div[contains(@class, "
"'slds-page-header')]//*[self::a[@title='{title}'] or "
"self::button[@name='{title}']]",
"field": "//lightning-input[.//label[text()='{}']]//input",
"field_label": "//label[@for!='' and "
"text()='{}']|//label[@for!=''][./span[text()='{}']]",
"field_lookup_link": "//*[@role='option'][.//*[@title='{}']]",
Expand All @@ -55,26 +56,21 @@
"'slds-page-header__detail-block')][.//span[contains(@class, "
"'slds-form-element__label')][@title='{}']]//span[contains(@class, "
"'uiOutputCheckbox')]//img[@alt='True']",
"field_value_link": "//records-lwc-highlights-panel//force-highlights-details-item[.//*[contains(@class, "
"'slds-text-title') and "
"text()='{}']]//p[contains(@class, "
"'fieldComponent')]//a[text()]",
"field_value_link": "//records-lwc-highlights-panel//force-highlights-details-item[.//*[.='{}']]//a",
"field_value_unchecked": "//li[contains(@class, "
"'slds-page-header__detail-block')][.//span[contains(@class, "
"'slds-form-element__label')][@title='{}']]//span[contains(@class, "
"'uiOutputCheckbox')]//img[@alt='False']",
},
"related": {
"button": "//article[contains(@class, "
"'forceRelatedListCardDesktop')][.//img][.//span[@title='{}']]//a[@title='{}']",
"card": "//article[contains(@class, "
"'forceRelatedListCardDesktop')][.//img][.//span[@title='{}']]",
"count": "//article[contains(@class, "
"'forceRelatedListCardDesktop')][.//img]//span[@title='{}']/following-sibling::span",
"link": "//article[contains(@class, "
"'forceRelatedListCardDesktop')][.//img][.//span[@title='{}']]//*[text()='{}']",
"popup_trigger": "//article[.//span[@title='{}'][//a[text()='{}']]]//div[contains(@class, "
"'forceVirtualAction')]/a",
"button": "//*[@data-component-id='force_relatedListContainer']//article[contains(@class, "
"'slds-card "
"slds-card_boundary')][.//span[@title='{}']]//*[text()='{}']",
"card": "//*[@data-component-id='force_relatedListContainer']//article[.//span[@title='{}']]",
"count": "//*[@data-component-id='force_relatedListContainer']//article//span[@title='{}']/following-sibling::span",
"link": "//*[@data-component-id='force_relatedListContainer']//article[.//span[@title='{}']]//*[text()='{}']",
"popup_trigger": "//*[@data-component-id='force_relatedListContainer']//article[.//span[@title='{}']]//span[text()='Show "
"Actions']",
},
},
"spinner": "css: div.slds-spinner",
Expand Down
5 changes: 5 additions & 0 deletions cumulusci/robotframework/locators_53.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import copy

from cumulusci.robotframework import locators_52

lex_locators = copy.deepcopy(locators_52.lex_locators)

0 comments on commit 1c097ec

Please sign in to comment.