• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python browser_utils.wait_until_appeared函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中shuup.testing.browser_utils.wait_until_appeared函数的典型用法代码示例。如果您正苦于以下问题:Python wait_until_appeared函数的具体用法?Python wait_until_appeared怎么用?Python wait_until_appeared使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wait_until_appeared函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _test_language_change

def _test_language_change(browser):
    assert browser.is_element_present_by_css("h2[class='block-title']")
    # By default the initialization the admin should be in English
    found_customer_details_en = False
    for block_title in browser.find_by_css("h2[class='block-title']"):
        if "Customer Details" in block_title.text:
            found_customer_details_en = True
    assert found_customer_details_en

    # Make sure that the translations is handled correctly and change to Finnish
    browser.find_by_id("dropdownMenu").click()
    browser.find_by_xpath('//a[@data-value="fi"]').first.click()

    wait_until_appeared(browser, "h2[class='block-title']")
    found_customer_details_fi = False
    for block_title in browser.find_by_css("h2[class='block-title']"):
        if "Asiakkaan tiedot" in block_title.text:
            found_customer_details_fi = True

    assert found_customer_details_fi

    # And back in English
    browser.find_by_id("dropdownMenu").click()
    browser.find_by_xpath('//a[@data-value="en"]').first.click()
    wait_until_appeared(browser, "h2[class='block-title']")
开发者ID:suutari,项目名称:shoop,代码行数:25,代码来源:test_order_creator.py


示例2: _set_settings

def _set_settings(browser):
    assert not browser.is_text_present("Internal Identifier")
    browser.find_by_css(".btn.btn-default.btn-inverse").click()
    browser.find_by_id("id_view_configuration_contact_identifier").click()
    browser.find_by_css(".btn.btn-success").click()
    wait_until_appeared(browser, ".picotable-item-info")
    assert browser.is_text_present("Internal Identifier")
开发者ID:shawnadelic,项目名称:shuup,代码行数:7,代码来源:test_picotable.py


示例3: _test_customer_data

def _test_customer_data(browser, person):
    # check defaults
    assert browser.find_by_css("input[name='save-address']").first.checked == True
    assert browser.find_by_css("input[name='ship-to-billing-address']").first.checked == False
    assert browser.find_by_css("input[name='order-for-company']").first.checked == False
    assert not browser.find_by_css("input[name='billing-tax_number']").first['required']
    browser.check("ship-to-billing-address")
    browser.check("order-for-company")
    assert len(browser.find_by_css("input[name='shipping-name']")) == 0, "shipping address column is hidden"
    assert browser.find_by_css("input[name='billing-tax_number']").first['required'], "tax number is required"

    browser.uncheck("order-for-company")
    click_element(browser, "#select-existing-customer")
    browser.windows.current = browser.windows[1]
    wait_until_appeared(browser, "a")
    # click second row - first row is admin
    browser.find_by_css("tbody tr")[1].find_by_css("a").click()
    browser.windows.current = browser.windows[0]
    # check fields were set
    wait_until_condition(
        browser, lambda x: x.find_by_name("billing-name").value == person.name)
    assert browser.find_by_name("billing-name").value == person.name
    assert browser.find_by_name("billing-street").value == person.default_billing_address.street
    assert browser.find_by_name("billing-city").value == person.default_billing_address.city
    assert browser.find_by_name("billing-country").value == person.default_billing_address.country
开发者ID:shawnadelic,项目名称:shuup,代码行数:25,代码来源:test_order_creator.py


示例4: _set_settings

def _set_settings(browser):
    assert not browser.is_text_present("Account Manager")
    browser.find_by_css(".btn.btn-default.btn-inverse").click()
    browser.find_by_css(".btn.btn-xs.btn-success.btn-add-sortable").first.click()
    browser.find_by_css(".btn.btn-success").first.click()
    wait_until_appeared(browser, ".picotable-item-info")
    wait_until_condition(browser, lambda x: x.is_text_present("Account Manager"))
开发者ID:suutari,项目名称:shoop,代码行数:7,代码来源:test_picotable.py


示例5: test_product_create

def test_product_create(browser, admin_user, live_server, settings):
    activate("en")
    shop = get_default_shop()
    get_default_product_type()
    get_default_sales_unit()
    get_default_tax_class()
    configuration.set(None, "shuup_product_tour_complete", True)
    object_created.connect(_add_custom_product_created_message, sender=Product, dispatch_uid="object_created_signal_test")
    initialize_admin_browser_test(browser, live_server, settings)

    url = reverse("shuup_admin:shop_product.new")
    browser.visit("%s%s" % (live_server, url))
    sku = "testsku"
    name = "Some product name"
    price_value = 10
    short_description = "short but gold"

    browser.fill("base-sku", sku)
    browser.fill("base-name__en", name)
    browser.fill("base-short_description__en", short_description)
    browser.fill("shop%s-default_price_value" % shop.pk, price_value)

    configuration.set(None, "shuup_category_tour_complete", True)
    _add_primary_category(browser, shop)
    _add_additional_category(browser, shop)

    click_element(browser, "button[form='product_form']")
    wait_until_appeared(browser, "div[class='message success']")
    product = Product.objects.filter(sku=sku).first()
    assert product.log_entries.filter(identifier=OBJECT_CREATED_LOG_IDENTIFIER).count() == 1
    object_created.disconnect(sender=Product, dispatch_uid="object_created_signal_test")
    shop_product = product.get_shop_instance(shop)
    assert shop_product.categories.count() == 2
开发者ID:gurch101,项目名称:shuup,代码行数:33,代码来源:test_product_create.py


示例6: _save_category

def _save_category(iframe):  # TODO: Revise! It seems that iframes are hard for Travis
    time.sleep(3)  # Let's just wait here to the iFrame to open fully (for Chrome and headless)
    wait_until_appeared(iframe, "button[form='category_form']")
    try:
        click_element(iframe, "button[form='category_form']")
    except selenium.common.exceptions.SessionNotCreatedException as e:
        click_element(iframe, "button[form='category_form']")
开发者ID:ruqaiya,项目名称:shuup,代码行数:7,代码来源:test_product_create.py


示例7: set_status

def set_status(browser, order, status):
    click_element(browser, "button.set-status-button")
    form_action = reverse("shuup_admin:order.set-status", kwargs={"pk": order.pk})
    click_element(browser, "button[formaction='%s'][value='%s']" % (form_action, status.pk))
    wait_until_appeared(browser, "div[class='message success']")
    wait_until_condition(browser, condition=lambda x: x.is_text_present("Order %s" % order.pk))
    order.refresh_from_db()
    assert order.status.pk == status.pk
开发者ID:ruqaiya,项目名称:shuup,代码行数:8,代码来源:test_order_detail.py


示例8: _test_toolbar_visibility

def _test_toolbar_visibility(browser, live_server, order):
    url = reverse("shuup_admin:order.detail", kwargs={"pk": order.pk})
    browser.visit("%s%s" % (live_server, url))
    wait_until_appeared(browser, "#order_details")
    _check_create_refund_link(browser, order, False)
    order.create_payment(order.taxful_total_price)
    browser.reload()
    wait_until_appeared(browser, "#order_details")
    _check_create_refund_link(browser, order, True)
开发者ID:suutari,项目名称:shoop,代码行数:9,代码来源:test_refunds.py


示例9: _add_product_to_basket_from_category

def _add_product_to_basket_from_category(live_server, browser, first_category, shop):
    url = reverse("shuup:category", kwargs={"pk": first_category.pk, "slug": first_category.slug})
    browser.visit("%s%s" % (live_server, url))
    wait_until_condition(browser, lambda x: x.is_text_present(first_category.name))

    # Make sure that the correct price is visible
    product = Product.objects.filter(sku="test-sku-2").first()
    selector = "#product-%s div.price-line span.lead strong" % product.id
    wait_until_condition(browser, lambda x: "720" in x.find_by_css(selector).first.text)

    # Test product price update
    new_price = 42
    shop_product = product.get_shop_instance(shop)
    shop_product.default_price_value = new_price
    shop_product.save()

    discount_amount = 5
    _create_category_product_discount(first_category, shop, discount_amount)

    browser.reload()
    wait_until_condition(
        browser,
        lambda x: str(new_price - discount_amount) in x.find_by_css(selector).first.text
    )

    # Go to product detail and update the price one more time
    click_element(browser, selector)

    product_detail_price_selector = "#product-price-div-%s span.product-price strong" % product.id
    wait_until_appeared(browser, product_detail_price_selector)
    wait_until_condition(
        browser,
        lambda x: str(new_price - discount_amount) in x.find_by_css(product_detail_price_selector).first.text)

    last_price = 120.53
    shop_product = product.get_shop_instance(shop)
    shop_product.default_price_value = last_price
    shop_product.save()

    new_discount_amount = 10
    _create_category_product_discount(first_category, shop, new_discount_amount)

    browser.reload()
    wait_until_condition(
        browser,
        lambda x: str(last_price - new_discount_amount) in x.find_by_css(product_detail_price_selector).first.text
    )

    # Add product to basket and navigate to basket view
    click_element(browser, "#add-to-cart-button-%s" % product.pk)  # add product to basket
    wait_until_appeared(browser, ".cover-wrap")
    wait_until_disappeared(browser, ".cover-wrap")
    click_element(browser, "#navigation-basket-partial")  # open upper basket navigation menu
    click_element(browser, "a[href='/basket/']")  # click the link to basket in dropdown
    wait_until_condition(browser, lambda x: x.is_text_present("Shopping cart"))  # we are in basket page
    wait_until_condition(browser, lambda x: x.is_text_present(product.name))  # product is in basket
开发者ID:ruqaiya,项目名称:shuup,代码行数:56,代码来源:test_coupon.py


示例10: test_dev_onboarding

def test_dev_onboarding(browser, admin_user, live_server, settings):
    Shop.objects.first().delete()  # Delete first shop created by test initializations
    call_command("shuup_init", *[], **{})
    shop = Shop.objects.first()
    assert shop.maintenance_mode
    initialize_admin_browser_test(browser, live_server, settings, onboarding=True)

    browser.fill("address-first_name", "Matti")
    browser.fill("address-last_name", "Teppo")
    browser.fill("address-phone", "112")
    browser.fill("address-street", "Teststreet")
    browser.fill("address-postal_code", "20540")
    browser.fill("address-city", "Turku")

    click_element(browser, "#select2-id_address-country-container")
    wait_until_appeared(browser, "input.select2-search__field")
    browser.find_by_css("input.select2-search__field").first.value = "Finland"
    wait_until_appeared(browser, ".select2-results__option:not([aria-live='assertive'])")
    browser.execute_script('$($(".select2-results__option")[0]).trigger({type: "mouseup"})')
    click_element(browser, "button[name='next']")

    wait_until_condition(browser, lambda x: x.is_text_present("To start accepting payments right away"))
    click_element(browser, "div[data-name='manual_payment'] button[name='activate']")
    browser.fill("manual_payment-service_name", "Laskulle")
    click_element(browser, "button[name='next']")

    wait_until_condition(browser, lambda x: x.is_text_present("To start shipping products right away"))
    click_element(browser, "div[data-name='manual_shipping'] button[name='activate']")
    browser.fill("manual_shipping-service_name", "Kotiinkuljetus")
    click_element(browser, "button[name='next']")

    wait_until_condition(browser, lambda x: x.is_text_present("theme for your shop"))
    click_element(browser, "div[data-identifier='candy_pink'] button[data-theme='shuup.themes.classic_gray']")
    click_element(browser, "button[name='next']")

    wait_until_condition(browser, lambda x: x.is_text_present("initial content and configure"))
    click_element(browser, "button[name='next']")

    wait_until_condition(browser, lambda x: x.is_text_present("install some sample data"))
    browser.execute_script('document.getElementsByName("sample-categories")[0].checked=true')
    browser.execute_script('document.getElementsByName("sample-products")[0].checked=true')
    click_element(browser, "button[name='next']")

    wait_until_condition(browser, lambda x: x.is_text_present("Welcome to Shuup!"))

    click_element(browser, "input[value='Publish shop']")

    shop.refresh_from_db()
    assert not shop.maintenance_mode
    assert Product.objects.count() == 10
    supplier = Supplier.objects.first()
    customer = AnonymousContact()
    assert len([
        product for product in Product.objects.all()
            if product.get_shop_instance(shop).is_orderable(supplier, customer, 1)
    ]) == 10
开发者ID:ruqaiya,项目名称:shuup,代码行数:56,代码来源:test_dev_onboarding.py


示例11: _test_confirm

def _test_confirm(browser):
    total = sum([decimal.Decimal(total_el.value) for total_el in browser.find_by_css("input[name='total']")])
    assert str(total) in browser.find_by_css(".order-footer h2").text, "order total is correct"
    click_element(browser, ".order-footer button")
    wait_until_appeared(browser, ".btn-danger")  # wait until the back button appears
    assert len(browser.find_by_css("table tbody tr")) == 5, "2 line items, 2 methods, 1 total line shown in confirmation table"
    # click confirm
    click_element(browser, ".btn-success")
    wait_until_appeared(browser, "#details-status-section")
    assert Order.objects.count() == 1, "order created"
开发者ID:yourkin,项目名称:shuup,代码行数:10,代码来源:test_order_creator.py


示例12: test_xtheme_snippet_injection

def test_xtheme_snippet_injection(browser, admin_user, live_server, settings):
    shop = factories.get_default_shop()
    initialize_admin_browser_test(browser, live_server, settings)

    url = reverse("shuup_admin:xtheme_snippet.new")
    browser.visit("%s%s" % (live_server, url))
    wait_until_condition(browser, lambda x: x.is_text_present("New Snippet"))
    browser.execute_script("$(\"[name='location']\").val('body_end').trigger('change')")
    browser.execute_script("$(\"[name='snippet_type']\").val('inline_js').trigger('change')")
    browser.execute_script("window.CodeMirror.editors['id_snippet-snippet'].setValue('alert(\"works\")');")
    click_element(browser, "button[type='submit']")
    wait_until_appeared(browser, "div[class='message success']")

    url = reverse("shuup:index")
    browser.visit("%s%s" % (live_server, url))

    def has_alert(browser):
        try:
            return browser.get_alert().text == "works"
        except:
            return False

    wait_until_condition(browser, has_alert)
    browser.get_alert().accept()

    theme = get_current_theme(shop)
    snippet = Snippet.objects.filter(shop=shop).first()
    snippet.themes = [theme.identifier]
    snippet.save()

    cache.clear()
    browser.visit("%s%s" % (live_server, url))
    wait_until_condition(browser, has_alert)
    browser.get_alert().accept()

    snippet.themes = ["doesnt-exist"]
    snippet.save()

    cache.clear()
    browser.visit("%s%s" % (live_server, url))
    wait_until_condition(browser, lambda x: x.is_text_present("Welcome to Default!"))

    with pytest.raises(Exception):
        browser.get_alert()

    # delete the snippet
    url = reverse("shuup_admin:xtheme_snippet.edit", kwargs=dict(pk=snippet.pk))
    browser.visit("%s%s" % (live_server, url))
    assert Snippet.objects.filter(shop=shop).exists()

    click_element(browser, ".shuup-toolbar button.btn.btn-danger")
    browser.get_alert().accept()
    wait_until_condition(browser, lambda x: not Snippet.objects.filter(shop=shop).exists())
开发者ID:ruqaiya,项目名称:shuup,代码行数:53,代码来源:test_snippet_injection.py


示例13: _test_regions

def _test_regions(browser, person):
    with pytest.raises(ElementDoesNotExist):
        browser.find_by_css("input[name='billing-region_code']").first
    assert browser.find_by_css("input[name='billing-region']").first
    browser.select("billing-country", "US")
    wait_until_appeared(browser, "select[name='billing-region_code']")
    with pytest.raises(ElementDoesNotExist):
        browser.find_by_css("input[name='billing-region']").first
    browser.select("billing-region_code", "CA")
    browser.select("billing-country", "CG")  # Congo does not have regions defined
    wait_until_appeared(browser, "input[name='billing-region']")
    browser.select("billing-country", person.default_billing_address.country)
开发者ID:suutari,项目名称:shoop,代码行数:12,代码来源:test_order_creator.py


示例14: _test_create_full_refund

def _test_create_full_refund(browser, live_server, order):
    url = reverse("shuup_admin:order.create-refund", kwargs={"pk": order.pk})
    browser.visit("%s%s" % (live_server, url))
    wait_until_condition(browser, lambda x: x.is_text_present("Refunded: %s" % format_money(order.shop.create_price("0.00"))))
    wait_until_condition(browser, lambda x: x.is_text_present("Remaining: %s" % format_money(order.taxful_total_price)))
    url = reverse("shuup_admin:order.create-full-refund", kwargs={"pk": order.pk})
    click_element(browser, "a[href='%s']" % url)
    wait_until_condition(browser, lambda x: x.is_text_present("Refund Amount: %s" % format_money(order.taxful_total_price)))
    click_element(browser, "#create-full-refund")
    wait_until_appeared(browser, "#order_details")
    _check_create_refund_link(browser, order, False)
    order.refresh_from_db()
    assert not order.taxful_total_price
    assert order.is_paid()
    assert order.is_fully_shipped()
开发者ID:suutari,项目名称:shoop,代码行数:15,代码来源:test_refunds.py


示例15: guest_ordering_test

def guest_ordering_test(browser, live_server):
    browser.fill("login-username", "test-username")
    click_element(browser, "button[name='login']")
    wait_until_appeared(browser, "div.form-group.passwordinput.required.has-error")
    browser.fill("login-password", "test-password")
    click_element(browser, "button[name='login']")
    wait_until_condition(browser, lambda x: x.is_text_present("Please enter a correct username and password."))
    wait_until_appeared(browser, "div.alert.alert-danger")

    click_element(browser, "button[data-id='id_checkout_method_choice-register']")
    click_element(browser, "li[data-original-index='0'] a")
    click_element(browser, "div.clearfix button.btn.btn-primary.btn-lg.pull-right")
    wait_until_condition(browser, lambda x: x.is_text_present("Checkout: Addresses"))
    url = reverse("shuup:checkout", kwargs={"phase": "checkout_method"})
    browser.visit("%s%s" % (live_server, url))
开发者ID:gurch101,项目名称:shuup,代码行数:15,代码来源:test_checkout_with_login_and_register.py


示例16: navigate_to_checkout

def navigate_to_checkout(browser, product):
    wait_until_condition(browser, lambda x: x.is_text_present("Newest Products"))
    wait_until_condition(browser, lambda x: x.is_text_present(product.name))

    click_element(browser, "#product-%s" % product.pk)  # open product from product list
    click_element(browser, "#add-to-cart-button-%s" % product.pk)  # add product to basket

    wait_until_appeared(browser, ".cover-wrap")
    wait_until_disappeared(browser, ".cover-wrap")

    click_element(browser, "#navigation-basket-partial")  # open upper basket navigation menu
    click_element(browser, "a[href='/basket/']")  # click the link to basket in dropdown
    wait_until_condition(browser, lambda x: x.is_text_present("Shopping cart"))  # we are in basket page
    wait_until_condition(browser, lambda x: x.is_text_present(product.name))  # product is in basket

    click_element(browser, "a[href='/checkout/']") # click link that leads to checkout
开发者ID:gurch101,项目名称:shuup,代码行数:16,代码来源:test_checkout_with_login_and_register.py


示例17: test_xtheme_plugin_form_language_order

def test_xtheme_plugin_form_language_order(admin_user, browser, live_server, settings, default_language):
    """
    Test that the first language option is the Parler default

    As you can see, we check for that the page has loaded and we use a sleep of 1 second.
    This is necessary specially into iframes. On this test, when we click to add a new plugin row
    or after a row selection, the iframe content is changed through a request,
    like a internal link when user clicks on a anchor. We have to make sure the NEW content is loaded
    before doing any element check, because it looks like the iframe won't find the correct elements
    if you start checking that before the new content gets loaded.
    """
    with override_settings(PARLER_DEFAULT_LANGUAGE_CODE=default_language):
        browser = initialize_admin_browser_test(browser, live_server, settings)
        browser.visit(live_server + "/")

        # Start edit
        wait_until_condition(browser, lambda x: page_has_loaded(x), timeout=20)
        wait_until_appeared(browser, ".xt-edit-toggle button[type='submit']")
        click_element(browser, ".xt-edit-toggle button[type='submit']")

        placeholder_selector = "#xt-ph-front_content-xtheme-person-contact-layout"
        placeholder_name = "front_content"
        wait_until_condition(browser, lambda x: x.is_element_present_by_css(placeholder_selector))
        click_element(browser, placeholder_selector)

        with browser.get_iframe("xt-edit-sidebar-iframe") as iframe:
            # make sure all scripts are loaded
            wait_until_condition(iframe, lambda x: page_has_loaded(x), timeout=20)

            wait_until_condition(iframe, lambda x: x.is_text_present("Edit Placeholder: %s" % placeholder_name))
            wait_until_appeared(iframe, "button.layout-add-row-btn")
            time.sleep(1)
            wait_until_condition(iframe, lambda x: page_has_loaded(x), timeout=20)

            # click to add a new row
            click_element(iframe, "button.layout-add-row-btn")
            time.sleep(1)
            wait_until_condition(iframe, lambda x: page_has_loaded(x), timeout=20)

            # select the last row (the added one)
            click_element(iframe, "button.layout-add-row-btn")
            iframe.find_by_css("div.layout-cell").last.click()
            time.sleep(1)
            wait_until_condition(iframe, lambda x: page_has_loaded(x), timeout=20)

            # select the TextPlugin
            wait_until_appeared(iframe, "select[name='general-plugin']")
            iframe.select("general-plugin", "text")
            time.sleep(1)
            wait_until_condition(iframe, lambda x: page_has_loaded(x), timeout=20)
            wait_until_appeared(iframe, "ul.editor-tabs")

            # check the languages order
            languages = [el.text for el in iframe.find_by_css("ul.editor-tabs li a")]
            assert languages[0] == default_language
开发者ID:ruqaiya,项目名称:shuup,代码行数:55,代码来源:test_xtheme_plugin_form.py


示例18: test_recently_viewed_products

def test_recently_viewed_products(browser, live_server, settings):
    shop = get_default_shop()
    category = get_default_category()
    category.shops.add(shop)
    category.status = CategoryStatus.VISIBLE
    category.save()
    category_url = reverse("shuup:category", kwargs={"pk": category.pk, "slug": category.slug})
    browser = initialize_front_browser_test(browser, live_server)
    for i in range(1, 7):
        product = new_product(i, shop, category)
        product_url = reverse("shuup:product", kwargs={"pk": product.pk, "slug": product.slug})
        browser.visit(live_server + product_url)
        wait_until_appeared(browser, ".product-main")
        browser.visit(live_server + category_url)
        wait_until_appeared(browser, ".categories-nav")
        items = browser.find_by_css(".recently-viewed li")
        assert items.first.text == product.name, "recently clicked product on top"
        assert len(items) == min(i, 5)
开发者ID:gurch101,项目名称:shuup,代码行数:18,代码来源:test_recently_viewed_products.py


示例19: _test_add_lines

def _test_add_lines(browser):
    line_items_before = browser.find_by_id("lines").find_by_css('.list-group-item')
    click_element(browser, "#add-line")
    wait_until_condition(
        browser, lambda x: len(x.find_by_css("#lines .list-group-item")) == len(line_items_before) + 1)
    # select product
    click_element(browser, "#lines .list-group-item:last-child a")
    browser.windows.current = browser.windows[1]
    wait_until_appeared(browser, "a")
    click_element(browser, "tbody a:first-of-type")
    browser.windows.current = browser.windows[0]
    wait_until_condition(browser, lambda x: x.find_by_css('#lines input[name="total"]').first.value == '10')
    last_line_item = browser.find_by_css("#lines .list-group-item:last-child")
    assert last_line_item.find_by_css('input[name="quantity"]').first.value == "1", "1 piece added"
    assert last_line_item.find_by_css('input[name="total"]').first.value == "10", "line item total is 10"
    click_element(browser, "#lines .list-group-item:last-child .delete button")
    wait_until_condition(
        browser,
        lambda x: len(x.find_by_css("#lines .list-group-item")) == len(line_items_before))
开发者ID:yourkin,项目名称:shuup,代码行数:19,代码来源:test_order_creator.py


示例20: test_gdpr_consent

def test_gdpr_consent(browser, live_server, settings):
    shop = get_default_shop()
    index_url = reverse("shuup:index")

    # create a GDPR setting for the shop
    shop_gdpr = GDPRSettings.get_for_shop(shop)
    shop_gdpr.cookie_banner_content = "my cookie banner content"
    shop_gdpr.cookie_privacy_excerpt = "my cookie privacyexcerpt"
    shop_gdpr.enabled = True
    shop_gdpr.save() # Enable GDPR

    browser = initialize_front_browser_test(browser, live_server)
    browser.visit("%s%s" % (live_server, index_url))
    wait_until_appeared(browser, ".gdpr-consent-warn-bar")
    assert (len(browser.find_by_css(".gdpr-consent-preferences")) == 1)
    click_element(browser, "#agree-btn")

    wait_until_condition(browser, lambda x: len(x.find_by_css(".gdpr-consent-warn-bar")) == 0)
    wait_until_condition(browser, lambda x: len(x.find_by_css(".gdpr-consent-preferences")) == 0)
开发者ID:ruqaiya,项目名称:shuup,代码行数:19,代码来源:test_gdpr_consent.py



注:本文中的shuup.testing.browser_utils.wait_until_appeared函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python browser_utils.wait_until_condition函数代码示例发布时间:2022-05-27
下一篇:
Python browser_utils.click_element函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap