-
Couldn't load subscription status.
- Fork 114
fix(playwright): Add playwright workaround within Accordion's .expect_open() and .expect_panels()
#1165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(playwright): Add playwright workaround within Accordion's .expect_open() and .expect_panels()
#1165
Changes from 1 commit
f187256
4512291
499ce37
f8ff5dd
9a84c63
d55b965
ee915b3
fb33260
9d6b8fd
ca92697
024089f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| from playwright.sync_api import FilePayload, FloatRect, Locator, Page, Position | ||
| from playwright.sync_api import expect as playwright_expect | ||
|
|
||
| # Import `shiny`'s typing extentions. | ||
| # Import `shiny`'s typing extensions. | ||
| # Since this is a private file, tell pyright to ignore the import | ||
| # (Imports split over many import statements due to auto formatting) | ||
| from shiny._typing_extensions import ( | ||
|
|
@@ -1090,31 +1090,29 @@ def expect_locator_values_in_list( | |
| loc_container_orig = loc_container | ||
|
|
||
| # Find all items in set | ||
| for item, i in zip(arr, range(len(arr))): | ||
| # Get all elements of type | ||
| has_locator = loc_item | ||
| # Get the `n`th matching element | ||
| has_locator = has_locator.nth(i) | ||
| # Make sure that element has the correct attribute value | ||
| has_locator = has_locator.locator( | ||
| f"xpath=self::*[{_xpath_match_str(key, item)}]" | ||
| ) | ||
|
|
||
| # Given the container, make sure it contains this locator | ||
| loc_container = loc_container.locator( | ||
| # Return self | ||
| "xpath=.", | ||
| has=has_locator, | ||
| ) | ||
|
|
||
| # Make sure other items are not in set | ||
| # If we know all elements are contained in the container, | ||
| # and all elements all unique, then it should have a count of `len(arr)` | ||
| for i in range(len(arr)): | ||
| # Get ith element of type | ||
| loc_item.nth(i) | ||
| # # Make sure that element has the correct attribute value | ||
| # has_locator = has_locator.locator( | ||
| # f"xpath=self::*[{_xpath_match_str(key, item)}]" | ||
| # ) | ||
| # | ||
| # # Given the container, make sure it contains this locator | ||
| # loc_container = loc_container.locator( | ||
| # # Return self | ||
| # "xpath=.", | ||
| # has=has_locator, | ||
| # ) | ||
|
||
|
|
||
| # Make sure other items are not in the set. | ||
| # If we know all elements are contained in the container | ||
| # and all elements are unique, then it should have a count of `len(arr)` | ||
| loc_inputs = loc_container.locator(loc_item) | ||
| try: | ||
| playwright_expect(loc_inputs).to_have_count(len(arr), timeout=timeout) | ||
| except AssertionError as e: | ||
| # Debug expections | ||
| # Debug expectations | ||
|
|
||
| # Expecting container to exist (count = 1) | ||
| playwright_expect(loc_container_orig).to_have_count(1, timeout=timeout) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.