Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into test-refactor-field-c…
Browse files Browse the repository at this point in the history
…reate-host-host-catalogs
  • Loading branch information
calcaide committed Dec 11, 2024
2 parents d552d06 + 0623d4a commit 02e6658
Show file tree
Hide file tree
Showing 36 changed files with 415 additions and 119 deletions.
2 changes: 2 additions & 0 deletions addons/core/translations/form/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ description:
type:
label: Type
help: The type of the resource, to help differentiate schemas
plugin_type:
label: plugin_type
login_name:
label: Login Name
help: The account login name
Expand Down
2 changes: 2 additions & 0 deletions e2e-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
admin/artifacts
desktop/artifacts
playwright-report

.auth
13 changes: 13 additions & 0 deletions e2e-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ 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:

Before running the e2e test locally, we need to launch an Enos Scenario. Make sure you followed all the steps within the [Getting started section](#getting-started).
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/auth-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export class AuthMethodsPage extends BaseResourcePage {

await this.page.getByRole('link', { name: 'Accounts' }).click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Create Account', exact: true })
.click();
await this.page.getByLabel('Name (Optional)').fill(accountName);
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class GroupsPage extends BaseResourcePage {
async addMemberToGroup(userName) {
await this.page.getByRole('link', { name: 'Members', exact: true }).click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Members', exact: true })
.click();
await this.page.getByRole('checkbox', { name: userName }).click();
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class RolesPage extends BaseResourcePage {
.getByRole('link', { name: 'Principals', exact: true })
.click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Principals', exact: true })
.click();
await this.page.getByRole('checkbox', { name: principalName }).click();
Expand Down
46 changes: 15 additions & 31 deletions e2e-tests/admin/pages/targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,14 @@ export class TargetsPage extends BaseResourcePage {
).toBeVisible();

const emptyLinkIsVisible = await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Host Sources', exact: true })
.isVisible();
if (emptyLinkIsVisible) {
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Host Sources', exact: true })
.click();
} else {
if (!emptyLinkIsVisible) {
await this.page.getByText('Manage').click();
await this.page.getByRole('link', { name: 'Add Host Sources' }).click();
}
await this.page
.getByRole('link', { name: 'Add Host Sources', exact: true })
.click();

await this.page
.getByRole('cell', { name: hostSourceName })
Expand Down Expand Up @@ -370,21 +366,15 @@ export class TargetsPage extends BaseResourcePage {
).toBeVisible();

const addBrokeredCredentialsButtonIsVisible = await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
.isVisible();

if (addBrokeredCredentialsButtonIsVisible) {
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
.click();
} else {
if (!addBrokeredCredentialsButtonIsVisible) {
await this.page.getByText('Manage').click();
await this.page
.getByRole('link', { name: 'Add Brokered Credentials' })
.click();
}
await this.page
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
.click();

await this.page
.getByRole('cell', { name: credentialName })
Expand Down Expand Up @@ -427,27 +417,21 @@ export class TargetsPage extends BaseResourcePage {
).toBeVisible();

const addInjectedCredentialsButtonIsVisible = await this.page
.getByRole('article')
.getByRole('link', {
name: 'Add Injected Application Credentials',
exact: true,
})
.isVisible();

if (addInjectedCredentialsButtonIsVisible) {
await this.page
.getByRole('article')
.getByRole('link', {
name: 'Add Injected Application Credentials',
exact: true,
})
.click();
} else {
if (!addInjectedCredentialsButtonIsVisible) {
await this.page.getByText('Manage').click();
await this.page
.getByRole('link', { name: 'Add Injected Application' })
.click();
}
await this.page
.getByRole('link', {
name: 'Add Injected Application Credentials',
exact: true,
})
.click();

await this.page
.getByRole('cell', { name: credentialName })
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/admin/pages/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class UsersPage extends BaseResourcePage {
.getByRole('link', { name: 'Accounts', exact: true })
.click();
await this.page
.getByRole('article')
.getByRole('link', { name: 'Add Accounts', exact: true })
.click();
await this.page
Expand Down
8 changes: 7 additions & 1 deletion e2e-tests/desktop/fixtures/electronTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import fs from 'fs';
* @return {string}
*/
const getExecutablePath = (buildDirectory = 'out') => {
const rootDir = path.resolve('../ui/desktop/electron-app');
// Using process.cwd() can change depending on where you run the tests so we use the current file location
// __dirname isn't available in ES modules so we need to indirectly get the directory
const rootDir = path.resolve(
import.meta.dirname,
'../../../ui/desktop/electron-app',
);

// directory where the builds are stored
const outDir = path.resolve(rootDir, buildDirectory);
// list of files in the out directory
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/desktop/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export default defineConfig({
workers: 1, // Tests need to be run in serial, otherwise there may be conflicts when using the CLI
use: {
baseURL: process.env.BOUNDARY_ADDR,
storageState: './admin/artifacts/authenticated-state.json',
extraHTTPHeaders: {
// This token is set in global-setup.js
Authorization: `Bearer ${process.env.E2E_TOKEN}`,
Expand Down
Loading

0 comments on commit 02e6658

Please sign in to comment.