Skip to content

Commit

Permalink
Merge branch 'main' into basket_page_branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Grom-Zadira85 authored May 5, 2024
2 parents c73b7ff + b5e8bdd commit b339a5f
Showing 1 changed file with 34 additions and 3 deletions.
37 changes: 34 additions & 3 deletions tests/test_search_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pages.locators import SearchTermsLocators as ST
from pages.locators import BaseLocators as Base
from selene import browser, be, have
from selene import browser, be, have, query
from selene.support.shared.jquery_style import s, ss


Expand All @@ -23,14 +23,25 @@ def test_015_001_002_count_search_terms():
ss(ST.TERMS_FOR_SEARCH_LIST_QTY).should(have.size(100))



# def test_015_001_002_selenium(driver):
# driver.get(ST.LINK_SEARCH_TERMS)
# q_of_goods = len(driver.find_elements(*ST.TERMS_FOR_SEARCH_LIST_QTY))
# assert q_of_goods == 100, "Nr of search terms is not equal to 100"


def test_015_001_003_check_if_search_terms_has_size_from_76_till_136(driver):
def test_015_001_003_check_if_search_terms_has_size_from_76_till_136():
# assert from selenium - how to check sizes
browser.open(ST.LINK_SEARCH_TERMS)
list_font_sizes = []
terms = ss(ST.LIST_OF_SEARCH_TERMS)
for g in terms:
g_font, g_size = g.get(query.attribute("style")).split(": ")
g_size = float(g_size.replace("%;", ""))
list_font_sizes.append(g_size)
assert min(list_font_sizes) <= 76 and max(list_font_sizes) >= 136, "Font sizes not between 76 and 136"


def test_015_001_003_check_if_search_terms_has_size_from_76_till_136_selenium(driver):
driver.get(ST.LINK_SEARCH_TERMS)
list_font_sizes = []
terms = driver.find_elements(By.CSS_SELECTOR, ST.LIST_OF_SEARCH_TERMS)
Expand Down Expand Up @@ -79,6 +90,26 @@ def test_015_001_005_check_if_specified_words_is_bigger_than_88(driver):
[size > 88 for size in list_font_sizes]), "Selected words have font size bigger thjan 88%"


def test_015_001_005_check_if_specified_words_is_bigger_than_88_selenium(driver):
words = ["HOODIE", "jacket", "pants", "shirt"]
driver.get(ST.LINK_SEARCH_TERMS)
list_of_goods = []
list_font_sizes = []
print()
terms = driver.find_elements(By.CSS_SELECTOR, ST.LIST_OF_SEARCH_TERMS)
for g in terms:
if g.text in words:
list_of_goods.append(g.text)
g_font, g_size = g.get_attribute("style").split(": ")
g_size = g_size.replace("%;", "")
g_size = float(g_size)
list_font_sizes.append(g_size)
print(list_of_goods)
print(list_font_sizes)
assert set(list_of_goods) == set(words) and all(
[size > 88 for size in list_font_sizes]), "Selected words have font size bigger thjan 88%"


def test_015_001_006_check_if_search_terms_are_sorted():
browser.open(ST.LINK_SEARCH_TERMS)

Expand Down

0 comments on commit b339a5f

Please sign in to comment.