Skip to content

Commit 4188803

Browse files
committed
fix(robot): make locator version test resilient to new locator files
The test_locators_in_robot_context test hardcoded the expected locator module name. When not running in a Robot context, the library falls back to the highest-numbered locator file. Use dynamic discovery (same pattern as test_locators_outside_robot_context) instead.
1 parent 3f8fa00 commit 4188803

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cumulusci/robotframework/tests/test_salesforce_locators.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ def test_locators_in_robot_context(self, get_latest_api_version):
1919
# This instantiates the robot library, mimicking a robot library import.
2020
# We've mocked out the code that would otherwise throw an error since
2121
# we're not running in the context of a robot test. The library should
22-
# return the latest version of the locators.
22+
# fall back to the latest version since the mock doesn't reach the
23+
# init path that resolves the API version from the org.
2324
sf = Salesforce()
2425

25-
expected = "cumulusci.robotframework.locators_57"
26+
locator_folder = Path("./cumulusci/robotframework")
27+
locator_modules = sorted(locator_folder.glob("locators_[0-9][0-9].py"))
28+
expected = f"cumulusci.robotframework.{locator_modules[-1].stem}"
29+
2630
actual = sf.locators_module.__name__
2731
message = "expected to load '{}', actually loaded '{}'".format(expected, actual)
2832
assert expected == actual, message

0 commit comments

Comments
 (0)