()
| 20 | |
| 21 | |
| 22 | def test_auth_cookie() -> None: |
| 23 | env = ScriptBrowserEnv() |
| 24 | env.reset() |
| 25 | _, reward, _, _, info = env.step( |
| 26 | create_goto_url_action("https://www.saucedemo.com/inventory.html"), |
| 27 | ) |
| 28 | assert reward == 1 |
| 29 | assert "page" in info and isinstance(info["page"], DetachedPage) |
| 30 | assert info["page"].url == "https://www.saucedemo.com/" |
| 31 | json.dump(auth_json, open("/tmp/auth.json", "w")) |
| 32 | instance_config = {"storage_state": "/tmp/auth.json"} |
| 33 | json.dump(instance_config, open("/tmp/config.json", "w")) |
| 34 | env.reset(options={"config_file": "/tmp/config.json"}) |
| 35 | _, reward, _, _, info = env.step( |
| 36 | create_goto_url_action("https://www.saucedemo.com/inventory.html"), |
| 37 | ) |
| 38 | assert reward == 1 |
| 39 | assert "page" in info and isinstance(info["page"], DetachedPage) |
| 40 | assert info["page"].url == "https://www.saucedemo.com/inventory.html" |
| 41 | env.close() |
| 42 | |
| 43 | |
| 44 | def test_async_auth_cookie() -> None: |
nothing calls this directly
no test coverage detected