style: 💄 Run prettier on e2e tests (#2560)

This commit is contained in:
Zhihe Li authored and GitHub committed 2024-11-12 18:11:00 -05:00
1 parent 1e3f533d83
commit 7e56e1cccf
31 files changed
+370 -219

No files matched your search

+1 -2
View File
@@ -40,5 +40,4 @@ async function globalSetup() {
export default globalSetup;
export const authenticatedState =
'./admin/artifacts/authenticated-state.json';
export const authenticatedState = './admin/artifacts/authenticated-state.json';
+7 -3
View File
@@ -17,8 +17,10 @@ export class LoginPage extends BaseResourcePage {
await this.page.getByLabel('Login Name').fill(loginName);
await this.page.getByLabel('Password', { exact: true }).fill(password);
await this.page.getByRole('button', { name: 'Sign In' }).click();
await expect(this.page.getByRole('navigation', { name: 'General' })).toBeVisible();
await expect(this.page.getByText(loginName),).toBeEnabled();
await expect(
this.page.getByRole('navigation', { name: 'General' }),
).toBeVisible();
await expect(this.page.getByText(loginName)).toBeEnabled();
}
/**
@@ -28,6 +30,8 @@ export class LoginPage extends BaseResourcePage {
async logout(loginName) {
await this.page.getByText(loginName).click();
await this.page.getByRole('button', { name: 'Sign Out' }).click();
await expect(this.page.getByRole('button', { name: 'Sign In' })).toBeVisible();
await expect(
this.page.getByRole('button', { name: 'Sign In' }),
).toBeVisible();
}
}
+3 -1
View File
@@ -18,7 +18,9 @@ export class SessionRecordingsPage extends BaseResourcePage {
*/
async reapplyStoragePolicy() {
await this.page.getByText('Manage').click();
await this.page.getByRole('button', { name: 'Re-apply storage policy' }).click();
await this.page
.getByRole('button', { name: 'Re-apply storage policy' })
.click();
await this.dismissSuccessAlert();
}
}
+4 -2
View File
@@ -37,7 +37,8 @@ export class WorkersPage extends BaseResourcePage {
* @param {string} newValue New value for API tag
*/
async editTag(origKey, newKey, newValue) {
await this.page.getByRole('table')
await this.page
.getByRole('table')
.getByRole('cell', { name: origKey })
.locator('..')
.getByRole('cell', { name: 'Overflow Options' })
@@ -56,7 +57,8 @@ export class WorkersPage extends BaseResourcePage {
* @param {string} key API tag key
*/
async removeTag(key) {
await this.page.getByRole('table')
await this.page
.getByRole('table')
.getByRole('cell', { name: key })
.locator('..')
.getByRole('cell', { name: 'Overflow Options' })
+44 -13
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { customAlphabet } from 'nanoid';
@@ -53,11 +53,21 @@ test.describe('Aliases (Enterprise)', async () => {
await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
// Create alias for target
await page
@@ -90,9 +100,9 @@ test.describe('Aliases (Enterprise)', async () => {
// Note: On the Target details page, there is a section with the header
// "Aliases". The extra check here is to ensure that we are on the Alias
// details page and not the Target details page.
await expect(
page.getByRole('heading', { name: 'Alias' }),
).not.toHaveText('Aliases');
await expect(page.getByRole('heading', { name: 'Alias' })).not.toHaveText(
'Aliases',
);
await page.getByRole('button', { name: 'Manage' }).click();
await page.getByText('Clear', { exact: true }).click();
await page.getByText('OK', { exact: true }).click();
@@ -147,11 +157,22 @@ test.describe('Aliases (Enterprise)', async () => {
await projectsPage.createProject();
alias = 'example.alias.' + nanoid();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createTargetWithAddressAndAlias(targetAddress, targetPort, alias);
const targetName = await targetsPage.createTargetWithAddressAndAlias(
targetAddress,
targetPort,
alias,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
// Connect to target using alias
await authorizeSessionByAliasCli(alias);
@@ -196,11 +217,21 @@ test.describe('Aliases (Enterprise)', async () => {
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
// Create new alias from scope page
await authenticateBoundaryCli(
+13 -6
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { customAlphabet } from 'nanoid';
@@ -78,9 +78,9 @@ test.describe('Aliases', async () => {
// Note: On the Target details page, there is a section with the header
// "Aliases". The extra check here is to ensure that we are on the Alias
// details page and not the Target details page.
await expect(
page.getByRole('heading', { name: 'Alias' }),
).not.toHaveText('Aliases');
await expect(page.getByRole('heading', { name: 'Alias' })).not.toHaveText(
'Aliases',
);
await page.getByRole('button', { name: 'Manage' }).click();
await page.getByText('Clear', { exact: true }).click();
await page.getByText('OK', { exact: true }).click();
@@ -133,7 +133,11 @@ test.describe('Aliases', async () => {
await projectsPage.createProject();
alias = 'example.alias.' + nanoid();
const targetsPage = new TargetsPage(page);
await targetsPage.createTargetWithAddressAndAlias(targetAddress, targetPort, alias);
await targetsPage.createTargetWithAddressAndAlias(
targetAddress,
targetPort,
alias,
);
// Connect to target using alias
await authorizeSessionByAliasCli(alias);
@@ -175,7 +179,10 @@ test.describe('Aliases', async () => {
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createTargetWithAddress(targetAddress, targetPort);
const targetName = await targetsPage.createTargetWithAddress(
targetAddress,
targetPort,
);
// Create new alias from scope page
await authenticateBoundaryCli(
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { nanoid } from 'nanoid';
@@ -62,9 +62,7 @@ test('Set up LDAP auth method @ce @ent @docker', async ({
await page.getByLabel('Description').fill('LDAP Auth Method');
await page.getByLabel('Address').fill(ldapAddr);
await page.getByLabel('Bind DN').fill(ldapAdminDn);
await page
.getByLabel('Bind Password')
.fill(ldapAdminPassword);
await page.getByLabel('Bind Password').fill(ldapAdminPassword);
await page.getByRole('switch', { name: 'Discover DN' }).click();
await page.getByLabel('User DN').fill(ldapDomainDn);
await page.getByLabel('User Attribute').fill('uid');
@@ -145,9 +143,7 @@ test('Set up LDAP auth method @ce @ent @docker', async ({
const ldapManagedGroupName = 'LDAP Managed Group ' + nanoid();
await page.getByLabel('Name (Optional)').fill(ldapManagedGroupName);
await page.getByLabel('Description').fill('This is an automated test');
await page
.getByRole('textbox', { name: 'Value' })
.fill(ldapGroupName);
await page.getByRole('textbox', { name: 'Value' }).fill(ldapGroupName);
await page.getByRole('button', { name: 'Add' }).click();
await page.getByRole('button', { name: 'Save' }).click();
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'node:child_process';
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
@@ -44,10 +44,17 @@ test('Multiple Credential Stores (ENT) @ent @aws @docker', async ({
const projectsPage = new ProjectsPage(page);
await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
const credentialName2 =
await credentialStoresPage.createStaticCredentialUsernamePassword(
sshUser,
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { readFile } from 'fs/promises';
import { nanoid } from 'nanoid';
@@ -33,11 +33,7 @@ let orgName;
let projectName;
let targetName;
test.beforeEach(async ({
page,
targetAddress,
targetPort,
}) => {
test.beforeEach(async ({ page, targetAddress, targetPort }) => {
await page.goto('/');
const orgsPage = new OrgsPage(page);
@@ -45,7 +41,10 @@ test.beforeEach(async ({
const projectsPage = new ProjectsPage(page);
projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
targetName = await targetsPage.createTargetWithAddress(targetAddress, targetPort);
targetName = await targetsPage.createTargetWithAddress(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
});
@@ -61,9 +60,16 @@ test('Static Credential Store (User & Key Pair) @ce @aws @docker', async ({
}) => {
try {
const credentialStoresPage = new CredentialStoresPage(page);
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
const targetsPage = new TargetsPage(page);
await targetsPage.addBrokeredCredentialsToTarget(targetName, credentialName);
await targetsPage.addBrokeredCredentialsToTarget(
targetName,
credentialName,
);
await authenticateBoundaryCli(
baseURL,
@@ -108,14 +114,21 @@ test('Static Credential Store (Username & Password) @ce @aws @docker', async ({
adminAuthMethodId,
adminLoginName,
adminPassword,
sshUser
sshUser,
}) => {
try {
const testPassword = 'password';
const credentialStoresPage = new CredentialStoresPage(page);
const credentialName = await credentialStoresPage.createStaticCredentialUsernamePassword(sshUser, testPassword);
const credentialName =
await credentialStoresPage.createStaticCredentialUsernamePassword(
sshUser,
testPassword,
);
const targetsPage = new TargetsPage(page);
await targetsPage.addBrokeredCredentialsToTarget(targetName, credentialName);
await targetsPage.addBrokeredCredentialsToTarget(
targetName,
credentialName,
);
await authenticateBoundaryCli(
baseURL,
@@ -183,7 +196,10 @@ test('Static Credential Store (JSON) @ce @aws @docker', async ({
).toBeVisible();
const targetsPage = new TargetsPage(page);
await targetsPage.addBrokeredCredentialsToTarget(targetName, credentialName);
await targetsPage.addBrokeredCredentialsToTarget(
targetName,
credentialName,
);
await authenticateBoundaryCli(
baseURL,
@@ -230,7 +246,10 @@ test('Multiple Credential Stores (CE) @ce @aws @docker', async ({
try {
const credentialStoresPage = new CredentialStoresPage(page);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
const credentialName2 =
await credentialStoresPage.createStaticCredentialUsernamePassword(
sshUser,
@@ -238,8 +257,14 @@ test('Multiple Credential Stores (CE) @ce @aws @docker', async ({
);
const targetsPage = new TargetsPage(page);
await targetsPage.addBrokeredCredentialsToTarget(targetName, credentialName);
await targetsPage.addBrokeredCredentialsToTarget(targetName, credentialName2);
await targetsPage.addBrokeredCredentialsToTarget(
targetName,
credentialName,
);
await targetsPage.addBrokeredCredentialsToTarget(
targetName,
credentialName2,
);
// Remove the host source from the target
await page
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'child_process';
import { nanoid } from 'nanoid';
@@ -65,8 +65,8 @@ test('Vault Credential Store (User & Key Pair) @ent @aws @docker', async ({
execSync(`vault secrets enable -path=${secretsPath} kv-v2`);
execSync(
`vault kv put -mount ${secretsPath} ${secretName} ` +
` username=${sshUser}` +
` private_key=@${sshKeyPath}`,
` username=${sshUser}` +
` private_key=@${sshKeyPath}`,
);
execSync(
`vault policy write ${secretPolicyName} ./admin/tests/fixtures/kv-policy.hcl`,
@@ -74,13 +74,13 @@ test('Vault Credential Store (User & Key Pair) @ent @aws @docker', async ({
const vaultToken = JSON.parse(
execSync(
`vault token create` +
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
),
);
const clientToken = vaultToken.auth.client_token;
@@ -90,13 +90,20 @@ test('Vault Credential Store (User & Key Pair) @ent @aws @docker', async ({
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createVaultCredentialStore(vaultAddr, clientToken);
const credentialLibraryName = await credentialStoresPage.createVaultGenericCredentialLibraryEnt(
`${secretsPath}/data/${secretName}`,
'SSH Private Key',
)
await credentialStoresPage.createVaultCredentialStore(
vaultAddr,
clientToken,
);
const credentialLibraryName =
await credentialStoresPage.createVaultGenericCredentialLibraryEnt(
`${secretsPath}/data/${secretName}`,
'SSH Private Key',
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialLibraryName,
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'child_process';
import { nanoid } from 'nanoid';
@@ -65,8 +65,8 @@ test('Vault Credential Store (User & Key Pair) @ce @aws @docker', async ({
execSync(`vault secrets enable -path=${secretsPath} kv-v2`);
execSync(
`vault kv put -mount ${secretsPath} ${secretName} ` +
` username=${sshUser}` +
` private_key=@${sshKeyPath}`,
` username=${sshUser}` +
` private_key=@${sshKeyPath}`,
);
execSync(
`vault policy write ${secretPolicyName} ./admin/tests/fixtures/kv-policy.hcl`,
@@ -74,13 +74,13 @@ test('Vault Credential Store (User & Key Pair) @ce @aws @docker', async ({
const vaultToken = JSON.parse(
execSync(
`vault token create` +
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
),
);
const clientToken = vaultToken.auth.client_token;
@@ -90,9 +90,15 @@ test('Vault Credential Store (User & Key Pair) @ce @aws @docker', async ({
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createTargetWithAddress(targetAddress, targetPort);
const targetName = await targetsPage.createTargetWithAddress(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createVaultCredentialStore(vaultAddr, clientToken);
await credentialStoresPage.createVaultCredentialStore(
vaultAddr,
clientToken,
);
const credentialLibraryName = 'Credential Library ' + nanoid();
await page.getByRole('link', { name: 'Credential Libraries' }).click();
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { execSync } from 'node:child_process';
import { authenticatedState } from '../global-setup.js';
@@ -50,21 +50,18 @@ test.beforeAll(async () => {
await checkVaultCli();
});
test.beforeEach(async ({
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
}) => {
execSync(`vault policy delete ${secretPolicyName}`);
execSync(`vault policy delete ${boundaryPolicyName}`);
await authenticateBoundaryCli(
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
});
test.beforeEach(
async ({ baseURL, adminAuthMethodId, adminLoginName, adminPassword }) => {
execSync(`vault policy delete ${secretPolicyName}`);
execSync(`vault policy delete ${boundaryPolicyName}`);
await authenticateBoundaryCli(
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
},
);
test('Verify resources can be deleted (enterprise) @ent @aws', async ({
page,
@@ -88,14 +85,25 @@ test('Verify resources can be deleted (enterprise) @ent @aws', async ({
let groupId = await createGroupCli(orgId);
let userId = await createUserCli(orgId);
let staticHostCatalogId = await createStaticHostCatalogCli(projectId);
let dynamicAwsHostCatalogId = await createDynamicAwsHostCatalogCli(projectId, awsRegion);
let dynamicAwsHostCatalogId = await createDynamicAwsHostCatalogCli(
projectId,
awsRegion,
);
let staticHostId = await createStaticHostCli(staticHostCatalogId);
let staticHostSetId = await createHostSetCli(staticHostCatalogId);
let staticCredentialStoreId =
await createStaticCredentialStoreCli(projectId);
const vaultToken = await getVaultToken(boundaryPolicyName, secretPolicyName);
let vaultCredentialStoreId = await createVaultCredentialStoreCli(projectId, vaultAddr, vaultToken);
let usernamePasswordCredentialId = await createUsernamePasswordCredentialCli(staticCredentialStoreId);
const vaultToken = await getVaultToken(
boundaryPolicyName,
secretPolicyName,
);
let vaultCredentialStoreId = await createVaultCredentialStoreCli(
projectId,
vaultAddr,
vaultToken,
);
let usernamePasswordCredentialId =
await createUsernamePasswordCredentialCli(staticCredentialStoreId);
let tcpTargetId = await createTcpTarget(projectId);
// Create enterprise boundary resources using CLI
+28 -20
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { execSync } from 'node:child_process';
import { authenticatedState } from '../global-setup.js';
@@ -49,21 +49,18 @@ test.beforeAll(async () => {
await checkVaultCli();
});
test.beforeEach(async ({
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
}) => {
execSync(`vault policy delete ${secretPolicyName}`);
execSync(`vault policy delete ${boundaryPolicyName}`);
await authenticateBoundaryCli(
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
});
test.beforeEach(
async ({ baseURL, adminAuthMethodId, adminLoginName, adminPassword }) => {
execSync(`vault policy delete ${secretPolicyName}`);
execSync(`vault policy delete ${boundaryPolicyName}`);
await authenticateBoundaryCli(
baseURL,
adminAuthMethodId,
adminLoginName,
adminPassword,
);
},
);
test('Verify resources can be deleted @ce @aws', async ({
page,
@@ -86,12 +83,23 @@ test('Verify resources can be deleted @ce @aws', async ({
let groupId = await createGroupCli(orgId);
let userId = await createUserCli(orgId);
let staticHostCatalogId = await createStaticHostCatalogCli(projectId);
let dynamicAwsHostCatalogId = await createDynamicAwsHostCatalogCli(projectId, awsRegion);
let dynamicAwsHostCatalogId = await createDynamicAwsHostCatalogCli(
projectId,
awsRegion,
);
let staticHostId = await createStaticHostCli(staticHostCatalogId);
let staticHostSetId = await createHostSetCli(staticHostCatalogId);
let staticCredentialStoreId = await createStaticCredentialStoreCli(projectId);
const vaultToken = await getVaultToken(boundaryPolicyName, secretPolicyName);
let vaultCredentialStoreId = await createVaultCredentialStoreCli(projectId, vaultAddr, vaultToken);
let staticCredentialStoreId =
await createStaticCredentialStoreCli(projectId);
const vaultToken = await getVaultToken(
boundaryPolicyName,
secretPolicyName,
);
let vaultCredentialStoreId = await createVaultCredentialStoreCli(
projectId,
vaultAddr,
vaultToken,
);
let usernamePasswordCredentialId =
await createUsernamePasswordCredentialCli(staticCredentialStoreId);
let tcpTargetId = await createTcpTarget(projectId);
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { nanoid } from 'nanoid';
@@ -63,12 +63,8 @@ test.describe('AWS', async () => {
.getByLabel('AWS')
.click();
await page.getByLabel('AWS Region').fill(awsRegion);
await page
.getByLabel('Access Key ID')
.fill(awsAccessKeyId);
await page
.getByLabel('Secret Access Key')
.fill(awsSecretAccessKey);
await page.getByLabel('Access Key ID').fill(awsAccessKeyId);
await page.getByLabel('Secret Access Key').fill(awsSecretAccessKey);
await page
.getByLabel('Disable credential rotation')
.click({ force: true });
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
+1 -1
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
+6 -16
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { LoginPage } from '../pages/login.js';
@@ -42,16 +42,12 @@ test.describe('Failure Cases', async () => {
page,
adminLoginName,
}) => {
await page
.getByLabel('Login Name')
.fill(adminLoginName);
await page.getByLabel('Login Name').fill(adminLoginName);
await page.getByLabel('Password', { exact: true }).fill('badpassword');
await page.getByRole('button', { name: 'Sign In' }).click();
await expect(page.getByRole('alert').getByText('Error')).toBeVisible();
await expect(page.getByRole('button', { name: 'Sign In' })).toBeVisible();
await expect(
page.getByText(adminLoginName),
).toBeHidden();
await expect(page.getByText(adminLoginName)).toBeHidden();
});
test('Log in with only username @ce @ent @aws @docker', async ({
@@ -62,9 +58,7 @@ test.describe('Failure Cases', async () => {
await page.getByRole('button', { name: 'Sign In' }).click();
await expect(page.getByRole('alert').getByText('Error')).toBeVisible();
await expect(page.getByRole('button', { name: 'Sign In' })).toBeVisible();
await expect(
page.getByText(adminLoginName),
).toBeHidden();
await expect(page.getByText(adminLoginName)).toBeHidden();
});
test('Log in with only password @ce @ent @aws @docker', async ({
@@ -72,14 +66,10 @@ test.describe('Failure Cases', async () => {
adminLoginName,
adminPassword,
}) => {
await page
.getByLabel('Password', { exact: true })
.fill(adminPassword);
await page.getByLabel('Password', { exact: true }).fill(adminPassword);
await page.getByRole('button', { name: 'Sign In' }).click();
await expect(page.getByRole('alert').getByText('Error')).toBeVisible();
await expect(page.getByRole('button', { name: 'Sign In' })).toBeVisible();
await expect(
page.getByText(adminLoginName),
).toBeHidden();
await expect(page.getByText(adminLoginName)).toBeHidden();
});
});
+1 -1
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'child_process';
@@ -97,12 +97,24 @@ test('Session Recording Test (AWS) @ent @aws', async ({
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('link', { name: projectName }).click();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
await targetsPage.addEgressWorkerFilterToTarget(`"${workerTagEgress}" in "/tags/type"`);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
await targetsPage.addEgressWorkerFilterToTarget(
`"${workerTagEgress}" in "/tags/type"`,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
await page.getByRole('link', { name: targetName }).click();
await targetsPage.enableSessionRecording(storageBucketName);
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'child_process';
@@ -100,14 +100,28 @@ test('Session Recording Test (MinIO) @ent @docker', async ({
await page.getByRole('link', { name: orgName }).click();
await page.getByRole('link', { name: projectName }).click();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
await targetsPage.addIngressWorkerFilterToTarget(`"${workerTagEgress}" in "/tags/type"`);
await targetsPage.addEgressWorkerFilterToTarget(`"${workerTagEgress}" in "/tags/type"`);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
await targetsPage.addIngressWorkerFilterToTarget(
`"${workerTagEgress}" in "/tags/type"`,
);
await targetsPage.addEgressWorkerFilterToTarget(
`"${workerTagEgress}" in "/tags/type"`,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
await page.getByRole('link', { name: targetName }).click();
await targetsPage.enableSessionRecording(storageBucketName);
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'child_process';
@@ -76,22 +76,22 @@ test('SSH Certificate Injection @ent @docker', async ({
execSync(
`vault write ${secretsPath}/config/ca` +
` private_key="${private_key}"` +
` public_key="${public_key}"` +
` generate_signing_key=false`,
` private_key="${private_key}"` +
` public_key="${public_key}"` +
` generate_signing_key=false`,
` format=json`,
);
const vaultToken = JSON.parse(
execSync(
`vault token create` +
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${sshPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${sshPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
),
);
const clientToken = vaultToken.auth.client_token;
@@ -106,11 +106,17 @@ test('SSH Certificate Injection @ent @docker', async ({
// Create target
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
// Create credentials
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createVaultCredentialStore(vaultAddr, clientToken);
await credentialStoresPage.createVaultCredentialStore(
vaultAddr,
clientToken,
);
const credentialLibraryName =
await credentialStoresPage.createVaultSshCertificateCredentialLibraryEnt(
`${secretsPath}/issue/${secretName}`,
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { execSync } from 'child_process';
@@ -66,8 +66,8 @@ test('SSH Credential Injection (Vault User & Key Pair) @ent @docker', async ({
execSync(`vault secrets enable -path=${secretsPath} kv-v2`);
execSync(
`vault kv put -mount ${secretsPath} ${secretName} ` +
` username=${sshUser}` +
` private_key=@${sshKeyPath}`,
` username=${sshUser}` +
` private_key=@${sshKeyPath}`,
);
execSync(
`vault policy write ${secretPolicyName} ./admin/tests/fixtures/kv-policy.hcl`,
@@ -75,13 +75,13 @@ test('SSH Credential Injection (Vault User & Key Pair) @ent @docker', async ({
const vaultToken = JSON.parse(
execSync(
`vault token create` +
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
` -no-default-policy=true` +
` -policy=${boundaryPolicyName}` +
` -policy=${secretPolicyName}` +
` -orphan=true` +
` -period=20m` +
` -renewable=true` +
` -format=json`,
),
);
const clientToken = vaultToken.auth.client_token;
@@ -96,17 +96,26 @@ test('SSH Credential Injection (Vault User & Key Pair) @ent @docker', async ({
// Create target
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
// Create credentials
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createVaultCredentialStore(vaultAddr, clientToken);
await credentialStoresPage.createVaultCredentialStore(
vaultAddr,
clientToken,
);
const credentialLibraryName =
await credentialStoresPage.createVaultGenericCredentialLibraryEnt(
`${secretsPath}/data/${secretName}`,
'SSH Private Key',
);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialLibraryName);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialLibraryName,
);
// Connect to target
await authenticateBoundaryCli(
+26 -7
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
@@ -50,7 +50,10 @@ test('Verify session created for TCP target @ent @aws @docker', async ({
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createTcpTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createTcpTargetWithAddressEnt(
targetAddress,
targetPort,
);
await authenticateBoundaryCli(
baseURL,
@@ -100,12 +103,21 @@ test('Verify session created for SSH target @ent @aws @docker', async ({
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createSshTargetWithAddressEnt(targetAddress, targetPort);
const targetName = await targetsPage.createSshTargetWithAddressEnt(
targetAddress,
targetPort,
);
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
await authenticateBoundaryCli(
baseURL,
@@ -192,8 +204,15 @@ test('SSH target with host sources @ent @aws @docker', async ({
// Create credentials and attach to target
const credentialStoresPage = new CredentialStoresPage(page);
await credentialStoresPage.createStaticCredentialStore();
const credentialName = await credentialStoresPage.createStaticCredentialKeyPair(sshUser, sshKeyPath);
await targetsPage.addInjectedCredentialsToTarget(targetName, credentialName);
const credentialName =
await credentialStoresPage.createStaticCredentialKeyPair(
sshUser,
sshKeyPath,
);
await targetsPage.addInjectedCredentialsToTarget(
targetName,
credentialName,
);
// Connect to target
await authenticateBoundaryCli(
+6 -3
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
@@ -121,7 +121,10 @@ test('Verify session created to target with address, then cancel the session @ce
const projectsPage = new ProjectsPage(page);
const projectName = await projectsPage.createProject();
const targetsPage = new TargetsPage(page);
const targetName = await targetsPage.createTargetWithAddress(targetAddress, targetPort);
const targetName = await targetsPage.createTargetWithAddress(
targetAddress,
targetPort,
);
await authenticateBoundaryCli(
baseURL,
@@ -208,7 +211,7 @@ test('Verify TCP target is updated @ce @aws @docker', async ({
await expect(page.getByText('"dev" in "/tags/type"')).toBeVisible();
await page.getByRole('textbox').click({ force: true });
await page.keyboard.press("Meta+A");
await page.keyboard.press('Meta+A');
await page.keyboard.press('Backspace');
await page.getByRole('textbox').fill('"prod" in "/tags/type"');
await page.getByRole('button', { name: 'Save' }).click();
+1 -1
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';
+18 -18
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { customAlphabet } from 'nanoid';
@@ -21,9 +21,7 @@ test('Worker Tags @ce @ent @aws @docker', async ({ page }) => {
.getByRole('link', { name: 'Workers' })
.click();
await expect(
page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByText('Workers'),
page.getByRole('navigation', { name: 'breadcrumbs' }).getByText('Workers'),
).toBeVisible();
// View tags from worker list page
@@ -82,9 +80,12 @@ test('Worker Tags @ce @ent @aws @docker', async ({ page }) => {
.getByRole('row')
.nth(1)
.getByRole('cell')
.nth(dialogTypeIndex)
).toHaveText('config')
await page.getByRole('dialog').getByRole('button', { name: 'Dismiss' }).click();
.nth(dialogTypeIndex),
).toHaveText('config');
await page
.getByRole('dialog')
.getByRole('button', { name: 'Dismiss' })
.click();
// Go to worker details and create a new tag
await page
@@ -106,9 +107,7 @@ test('Worker Tags @ce @ent @aws @docker', async ({ page }) => {
.getByRole('link', { name: 'Workers' })
.click();
await expect(
page
.getByRole('navigation', { name: 'breadcrumbs' })
.getByText('Workers'),
page.getByRole('navigation', { name: 'breadcrumbs' }).getByText('Workers'),
).toBeVisible();
await page
.getByRole('table')
@@ -122,9 +121,12 @@ test('Worker Tags @ce @ent @aws @docker', async ({ page }) => {
page
.getByRole('dialog')
.getByRole('table')
.getByRole('cell', { name: tagKey + " = " + tagValue })
.getByRole('cell', { name: tagKey + ' = ' + tagValue }),
).toBeVisible();
await page.getByRole('dialog').getByRole('button', { name: 'Dismiss' }).click();
await page
.getByRole('dialog')
.getByRole('button', { name: 'Dismiss' })
.click();
// Go to worker details page
await page
@@ -165,14 +167,14 @@ test('Worker Tags @ce @ent @aws @docker', async ({ page }) => {
.getByRole('row')
.nth(1)
.getByRole('cell')
.nth(workerDetailsTypeIndex)
.nth(workerDetailsTypeIndex),
).toHaveText('config');
await expect(
page
.getByRole('table')
.getByRole('cell', { name: tagKey })
.locator('..')
.getByRole('cell', { name: tagValue })
.getByRole('cell', { name: tagValue }),
).toBeVisible();
// Edit the tag
@@ -184,14 +186,12 @@ test('Worker Tags @ce @ent @aws @docker', async ({ page }) => {
.getByRole('table')
.getByRole('cell', { name: newTagKey })
.locator('..')
.getByRole('cell', { name: newTagValue })
.getByRole('cell', { name: newTagValue }),
).toBeVisible();
// Delete the tag
await workersPage.removeTag(newTagKey);
await expect(
page
.getByRole('table')
.getByRole('cell', { name: newTagKey })
page.getByRole('table').getByRole('cell', { name: newTagKey }),
).not.toBeVisible();
});
+1 -1
View File
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: BUSL-1.1
*/
import { test } from '../playwright.config.js'
import { test } from '../playwright.config.js';
import { expect } from '@playwright/test';
import { authenticatedState } from '../global-setup.js';