test(e2e): Enable Admin UI e2e tests to run against a local branch (#2700)

* test(e2e): decouple url used for browser vs cli

* test(e2e): Add instructions for using the UI of a local branch

* CR

* Fix typo in e2e-tests/README.md

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>

---------

Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
This commit is contained in:
Michael LiandDharini Jeeva authored and GitHub committed 2025-03-05 11:38:12 -05:00
1 parent ddfcbde7d4
commit e29a83ec25
24 files changed
+106 -92

No files matched your search

+13 -14
View File
@@ -116,19 +116,6 @@ Enos needs some configuration variables to run the scenario successfully. [See t
More documentation about [scenario variables](https://github.com/hashicorp/boundary/tree/main/enos#scenarios-variables).
> [!TIP]
> To run e2e tests against a local branch for Admin UI, update the UI commit in boundary so it gets picked up when enos builds the binary
By default, enos will build the version of the UI that is specified in the `VERSION` commit for `boundary`. To use a specific branch, update the version first before running the scenario.
In the `boundary` or `boundary-enterprise` repository:
```bash
UI_COMMITISH=<commit sha> make update-ui-version
# Alternatively if you want to just be able to run the same command for the most recent commit
UI_COMMITISH=$(git -C <boundary-ui(-enterprise) repo path> rev-parse HEAD) make update-ui-version
```
## Run tests:
Make sure you followed all the steps within the [Getting started section](#getting-started).
@@ -166,7 +153,7 @@ Using Terminal 1:
- `eval "$(doormat aws export --account boundary_team_acctest_dev)"`. Exporting AWS env variables from doormat to your terminal.
- `enos scenario launch e2e_ui_aws builder:local` or `enos scenario launch e2e_ui_aws_ent builder:local` if in enterprise.
- Launches enos scenario, this will take from 5 to 10 minutes. When its done, you will see a Enos Operations finished! within your terminal. Check out more scenarios [here](https://github.com/hashicorp/boundary/tree/main/enos).
- `bash scripts/test_e2e_env.sh`. Prints all the env variables within Enos scenario. Copy the output and paste it within your Terminal 2 (Boundary UI). These env variables are need within Boundary UI to run the test against the enos scenario.
- `bash scripts/test_e2e_env.sh`. Prints all the env variables within Enos scenario. Copy the output and paste it within your Terminal 2 (Boundary UI). These env variables are needed within Boundary UI to run the test against the enos scenario.
Alternatively, you can also redirect the output to an `.env` file that will get picked up by tests automatically which is useful if you're running tests in your IDE:
```
@@ -201,6 +188,18 @@ PWDEBUG=console yarn playwright test --headed --config admin/playwright.config.j
PWDEBUG=console yarn playwright test --headed --config admin/playwright.config.js login.spec.js --debug
```
##### Admin (Using a Local Branch)
```shell
# In one terminal, run the `test_e2e_env.sh` script, and then do the following...
cd boundary-ui/
ENABLE_MIRAGE=false API_HOST=$BOUNDARY_ADDR yarn workspace admin start
# In another terminal, run the `test_e2e_env.sh` script and then do the following...
cd boundary-ui/e2e-tests
BOUNDARY_ADDR_BRANCH="http://localhost:4200" yarn run admin:{edition}:{infra} # Example: yarn run admin:ce:aws
```
#### Desktop
> [!NOTE]
+2 -2
View File
@@ -4,7 +4,7 @@
*/
import { defineConfig, devices } from '@playwright/test';
import { authenticatedState } from '../global-setup';
import { authenticatedState, baseUrl } from '../global-setup';
/** @type {import('@playwright/test').PlaywrightTestConfig} */
export default defineConfig({
@@ -13,7 +13,7 @@ export default defineConfig({
timeout: 90000, // Each test is given 90s to complete
workers: 1, // Tests need to be run in serial, otherwise there may be conflicts when using the CLI
use: {
baseURL: process.env.BOUNDARY_ADDR,
baseURL: baseUrl,
extraHTTPHeaders: {
// This token is set in global-setup.js
Authorization: `Bearer ${process.env.E2E_TOKEN}`,
+9 -9
View File
@@ -25,7 +25,7 @@ test.describe('Aliases (Enterprise)', () => {
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -81,7 +81,7 @@ test.describe('Aliases (Enterprise)', () => {
// Connect to target using alias
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -115,7 +115,7 @@ test.describe('Aliases (Enterprise)', () => {
connect.kill('SIGTERM');
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -138,7 +138,7 @@ test.describe('Aliases (Enterprise)', () => {
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -156,7 +156,7 @@ test.describe('Aliases (Enterprise)', () => {
const orgsPage = new OrgsPage(page);
orgName = await orgsPage.createOrg();
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -191,7 +191,7 @@ test.describe('Aliases (Enterprise)', () => {
connect.kill('SIGTERM');
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -215,7 +215,7 @@ test.describe('Aliases (Enterprise)', () => {
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -253,7 +253,7 @@ test.describe('Aliases (Enterprise)', () => {
// Create new alias from scope page
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -285,7 +285,7 @@ test.describe('Aliases (Enterprise)', () => {
connect.kill('SIGTERM');
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
+9 -9
View File
@@ -24,7 +24,7 @@ test.describe('Aliases', () => {
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -64,7 +64,7 @@ test.describe('Aliases', () => {
// Connect to target using alias
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -98,7 +98,7 @@ test.describe('Aliases', () => {
connect.kill('SIGTERM');
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -121,7 +121,7 @@ test.describe('Aliases', () => {
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -139,7 +139,7 @@ test.describe('Aliases', () => {
const orgsPage = new OrgsPage(page);
orgName = await orgsPage.createOrg();
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -163,7 +163,7 @@ test.describe('Aliases', () => {
connect.kill('SIGTERM');
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -186,7 +186,7 @@ test.describe('Aliases', () => {
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -213,7 +213,7 @@ test.describe('Aliases', () => {
// Create new alias from scope page
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -244,7 +244,7 @@ test.describe('Aliases', () => {
connect.kill('SIGTERM');
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -26,7 +26,7 @@ test(
{ tag: ['@ce', '@ent', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -297,7 +297,7 @@ test(
} finally {
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -33,6 +33,7 @@ test(
page,
context,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -263,7 +264,7 @@ test(
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -25,7 +25,7 @@ test(
{ tag: ['@ce', '@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -108,7 +108,7 @@ test(
).toBeVisible();
} finally {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -23,7 +23,7 @@ test(
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -106,7 +106,7 @@ test(
// Verify credentials
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -136,7 +136,7 @@ test(
} finally {
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -44,7 +44,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -65,7 +65,7 @@ test(
);
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -95,7 +95,7 @@ test(
} finally {
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -114,7 +114,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -135,7 +135,7 @@ test(
);
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -161,7 +161,7 @@ test(
} finally {
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -180,7 +180,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -224,7 +224,7 @@ test(
);
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -252,7 +252,7 @@ test(
} finally {
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -271,7 +271,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -317,7 +317,7 @@ test(
} finally {
if (orgName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -39,7 +39,7 @@ test(
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -106,7 +106,7 @@ test(
// Verify that session can be established
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -42,7 +42,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -120,7 +120,7 @@ test(
// Verify correct credentials are returned after authorizing session
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -26,9 +26,14 @@ test.beforeAll(async () => {
});
test.beforeEach(
async ({ baseURL, adminAuthMethodId, adminLoginName, adminPassword }) => {
async ({
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
}) => {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -26,9 +26,14 @@ test.beforeAll(async () => {
});
test.beforeEach(
async ({ baseURL, adminAuthMethodId, adminLoginName, adminPassword }) => {
async ({
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
}) => {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -25,7 +25,7 @@ test.describe('AWS', () => {
{ tag: ['@ent', '@aws'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -199,7 +199,7 @@ test.describe('AWS', () => {
// Connect to target
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -222,7 +222,7 @@ test.describe('AWS', () => {
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -25,7 +25,7 @@ test.describe('AWS', () => {
{ tag: ['@ce', '@aws'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -199,7 +199,7 @@ test.describe('AWS', () => {
// Connect to target
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -222,7 +222,7 @@ test.describe('AWS', () => {
}
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -15,7 +15,7 @@ test(
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -49,7 +49,7 @@ test(
} finally {
if (policyName) {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
+2 -2
View File
@@ -19,7 +19,7 @@ test(
{ tag: ['@ce', '@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -38,7 +38,7 @@ test(
await rolesPage.addGrantsToRole('ids=*;type=*;actions=read,list');
} finally {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -26,7 +26,7 @@ test(
{ tag: ['@ent', '@aws'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -47,7 +47,7 @@ test(
let connect;
try {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -26,7 +26,7 @@ test(
{ tag: ['@ent', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -49,7 +49,7 @@ test(
let connect;
try {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -37,7 +37,7 @@ test(
{ tag: ['@ent', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -122,7 +122,7 @@ test(
// Connect to target
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -39,7 +39,7 @@ test(
{ tag: ['@ent', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -112,7 +112,7 @@ test(
// Connect to target
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
+6 -6
View File
@@ -23,7 +23,7 @@ test(
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -47,7 +47,7 @@ test(
);
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -90,7 +90,7 @@ test(
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -125,7 +125,7 @@ test(
);
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -164,7 +164,7 @@ test(
{ tag: ['@ent', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -231,7 +231,7 @@ test(
// Connect to target
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
+6 -6
View File
@@ -23,7 +23,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -66,7 +66,7 @@ test(
// Connect to target
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -109,7 +109,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -133,7 +133,7 @@ test(
);
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -176,7 +176,7 @@ test(
{ tag: ['@ce', '@aws', '@docker'] },
async ({
page,
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
@@ -239,7 +239,7 @@ test(
await basePage.dismissSuccessAlert();
} finally {
await boundaryCli.authenticateBoundary(
baseURL,
controllerAddr,
adminAuthMethodId,
adminLoginName,
adminPassword,
+5 -1
View File
@@ -28,7 +28,7 @@ const authenticateToBoundary = async () => {
// Log in and save the authenticated state to reuse in tests
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto(process.env.BOUNDARY_ADDR);
await page.goto(baseUrl);
const loginPage = new LoginPage(page);
await loginPage.login(
@@ -49,6 +49,9 @@ const authenticateToBoundary = async () => {
export default globalSetup;
export const baseUrl =
process.env.BOUNDARY_ADDR_BRANCH ?? process.env.BOUNDARY_ADDR;
export const authenticatedState = path.resolve(
__dirname,
'./.auth/authenticated-state.json',
@@ -65,6 +68,7 @@ export const test = baseTest.extend({
awsHostSetIps: process.env.E2E_AWS_HOST_SET_IPS,
awsRegion: process.env.E2E_AWS_REGION,
awsSecretAccessKey: process.env.E2E_AWS_SECRET_ACCESS_KEY,
controllerAddr: process.env.BOUNDARY_ADDR,
bucketAccessKeyId: process.env.E2E_BUCKET_ACCESS_KEY_ID,
bucketEndpointUrl: process.env.E2E_BUCKET_ENDPOINT_URL,
bucketName: process.env.E2E_BUCKET_NAME,