From c2ec55b552a8de16ba098600f0975d28b434b815 Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Sun, 22 Aug 2021 07:11:15 -0700 Subject: [PATCH] add test_description_per_license.py --- test/test_description_per_license.py | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/test_description_per_license.py diff --git a/test/test_description_per_license.py b/test/test_description_per_license.py new file mode 100644 index 0000000..446d2a9 --- /dev/null +++ b/test/test_description_per_license.py @@ -0,0 +1,36 @@ +from test.test_description import TestDescription +from unittest import TestCase +import re + + +class TestDescriptionPerLicense(TestDescription, TestCase): + def test_description_per_license(self): + match = re.compile(r'^(.*)(\s\(\d*\))$') + + self.driver.find_element_by_id('button-for-filter-by-license').click() + + licenseSelectionRow = self.driver.find_element_by_id( + 'licenseSelectionRow' + ) + + inputs = [ + x.get_attribute( + 'id' + ) for x in licenseSelectionRow.find_elements_by_tag_name( + 'input' + ) + ] + + for i, x in enumerate(inputs): + button = self.driver.find_element_by_id( + x).find_element_by_xpath('..') + + license = match.search( + button.find_element_by_tag_name('label').text).group(1) + if i == 0: + self.licenses = license + else: + self.licenses += f', {license}' + + button.click() + self.coalesced_text_test()