Skip to content

Commit 4ca442d

Browse files
authored
Ben/testrail custom fields (#467)
* revert quotes on prefs obj method * add tr endpoints for custom fields; update a test * fix thing that bothers IDEs * missed a str()
1 parent e4c7226 commit 4ca442d

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

modules/page_object_prefs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,14 @@ def click_popup_panel_button(self, field: str) -> BasePage:
394394
self.get_element("panel-popup-button", labels=[field]).click()
395395
return self
396396

397-
def select_https_only_setting(self, option_id: "HttpsOnlyStatus") -> BasePage:
397+
def select_https_only_setting(self, option_id: HttpsOnlyStatus) -> BasePage:
398398
"""
399399
Click the HTTPS Only option given
400400
"""
401401
self.find_in_settings("HTTPS")
402-
self.element_clickable(option_id)
403-
self.click_on(option_id)
404-
self.element_attribute_contains(option_id, "checked", "")
402+
self.element_clickable(str(option_id))
403+
self.click_on(str(option_id))
404+
self.element_attribute_contains(str(option_id), "checked", "")
405405
return self
406406

407407
def set_default_zoom_level(self, zoom_percentage: int) -> BasePage:

modules/testrail.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,21 @@ def get_test_case(self, case_id):
160160
"""Get a given Test Case"""
161161
return self.client.send_get(f"get_case/{case_id}")
162162

163+
def update_cases_in_suite(self, suite_id, case_ids, **kwargs):
164+
"""Given a suite and a list of test cases, update all listed
165+
test cases according to keyword args"""
166+
if not kwargs:
167+
return None
168+
return self.client.send_post(
169+
f"update_cases/{suite_id}", {"case_ids": case_ids, **kwargs}
170+
)
171+
172+
def update_test_case(self, case_id, **kwargs):
173+
"""Given a test case id, update according to keyword args"""
174+
if not kwargs:
175+
return None
176+
return self.client.send_post(f"update_case/{case_id}", **kwargs)
177+
163178
def create_test_run_on_plan_entry(
164179
self, plan_id, entry_id, config_ids, description=None, case_ids=None
165180
):
@@ -235,6 +250,14 @@ def matching_plan_in_milestone(self, testrail_project_id, milestone_id, plan_nam
235250
return self._get_full_plan(plan.get("id"))
236251
return None
237252

253+
def matching_custom_field(self, name):
254+
"""Given a name, return the case_field object that matches (name or label)"""
255+
custom_fields = self._get_case_fields()
256+
for field in custom_fields:
257+
if name in field.get("name") or name in field.get("label"):
258+
return field
259+
return None
260+
238261
def create_new_plan(
239262
self,
240263
testrail_project_id,
@@ -448,6 +471,9 @@ def _get_plans_in_milestone(self, testrail_project_id, milestone_id):
448471
def _get_full_plan(self, plan_id):
449472
return self.client.send_get(f"get_plan/{plan_id}")
450473

474+
def _get_case_fields(self):
475+
return self.client.send_get("get_case_fields")
476+
451477
def _retry_api_call(self, api_call, *args, max_retries=3, delay=5):
452478
"""
453479
Retries the given API call up to max_retries times with a delay between attempts.

tests/password_manager/test_primary_password_triggered_on_about_logins_access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_primary_password_triggered_on_about_logins_access_via_hamburger_menu(
9191

9292
# Verify that about:logins page is accessible after the primary password was entered
9393
driver.switch_to.window(driver.window_handles[0])
94-
assert driver.current_url.startswith("about:logins")
94+
about_logins.url_contains("about:logins")
9595

9696
# Verify that the saved login is visible and accessible in the login list
9797
about_logins.wait.until(

0 commit comments

Comments
 (0)