-
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
#799 test yandex ecommerce #800
Conversation
aace71d
to
393c556
Compare
@duker33 Please, make a review for this PR |
@artemiy312 , sorry, started 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.
Some minors about naming. May be discussion is required
|
||
|
||
class Product(abc.ABC): | ||
""""Represent a product at the site.""" |
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.
redundant comment
|
||
|
||
|
||
class CatalogProduct(Product): |
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.
class CatalogProduct(Product): | |
class ProductCard(Product): |
Product is the member of catalog too. With the docstring below becomes redundant too
|
||
|
||
class Cart: | ||
""""Represent the cart at the site.""" |
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.
Cart panel at the top right of the site.
Every page contains this panel. Lazily loaded with js after a page is loaded.
|
||
|
||
class CartPosition(Product): | ||
""""Represent a position from cart.""" |
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.
Row with a position data on cart panel.
Position rows list is shown at the dropdown part of the cart panel.
self.pos_index = pos_index | ||
|
||
def xpath_to(self, path): | ||
return (By.XPATH, f'//ul[@id="basket-list"]/li[{self.pos_index}]/' + path) |
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 would be better to implement xpath as separated property:
@property
def xpath(self, path):
return (By.XPATH, f'//ul[@id="basket-list"]/li[{self.pos_index}]')
And client code can use it like this:
'/'.join([position.xpath, path])
If you don't agree with this approach, provide plz some docstring, that describes what xpath_to(path)
interface means
@@ -18,11 +18,11 @@ def __init__(self, driver, slug): | |||
def path(self): | |||
return reverse('category', args=(self.slug,)) | |||
|
|||
def product_cards(self) -> typing.List[ProductCard]: | |||
def products(self) -> typing.List[CatalogProduct]: |
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.
product_cards
might be better, i think. up2you
# @todo #682:120m Implement and reuse shopelectro.selenium.ProductPage for selenium tests. | ||
|
||
|
||
class ProductPage(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.
class ProductPage(Page): | |
class Product(Page): |
we are already at pages.product
module context. up2you
# Here are goals left to test: | ||
# - onCartClear from cart | ||
# - onProductAdd from catalog, product and order pages | ||
# - onProductRemove from cart and order page | ||
# - onProductDetail from product page | ||
|
||
def reached_goals(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.
def reached_goals(self): | |
def get_reached_goals(self): |
let's use verbs at the beginning of the method names. Or change current convention.
Or you can turn this method to property to preserve this name
|
||
reached = self.get_first(reached_goals) | ||
self.assertEqual(reached['currencyCode'], 'RUB') | ||
self.assertEqual( |
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.
you can collapse it to the single string, i think. Up2you
Test reaching of goals. | ||
|
||
Match submitted results with Yandex spec for message representation. | ||
Yandex docs: https://yandex.com/support/metrica/data/e-commerce.html |
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.
...
Docs contains details about goals data structure.
Closes #799
Closes #788