mirror of
https://github.com/TrentSPalmer/hugo_themes_report.git
synced 2025-04-13 01:52:48 -07:00
fix deprecated find_elements_by* and find_element_by*
This commit is contained in:
parent
1aabfdbcce
commit
5895102451
test
test_description.pytest_description_per_features.pytest_description_per_license.pytest_description_per_min_hugo_version.pytest_description_per_more_columns.pytest_description_per_sort_by.pytest_description_per_tags.pytest_filterby_features.pytest_filterby_license.pytest_filterby_minver.pytest_filterby_tags.pytest_minus_button.pytest_multiple_filters.pytest_plus_button.pytest_scroll.pytest_selection_options_menu.pytest_selenium.pytest_showing_columns.pytest_sort_by.pytest_title.py
@ -1,12 +1,13 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescription(TestSelenium, TestCase):
|
class TestDescription(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestDescription, self).setUp()
|
super(TestDescription, self).setUp()
|
||||||
self.plus_button = self.driver.find_element_by_id('plus-button')
|
self.plus_button = self.driver.find_element(By.ID, 'plus-button')
|
||||||
self.desc = self.driver.find_element_by_id('description')
|
self.desc = self.driver.find_element(By.ID, 'description')
|
||||||
self.tp_ShowingColumns = "ShowingColumns: "
|
self.tp_ShowingColumns = "ShowingColumns: "
|
||||||
self.tp_SortedBy = "; SortedBy: "
|
self.tp_SortedBy = "; SortedBy: "
|
||||||
self.tp_Minver = "; FilteredBy: MinHugoVersion="
|
self.tp_Minver = "; FilteredBy: MinHugoVersion="
|
||||||
|
@ -1,67 +1,69 @@
|
|||||||
|
import re
|
||||||
|
from secrets import choice
|
||||||
from test.test_description import TestDescription
|
from test.test_description import TestDescription
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from secrets import choice
|
|
||||||
import re
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescriptionPerFeatures(TestDescription, TestCase):
|
class TestDescriptionPerFeatures(TestDescription, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestDescriptionPerFeatures, self).setUp()
|
super(TestDescriptionPerFeatures, self).setUp()
|
||||||
self.driver.find_element_by_id('button-for-filter-by-features').click()
|
self.driver.find_element(By.ID, 'button-for-filter-by-features').click()
|
||||||
self.match = re.compile(r'^(.*)(\s\(\d*\))$')
|
self.match = re.compile(r'^(.*)(\s\(\d*\))$')
|
||||||
|
|
||||||
def test_description_per_features(self):
|
def test_description_per_features(self):
|
||||||
featureSelectionRow = self.driver.find_element_by_id(
|
featureSelectionRow = self.driver.find_element(
|
||||||
'featureSelectionRow')
|
By.ID, 'featureSelectionRow')
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
x.get_attribute(
|
x.get_attribute(
|
||||||
'id'
|
'id'
|
||||||
) for x in featureSelectionRow.find_elements_by_tag_name(
|
) for x in featureSelectionRow.find_elements(
|
||||||
'input'
|
By.TAG_NAME, 'input'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for x in inputs:
|
for x in inputs:
|
||||||
button = self.driver.find_element_by_id(
|
button = self.driver.find_element(
|
||||||
x).find_element_by_xpath('..')
|
By.ID, x).find_element(By.XPATH, '..')
|
||||||
|
|
||||||
self.features = self.match.search(
|
self.features = self.match.search(
|
||||||
button.find_element_by_tag_name('label').text).group(1)
|
button.find_element(By.TAG_NAME, 'label').text).group(1)
|
||||||
|
|
||||||
button.click()
|
button.click()
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
x).find_element_by_xpath('..').click()
|
By.ID, x).find_element(By.XPATH, '..').click()
|
||||||
|
|
||||||
def test_description_per_features_random(self):
|
def test_description_per_features_random(self):
|
||||||
self.randomly_select_feature()
|
self.randomly_select_feature()
|
||||||
|
|
||||||
def randomly_select_feature(self):
|
def randomly_select_feature(self):
|
||||||
featureSelectionRow = self.driver.find_element_by_id(
|
featureSelectionRow = self.driver.find_element(
|
||||||
'featureSelectionRow')
|
By.ID, 'featureSelectionRow')
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
x.get_attribute(
|
x.get_attribute(
|
||||||
'id'
|
'id'
|
||||||
) for x in featureSelectionRow.find_elements_by_tag_name(
|
) for x in featureSelectionRow.find_elements(
|
||||||
'input'
|
By.TAG_NAME, 'input'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
unchecked_inputs = [
|
unchecked_inputs = [
|
||||||
x for x in inputs if self.driver.find_element_by_id(
|
x for x in inputs if self.driver.find_element(
|
||||||
x).is_selected() is False
|
By.ID, x).is_selected() is False
|
||||||
]
|
]
|
||||||
|
|
||||||
if len(unchecked_inputs) > 0:
|
if len(unchecked_inputs) > 0:
|
||||||
random_input = choice(unchecked_inputs)
|
random_input = choice(unchecked_inputs)
|
||||||
button = self.driver.find_element_by_id(
|
button = self.driver.find_element(
|
||||||
random_input).find_element_by_xpath('..')
|
By.ID, random_input).find_element(By.XPATH, '..')
|
||||||
|
|
||||||
feature = self.match.search(
|
feature = self.match.search(
|
||||||
button.find_element_by_tag_name('label').text).group(1)
|
button.find_element(By.TAG_NAME, 'label').text).group(1)
|
||||||
|
|
||||||
button.click()
|
button.click()
|
||||||
|
|
||||||
|
@ -1,32 +1,34 @@
|
|||||||
|
import re
|
||||||
from test.test_description import TestDescription
|
from test.test_description import TestDescription
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
import re
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescriptionPerLicense(TestDescription, TestCase):
|
class TestDescriptionPerLicense(TestDescription, TestCase):
|
||||||
def test_description_per_license(self):
|
def test_description_per_license(self):
|
||||||
match = re.compile(r'^(.*)(\s\(\d*\))$')
|
match = re.compile(r'^(.*)(\s\(\d*\))$')
|
||||||
|
|
||||||
self.driver.find_element_by_id('button-for-filter-by-license').click()
|
self.driver.find_element(By.ID, 'button-for-filter-by-license').click()
|
||||||
|
|
||||||
licenseSelectionRow = self.driver.find_element_by_id(
|
licenseSelectionRow = self.driver.find_element(
|
||||||
'licenseSelectionRow'
|
By.ID, 'licenseSelectionRow'
|
||||||
)
|
)
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
x.get_attribute(
|
x.get_attribute(
|
||||||
'id'
|
'id'
|
||||||
) for x in licenseSelectionRow.find_elements_by_tag_name(
|
) for x in licenseSelectionRow.find_elements(
|
||||||
'input'
|
By.TAG_NAME, 'input'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for i, x in enumerate(inputs):
|
for i, x in enumerate(inputs):
|
||||||
button = self.driver.find_element_by_id(
|
button = self.driver.find_element(
|
||||||
x).find_element_by_xpath('..')
|
By.ID, x).find_element(By.XPATH, '..')
|
||||||
|
|
||||||
license = match.search(
|
license = match.search(
|
||||||
button.find_element_by_tag_name('label').text).group(1)
|
button.find_element(By.TAG_NAME, 'label').text).group(1)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
self.licenses = license
|
self.licenses = license
|
||||||
else:
|
else:
|
||||||
|
@ -1,29 +1,31 @@
|
|||||||
from test.test_description import TestDescription
|
from test.test_description import TestDescription
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescriptionPerMinHugoVersion(TestDescription, TestCase):
|
class TestDescriptionPerMinHugoVersion(TestDescription, TestCase):
|
||||||
def test_description_per_min_hugo_version(self):
|
def test_description_per_min_hugo_version(self):
|
||||||
|
|
||||||
self.driver.find_element_by_id('button-for-filter-by-minver').click()
|
self.driver.find_element(By.ID, 'button-for-filter-by-minver').click()
|
||||||
|
|
||||||
minVerSelectionRow = self.driver.find_element_by_id(
|
minVerSelectionRow = self.driver.find_element(
|
||||||
'minVerSelectionRow'
|
By.ID, 'minVerSelectionRow'
|
||||||
)
|
)
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
x.get_attribute(
|
x.get_attribute(
|
||||||
'id'
|
'id'
|
||||||
) for x in minVerSelectionRow.find_elements_by_tag_name(
|
) for x in minVerSelectionRow.find_elements(
|
||||||
'input'
|
By.TAG_NAME, 'input'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for x in inputs:
|
for x in inputs:
|
||||||
button = self.driver.find_element_by_id(
|
button = self.driver.find_element(
|
||||||
x).find_element_by_xpath('..')
|
By.ID, x).find_element(By.XPATH, '..')
|
||||||
|
|
||||||
self.min_ver = button.find_element_by_tag_name('label').text
|
self.min_ver = button.find_element(By.TAG_NAME, 'label').text
|
||||||
|
|
||||||
button.click()
|
button.click()
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
@ -1,64 +1,65 @@
|
|||||||
from test.test_description import TestDescription
|
from test.test_description import TestDescription
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescriptionPerMoreColumns(TestDescription, TestCase):
|
class TestDescriptionPerMoreColumns(TestDescription, TestCase):
|
||||||
def test_description_per_more_columns(self):
|
def test_description_per_more_columns(self):
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(By.ID, 'button-for-showing-columns').click()
|
||||||
'button-for-showing-columns').click()
|
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'commit-column-selection-input'
|
By.ID, 'commit-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars"
|
self.columns = "theme, date, stars"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'num_stars-column-selection-input'
|
By.ID, 'num_stars-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date"
|
self.columns = "theme, date"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'date-column-selection-input'
|
By.ID, 'date-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme"
|
self.columns = "theme"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'cname-column-selection-input'
|
By.ID, 'cname-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars, commit"
|
self.columns = "theme, date, stars, commit"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'min_ver-column-selection-input'
|
By.ID, 'min_ver-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars, commit, minVer"
|
self.columns = "theme, date, stars, commit, minVer"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'license-column-selection-input'
|
By.ID, 'license-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars, commit, minVer, license"
|
self.columns = "theme, date, stars, commit, minVer, license"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'desc-column-selection-input'
|
By.ID, 'desc-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars, commit, minVer, license, desc"
|
self.columns = "theme, date, stars, commit, minVer, license, desc"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'tags-column-selection-input'
|
By.ID, 'tags-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars, commit, minVer, license, desc, "\
|
self.columns = "theme, date, stars, commit, minVer, license, desc, "\
|
||||||
"tags"
|
"tags"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'features-column-selection-input'
|
By.ID, 'features-column-selection-input'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.columns = "theme, date, stars, commit, minVer, license, desc, "\
|
self.columns = "theme, date, stars, commit, minVer, license, desc, "\
|
||||||
"tags, features"
|
"tags, features"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
@ -1,37 +1,39 @@
|
|||||||
from test.test_description import TestDescription
|
from test.test_description import TestDescription
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescriptionPerSortBy(TestDescription, TestCase):
|
class TestDescriptionPerSortBy(TestDescription, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestDescriptionPerSortBy, self).setUp()
|
super(TestDescriptionPerSortBy, self).setUp()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'button-for-showing-sort-option').click()
|
By.ID, 'button-for-showing-sort-option').click()
|
||||||
|
|
||||||
def test_description_per_sort_by_stars(self):
|
def test_description_per_sort_by_stars(self):
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'sortByStars'
|
By.ID, 'sortByStars'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.sorted_by = "stars, date, name, minVer, license"
|
self.sorted_by = "stars, date, name, minVer, license"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
def test_description_per_sort_by_License(self):
|
def test_description_per_sort_by_License(self):
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'sortByLicense'
|
By.ID, 'sortByLicense'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.sorted_by = "license, date, stars, name, minVer"
|
self.sorted_by = "license, date, stars, name, minVer"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
def test_description_per_sort_by_minVer(self):
|
def test_description_per_sort_by_minVer(self):
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'sortByMinVer'
|
By.ID, 'sortByMinVer'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.sorted_by = "minVer, date, stars, name, license"
|
self.sorted_by = "minVer, date, stars, name, license"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
def test_description_per_sort_by_name(self):
|
def test_description_per_sort_by_name(self):
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'sortByName'
|
By.ID, 'sortByName'
|
||||||
).find_element_by_xpath('..').click()
|
).find_element(By.XPATH, '..').click()
|
||||||
self.sorted_by = "name, date, stars, minVer, license"
|
self.sorted_by = "name, date, stars, minVer, license"
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
@ -1,67 +1,69 @@
|
|||||||
|
import re
|
||||||
|
from secrets import choice
|
||||||
from test.test_description import TestDescription
|
from test.test_description import TestDescription
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from secrets import choice
|
|
||||||
import re
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestDescriptionPerTags(TestDescription, TestCase):
|
class TestDescriptionPerTags(TestDescription, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestDescriptionPerTags, self).setUp()
|
super(TestDescriptionPerTags, self).setUp()
|
||||||
self.driver.find_element_by_id('button-for-filter-by-tags').click()
|
self.driver.find_element(By.ID, 'button-for-filter-by-tags').click()
|
||||||
self.match = re.compile(r'^(.*)(\s\(\d*\))$')
|
self.match = re.compile(r'^(.*)(\s\(\d*\))$')
|
||||||
|
|
||||||
def test_description_per_tags(self):
|
def test_description_per_tags(self):
|
||||||
tagSelectionRow = self.driver.find_element_by_id(
|
tagSelectionRow = self.driver.find_element(
|
||||||
'tagSelectionRow')
|
By.ID, 'tagSelectionRow')
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
x.get_attribute(
|
x.get_attribute(
|
||||||
'id'
|
'id'
|
||||||
) for x in tagSelectionRow.find_elements_by_tag_name(
|
) for x in tagSelectionRow.find_elements(
|
||||||
'input'
|
By.TAG_NAME, 'input'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
for x in inputs:
|
for x in inputs:
|
||||||
button = self.driver.find_element_by_id(
|
button = self.driver.find_element(
|
||||||
x).find_element_by_xpath('..')
|
By.ID, x).find_element(By.XPATH, '..')
|
||||||
|
|
||||||
self.tags = self.match.search(
|
self.tags = self.match.search(
|
||||||
button.find_element_by_tag_name('label').text).group(1)
|
button.find_element(By.TAG_NAME, 'label').text).group(1)
|
||||||
|
|
||||||
button.click()
|
button.click()
|
||||||
self.coalesced_text_test()
|
self.coalesced_text_test()
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
x).find_element_by_xpath('..').click()
|
By.ID, x).find_element(By.XPATH, '..').click()
|
||||||
|
|
||||||
def test_description_per_tags_random(self):
|
def test_description_per_tags_random(self):
|
||||||
self.randomly_select_tag()
|
self.randomly_select_tag()
|
||||||
|
|
||||||
def randomly_select_tag(self):
|
def randomly_select_tag(self):
|
||||||
tagSelectionRow = self.driver.find_element_by_id(
|
tagSelectionRow = self.driver.find_element(
|
||||||
'tagSelectionRow')
|
By.ID, 'tagSelectionRow')
|
||||||
|
|
||||||
inputs = [
|
inputs = [
|
||||||
x.get_attribute(
|
x.get_attribute(
|
||||||
'id'
|
'id'
|
||||||
) for x in tagSelectionRow.find_elements_by_tag_name(
|
) for x in tagSelectionRow.find_elements(
|
||||||
'input'
|
By.TAG_NAME, 'input'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
unchecked_inputs = [
|
unchecked_inputs = [
|
||||||
x for x in inputs if self.driver.find_element_by_id(
|
x for x in inputs if self.driver.find_element(
|
||||||
x).is_selected() is False
|
By.ID, x).is_selected() is False
|
||||||
]
|
]
|
||||||
|
|
||||||
if len(unchecked_inputs) > 0:
|
if len(unchecked_inputs) > 0:
|
||||||
random_input = choice(unchecked_inputs)
|
random_input = choice(unchecked_inputs)
|
||||||
button = self.driver.find_element_by_id(
|
button = self.driver.find_element(
|
||||||
random_input).find_element_by_xpath('..')
|
By.ID, random_input).find_element(By.XPATH, '..')
|
||||||
|
|
||||||
tag = self.match.search(
|
tag = self.match.search(
|
||||||
button.find_element_by_tag_name('label').text).group(1)
|
button.find_element(By.TAG_NAME, 'label').text).group(1)
|
||||||
|
|
||||||
button.click()
|
button.click()
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
from ast import literal_eval
|
||||||
|
from test.database import get_themes_orderedby_cname
|
||||||
|
from test.test_filterby_tags import MATCH
|
||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from test.database import get_themes_orderedby_cname
|
|
||||||
from ast import literal_eval
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from test.test_filterby_tags import MATCH
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestFilterByFeatures(TestSelenium, TestCase):
|
class TestFilterByFeatures(TestSelenium, TestCase):
|
||||||
@ -17,22 +19,22 @@ class TestFilterByFeatures(TestSelenium, TestCase):
|
|||||||
'sortByName',
|
'sortByName',
|
||||||
'button-for-filter-by-features',
|
'button-for-filter-by-features',
|
||||||
]:
|
]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
|
|
||||||
def test_filterby_features(self):
|
def test_filterby_features(self):
|
||||||
filterby_features_inputs = self.get_filter_by_features_inputs()
|
filterby_features_inputs = self.get_filter_by_features_inputs()
|
||||||
|
|
||||||
for feature in filterby_features_inputs:
|
for feature in filterby_features_inputs:
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{feature}-feature-selection-input").click()
|
By.ID, f"{feature}-feature-selection-input").click()
|
||||||
|
|
||||||
self.themes = [x for x in get_themes_orderedby_cname() if
|
self.themes = [x for x in get_themes_orderedby_cname() if
|
||||||
x.features_list is not None and feature
|
x.features_list is not None and feature
|
||||||
in literal_eval(x.features_list)]
|
in literal_eval(x.features_list)]
|
||||||
self.update_features_available()
|
self.update_features_available()
|
||||||
|
|
||||||
featureSelectionRow = self.driver.find_element_by_id(
|
featureSelectionRow = self.driver.find_element(
|
||||||
'featureSelectionRow')
|
By.ID, 'featureSelectionRow')
|
||||||
buttons = BeautifulSoup(
|
buttons = BeautifulSoup(
|
||||||
featureSelectionRow.get_attribute(
|
featureSelectionRow.get_attribute(
|
||||||
'innerHTML'), features='lxml').findAll('button')
|
'innerHTML'), features='lxml').findAll('button')
|
||||||
@ -47,7 +49,7 @@ class TestFilterByFeatures(TestSelenium, TestCase):
|
|||||||
self.features_available[button_feature]['num_themes']
|
self.features_available[button_feature]['num_themes']
|
||||||
)
|
)
|
||||||
|
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = BeautifulSoup(results_table_div.get_attribute(
|
rows = BeautifulSoup(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
@ -73,13 +75,13 @@ class TestFilterByFeatures(TestSelenium, TestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{feature}-feature-selection-input").click()
|
By.ID, f"{feature}-feature-selection-input").click()
|
||||||
|
|
||||||
def get_filter_by_features_inputs(self):
|
def get_filter_by_features_inputs(self):
|
||||||
div = self.driver.find_element_by_id('featureSelectionRow')
|
div = self.driver.find_element(By.ID, 'featureSelectionRow')
|
||||||
return [x.get_attribute('id')[:-24]
|
return [x.get_attribute('id')[:-24]
|
||||||
for x in div.find_elements_by_tag_name('input')]
|
for x in div.find_elements(By.TAG_NAME, 'input')]
|
||||||
|
|
||||||
def update_features_available(self):
|
def update_features_available(self):
|
||||||
self.features_available = {}
|
self.features_available = {}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
from test.database import get_themes_orderedby_cname
|
||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from test.database import get_themes_orderedby_cname
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestFilterByLicense(TestSelenium, TestCase):
|
class TestFilterByLicense(TestSelenium, TestCase):
|
||||||
@ -15,21 +17,21 @@ class TestFilterByLicense(TestSelenium, TestCase):
|
|||||||
'sortByName',
|
'sortByName',
|
||||||
'button-for-filter-by-license',
|
'button-for-filter-by-license',
|
||||||
]:
|
]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
self.themes = get_themes_orderedby_cname()
|
self.themes = get_themes_orderedby_cname()
|
||||||
|
|
||||||
def test_filter_by_license(self):
|
def test_filter_by_license(self):
|
||||||
filterby_lic_inputs = [x.get_attribute('id')[:-24]
|
filterby_lic_inputs = [x.get_attribute('id')[:-24]
|
||||||
for x in self.driver.find_element_by_id(
|
for x in self.driver.find_element(
|
||||||
'licenseSelectionRow').find_elements_by_tag_name('input')]
|
By.ID, 'licenseSelectionRow').find_elements(By.TAG_NAME, 'input')]
|
||||||
|
|
||||||
for license in filterby_lic_inputs:
|
for license in filterby_lic_inputs:
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{license}-license-selection-input").click()
|
By.ID, f"{license}-license-selection-input").click()
|
||||||
themes = list(
|
themes = list(
|
||||||
filter(lambda x: x.theme_license == license, self.themes)
|
filter(lambda x: x.theme_license == license, self.themes)
|
||||||
)
|
)
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = BeautifulSoup(results_table_div.get_attribute(
|
rows = BeautifulSoup(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
@ -47,5 +49,5 @@ class TestFilterByLicense(TestSelenium, TestCase):
|
|||||||
themes[i].theme_license,
|
themes[i].theme_license,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{license}-license-selection-input").click()
|
By.ID, f"{license}-license-selection-input").click()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
from test.test_selenium import TestSelenium
|
|
||||||
from unittest import TestCase
|
|
||||||
from test.database import get_themes_orderedby_cname
|
from test.database import get_themes_orderedby_cname
|
||||||
from test.theme_compare import semver_split, compare_jk
|
from test.test_selenium import TestSelenium
|
||||||
|
from test.theme_compare import compare_jk, semver_split
|
||||||
|
from unittest import TestCase
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
|
||||||
@ -16,17 +18,17 @@ class TestFilterByMinVer(TestSelenium, TestCase):
|
|||||||
'sortByName',
|
'sortByName',
|
||||||
'button-for-filter-by-minver',
|
'button-for-filter-by-minver',
|
||||||
]:
|
]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
self.themes = get_themes_orderedby_cname()
|
self.themes = get_themes_orderedby_cname()
|
||||||
|
|
||||||
def test_filter_by_min_ver(self):
|
def test_filter_by_min_ver(self):
|
||||||
filterby_mv_inputs = [x.get_attribute('id')[0:-33]
|
filterby_mv_inputs = [x.get_attribute('id')[0:-33]
|
||||||
for x in self.driver.find_element_by_id(
|
for x in self.driver.find_element(
|
||||||
'minVerSelectionRow').find_elements_by_tag_name('input')]
|
By.ID, 'minVerSelectionRow').find_elements(By.TAG_NAME, 'input')]
|
||||||
|
|
||||||
for m_ver in filterby_mv_inputs:
|
for m_ver in filterby_mv_inputs:
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f'{m_ver}-select-minver-radio-button-input').click()
|
By.ID, f'{m_ver}-select-minver-radio-button-input').click()
|
||||||
if m_ver == 'none':
|
if m_ver == 'none':
|
||||||
themes = self.themes
|
themes = self.themes
|
||||||
else:
|
else:
|
||||||
@ -38,7 +40,7 @@ class TestFilterByMinVer(TestSelenium, TestCase):
|
|||||||
) != 1, self.themes
|
) != 1, self.themes
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = BeautifulSoup(results_table_div.get_attribute(
|
rows = BeautifulSoup(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ from test.database import get_themes_orderedby_cname
|
|||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import re
|
import re
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
MATCH = re.compile(r'^(.*)(\s\(\d*\))$')
|
MATCH = re.compile(r'^(.*)(\s\(\d*\))$')
|
||||||
|
|
||||||
|
|
||||||
@ -18,22 +19,22 @@ class TestFilterByTags(TestSelenium, TestCase):
|
|||||||
'sortByName',
|
'sortByName',
|
||||||
'button-for-filter-by-tags',
|
'button-for-filter-by-tags',
|
||||||
]:
|
]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
self.themes = get_themes_orderedby_cname()
|
self.themes = get_themes_orderedby_cname()
|
||||||
|
|
||||||
def test_filter_by_tags(self):
|
def test_filter_by_tags(self):
|
||||||
filterby_tags_inputs = self.get_filter_by_tags_inputs()
|
filterby_tags_inputs = self.get_filter_by_tags_inputs()
|
||||||
|
|
||||||
for tag in filterby_tags_inputs:
|
for tag in filterby_tags_inputs:
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{tag}-tag-selection-input").click()
|
By.ID, f"{tag}-tag-selection-input").click()
|
||||||
|
|
||||||
themes = [x for x in self.themes if
|
themes = [x for x in self.themes if
|
||||||
x.tags_list is not None and tag
|
x.tags_list is not None and tag
|
||||||
in literal_eval(x.tags_list)]
|
in literal_eval(x.tags_list)]
|
||||||
self.update_tags_available(themes)
|
self.update_tags_available(themes)
|
||||||
|
|
||||||
tagSelectionRow = self.driver.find_element_by_id('tagSelectionRow')
|
tagSelectionRow = self.driver.find_element(By.ID, 'tagSelectionRow')
|
||||||
buttons = BeautifulSoup(
|
buttons = BeautifulSoup(
|
||||||
tagSelectionRow.get_attribute(
|
tagSelectionRow.get_attribute(
|
||||||
'innerHTML'), features='lxml').findAll('button')
|
'innerHTML'), features='lxml').findAll('button')
|
||||||
@ -50,7 +51,7 @@ class TestFilterByTags(TestSelenium, TestCase):
|
|||||||
self.tags_available[button_tag]['num_themes']
|
self.tags_available[button_tag]['num_themes']
|
||||||
)
|
)
|
||||||
|
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = BeautifulSoup(results_table_div.get_attribute(
|
rows = BeautifulSoup(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
@ -75,13 +76,13 @@ class TestFilterByTags(TestSelenium, TestCase):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{tag}-tag-selection-input").click()
|
By.ID, f"{tag}-tag-selection-input").click()
|
||||||
|
|
||||||
def get_filter_by_tags_inputs(self):
|
def get_filter_by_tags_inputs(self):
|
||||||
div = self.driver.find_element_by_id('tagSelectionRow')
|
div = self.driver.find_element(By.ID, 'tagSelectionRow')
|
||||||
return [x.get_attribute('id')[:-20]
|
return [x.get_attribute('id')[:-20]
|
||||||
for x in div.find_elements_by_tag_name('input')]
|
for x in div.find_elements(By.TAG_NAME, 'input')]
|
||||||
|
|
||||||
def update_tags_available(self, themes):
|
def update_tags_available(self, themes):
|
||||||
self.tags_available = {}
|
self.tags_available = {}
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestMinusButton(TestSelenium, TestCase):
|
class TestMinusButton(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestMinusButton, self).setUp()
|
super(TestMinusButton, self).setUp()
|
||||||
self.plus_button = self.driver.find_element_by_id('plus-button')
|
self.plus_button = self.driver.find_element(By.ID, 'plus-button')
|
||||||
self.minus_button = self.driver.find_element_by_id('minus-button')
|
self.minus_button = self.driver.find_element(By.ID, 'minus-button')
|
||||||
self.selection_options_menu = self.driver.find_element_by_id(
|
self.selection_options_menu = self.driver.find_element(
|
||||||
'selection-options-menu')
|
By.ID, 'selection-options-menu')
|
||||||
|
|
||||||
def test_minus_button_props(self):
|
def test_minus_button_props(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from ast import literal_eval
|
||||||
from unittest import TestCase
|
|
||||||
from secrets import choice
|
from secrets import choice
|
||||||
from test.database import get_themes_orderedby_cname
|
from test.database import get_themes_orderedby_cname
|
||||||
from ast import literal_eval
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
from test.test_filterby_tags import MATCH
|
from test.test_filterby_tags import MATCH
|
||||||
|
from test.test_selenium import TestSelenium
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestMultipleFilters(TestSelenium, TestCase):
|
class TestMultipleFilters(TestSelenium, TestCase):
|
||||||
@ -20,7 +22,7 @@ class TestMultipleFilters(TestSelenium, TestCase):
|
|||||||
'sortByName',
|
'sortByName',
|
||||||
'button-for-filter-by-features',
|
'button-for-filter-by-features',
|
||||||
]:
|
]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
self.current_filter = 'features'
|
self.current_filter = 'features'
|
||||||
self.selected_tags = []
|
self.selected_tags = []
|
||||||
self.selected_features = []
|
self.selected_features = []
|
||||||
@ -32,7 +34,7 @@ class TestMultipleFilters(TestSelenium, TestCase):
|
|||||||
self.check_table_contents()
|
self.check_table_contents()
|
||||||
|
|
||||||
def check_table_contents(self):
|
def check_table_contents(self):
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = BeautifulSoup(results_table_div.get_attribute(
|
rows = BeautifulSoup(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
@ -95,16 +97,16 @@ class TestMultipleFilters(TestSelenium, TestCase):
|
|||||||
tc_from_button, tc_from_selfdotthemes, msg=feature_from_button)
|
tc_from_button, tc_from_selfdotthemes, msg=feature_from_button)
|
||||||
|
|
||||||
def update_available_licenses(self):
|
def update_available_licenses(self):
|
||||||
licenseSelectionRow = self.driver.find_element_by_id(
|
licenseSelectionRow = self.driver.find_element(
|
||||||
'licenseSelectionRow')
|
By.ID, 'licenseSelectionRow')
|
||||||
self.license_buttons = BeautifulSoup(
|
self.license_buttons = BeautifulSoup(
|
||||||
licenseSelectionRow.get_attribute('innerHTML'), features='lxml'
|
licenseSelectionRow.get_attribute('innerHTML'), features='lxml'
|
||||||
).findAll('button')
|
).findAll('button')
|
||||||
|
|
||||||
def set_unchecked_features(self):
|
def set_unchecked_features(self):
|
||||||
featureSelectionRow = self.driver.find_element_by_id(
|
featureSelectionRow = self.driver.find_element(
|
||||||
'featureSelectionRow')
|
By.ID, 'featureSelectionRow')
|
||||||
inputs = featureSelectionRow.find_elements_by_tag_name('input')
|
inputs = featureSelectionRow.find_elements(By.TAG_NAME, 'input')
|
||||||
self.unchecked_features = [
|
self.unchecked_features = [
|
||||||
x.get_attribute('id')[:-24] for x in inputs if not x.is_selected()
|
x.get_attribute('id')[:-24] for x in inputs if not x.is_selected()
|
||||||
]
|
]
|
||||||
@ -113,9 +115,9 @@ class TestMultipleFilters(TestSelenium, TestCase):
|
|||||||
).findAll('button')
|
).findAll('button')
|
||||||
|
|
||||||
def set_unchecked_tags(self):
|
def set_unchecked_tags(self):
|
||||||
tagSelectionRow = self.driver.find_element_by_id(
|
tagSelectionRow = self.driver.find_element(
|
||||||
'tagSelectionRow')
|
By.ID, 'tagSelectionRow')
|
||||||
inputs = tagSelectionRow.find_elements_by_tag_name('input')
|
inputs = tagSelectionRow.find_elements(By.TAG_NAME, 'input')
|
||||||
self.unchecked_tags = [
|
self.unchecked_tags = [
|
||||||
x.get_attribute('id')[:-20] for x in inputs if not x.is_selected()
|
x.get_attribute('id')[:-20] for x in inputs if not x.is_selected()
|
||||||
]
|
]
|
||||||
@ -148,29 +150,29 @@ class TestMultipleFilters(TestSelenium, TestCase):
|
|||||||
def check_random_feature(self):
|
def check_random_feature(self):
|
||||||
if len(self.unchecked_features) > 0:
|
if len(self.unchecked_features) > 0:
|
||||||
random_feature = choice(self.unchecked_features[:2])
|
random_feature = choice(self.unchecked_features[:2])
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{random_feature}-feature-selection-input").click()
|
By.ID, f"{random_feature}-feature-selection-input").click()
|
||||||
self.selected_features.append(random_feature)
|
self.selected_features.append(random_feature)
|
||||||
self.update_lists()
|
self.update_lists()
|
||||||
|
|
||||||
def check_random_tag(self):
|
def check_random_tag(self):
|
||||||
if len(self.unchecked_tags) > 0:
|
if len(self.unchecked_tags) > 0:
|
||||||
random_tag = choice(self.unchecked_tags[:2])
|
random_tag = choice(self.unchecked_tags[:2])
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
f"{random_tag}-tag-selection-input").click()
|
By.ID, f"{random_tag}-tag-selection-input").click()
|
||||||
self.selected_tags.append(random_tag)
|
self.selected_tags.append(random_tag)
|
||||||
self.update_lists()
|
self.update_lists()
|
||||||
|
|
||||||
def multiple_filter_test(self):
|
def multiple_filter_test(self):
|
||||||
if self.current_filter == 'tags':
|
if self.current_filter == 'tags':
|
||||||
self.current_filter = 'features'
|
self.current_filter = 'features'
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'button-for-filter-by-features').click()
|
By.ID, 'button-for-filter-by-features').click()
|
||||||
self.add_feature_filter()
|
self.add_feature_filter()
|
||||||
if self.current_filter == 'features':
|
if self.current_filter == 'features':
|
||||||
self.current_filter = 'tags'
|
self.current_filter = 'tags'
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'button-for-filter-by-tags').click()
|
By.ID, 'button-for-filter-by-tags').click()
|
||||||
self.add_tag_filter()
|
self.add_tag_filter()
|
||||||
|
|
||||||
def has_tags_and_features(self, tl, fl):
|
def has_tags_and_features(self, tl, fl):
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestPlusButton(TestSelenium, TestCase):
|
class TestPlusButton(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestPlusButton, self).setUp()
|
super(TestPlusButton, self).setUp()
|
||||||
self.plus_button = self.driver.find_element_by_id('plus-button')
|
self.plus_button = self.driver.find_element(By.ID, 'plus-button')
|
||||||
self.minus_button = self.driver.find_element_by_id('minus-button')
|
self.minus_button = self.driver.find_element(By.ID, 'minus-button')
|
||||||
self.selection_options_menu = self.driver.find_element_by_id(
|
self.selection_options_menu = self.driver.find_element(
|
||||||
'selection-options-menu')
|
By.ID, 'selection-options-menu')
|
||||||
|
|
||||||
def test_plus_button_props(self):
|
def test_plus_button_props(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestScroll(TestSelenium, TestCase):
|
class TestScroll(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestScroll, self).setUp()
|
super(TestScroll, self).setUp()
|
||||||
self.plus_button = self.driver.find_element_by_id('plus-button')
|
self.plus_button = self.driver.find_element(By.ID, 'plus-button')
|
||||||
self.minus_button = self.driver.find_element_by_id('minus-button')
|
self.minus_button = self.driver.find_element(By.ID, 'minus-button')
|
||||||
|
|
||||||
def test_get_scroll_position(self):
|
def test_get_scroll_position(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
DBI = [
|
DBI = [
|
||||||
'button-for-showing-sort-option',
|
'button-for-showing-sort-option',
|
||||||
'button-for-showing-columns',
|
'button-for-showing-columns',
|
||||||
@ -29,25 +31,25 @@ FLEXROWS = [
|
|||||||
class TestSelectionOptionsMenu(TestSelenium, TestCase):
|
class TestSelectionOptionsMenu(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestSelectionOptionsMenu, self).setUp()
|
super(TestSelectionOptionsMenu, self).setUp()
|
||||||
self.driver.find_element_by_id('plus-button').click()
|
self.driver.find_element(By.ID, 'plus-button').click()
|
||||||
self.div = self.driver.find_element_by_id('selection-options-menu')
|
self.div = self.driver.find_element(By.ID, 'selection-options-menu')
|
||||||
|
|
||||||
def display_is_d_test(self, y_list, d):
|
def display_is_d_test(self, y_list, d):
|
||||||
for x in y_list:
|
for x in y_list:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
x).value_of_css_property('display'), d)
|
By.ID, x).value_of_css_property('display'), d)
|
||||||
|
|
||||||
def test_default_selection_options_menu_buttons_exist(self):
|
def test_default_selection_options_menu_buttons_exist(self):
|
||||||
self.display_is_d_test(DBI, 'block')
|
self.display_is_d_test(DBI, 'block')
|
||||||
ids = [x.get_attribute(
|
ids = [x.get_attribute(
|
||||||
'id') for x in self.div.find_elements_by_tag_name('button')]
|
'id') for x in self.div.find_elements(By.TAG_NAME, 'button')]
|
||||||
self.assertEqual(ids, DBI)
|
self.assertEqual(ids, DBI)
|
||||||
|
|
||||||
def test_buttons(self):
|
def test_buttons(self):
|
||||||
self.display_is_d_test(DBI, 'block')
|
self.display_is_d_test(DBI, 'block')
|
||||||
for i, x in enumerate(DBI):
|
for i, x in enumerate(DBI):
|
||||||
button = self.driver.find_element_by_id(x)
|
button = self.driver.find_element(By.ID, x)
|
||||||
button.click()
|
button.click()
|
||||||
self.assertEqual(button.value_of_css_property('display'), 'none')
|
self.assertEqual(button.value_of_css_property('display'), 'none')
|
||||||
self.display_is_d_test([*DBI[0:i], *DBI[i + 1:]], 'block')
|
self.display_is_d_test([*DBI[0:i], *DBI[i + 1:]], 'block')
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
from unittest import TestCase
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
from selenium.webdriver.chrome.service import Service
|
|
||||||
from selenium.webdriver.chrome.options import Options
|
from selenium.webdriver.chrome.options import Options
|
||||||
|
from selenium.webdriver.chrome.service import Service
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
OPTIONS = Options()
|
OPTIONS = Options()
|
||||||
OPTIONS.add_argument('--ignore-certificate-errors')
|
OPTIONS.add_argument('--ignore-certificate-errors')
|
||||||
OPTIONS.add_argument('--incognito')
|
OPTIONS.add_argument('--incognito')
|
||||||
@ -25,5 +28,5 @@ class TestSelenium(TestCase):
|
|||||||
class TestIDsForDuplicates(TestSelenium, TestCase):
|
class TestIDsForDuplicates(TestSelenium, TestCase):
|
||||||
def test_for_unique_ids(self):
|
def test_for_unique_ids(self):
|
||||||
ids = [x.get_attribute(
|
ids = [x.get_attribute(
|
||||||
'id') for x in self.driver.find_elements_by_xpath('//*[@id]')]
|
'id') for x in self.driver.find_elements(By.XPATH, '//*[@id]')]
|
||||||
self.assertEqual(len(ids), len(set(ids)))
|
self.assertEqual(len(ids), len(set(ids)))
|
||||||
|
@ -1,41 +1,43 @@
|
|||||||
import re
|
import re
|
||||||
|
from ast import literal_eval
|
||||||
|
from test.database import get_themes_orderedby_cname
|
||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from bs4 import BeautifulSoup as Bs
|
from bs4 import BeautifulSoup as Bs
|
||||||
from test.database import get_themes_orderedby_cname
|
from selenium.webdriver.common.by import By
|
||||||
from ast import literal_eval
|
|
||||||
|
|
||||||
|
|
||||||
class TestShowingColumns(TestSelenium, TestCase):
|
class TestShowingColumns(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestShowingColumns, self).setUp()
|
super(TestShowingColumns, self).setUp()
|
||||||
self.driver.find_element_by_id('plus-button').click()
|
self.driver.find_element(By.ID, 'plus-button').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'button-for-showing-sort-option').click()
|
By.ID, 'button-for-showing-sort-option').click()
|
||||||
self.driver.find_element_by_id('sortByName').click()
|
self.driver.find_element(By.ID, 'sortByName').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'button-for-showing-columns').click()
|
By.ID, 'button-for-showing-columns').click()
|
||||||
self.themes = get_themes_orderedby_cname()
|
self.themes = get_themes_orderedby_cname()
|
||||||
self.tc = len(self.themes)
|
self.tc = len(self.themes)
|
||||||
|
|
||||||
def test_non_default_table(self):
|
def test_non_default_table(self):
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'min_ver-column-selection-input').click()
|
By.ID, 'min_ver-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'license-column-selection-input').click()
|
By.ID, 'license-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'desc-column-selection-input').click()
|
By.ID, 'desc-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'tags-column-selection-input').click()
|
By.ID, 'tags-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'features-column-selection-input').click()
|
By.ID, 'features-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'date-column-selection-input').click()
|
By.ID, 'date-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'num_stars-column-selection-input').click()
|
By.ID, 'num_stars-column-selection-input').click()
|
||||||
self.driver.find_element_by_id(
|
self.driver.find_element(
|
||||||
'commit-column-selection-input').click()
|
By.ID, 'commit-column-selection-input').click()
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = Bs(results_table_div.get_attribute(
|
rows = Bs(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
@ -80,7 +82,7 @@ class TestShowingColumns(TestSelenium, TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_default_table(self):
|
def test_default_table(self):
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = Bs(results_table_div.get_attribute(
|
rows = Bs(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from itertools import permutations
|
|||||||
from test.theme_compare import theme_compare
|
from test.theme_compare import theme_compare
|
||||||
from functools import cmp_to_key
|
from functools import cmp_to_key
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
SBB = [
|
SBB = [
|
||||||
'sortByDate',
|
'sortByDate',
|
||||||
@ -26,7 +27,7 @@ class TestsSortBy(TestSelenium, TestCase):
|
|||||||
'license-column-selection-input',
|
'license-column-selection-input',
|
||||||
'button-for-showing-sort-option',
|
'button-for-showing-sort-option',
|
||||||
]:
|
]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
self.themes = get_themes_as_dicts_of_sortable_columns()
|
self.themes = get_themes_as_dicts_of_sortable_columns()
|
||||||
self.tc = len(self.themes)
|
self.tc = len(self.themes)
|
||||||
|
|
||||||
@ -43,11 +44,11 @@ class TestsSortBy(TestSelenium, TestCase):
|
|||||||
reverse order of the current permutation
|
reverse order of the current permutation
|
||||||
'''
|
'''
|
||||||
for x in y[::-1]:
|
for x in y[::-1]:
|
||||||
self.driver.find_element_by_id(x).click()
|
self.driver.find_element(By.ID, x).click()
|
||||||
|
|
||||||
sort_by_inputs = [x.get_attribute(
|
sort_by_inputs = [x.get_attribute(
|
||||||
'id') for x in self.driver.find_element_by_id(
|
'id') for x in self.driver.find_element(
|
||||||
'sortByRow').find_elements_by_tag_name('input')]
|
By.ID, 'sortByRow').find_elements(By.TAG_NAME, 'input')]
|
||||||
'''
|
'''
|
||||||
and then assert that the sort_by button row is now
|
and then assert that the sort_by button row is now
|
||||||
in the same order left->right, as the current
|
in the same order left->right, as the current
|
||||||
@ -61,7 +62,7 @@ class TestsSortBy(TestSelenium, TestCase):
|
|||||||
self.themes.sort(
|
self.themes.sort(
|
||||||
key=cmp_to_key(lambda a, b: theme_compare(a, b, y)))
|
key=cmp_to_key(lambda a, b: theme_compare(a, b, y)))
|
||||||
|
|
||||||
results_table_div = self.driver.find_element_by_id('results')
|
results_table_div = self.driver.find_element(By.ID, 'results')
|
||||||
rows = BeautifulSoup(results_table_div.get_attribute(
|
rows = BeautifulSoup(results_table_div.get_attribute(
|
||||||
'innerHTML'), features='lxml').find('table').findAll('tr')
|
'innerHTML'), features='lxml').find('table').findAll('tr')
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
from test.test_selenium import TestSelenium
|
from test.test_selenium import TestSelenium
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
|
||||||
class TestTitle(TestSelenium, TestCase):
|
class TestTitle(TestSelenium, TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestTitle, self).setUp()
|
super(TestTitle, self).setUp()
|
||||||
self.x = self.driver.find_elements_by_tag_name('h1')
|
self.x = self.driver.find_elements(By.TAG_NAME, 'h1')
|
||||||
|
|
||||||
def test_title(self):
|
def test_title(self):
|
||||||
self.assertEqual(len(self.x), 1)
|
self.assertEqual(len(self.x), 1)
|
||||||
@ -21,7 +23,7 @@ class TestTitle(TestSelenium, TestCase):
|
|||||||
self.x[0].value_of_css_property('font-family'), 'sans-serif')
|
self.x[0].value_of_css_property('font-family'), 'sans-serif')
|
||||||
|
|
||||||
def test_title_anchor(self):
|
def test_title_anchor(self):
|
||||||
x_anchors = self.x[0].find_elements_by_tag_name('a')
|
x_anchors = self.x[0].find_elements(By.TAG_NAME, 'a')
|
||||||
self.assertEqual(len(x_anchors), 1)
|
self.assertEqual(len(x_anchors), 1)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
x_anchors[0].get_attribute('href'),
|
x_anchors[0].get_attribute('href'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user