-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#682 production tests #688
Conversation
5cff3ae
to
8f6dea9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some naiming, minor arch and tasks estimates
shopelectro/selenium/__init__.py
Outdated
It is based on `pages` and `elements`. | ||
|
||
The page object should encapsulate the mechanics required | ||
to find and manipulate the data and combines elements to reache it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to find and manipulate the data and combines elements to reache it. | |
to find and manipulate the data and combines elements to reach it. |
|
||
|
||
class ProductCard: | ||
""""Represent a product card of category page.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""""Represent a product card of category page.""" | |
""""Represent a product card from category page.""" |
class ProductCard: | ||
""""Represent a product card of category page.""" | ||
|
||
def __init__(self, driver, card_number): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'll be good to provide doc for card_number: Order number at category page's card list
self.driver.wait.until(EC.visibility_of_element_located(By.XPATH, xpath)) | ||
|
||
def add_to_cart(self): | ||
self._get_element(self.xpath).click() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and ctor we have button_xpath
, but here is xpath
self.button_xpath = f'//*[@id="products-wrapper"]/div[{card_number}]/div[2]/div[5]/button' | ||
|
||
def _get_element(self, xpath): | ||
self.driver.wait.until(EC.visibility_of_element_located(By.XPATH, xpath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are not needed to pass xpath as the arg, because we already have xpath as field of self
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should pass By.XPATH, xpath
pair as tuple as i know. Maybe it's not necessary, but we usually do like this
self.slug = slug | ||
|
||
@property | ||
def address(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before this moment we used path
for reversed part of url without domain. Why address
now?
Maybe we'll leave path
?
OrderPage too
shopelectro/selenium/pages/order.py
Outdated
|
||
from pages.models import CustomPage | ||
|
||
# @todo #682:60m Implement and reuse shopelectro.selenium.OrderPage for selenium tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suggest 120m for this task
|
||
def fill_contacts(self, contacts): | ||
pass | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should choose payment type here too
shopelectro/selenium/pages/page.py
Outdated
self.driver = driver | ||
self.address: str | ||
|
||
def move_to(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when we read page.move_to()
, someone can think, that we are moving somewhere outside this page.
I suggest load
or open
as name
shopelectro/selenium/pages/page.py
Outdated
self.address: str | ||
|
||
def move_to(self): | ||
assert self.address, f"Set a page address to {self.__class__.__name__}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert self.address, f"Set a page address to {self.__class__.__name__}" | |
assert self.address, f'Set a page address to {self.__class__.__name__}' |
ffae560
to
f7183a6
Compare
Closes #682 #323