+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>
286 lines
9.9 KiB
JavaScript
286 lines
9.9 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
/* eslint-disable no-undef */
|
|
const { expect } = require('@playwright/test');
|
|
const { nanoid } = require('nanoid');
|
|
|
|
/**
|
|
* Uses the UI to create a new organization
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the organization
|
|
*/
|
|
exports.createNewOrg = async (page) => {
|
|
const orgName = 'Org ' + nanoid();
|
|
await page
|
|
.getByRole('navigation', { name: 'General' })
|
|
.getByRole('link', { name: 'Orgs' })
|
|
.click();
|
|
await page.getByRole('link', { name: 'New Org' }).click();
|
|
await page.getByLabel('Name').fill(orgName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
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('navigation', { name: 'breadcrumbs' })
|
|
.getByRole('link', { name: orgName })
|
|
).toBeVisible();
|
|
|
|
return orgName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to create a new project. Assumes you have selected the desired org.
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the project
|
|
*/
|
|
exports.createNewProject = async (page) => {
|
|
const projectName = 'Project ' + nanoid();
|
|
await page
|
|
.getByRole('navigation', { name: 'General' })
|
|
.getByRole('link', { name: 'Projects' })
|
|
.click();
|
|
await page.getByRole('link', { name: 'New' }).click();
|
|
await page.getByLabel('Name').fill(projectName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
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('navigation', { name: 'breadcrumbs' })
|
|
.getByRole('link', { name: projectName })
|
|
).toBeVisible();
|
|
|
|
return projectName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to create a new host catalog. Assumes you have selected the desired project.
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the host catalog
|
|
*/
|
|
exports.createNewHostCatalog = async (page) => {
|
|
const hostCatalogName = 'Host Catalog ' + nanoid();
|
|
await page
|
|
.getByRole('navigation', { name: 'Resources' })
|
|
.getByRole('link', { name: 'Host Catalogs' })
|
|
.click();
|
|
await page.getByRole('link', { name: 'New' }).click();
|
|
await page.getByLabel('Name').fill(hostCatalogName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
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('navigation', { name: 'breadcrumbs' })
|
|
.getByRole('link', { name: hostCatalogName })
|
|
).toBeVisible();
|
|
|
|
return hostCatalogName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to create a new host set. Assumes you have just created a new host catalog.
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the host set
|
|
*/
|
|
exports.createNewHostSet = async (page) => {
|
|
const hostSetName = 'Host Set ' + nanoid();
|
|
await page.getByRole('link', { name: 'Host Sets' }).click();
|
|
await page.getByRole('link', { name: 'New', exact: true }).click();
|
|
await page.getByLabel('Name').fill(hostSetName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
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('navigation', { name: 'breadcrumbs' })
|
|
.getByRole('link', { name: hostSetName })
|
|
).toBeVisible();
|
|
|
|
return hostSetName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to create a new host in a host set. Assumes you have just created a new host set.
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the host
|
|
*/
|
|
exports.createNewHostInHostSet = async (page) => {
|
|
const hostName = 'Host ' + nanoid();
|
|
await page.getByText('Manage').click();
|
|
await page.getByRole('link', { name: 'Create and Add Host' }).click();
|
|
await page.getByLabel('Name').fill(hostName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page.getByLabel('Address').fill(process.env.E2E_TARGET_IP);
|
|
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: hostName })).toBeVisible();
|
|
|
|
return hostName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to create a new target. Assumes you have selected the desired project.
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the target
|
|
*/
|
|
exports.createNewTarget = async (page) => {
|
|
const targetName = 'Target ' + nanoid();
|
|
await page
|
|
.getByRole('navigation', { name: 'Resources' })
|
|
.getByRole('link', { name: 'Targets' })
|
|
.click();
|
|
await page.getByRole('link', { name: 'New' }).click();
|
|
await page.getByLabel('Name').fill(targetName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page.getByLabel('Default Port').fill(process.env.E2E_SSH_PORT);
|
|
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('navigation', { name: 'breadcrumbs' })
|
|
.getByRole('link', { name: targetName })
|
|
).toBeVisible();
|
|
|
|
return targetName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to create a new target with address. Assumes you have selected the desired project.
|
|
* @param {Page} page Playwright page object
|
|
* @returns Name of the target
|
|
*/
|
|
exports.createNewTargetWithAddress = async (page) => {
|
|
const targetName = 'Target ' + nanoid();
|
|
await page
|
|
.getByRole('navigation', { name: 'Resources' })
|
|
.getByRole('link', { name: 'Targets' })
|
|
.click();
|
|
await page.getByRole('link', { name: 'New' }).click();
|
|
await page.getByLabel('Name').fill(targetName);
|
|
await page.getByLabel('Description').fill('This is an automated test');
|
|
await page.getByLabel('Target Address').fill(process.env.E2E_TARGET_IP);
|
|
await page.getByLabel('Default Port').fill(process.env.E2E_SSH_PORT);
|
|
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('navigation', { name: 'breadcrumbs' })
|
|
.getByRole('link', { name: targetName })
|
|
).toBeVisible();
|
|
|
|
return targetName;
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to add a host source to a target. Assume you have selected the desired target.
|
|
* @param {Page} page Playwright page object
|
|
* @param {string} hostSourceName Name of host source that will be attached to the target
|
|
*/
|
|
exports.addHostSourceToTarget = async (page, hostSourceName) => {
|
|
await page.getByRole('link', { name: 'Host Sources', exact: true }).click();
|
|
await page
|
|
.getByRole('article')
|
|
.getByRole('link', { name: 'Add Host Sources', exact: true })
|
|
.click();
|
|
await page
|
|
.getByRole('cell', { name: hostSourceName })
|
|
.locator('..')
|
|
.getByRole('checkbox')
|
|
.click({ force: true });
|
|
await page.getByRole('button', { name: 'Add Host Sources' }).click();
|
|
await expect(
|
|
page.getByRole('alert').getByText('Success', { exact: true })
|
|
).toBeVisible();
|
|
await page.getByRole('button', { name: 'Dismiss' }).click();
|
|
await expect(page.getByRole('link', { name: hostSourceName })).toBeVisible();
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to navigate to Sessions and waits for the session to appear.
|
|
* @param {Page} page Playwright page object
|
|
* @param {string} targetName Name of the target associated with the session
|
|
*/
|
|
exports.waitForSessionToBeVisible = async (page, targetName) => {
|
|
await page
|
|
.getByRole('navigation', { name: 'Resources' })
|
|
.getByRole('link', { name: 'Sessions' })
|
|
.click();
|
|
let i = 0;
|
|
let sessionIsVisible = false;
|
|
do {
|
|
i = i + 1;
|
|
sessionIsVisible = await page
|
|
.getByRole('cell', { name: targetName })
|
|
.isVisible();
|
|
if (sessionIsVisible) {
|
|
break;
|
|
}
|
|
await page.getByRole('button', { name: 'Refresh' }).click();
|
|
await expect(page.getByRole('button', { name: 'Refresh' })).toBeEnabled();
|
|
} while (i < 5);
|
|
|
|
if (!sessionIsVisible) {
|
|
throw new Error('Session is not visible');
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Uses the UI to navigate to the specified Target and add the Brokered Credentials to it.
|
|
* @param {Page} page Playwright page object
|
|
* @param {string} targetName Name of the target associated with the session
|
|
* @param {string} credentialName Name of the credentials to be added to the target
|
|
*/
|
|
exports.addBrokeredCredentialsToTarget = async (page, targetName, credentialName) => {
|
|
await page
|
|
.getByRole('navigation', { name: 'Resources' })
|
|
.getByRole('link', { name: 'Targets' })
|
|
.click();
|
|
await page.getByRole('link', { name: targetName }).click();
|
|
await page
|
|
.getByRole('link', { name: 'Brokered Credentials', exact: true })
|
|
.click();
|
|
await page
|
|
.getByRole('article')
|
|
.getByRole('link', { name: 'Add Brokered Credentials', exact: true })
|
|
.click();
|
|
await page
|
|
.getByRole('cell', { name: credentialName })
|
|
.locator('..')
|
|
.getByRole('checkbox')
|
|
.click({ force: true });
|
|
await page
|
|
.getByRole('button', { name: 'Add Brokered Credentials', exact: true })
|
|
.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();
|
|
}
|