I have a problem with asserting two product lists. The first list is checked and assigned to the variable "old_products", a new product is added and the product list is checked again and assigned to an another variable "new_products"
def test_add_product(app):
old_products = app.product.get_list()
app.product.add_product(Product(app, number="", description="", name="", i=""))
new_products = app.product.get_list()
assert len(old_products) + 1 == len(new_products)
And this is my function:
def get_list(self):
wd = self.app.wd
self.open_products_page()
products = []
for product in wd.find_elements_by_css_selector("tr._row--ng-543wer"):
products.append(product)
return products
But I got error when my test starts:
assert (20 + 1) == 0
E + where 20 =
len([<selenium.webdriver.remote.webelement.WebElement...])
E + and 0 = len([])
Aucun commentaire:
Enregistrer un commentaire