Skip to content

Commit 69a3119

Browse files
committed
fix missing test helper
1 parent da2bc6f commit 69a3119

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { Page } from '@playwright/test';
2+
3+
/**
4+
* Mocks the environment API call to return a claimed instance.
5+
* Used in keyless mode tests to simulate an instance that has been claimed.
6+
*/
7+
export const mockClaimedInstanceEnvironmentCall = async (page: Page): Promise<void> => {
8+
await page.route('*/**/v1/environment*', async route => {
9+
const response = await route.fetch();
10+
const json = await response.json();
11+
const newJson = {
12+
...json,
13+
auth_config: {
14+
...json.auth_config,
15+
claimed_at: Date.now(),
16+
},
17+
};
18+
await route.fulfill({ response, json: newJson });
19+
});
20+
};

0 commit comments

Comments
 (0)