MCPcopy Create free account
hub / github.com/THUDM/AutoWebGLM / test_auth_cookie

Function test_auth_cookie

webarena/tests/test_browser_env/test_auth_cookie.py:22–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21
22def 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
44def test_async_auth_cookie() -> None:

Callers

nothing calls this directly

Calls 5

resetMethod · 0.95
stepMethod · 0.95
closeMethod · 0.95
ScriptBrowserEnvClass · 0.85
create_goto_url_actionFunction · 0.85

Tested by

no test coverage detected