Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions webdriver/tests/bidi/storage/delete_cookies/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def test_filter(
new_tab,
test_page,
domain_value,
add_cookie,
add_document_cookie,
filter,
):
await bidi_session.browsing_context.navigate(
Expand All @@ -40,14 +40,14 @@ async def test_filter(
cookie_value_matching_filter = "bar"

cookie1_name = "baz"
await add_cookie(new_tab["context"], cookie1_name, cookie_value_matching_filter, secure=True)
await add_document_cookie(new_tab["context"], cookie1_name, cookie_value_matching_filter, secure=True)

cookie2_name = "foo"
await add_cookie(new_tab["context"], cookie2_name, cookie_value_matching_filter, secure=True)
await add_document_cookie(new_tab["context"], cookie2_name, cookie_value_matching_filter, secure=True)

cookie3_name = "foo_3"
cookie3_value = "not_bar"
await add_cookie(new_tab["context"], cookie3_name, cookie3_value, secure=True)
await add_document_cookie(new_tab["context"], cookie3_name, cookie3_value, secure=True)

result = await bidi_session.storage.delete_cookies(
filter=filter,
Expand Down Expand Up @@ -75,7 +75,7 @@ async def test_filter_domain(
test_page,
test_page_cross_origin,
domain_value,
add_cookie,
add_document_cookie,
):
await bidi_session.browsing_context.navigate(
context=top_context["context"], url=test_page, wait="complete"
Expand All @@ -86,16 +86,16 @@ async def test_filter_domain(

cookie1_name = "bar"
cookie1_value = "foo"
await add_cookie(top_context["context"], cookie1_name, cookie1_value, secure=True)
await add_document_cookie(top_context["context"], cookie1_name, cookie1_value, secure=True)

cookie2_name = "foo"
cookie2_value = "bar"
await add_cookie(top_context["context"], cookie2_name, cookie2_value, secure=True)
await add_document_cookie(top_context["context"], cookie2_name, cookie2_value, secure=True)

cookie3_name = "foo_2"
cookie3_value = "bar_2"
cookie3_domain = domain_value(domain="alt")
await add_cookie(new_tab["context"], cookie3_name, cookie3_value, secure=True)
await add_document_cookie(new_tab["context"], cookie3_name, cookie3_value, secure=True)

filter = CookieFilter(domain=domain_value())
result = await bidi_session.storage.delete_cookies(
Expand Down Expand Up @@ -129,7 +129,7 @@ async def test_filter_expiry(
new_tab,
test_page,
domain_value,
add_cookie,
add_document_cookie,
expiry_diff_to_delete,
expiry_diff_to_remain,
):
Expand All @@ -143,7 +143,7 @@ async def test_filter_expiry(

cookie1_name = "bar"
cookie1_value = "foo"
await add_cookie(
await add_document_cookie(
context=new_tab["context"],
name=cookie1_name,
value=cookie1_value,
Expand All @@ -153,7 +153,7 @@ async def test_filter_expiry(

cookie2_name = "foo"
cookie2_value = "bar"
await add_cookie(
await add_document_cookie(
context=new_tab["context"],
name=cookie2_name,
value=cookie2_value,
Expand All @@ -169,7 +169,7 @@ async def test_filter_expiry(
expiry_date_to_remain = generate_expiry_date(expiry_diff_to_remain)
date_string_to_remain = format_expiry_string(expiry_date_to_remain)

await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie3_name,
cookie3_value,
Expand Down Expand Up @@ -197,7 +197,7 @@ async def test_filter_expiry(
)


async def test_filter_name(bidi_session, new_tab, test_page, add_cookie, domain_value):
async def test_filter_name(bidi_session, new_tab, test_page, add_document_cookie, domain_value):
await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=test_page, wait="complete"
)
Expand All @@ -206,20 +206,20 @@ async def test_filter_name(bidi_session, new_tab, test_page, add_cookie, domain_

cookie1_value = "bar"
cookie1_path = "/"
await add_cookie(
await add_document_cookie(
new_tab["context"], name_to_delete, cookie1_value, path=cookie1_path, secure=True
)

cookie2_value = "baz"
cookie2_path = "/webdriver/"
await add_cookie(
await add_document_cookie(
new_tab["context"], name_to_delete, cookie2_value, path=cookie2_path, secure=True
)

name_to_remain = "foo_2"
cookie3_value = "bar_2"
cookie3_path = "/"
await add_cookie(new_tab["context"], name_to_remain, cookie3_value, path=cookie3_path, secure=True)
await add_document_cookie(new_tab["context"], name_to_remain, cookie3_value, path=cookie3_path, secure=True)

filter = CookieFilter(name=name_to_delete)
result = await bidi_session.storage.delete_cookies(
Expand Down Expand Up @@ -258,15 +258,15 @@ async def test_filter_same_site(
domain_value,
same_site_to_delete,
same_site_to_remain,
add_cookie,
add_document_cookie,
):
await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=test_page, wait="complete"
)

cookie1_name = "bar"
cookie1_value = "foo"
await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie1_name,
cookie1_value,
Expand All @@ -276,7 +276,7 @@ async def test_filter_same_site(

cookie2_name = "foo"
cookie2_value = "bar"
await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie2_name,
cookie2_value,
Expand All @@ -286,7 +286,7 @@ async def test_filter_same_site(

cookie3_name = "foo_3"
cookie3_value = "bar_3"
await add_cookie(
await add_document_cookie(
new_tab["context"], cookie3_name, cookie3_value, same_site=same_site_to_remain, secure=True
)

Expand Down Expand Up @@ -320,7 +320,7 @@ async def test_filter_secure(
new_tab,
test_page,
domain_value,
add_cookie,
add_document_cookie,
secure_to_delete,
secure_to_remain,
):
Expand All @@ -330,7 +330,7 @@ async def test_filter_secure(

cookie1_name = "bar"
cookie1_value = "foo"
await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie1_name,
cookie1_value,
Expand All @@ -340,7 +340,7 @@ async def test_filter_secure(

cookie2_name = "foo"
cookie2_value = "bar"
await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie2_name,
cookie2_value,
Expand All @@ -350,7 +350,7 @@ async def test_filter_secure(

cookie3_name = "foo_3"
cookie3_value = "bar_3"
await add_cookie(
await add_document_cookie(
new_tab["context"], cookie3_name, cookie3_value, same_site="strict", secure=secure_to_remain
)

Expand Down Expand Up @@ -388,7 +388,7 @@ async def test_filter_path(
new_tab,
test_page,
domain_value,
add_cookie,
add_document_cookie,
path_to_delete,
path_to_remain,
):
Expand All @@ -398,7 +398,7 @@ async def test_filter_path(

cookie1_name = "bar"
cookie1_value = "foo"
await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie1_name,
cookie1_value,
Expand All @@ -408,7 +408,7 @@ async def test_filter_path(

cookie2_name = "foo"
cookie2_value = "bar"
await add_cookie(
await add_document_cookie(
new_tab["context"],
cookie2_name,
cookie2_value,
Expand All @@ -418,7 +418,7 @@ async def test_filter_path(

cookie3_name = "foo_3"
cookie3_value = "bar_3"
await add_cookie(
await add_document_cookie(
new_tab["context"], cookie3_name, cookie3_value, path=path_to_remain, secure=True
)

Expand Down
16 changes: 8 additions & 8 deletions webdriver/tests/bidi/storage/delete_cookies/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def test_default_partition(
test_page,
test_page_cross_origin,
domain_value,
add_cookie,
add_document_cookie,
set_cookie,
with_document_cookie,
):
Expand All @@ -43,8 +43,8 @@ async def test_default_partition(
cookie2_value = "bar_2"

if with_document_cookie:
await add_cookie(new_tab["context"], cookie1_name, cookie1_value, secure=True)
await add_cookie(top_context["context"], cookie2_name, cookie2_value, secure=True)
await add_document_cookie(new_tab["context"], cookie1_name, cookie1_value, secure=True)
await add_document_cookie(top_context["context"], cookie2_name, cookie2_value, secure=True)
else:
await set_cookie(
cookie=create_cookie(
Expand Down Expand Up @@ -77,7 +77,7 @@ async def test_partition_context(
new_tab,
test_page,
domain_value,
add_cookie,
add_document_cookie,
set_cookie,
with_document_cookie,
):
Expand All @@ -89,7 +89,7 @@ async def test_partition_context(
cookie_value = "bar"
partition = BrowsingContextPartitionDescriptor(new_tab["context"])
if with_document_cookie:
await add_cookie(new_tab["context"], cookie_name, cookie_value, secure=True)
await add_document_cookie(new_tab["context"], cookie_name, cookie_value, secure=True)
else:
await set_cookie(
cookie=create_cookie(
Expand Down Expand Up @@ -224,7 +224,7 @@ async def test_partition_user_context(
create_user_context,
test_page_cross_origin,
domain_value,
add_cookie,
add_document_cookie,
set_cookie,
with_document_cookie,
):
Expand Down Expand Up @@ -255,10 +255,10 @@ async def test_partition_user_context(
cookie2_partition = StorageKeyPartitionDescriptor(user_context=user_context_2)

if with_document_cookie:
await add_cookie(
await add_document_cookie(
new_context_1["context"], cookie1_name, cookie1_value, path="/", secure=True
)
await add_cookie(
await add_document_cookie(
new_context_2["context"], cookie2_name, cookie2_value, path="/", secure=True
)
else:
Expand Down
Loading