diff options
author | Frederick Muriuki Muriithi | 2024-01-29 10:47:57 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-01-30 07:18:25 +0300 |
commit | e92b61cb38b308f1451d274f5483c5c575c75b14 (patch) | |
tree | 04fa215c5b02fb60d3bfcba8286f7779816702bc | |
parent | 7b99f911afb40a4c9687d39d5c0e62c12558a0ab (diff) | |
download | genenetwork2-e92b61cb38b308f1451d274f5483c5c575c75b14.tar.gz |
Use XPath to specify form, and refine test
Use XPath to pick the form by its ID rather than its numerical
position which can change with the addition of (a) form(s) before the
one we wish to test.
-rw-r--r-- | test/requests/main_web_functionality.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/requests/main_web_functionality.py b/test/requests/main_web_functionality.py index 40336f47..d4dae8b5 100644 --- a/test/requests/main_web_functionality.py +++ b/test/requests/main_web_functionality.py @@ -30,8 +30,13 @@ def check_search_page(host): def check_traits_page(host, traits_url): results = requests.get(host+traits_url) doc = document_fromstring(results.text) - traits_form = doc.forms[1] - assert(traits_form.fields["corr_dataset"] == "HC_M2_0606_P") + traits_forms = doc.xpath('//form[@id="trait_data_form"]') + + assert len(traits_forms) > 0, "Traits' form not found!" + assert len(traits_forms) == 1, "More than one form with the same ID" + traits_form2 = traits_forms[0] + + assert(traits_form2.fields["corr_dataset"] == "HC_M2_0606_P") print("OK") check_page(host, host+traits_url) |