Skip to content
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

Merged
merged 6 commits into from
Apr 8, 2019
Merged

Conversation

ArtemijRodionov
Copy link
Contributor

@ArtemijRodionov ArtemijRodionov commented Apr 1, 2019

Closes #799
Closes #788

@ArtemijRodionov ArtemijRodionov self-assigned this Apr 1, 2019
@ArtemijRodionov ArtemijRodionov requested a review from duker33 April 1, 2019 10:12
@ArtemijRodionov ArtemijRodionov force-pushed the 799-test-yandex-ecommerce branch from aace71d to 393c556 Compare April 1, 2019 10:25
@ArtemijRodionov
Copy link
Contributor Author

@duker33 Please, make a review for this PR

@duker33
Copy link
Contributor

duker33 commented Apr 5, 2019

@artemiy312 , sorry, started it

Copy link
Contributor

@duker33 duker33 left a 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."""
Copy link
Contributor

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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."""
Copy link
Contributor

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."""
Copy link
Contributor

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)
Copy link
Contributor

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]:
Copy link
Contributor

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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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(
Copy link
Contributor

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
Copy link
Contributor

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.

@ArtemijRodionov ArtemijRodionov merged commit 73af98b into master Apr 8, 2019
@ArtemijRodionov ArtemijRodionov deleted the 799-test-yandex-ecommerce branch April 8, 2019 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants