Skip to content

Commit cd07155

Browse files
committed
refactor: 💡 Force requests in playwright to use controller addr
1 parent 4b1327d commit cd07155

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎e2e-tests/global-setup.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,25 @@ async function globalSetup() {
2727
const authenticateToBoundary = async () => {
2828
// Log in and save the authenticated state to reuse in tests
2929
const browser = await chromium.launch();
30-
const page = await browser.newPage();
30+
const browserContext = await browser.newContext();
31+
const page = await browserContext.newPage();
3132
await page.goto(baseUrl);
3233

3334
const loginPage = new LoginPage(page);
3435
await loginPage.login(
3536
process.env.E2E_PASSWORD_ADMIN_LOGIN_NAME,
3637
process.env.E2E_PASSWORD_ADMIN_PASSWORD,
3738
);
38-
const storageState = await page
39-
.context()
40-
.storageState({ path: authenticatedState });
39+
const storageState = await browserContext.storageState({
40+
path: authenticatedState,
41+
});
4142

4243
const state = JSON.parse(storageState.origins[0].localStorage[0].value);
4344

4445
// Set the token in the environment for use in API requests
4546
process.env.E2E_TOKEN = state.authenticated.token;
4647

48+
await browserContext.close();
4749
await browser.close();
4850
};
4951

@@ -90,4 +92,10 @@ export const test = baseTest.extend({
9092
vaultAddr: process.env.E2E_VAULT_ADDR_PUBLIC,
9193
vaultAddrPrivate: process.env.E2E_VAULT_ADDR_PRIVATE,
9294
workerTagEgress: process.env.E2E_WORKER_TAG_EGRESS,
95+
request: async ({ playwright }, use) => {
96+
const request = await playwright.request.newContext({
97+
baseURL: process.env.BOUNDARY_ADDR,
98+
});
99+
await use(request);
100+
},
93101
});

0 commit comments

Comments
 (0)