add test_description_per_license.py

This commit is contained in:
Trent Palmer 2021-08-22 07:11:15 -07:00
parent 206254bf45
commit c2ec55b552
1 changed files with 36 additions and 0 deletions

View File

@ -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()