|
15 | 15 | from tenacity import retry, stop_after_attempt, retry_if_exception_type |
16 | 16 |
|
17 | 17 | from browsergym.workarena import ATOMIC_TASKS |
| 18 | +from browsergym.workarena.instance import SNowInstance, fetch_instances |
| 19 | + |
| 20 | +INSTANCE_POOL = fetch_instances() |
| 21 | + |
| 22 | +if not INSTANCE_POOL: |
| 23 | + pytest.skip( |
| 24 | + "No ServiceNow instances available from fetch_instances().", allow_module_level=True |
| 25 | + ) |
| 26 | + |
| 27 | + |
| 28 | +@pytest.fixture( |
| 29 | + scope="session", params=INSTANCE_POOL, ids=[entry["url"] for entry in INSTANCE_POOL] |
| 30 | +) |
| 31 | +def snow_instance_entry(request): |
| 32 | + return request.param |
18 | 33 |
|
19 | 34 |
|
20 | 35 | @retry( |
|
26 | 41 | @pytest.mark.parametrize("task_entrypoint", ATOMIC_TASKS) |
27 | 42 | @pytest.mark.parametrize("random_seed", range(1)) |
28 | 43 | @pytest.mark.slow |
29 | | -def test_cheat(task_entrypoint, random_seed: int, page: Page): |
30 | | - task = task_entrypoint(seed=random_seed) |
| 44 | +def test_cheat(task_entrypoint, random_seed: int, page: Page, snow_instance_entry): |
| 45 | + instance = SNowInstance( |
| 46 | + snow_url=snow_instance_entry["url"], |
| 47 | + snow_credentials=("admin", snow_instance_entry["password"]), |
| 48 | + ) |
| 49 | + task = task_entrypoint(seed=random_seed, instance=instance) |
31 | 50 | goal, info = task.setup(page=page) |
32 | 51 | chat_messages = [] |
33 | 52 | reward, done, message, info = task.validate(page, chat_messages) |
|
0 commit comments