"""Integration tests for page.info command — require a live browser.""" def test_page_info_returns_required_fields(browser, http_tab): """page.info returns title, url, readyState and lang.""" browser("tabs.active", {"tabId": http_tab["id"]}) info = browser("page.info") assert isinstance(info, dict) assert "title" in info assert "url" in info assert "readyState" in info assert "lang" in info def test_page_info_url_matches_active_tab(browser, http_tab): """URL reported by page.info matches the tab URL in tabs.list.""" browser("tabs.active", {"tabId": http_tab["id"]}) info = browser("page.info") assert info is not None # Active tab URL should match (allow for trailing slash difference) assert "example.com" in info.get("url", "") def test_page_info_ready_state_complete(browser, http_tab): """A fully loaded page reports readyState == 'complete'.""" browser("tabs.active", {"tabId": http_tab["id"]}) info = browser("page.info") assert info.get("readyState") == "complete" def test_page_info_title_non_empty(browser, http_tab): """example.com has a non-empty title.""" browser("tabs.active", {"tabId": http_tab["id"]}) info = browser("page.info") assert isinstance(info.get("title"), str) assert len(info["title"]) > 0 def test_page_info_meta_is_dict(browser, http_tab): """meta field is a dict (may be empty for simple pages).""" browser("tabs.active", {"tabId": http_tab["id"]}) info = browser("page.info") meta = info.get("meta") assert meta is None or isinstance(meta, dict)