Esempio n. 1
0
    def test_add_from_product_page(self):
        product = Product.objects.first()
        page = selenium.Product(self.browser, product.vendor_code)
        page.load()
        page.add_to_cart()

        self.assert_add(product, 1)
Esempio n. 2
0
    def test_product_detail(self):
        product = Product.objects.first()
        selenium.Product(self.browser, product.vendor_code).load()

        reached_goals = self.get_goals()
        self.assertTrue(reached_goals)

        reached = reached_goals[0]
        self.assertIn('detail', reached)
        self.assertEqual(reached['currencyCode'], 'RUB')

        reached_detail = reached['detail']
        self.assertEqual(
            len(reached_detail['products']),
            1,
        )

        self.assertEqual(
            reached_detail['products'][0], {
                'id': product.id,
                'name': product.name,
                'brand': product.get_brand_name(),
                'quantity': 1,
                'category': product.category.name,
            })
Esempio n. 3
0
    def test_product_detail(self):
        product = Product.objects.first()
        selenium.Product(self.browser, product.vendor_code).load()

        goals = self.get_goals()
        self.assertTrue(goals)
        self.assertEqual(goals[0]['event'], 'Detail')
        ecommerce = goals[0]['ecommerce']
        self.assertIn('detail', ecommerce)
        self.assertEqual(ecommerce['currencyCode'], 'RUB')

        detail = ecommerce['detail']
        self.assertEqual(
            len(detail['products']),
            1,
        )

        self.assertEqual(
            detail['products'][0], {
                'id': product.id,
                'name': product.name,
                'brand': product.get_brand_name(),
                'quantity': 1,
                'category': product.category.name,
            })
Esempio n. 4
0
    def test_clear_cart(self):  # Ignore CPDBear
        product = Product.objects.first()
        page = selenium.Product(self.browser, product.vendor_code)
        page.load()
        page.add_to_cart()
        page.cart().clear()

        self.assert_remove(product, 2)
Esempio n. 5
0
    def test_remove_from_cart(self):
        product = Product.objects.first()
        page = selenium.Product(self.browser, product.vendor_code)
        page.load()
        page.add_to_cart()
        cart = page.cart()
        cart.remove(cart.positions.first())

        self.assert_remove(product, 2)
Esempio n. 6
0
    def test_remove_from_order_page(self):
        product = Product.objects.first()
        product_page = selenium.Product(self.browser, product.vendor_code)
        product_page.load()
        product_page.add_to_cart()

        order_page = selenium.OrderPage(self.browser)
        order_page.load()
        order_page.remove(order_page.positions.first())

        self.assert_remove(product, 0)