Skip to content

Commit

Permalink
Merge pull request #39 from py-AQA/Visibility_of_data
Browse files Browse the repository at this point in the history
sports wear items and username on each page
  • Loading branch information
Cruz06 authored May 3, 2024
2 parents a242d6f + 6314ff6 commit 1ab6fe9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
11 changes: 11 additions & 0 deletions pages/locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ class BaseLocators:
PAGE_TITLE = 'h1'
BREADCRUMBS_LIST = ".breadcrumbs li"
BREADCRUMBS_LINKS = '.breadcrumbs > ul > li > a'
PRODUCT_ITEM_IN_CATALOG = 'li.product-item' # каждый товар на любой странице в целом
PRODUCT_PRICE = '.price-label'
PRODUCT_NAME = '.product-item-link'
PRODUCT_IMAGE = '.product-image-photo'
ALL_URL = ["https://magento.softwaretestingboard.com/",
"https://magento.softwaretestingboard.com/what-is-new.html",
"https://magento.softwaretestingboard.com/women/tops-women/jackets-women.html,"
"https://magento.softwaretestingboard.com/training.html"
]


class SearchTermsLocators:
Expand All @@ -77,3 +86,5 @@ class LoginLocators:
LINK_ACCOUNT = 'https://magento.softwaretestingboard.com/customer/account/'


class PerformanceSportswear:
LINK_SPORT = "https://magento.softwaretestingboard.com/collections/performance-new.html"
13 changes: 12 additions & 1 deletion tests/auth/test_sign_in.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from pages import sign_in, my_account, message
from pages.locators import LoginLocators
from pages.locators import LoginLocators, BaseLocators
from selene import browser, be, have
from selene.support.shared.jquery_style import s

Expand Down Expand Up @@ -33,5 +35,14 @@ def test_004_005_002_login_successful():
s(LoginLocators.AUTHORIZATION_LINK).should(have.no.text("Sign In"))


def test_004_005_003_nickname_on_each_page():
# I used only 4 links, otherwise test will take too much time
browser.open(LoginLocators.LINK_LOGIN)
s(LoginLocators.FIELD_NAME).type("ahahah1@gmail.com")
s(LoginLocators.FIELD_PASSWORD).type("jk$34_tor")
s(LoginLocators.BUTTON_SUBMIT).click()
for lnk in BaseLocators.ALL_URL:
browser.open(lnk)
s(LoginLocators.USER_NAME_IN_WELCOME).should(have.text("фы ывф"))


27 changes: 27 additions & 0 deletions tests/test_performance_sportswear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pytest
from selene.support.conditions.have import values_containing, values
from selenium.webdriver.common.by import By

from pages.locators import PerformanceSportswear, BaseLocators
from selene import browser, be, have, query
from selene.support.shared.jquery_style import s, ss
from selene.support.conditions import be, have


def test_006_008_001_visibility_of_price_photo_name():
# I can't count elements on the page via selen
browser.open(PerformanceSportswear.LINK_SPORT)
ss(BaseLocators.PRODUCT_NAME).should(have.size(5))
ss(BaseLocators.PRODUCT_PRICE).should(have.size(5))
ss(BaseLocators.PRODUCT_IMAGE).should(have.size(5))


def test_006_008_001_visibility_of_price_photo_name_selenium(driver):
# I have to find actual nr of elements on the page via python/selenium
browser.open(PerformanceSportswear.LINK_SPORT)
driver.get(PerformanceSportswear.LINK_SPORT)
nr_of_items_on_page = len(driver.find_elements(By.CSS_SELECTOR, BaseLocators.PRODUCT_ITEM_IN_CATALOG))
ss(BaseLocators.PRODUCT_NAME).should(have.size(nr_of_items_on_page))
ss(BaseLocators.PRODUCT_PRICE).should(have.size(nr_of_items_on_page))
ss(BaseLocators.PRODUCT_IMAGE).should(have.size(nr_of_items_on_page))

File renamed without changes.

0 comments on commit 1ab6fe9

Please sign in to comment.