本文整理汇总了Python中shuup.testing.browser_utils.wait_until_condition函数的典型用法代码示例。如果您正苦于以下问题:Python wait_until_condition函数的具体用法?Python wait_until_condition怎么用?Python wait_until_condition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wait_until_condition函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _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
示例2: _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
示例3: test_product_descriptions
def test_product_descriptions(browser, live_server, settings):
activate("en")
cache.clear()
shop = get_default_shop()
product = create_product("product1",
shop=shop,
description="<b>My HTML description</b>",
short_description="some short of description instead",
supplier=get_default_supplier())
sp = ShopProduct.objects.get(product=product, shop=shop)
sp.primary_category = get_default_category()
sp.categories.add(get_default_category())
sp.save()
# initialize test and go to front page
browser = initialize_front_browser_test(browser, live_server)
# view product detail page
url = reverse("shuup:product", kwargs={"pk": product.pk, "slug": product.slug})
browser.visit("%s%s" % (live_server, url))
wait_until_condition(browser, lambda x: x.is_text_present(product.short_description))
assert product.description in browser.html
# ensure the version is in static files
assert "style.css?v=%s" % shuup.__version__ in browser.html
# product preview
url = reverse("shuup:xtheme_extra_view", kwargs={"view": "products"})
browser.visit("%s%s" % (live_server, url))
product_div_name = "product-{}".format(product.pk)
wait_until_condition(browser, lambda x: x.find_by_css("#{} button.btn".format(product_div_name)))
browser.execute_script("$('#{} button.btn').click();".format(product_div_name))
assert product.short_description == browser.find_by_css("#{} p.description".format(product_div_name))[0].html
开发者ID:gurch101,项目名称:shuup,代码行数:33,代码来源:test_product_view.py
示例4: _test_quick_add_lines
def _test_quick_add_lines(browser):
assert browser.find_by_css("input[name='auto-add']").first.checked == True
# add line automatically just by searching and finding direct match
click_element(browser, "#quick-add .select2")
wait_until_condition(
browser, lambda x: len(browser.find_by_css("#quick-add .select2-container--open")) == 1)
browser.find_by_css("input.select2-search__field").first.value = "test-sku1"
wait_until_condition(browser, lambda x: len(x.find_by_css("#lines .list-group-item")) == 1)
line_items = browser.find_by_css("#lines .list-group-item")
assert len(browser.find_by_css("#quick-add .select2-container--open")) == 1, "select is open after add"
assert line_items.first.find_by_css('input[name="quantity"]').first.value == '1', "one piece added"
browser.find_by_css("input.select2-search__field").first.value = "test-sku1"
wait_until_condition(browser, lambda x: x.find_by_css('#lines input[name="quantity"]').first.value == '2')
line_items = browser.find_by_id("lines").find_by_css('.list-group-item')
assert len(line_items) == 1, "only one line item exists"
assert line_items.first.find_by_css('input[name="quantity"]').first.value == '2', "two pieces added"
# add line automatically by searching and clicking on match
browser.find_by_css("input.select2-search__field").first.value = "test-sku"
wait_until_appeared(browser, ".select2-results__option:not([aria-live='assertive'])")
browser.execute_script('$($(".select2-results__option")[0]).trigger({type: "mouseup"})')
wait_until_condition(browser, lambda x: x.find_by_css('#lines input[name="quantity"]').first.value == '3')
assert line_items.first.find_by_css('input[name="quantity"]').first.value == '3', "three pieces added"
# add line manually
browser.uncheck("auto-add")
click_element(browser, "#quick-add .select2")
wait_until_appeared(browser, "input.select2-search__field")
browser.find_by_css("input.select2-search__field").first.value = "test-sku0"
wait_until_appeared(browser, ".select2-results__option:not([aria-live='assertive'])")
browser.execute_script('$($(".select2-results__option")[0]).trigger({type: "mouseup"})')
wait_until_condition(browser, lambda x: len(x.find_by_css('#lines .list-group-item')) == 2)
line_items = browser.find_by_id("lines").find_by_css('.list-group-item')
assert len(line_items) == 2, "two line items exist"
开发者ID:suutari,项目名称:shoop,代码行数:35,代码来源:test_order_creator.py
示例5: test_single_page_checkout_with_login_and_register
def test_single_page_checkout_with_login_and_register(browser, live_server, settings):
# initialize
product_name = "Test Product"
get_default_shop()
pm = get_default_payment_method()
sm = get_default_shipping_method()
product = create_orderable_product(product_name, "test-123", price=100)
OrderStatus.objects.create(
identifier="initial",
role=OrderStatusRole.INITIAL,
name="initial",
default=True
)
# Initialize test and go to front page
browser = initialize_front_browser_test(browser, live_server)
wait_until_condition(browser, lambda x: x.is_text_present("Welcome to Default!"))
navigate_to_checkout(browser, product)
# Let's assume that after addresses the checkout is normal
wait_until_condition(browser, lambda x: x.is_text_present("Checkout Method"))
test_username = "test_username"
test_email = "[email protected]"
test_password = "test_password"
register_test(browser, live_server, test_username, test_email, test_password)
login_and_finish_up_the_checkout(browser, live_server, test_username, test_email, test_password)
开发者ID:gurch101,项目名称:shuup,代码行数:28,代码来源:test_checkout_with_login_and_register.py
示例6: 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
示例7: 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
示例8: test_menu
def test_menu(browser, admin_user, live_server, settings):
shop = get_default_shop()
initialize_admin_browser_test(browser, live_server, settings)
browser.find_by_css(".menu-list li").first.click()
wait_until_condition(browser, lambda x: x.is_text_present("New product"))
# Make sure that the menu is clickable in small devices
browser.driver.set_window_size(480, 960)
browser.find_by_css("#menu-button").first.click()
browser.find_by_css(".menu-list li").first.click()
wait_until_condition(browser, lambda x: x.is_text_present("New product"))
开发者ID:suutari,项目名称:shoop,代码行数:13,代码来源:test_menu.py
示例9: categories_filter_test
def categories_filter_test(browser, first_cat, second_cat, third_cat):
# Add all products in second category to also in first category
for shop_product in ShopProduct.objects.filter(primary_category=second_cat):
shop_product.categories.add(first_cat)
# Add one product including first_cat also to third_cat
shop_product = ShopProduct.objects.filter(primary_category=first_cat).last()
shop_product.categories.add(third_cat)
# Activate categories filter for current category which is the first one
set_configuration(
category=first_cat,
data={
"override_default_configuration": True,
"sort_products_by_name": True,
"sort_products_by_name_ordering": 1,
"sort_products_by_price": True,
"sort_products_by_price_ordering": 2,
"filter_products_by_category": True
}
)
browser.reload()
wait_until_condition(browser, lambda x: x.is_element_present_by_id("categories-%s" % third_cat.id))
browser.execute_script("$('#categories-%s').click();" % third_cat.id)
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 1)
browser.execute_script("$('#categories-%s').click();" % second_cat.id)
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 1)
browser.execute_script("$('#categories-%s').click();" % third_cat.id)
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 12)
开发者ID:ruqaiya,项目名称:shuup,代码行数:28,代码来源:test_category_view.py
示例10: second_category_sort_test
def second_category_sort_test(browser, live_server, shop, category):
url = reverse("shuup:category", kwargs={"pk": category.pk, "slug": category.slug})
browser.visit("%s%s" % (live_server, url))
wait_until_condition(browser, lambda x: x.is_element_present_by_css("button[data-id='id_limit']"), timeout=30)
# Set limit to 24
click_element(browser, "button[data-id='id_limit']")
click_element(browser, "button[data-id='id_limit'] + .dropdown-menu li[data-original-index='1'] a")
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 13, timeout=30)
# Check that visibility change affects the product count
shop_products = ShopProduct.objects.filter(primary_category_id=category.id)[:3]
for sp in shop_products:
sp.visibility = ShopProductVisibility.NOT_VISIBLE
sp.save()
cache.clear()
browser.reload()
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 10)
for sp in shop_products:
sp.visibility = ShopProductVisibility.ALWAYS_VISIBLE
sp.save()
cache.clear()
browser.reload()
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 13, timeout=30)
开发者ID:ruqaiya,项目名称:shuup,代码行数:27,代码来源:test_category_view.py
示例11: second_category_sort_with_price_filter
def second_category_sort_with_price_filter(browser, category):
set_configuration(
category=category,
data={
"override_default_configuration": True,
"filter_products_by_price": True,
"filter_products_by_price_range_min": 5,
"filter_products_by_price_range_max": 12,
"filter_products_by_price_range_size": 3
}
)
browser.reload()
wait_until_condition(browser, lambda x: len(x.find_by_css("#id_price_range option")) == 5)
# 5 products and let's filter all products with price less than 5
click_element(browser, "button[data-id='id_price_range']")
click_element(browser, "button[data-id='id_price_range'] + .dropdown-menu li[data-original-index='1'] a")
# 4 products and let's filter products with price +12
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 4)
click_element(browser, "button[data-id='id_price_range']")
click_element(browser, "button[data-id='id_price_range'] + .dropdown-menu li[data-original-index='4'] a")
# Now 2 products left and now filter with price 8-11
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 2)
click_element(browser, "button[data-id='id_price_range']")
click_element(browser, "button[data-id='id_price_range'] + .dropdown-menu li[data-original-index='3'] a")
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 3)
开发者ID:ruqaiya,项目名称:shuup,代码行数:29,代码来源:test_category_view.py
示例12: basic_sorting_test
def basic_sorting_test(browser):
# Sort from Z to A
click_element(browser, "button[data-id='id_sort']")
# WARNING: data-original-index was removed after bootstrap-select 1.6.3
click_element(browser, "li[data-original-index='1'] a")
expected_first_prod_id = "product-%s" % Product.objects.filter(sku="sku-3").first().id
wait_until_condition(
browser, lambda x: x.find_by_css(".product-card").first["id"] == expected_first_prod_id)
# Sort by price (highest first)
click_element(browser, "button[data-id='id_sort']")
click_element(browser, "li[data-original-index='3'] a")
expected_first_prod_id = "product-%s" % Product.objects.filter(sku="sku-8").first().id
wait_until_condition(
browser, lambda x: x.find_by_css(".product-card").first["id"] == expected_first_prod_id)
# Sort by price (lowest first)
click_element(browser, "button[data-id='id_sort']")
click_element(browser, "li[data-original-index='2'] a")
expected_first_prod_id = "product-%s" % Product.objects.filter(sku="sku-3").first().id
wait_until_condition(
browser, lambda x: x.find_by_css(".product-card").first["id"] == expected_first_prod_id)
# Sort from A to Z
click_element(browser, "button[data-id='id_sort']")
click_element(browser, "li[data-original-index='0'] a")
expected_first_prod_id = "product-%s" % Product.objects.filter(sku="sku-2").first().id
wait_until_condition(
browser, lambda x: x.find_by_css(".product-card").first["id"] == expected_first_prod_id)
开发者ID:ruqaiya,项目名称:shuup,代码行数:30,代码来源:test_search_view.py
示例13: second_category_sort_test
def second_category_sort_test(browser, live_server, shop, category):
url = reverse("shuup:category", kwargs={"pk": category.pk, "slug": category.slug})
browser.visit("%s%s" % (live_server, url))
assert not browser.is_text_present("Sort") # Sort shouldn't be available since default configurations
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 12)
click_element(browser, "#next_page a")
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 1, timeout=30)
click_element(browser, "#previous_page a")
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 12, timeout=30)
# Activate limit page size changer
set_configuration(
shop=shop,
data={
"sort_products_by_name": True,
"sort_products_by_name_ordering": 1,
"sort_products_by_price": True,
"sort_products_by_price_ordering": 2,
"limit_product_list_page_size": True
}
)
browser.reload()
# Set limit to 24
click_element(browser, "button[data-id='id_limit']")
click_element(browser, "button[data-id='id_limit'] + .dropdown-menu li[data-original-index='1'] a")
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 13)
开发者ID:suutari,项目名称:shoop,代码行数:26,代码来源:test_category_view.py
示例14: second_test_query
def second_test_query(browser, live_server, url):
browser.visit("%s%s?q=Test" % (live_server, url))
wait_until_condition(browser, lambda x: len(x.find_by_css(".product-card")) == 7)
expected_first_prod_id = "product-%s" % Product.objects.filter(sku="sku-4").first().id
wait_until_condition(browser, lambda x: x.find_by_css(".product-card").first["id"] == expected_first_prod_id)
expected_second_prod_id = "product-%s" % Product.objects.filter(sku="sku-10").first().id
wait_until_condition(browser, lambda x: x.find_by_css(".product-card")[1]["id"] == expected_second_prod_id)
expected_third_prod_id = "product-%s" % Product.objects.filter(sku="sku-8").first().id
wait_until_condition(browser, lambda x: x.find_by_css(".product-card")[2]["id"] == expected_third_prod_id)
expected_last_prod_id = "product-%s" % Product.objects.filter(sku="sku-2").first().id
wait_until_condition(browser, lambda x: x.find_by_css(".product-card").last["id"] == expected_last_prod_id)
开发者ID:suutari,项目名称:shoop,代码行数:14,代码来源:test_search_view.py
示例15: test_quick_add
def test_quick_add(browser, admin_user, live_server, settings):
shop = get_default_shop()
get_default_product_type()
get_default_sales_unit()
get_default_tax_class()
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)
wait_until_appeared(browser, "#id_shop%d-primary_category ~ .quick-add-btn a.btn" % shop.id)
click_element(browser, "#id_shop%d-primary_category ~ .quick-add-btn a.btn" % shop.id)
wait_until_appeared(browser, "#create-object-iframe")
with browser.get_iframe('create-object-iframe') as iframe:
assert Category.objects.count() == 0
wait_until_appeared(iframe, "input[name='base-name__en']")
iframe.fill("base-name__en", "Test Category")
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']")
click_element(browser, "button[form='category_form']")
wait_until_condition(browser, condition=lambda x: Category.objects.count() == 1, timeout=20)
assert Category.objects.first().name == "Test Category"
# click to edit the button
click_element(browser, "#id_shop%d-primary_category ~ .edit-object-btn a.btn" % shop.id)
with browser.get_iframe('create-object-iframe') as iframe:
wait_until_appeared(iframe, "input[name='base-name__en']")
new_cat_name = "Changed Name"
iframe.fill("base-name__en", new_cat_name)
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']")
click_element(iframe, "button[form='category_form']")
wait_until_condition(browser, condition=lambda x: Category.objects.first().name == new_cat_name, timeout=20)
click_element(browser, "button[form='product_form']")
wait_until_appeared(browser, "div[class='message success']")
开发者ID:ruqaiya,项目名称:shuup,代码行数:49,代码来源:test_quick_add_edit_button.py
示例16: test_product_detail
def test_product_detail(browser, admin_user, live_server, settings):
activate(settings.PARLER_DEFAULT_LANGUAGE_CODE)
shop = get_default_shop()
order = create_empty_order(shop=shop)
order.save()
initialize_admin_browser_test(browser, live_server, settings)
url = reverse("shuup_admin:order.detail", kwargs={"pk": order.pk})
browser.visit("%s%s" % (live_server, url))
wait_until_condition(browser, condition=lambda x: x.is_text_present("Order %s" % order.pk))
change_addresses(live_server, browser, order)
set_status(browser, order, OrderStatus.objects.get_default_processing())
assert order.can_set_complete()
set_status(browser, order, OrderStatus.objects.get_default_complete())
开发者ID:ruqaiya,项目名称:shuup,代码行数:15,代码来源:test_order_detail.py
示例17: 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
示例18: _add_primary_category
def _add_primary_category(browser, shop):
assert Category.objects.count() == 0
select_id = "id_shop%s-primary_category" % shop.pk
move_to_element(browser, "#%s" % select_id, header_height=100)
# Quick add new primary category
wait_until_appeared(browser, "#id_shop%d-primary_category ~ .quick-add-btn a.btn" % shop.id)
click_element(browser, "#id_shop%d-primary_category ~ .quick-add-btn a.btn" % shop.id)
wait_until_appeared(browser, "#create-object-iframe")
with browser.get_iframe('create-object-iframe') as iframe:
wait_until_appeared(iframe, "input[name='base-name__en']")
iframe.fill("base-name__en", "Test Category")
_save_category(iframe)
wait_until_condition(browser, condition=lambda x: not x.is_element_present_by_id("create-object-overlay"))
check_category_count(browser, 1)
wait_until_condition(browser, lambda x: len(x.find_by_css("#%s option" % select_id)) == 1)
开发者ID:ruqaiya,项目名称:shuup,代码行数:17,代码来源:test_product_create.py
示例19: _activate_basket_campaign_through_coupon
def _activate_basket_campaign_through_coupon(browser, category, shop):
# We should already be at basket so let's verify the total
wait_until_condition(browser, lambda x: "110.53" in x.find_by_css("div.total-price strong").first.text)
coupon_code = _create_coupon_campaign(category, shop)
browser.fill("code", coupon_code)
click_element(browser, "#submit-code")
wait_until_condition(browser, lambda x: x.is_text_present(coupon_code))
wait_until_condition(browser, lambda x: "-€22.11" in x.find_by_css("div.product-sum h4.price").last.text)
wait_until_condition(browser, lambda x: "€88.42" in x.find_by_css("div.total-price strong").first.text)
开发者ID:ruqaiya,项目名称:shuup,代码行数:11,代码来源:test_coupon.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_condition函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论