Beispiel #1
0
    def purchase(self):
        order_page = selenium.OrderPage(self.browser)
        order_page.load()
        order_page.fill_contacts()
        order_page.make_order()

        success_page = selenium.SuccessPage(self.browser)
        success_page.wait_loaded()
        self.assertTrue(success_page.is_success())
Beispiel #2
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)
Beispiel #3
0
def check_purchase(self):
    try:
        with selenium.SiteDriver(site_url=settings.BASE_URL) as driver:
            category_page = selenium.CategoryPage(
                driver,
                CategoryPage.objects.first().slug)
            category_page.load()
            category_page.add_to_cart()

            order_page = selenium.OrderPage(driver)
            order_page.load()
            order_page.fill_contacts()
            order_page.make_order()

            success_page = selenium.SuccessPage(driver)
            assert success_page.is_success()
    except (WebDriverException, AssertionError) as err:
        if self.request.retries + 1 > self.max_retries:
            # report on the last attempt
            TelegramReport().send(
                f'Can\'t buy a product. Got the error: {err}')
        raise err