+1





![hashicorp-copywrite[bot]](/avatar/120e964899bc27ee3737fc0cc3585755e19422fe9bff82b60b4b0c13d481706c?size=40)

![dependabot[bot]](/avatar/bd5a8d6c673b738d52b0ac42a110045f3f964b3ebfc1d60ea805af743b1dc0e6?size=40)
2d5323b07a
* fix: 🐛 add model hook to host route for dynamic host catalogs (#1659) * fix: 🐛 add model hook to host route for dynamic host catalogs ✅ Closes: ICU-8594 * refactor: 💡 remove page formatting for host route * [COMPLIANCE] Add Copyright and License Headers (#1660) Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Carlos Alcaide Corvo <ccorvo@hashicorp.com> * chore(deps-dev): bump webpack from 5.59.1 to 5.76.0 (#1654) Bumps [webpack](https://github.com/webpack/webpack) from 5.59.1 to 5.76.0. - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.59.1...v5.76.0) --- updated-dependencies: - dependency-name: webpack dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Randall Morey <randall@randallmorey.com> Co-authored-by: Carlos Alcaide Corvo <ccorvo@hashicorp.com> * Feature metadata (#1661) * feat: 🎸 load edition from controller-metadata.json * refactor: 💡 rename edition and add licensed features support * chore: 🤖 support dev toggling of licensed features * chore: 🤖 rename ent edition * Update ui/admin/app/services/feature-edition.js * Update ui/admin/app/instance-initializers/feature-edition.js Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * chore: 🤖 cleanup * chore: 🤖 feature edition disabled in tests / fix test cases * test: 💍 remove feature disable calls in tests * test: 💍 fix broken tests * fix: 🐛 fix config bug * fix: 🐛 fix broken test due to feature flags --------- Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> * fix: 🐛 Fix missing translation (#1662) Fix missing translation on the toggle color theme selector * Resolutions audit: Delete 3 oldest resolutions (#1663) * Delete bl from resolutions * Delete tough-cookie from resolutions * Delete npm from resolutions * chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#1665) Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1. - [Release notes](https://github.com/kornelski/http-cache-semantics/releases) - [Commits](https://github.com/kornelski/http-cache-semantics/compare/v4.1.0...v4.1.1) --- updated-dependencies: - dependency-name: http-cache-semantics dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore: 🤖 Update electron-forge/* packages (#1666) Update electron-forge/* packages * feat: 🎸 Add support to display external name for dynamic hosts (#1664) * feat: 🎸 Add support to display external name for dynamic hosts ✅ Closes: ICU-8795 * test(admin/e2e): Add create target with address test (#1667) * chore: 🤖 update design system package (#1668) * test(admin/e2e): Define expected private key for vault credential store test (#1671) * test: 💍 (admin-e2e): Add test to create different credentials (#1670) * chore: 🤖 add json5 to resolutions per dependabot alerts (#1672) * chore: 🤖 add json5 to resolutions per dependabot alerts * fix: 🐛 remove unecessary resolutions * chore: 🤖 upgrade @storybook/ember-cli-storybook to 0.6.0 (#1669) * chore: 🤖 update @storybook/ember-cli-storybook to 0.6.0 ✅ Closes: ICU-6588 * chore: 🤖 remove css-what from resolutions * refactor: 💡 update selector for delete storage bucket test * chore: 🤖 fix yarn.lock --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: lisbet-alvarez <107949262+lisbet-alvarez@users.noreply.github.com> Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: Carlos Alcaide Corvo <ccorvo@hashicorp.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Randall Morey <randall@randallmorey.com> Co-authored-by: Zhihe Li <zhihe.li@hashicorp.com> Co-authored-by: github-team-secure-boundary <hc-github-team-secure-boundary@hashicorp.com> Co-authored-by: hc-github-team-secure-boundary <82989682+hc-github-team-secure-boundary@users.noreply.github.com> Co-authored-by: Stan Ryzhov <60649800+stasryzhov@users.noreply.github.com> Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
221 lines
7.5 KiB
JavaScript
221 lines
7.5 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
/* eslint-disable no-undef */
|
|
const { test, expect } = require('@playwright/test');
|
|
const { readFile } = require('fs/promises');
|
|
const { nanoid } = require('nanoid');
|
|
const { checkEnv, authenticatedState } = require('../helpers/general');
|
|
const {
|
|
authenticateBoundaryCli,
|
|
checkBoundaryCli,
|
|
getSessionCli,
|
|
} = require('../helpers/boundary-cli');
|
|
const {
|
|
createNewOrg,
|
|
createNewProject,
|
|
createNewHostCatalog,
|
|
createNewHostSet,
|
|
createNewHostInHostSet,
|
|
createNewTarget,
|
|
addBrokeredCredentialsToTarget,
|
|
addHostSourceToTarget,
|
|
} = require('../helpers/boundary-ui');
|
|
|
|
test.use({ storageState: authenticatedState });
|
|
|
|
test.beforeAll(async () => {
|
|
await checkEnv([
|
|
'E2E_TARGET_IP',
|
|
'E2E_SSH_USER',
|
|
'E2E_SSH_KEY_PATH',
|
|
'E2E_SSH_PORT',
|
|
]);
|
|
|
|
await checkBoundaryCli();
|
|
});
|
|
|
|
let orgName;
|
|
let projectName;
|
|
let targetName;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
await page.goto('/');
|
|
|
|
orgName = await createNewOrg(page);
|
|
projectName = await createNewProject(page);
|
|
await createNewHostCatalog(page);
|
|
const hostSetName = await createNewHostSet(page);
|
|
await createNewHostInHostSet(page);
|
|
targetName = await createNewTarget(page);
|
|
await addHostSourceToTarget(page, hostSetName);
|
|
|
|
const credentialStoreName = 'Credential Store ' + nanoid();
|
|
await page
|
|
.getByRole('navigation', { name: 'Resources' })
|
|
.getByRole('link', { name: 'Credential Stores' })
|
|
.click();
|
|
await page.getByRole('link', { name: 'New' }).click();
|
|
await page.getByLabel('Name', { exact: true }).fill(credentialStoreName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page.getByRole('group', { name: 'Type' }).getByLabel('Static').click();
|
|
await page.getByRole('button', { name: 'Save' }).click();
|
|
await expect(
|
|
page.getByRole('alert').getByText('Success', { exact: true })
|
|
).toBeVisible();
|
|
await page.getByRole('button', { name: 'Dismiss' }).click();
|
|
await expect(
|
|
page.getByRole('link', { name: credentialStoreName })
|
|
).toBeVisible();
|
|
});
|
|
|
|
test('Static Credential Store (User & Key Pair)', async ({ page }) => {
|
|
const credentialName = 'Credential ' + nanoid();
|
|
await page.getByRole('link', { name: 'Credentials', exact: true }).click();
|
|
await page.getByRole('link', { name: 'New', exact: true }).click();
|
|
await page.getByLabel('Name', { exact: true }).fill(credentialName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page
|
|
.getByRole('group', { name: 'Type' })
|
|
.getByLabel('Username & Key Pair')
|
|
.click();
|
|
await page
|
|
.getByLabel('Username', { exact: true })
|
|
.fill(process.env.E2E_SSH_USER);
|
|
const keyData = await readFile(process.env.E2E_SSH_KEY_PATH, {
|
|
encoding: 'utf-8',
|
|
});
|
|
await page.getByLabel('SSH Private Key', { exact: true }).fill(keyData);
|
|
await page.getByRole('button', { name: 'Save' }).click();
|
|
await expect(
|
|
page.getByRole('alert').getByText('Success', { exact: true })
|
|
).toBeVisible();
|
|
await page.getByRole('button', { name: 'Dismiss' }).click();
|
|
await expect(page.getByRole('link', { name: credentialName })).toBeVisible();
|
|
|
|
await addBrokeredCredentialsToTarget(page, targetName, credentialName);
|
|
|
|
await authenticateBoundaryCli();
|
|
const session = await getSessionCli(orgName, projectName, targetName);
|
|
const retrievedUser = session.item.credentials[0].credential.username;
|
|
const retrievedKey = session.item.credentials[0].credential.private_key;
|
|
|
|
if (process.env.E2E_SSH_USER != retrievedUser) {
|
|
throw new Error(
|
|
'Stored User does not match. EXPECTED: ' +
|
|
process.env.E2E_SSH_USER +
|
|
', ACTUAL: ' +
|
|
retrievedUser
|
|
);
|
|
}
|
|
if (keyData != retrievedKey) {
|
|
throw new Error('Stored Key does not match');
|
|
}
|
|
});
|
|
|
|
test('Static Credential Store (Username & Password)', async ({ page }) => {
|
|
const credentialName = 'Credential ' + nanoid();
|
|
await page.getByRole('link', { name: 'Credentials', exact: true }).click();
|
|
await page.getByRole('link', { name: 'New', exact: true }).click();
|
|
await page.getByLabel('Name', { exact: true }).fill(credentialName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page
|
|
.getByRole('group', { name: 'Type' })
|
|
.getByLabel('Username & Password')
|
|
.click();
|
|
await page
|
|
.getByLabel('Username', { exact: true })
|
|
.fill(process.env.E2E_SSH_USER);
|
|
const testPassword = 'password';
|
|
await page.getByLabel('Password', { exact: true }).fill(testPassword);
|
|
await page.getByRole('button', { name: 'Save' }).click();
|
|
await expect(
|
|
page.getByRole('alert').getByText('Success', { exact: true })
|
|
).toBeVisible();
|
|
await page.getByRole('button', { name: 'Dismiss' }).click();
|
|
await expect(page.getByRole('link', { name: credentialName })).toBeVisible();
|
|
|
|
await addBrokeredCredentialsToTarget(page, targetName, credentialName);
|
|
|
|
await authenticateBoundaryCli();
|
|
const session = await getSessionCli(orgName, projectName, targetName);
|
|
const retrievedUser = session.item.credentials[0].credential.username;
|
|
const retrievedPassword = session.item.credentials[0].credential.password;
|
|
|
|
if (process.env.E2E_SSH_USER != retrievedUser) {
|
|
throw new Error(
|
|
'Stored User does not match. EXPECTED: ' +
|
|
process.env.E2E_SSH_USER +
|
|
', ACTUAL: ' +
|
|
retrievedUser
|
|
);
|
|
}
|
|
if (testPassword != retrievedPassword) {
|
|
throw new Error(
|
|
'Stored Password does not match. EXPECTED: ' +
|
|
testPassword +
|
|
', ACTUAL: ' +
|
|
retrievedPassword
|
|
);
|
|
}
|
|
});
|
|
|
|
test('Static Credential Store (JSON)', async ({ page }) => {
|
|
const credentialName = 'Credential ' + nanoid();
|
|
await page.getByRole('link', { name: 'Credentials', exact: true }).click();
|
|
await page.getByRole('link', { name: 'New', exact: true }).click();
|
|
await page.getByLabel('Name', { exact: true }).fill(credentialName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page.getByRole('group', { name: 'Type' }).getByLabel('JSON').click();
|
|
await page.getByText('{}').click();
|
|
const testName = 'name-json';
|
|
const testPassword = 'password-json';
|
|
const testId = 'id-json';
|
|
await page.keyboard.type(
|
|
`"username": "${testName}",
|
|
"password": "${testPassword}",
|
|
"id": "${testId}"`
|
|
);
|
|
await page.getByRole('button', { name: 'Save' }).click();
|
|
await expect(
|
|
page.getByRole('alert').getByText('Success', { exact: true })
|
|
).toBeVisible();
|
|
await page.getByRole('button', { name: 'Dismiss' }).click();
|
|
await expect(page.getByRole('link', { name: credentialName })).toBeVisible();
|
|
|
|
await addBrokeredCredentialsToTarget(page, targetName, credentialName);
|
|
|
|
await authenticateBoundaryCli();
|
|
const session = await getSessionCli(orgName, projectName, targetName);
|
|
const retrievedUser = session.item.credentials[0].credential.username;
|
|
const retrievedPassword = session.item.credentials[0].credential.password;
|
|
const retrievedId = session.item.credentials[0].credential.id;
|
|
|
|
if (testName != retrievedUser) {
|
|
throw new Error(
|
|
'Stored User does not match. EXPECTED: ' +
|
|
process.env.E2E_SSH_USER +
|
|
', ACTUAL: ' +
|
|
retrievedUser
|
|
);
|
|
}
|
|
if (testPassword != retrievedPassword) {
|
|
throw new Error(
|
|
'Stored Password does not match. EXPECTED: ' +
|
|
testPassword +
|
|
', ACTUAL: ' +
|
|
retrievedPassword
|
|
);
|
|
}
|
|
if (testId != retrievedId) {
|
|
throw new Error(
|
|
'Stored ID does not match. EXPECTED: ' +
|
|
testId +
|
|
', ACTUAL: ' +
|
|
retrievedId
|
|
);
|
|
}
|
|
});
|