change that tab open change url inplace and get active tab from window id
This commit is contained in:
@@ -81,3 +81,24 @@ def test_nav_open_in_background(browser):
|
||||
assert not new_tab.get("active"), "background tab should not be active"
|
||||
finally:
|
||||
browser("tabs.close", {"tabId": new_id})
|
||||
|
||||
|
||||
def test_nav_to_updates_existing_tab(browser):
|
||||
result = browser("navigate.open", {"url": "https://example.com", "background": True})
|
||||
tab_id = result["id"]
|
||||
|
||||
try:
|
||||
before_ids = {t["id"] for t in browser("tabs.list")}
|
||||
updated = browser("navigate.to", {"tabId": tab_id, "url": "https://example.org"})
|
||||
assert updated["id"] == tab_id
|
||||
|
||||
tabs = browser("tabs.list")
|
||||
after_ids = {t["id"] for t in tabs}
|
||||
assert after_ids == before_ids
|
||||
tab = next(t for t in tabs if t["id"] == tab_id)
|
||||
assert "example.org" in (tab.get("url") or "")
|
||||
finally:
|
||||
try:
|
||||
browser("tabs.close", {"tabId": tab_id})
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user