From 659067dd0861ce999b6c30bebe37ea1b4ca5a4ab Mon Sep 17 00:00:00 2001 From: Michael Li Date: Wed, 20 Dec 2023 15:06:38 -0500 Subject: [PATCH] test(admin/e2e): Add tags to tests (#2046) --- ui/admin/package.json | 4 ++++ ui/admin/tests/e2e/README.md | 15 ++++++++------- ui/admin/tests/e2e/tests/auth-method.spec.js | 2 +- .../e2e/tests/credential-store-static.spec.js | 10 +++++++--- .../e2e/tests/credential-store-vault.spec.js | 4 +++- ui/admin/tests/e2e/tests/delete-resources.spec.js | 4 ++-- .../tests/e2e/tests/dynamic-host-catalog.spec.js | 2 +- ui/admin/tests/e2e/tests/group-role.spec.js | 2 +- ui/admin/tests/e2e/tests/login.spec.js | 12 ++++++++---- ui/admin/tests/e2e/tests/target.spec.js | 6 +++--- 10 files changed, 38 insertions(+), 23 deletions(-) diff --git a/ui/admin/package.json b/ui/admin/package.json index bd1fa2210..2cbe16eeb 100644 --- a/ui/admin/package.json +++ b/ui/admin/package.json @@ -34,6 +34,10 @@ "test": "concurrently \"npm:test:*\" --names \"test:\"", "test:ember": "COVERAGE=true ember exam --test-port 0 --split=4 --parallel=1 --random", "e2e": "yarn playwright test --config ./tests/e2e/playwright.config.js", + "e2e:ce:aws": "yarn run e2e --grep \"(?=.*@ce)(?=.*@aws)\"", + "e2e:ce:docker": "yarn run e2e --grep \"(?=.*@ce)(?=.*@docker)\"", + "e2e:ent:aws": "yarn run e2e \"(?=.*@ent)(?=.*@aws)\"", + "e2e:ent:docker": "yarn run e2e \"(?=.*@ent)(?=.*@docker)\"", "e2e:dev:chrome": "yarn run e2e --project=chromium --headed", "e2e:dev:firefox": "yarn run e2e --project=firefox --headed", "e2e:dev:safari": "yarn run e2e --project=webkit --headed", diff --git a/ui/admin/tests/e2e/README.md b/ui/admin/tests/e2e/README.md index d08814b36..11b63e289 100644 --- a/ui/admin/tests/e2e/README.md +++ b/ui/admin/tests/e2e/README.md @@ -113,7 +113,7 @@ It is not necessary, but from this point we recommend having 2 terminals open.  ### Launch Enos Scenario -Using Terminal 1: +Using Terminal 1: - `$ cd boundary/enos`. - `$ doormat login`. Login with Doormat. - `$ eval "$(doormat aws export --account boundary_team_acctest_dev)"`. Exporting AWS env variables from doormat to your terminal. @@ -136,14 +136,15 @@ PWDEBUG=console yarn playwright test --headed --config ./tests/e2e/playwright.co PWDEBUG=console yarn playwright test --headed --config ./tests/e2e/playwright.config.js login.spec.js --debug ``` -To run the tests with a specific tag (e.g. @enterprise), use this command. +To run all tests for a certain configuration, you can use the following shortcuts ```bash -PWDEBUG=console yarn playwright test --grep @enterprise --headed --config ./tests/e2e/playwright.config.js delete-resources.spec.js -``` +# Runs all tests pertaining to the Community Edition +yarn run e2e:ce:aws +yarn run e2e:ce:docker -To run all tests except those with a specific tag (e.g. @enterprise), use this command. -```bash -PWDEBUG=console yarn playwright test --grep-invert @enterprise --headed --config ./tests/e2e/playwright.config.js delete-resources.spec.js +# Runs all tests pertaining to the Enterprise Edition +yarn run e2e:ent:aws +yarn run e2e:ent:docker ``` [Playwright documentation about running tests](https://playwright.dev/docs/running-tests). diff --git a/ui/admin/tests/e2e/tests/auth-method.spec.js b/ui/admin/tests/e2e/tests/auth-method.spec.js index 55219a4f6..ffbdc5aea 100644 --- a/ui/admin/tests/e2e/tests/auth-method.spec.js +++ b/ui/admin/tests/e2e/tests/auth-method.spec.js @@ -28,7 +28,7 @@ test.beforeAll(async () => { await checkBoundaryCli(); }); -test('Verify new auth-method can be created and assigned to users', async ({ +test('Verify new auth-method can be created and assigned to users @ce @ent @aws @docker', async ({ page, }) => { await page.goto('/'); diff --git a/ui/admin/tests/e2e/tests/credential-store-static.spec.js b/ui/admin/tests/e2e/tests/credential-store-static.spec.js index 1f39ae951..8f3c1e641 100644 --- a/ui/admin/tests/e2e/tests/credential-store-static.spec.js +++ b/ui/admin/tests/e2e/tests/credential-store-static.spec.js @@ -73,7 +73,9 @@ test.beforeEach(async ({ page }) => { ).toBeVisible(); }); -test('Static Credential Store (User & Key Pair)', async ({ page }) => { +test('Static Credential Store (User & Key Pair) @ce @aws @docker', async ({ + page, +}) => { const credentialName = 'Credential ' + nanoid(); await page.getByRole('link', { name: 'Credentials', exact: true }).click(); await page.getByRole('link', { name: 'New', exact: true }).click(); @@ -121,7 +123,9 @@ test('Static Credential Store (User & Key Pair)', async ({ page }) => { } }); -test('Static Credential Store (Username & Password)', async ({ page }) => { +test('Static Credential Store (Username & Password) @ce @aws @docker', async ({ + page, +}) => { const credentialName = 'Credential ' + nanoid(); await page.getByRole('link', { name: 'Credentials', exact: true }).click(); await page.getByRole('link', { name: 'New', exact: true }).click(); @@ -172,7 +176,7 @@ test('Static Credential Store (Username & Password)', async ({ page }) => { } }); -test('Static Credential Store (JSON)', async ({ page }) => { +test('Static Credential Store (JSON) @ce @aws @docker', async ({ page }) => { const credentialName = 'Credential ' + nanoid(); await page.getByRole('link', { name: 'Credentials', exact: true }).click(); await page.getByRole('link', { name: 'New', exact: true }).click(); diff --git a/ui/admin/tests/e2e/tests/credential-store-vault.spec.js b/ui/admin/tests/e2e/tests/credential-store-vault.spec.js index 82a31cdef..59209c2c1 100644 --- a/ui/admin/tests/e2e/tests/credential-store-vault.spec.js +++ b/ui/admin/tests/e2e/tests/credential-store-vault.spec.js @@ -53,7 +53,9 @@ test.beforeEach(async ({ page }) => { await page.goto('/'); }); -test('Vault Credential Store (User & Key Pair)', async ({ page }) => { +test('Vault Credential Store (User & Key Pair) @ce @aws @docker', async ({ + page, +}) => { execSync( `vault policy write ${boundaryPolicyName} ./tests/e2e/tests/fixtures/boundary-controller-policy.hcl`, ); diff --git a/ui/admin/tests/e2e/tests/delete-resources.spec.js b/ui/admin/tests/e2e/tests/delete-resources.spec.js index e3ad9ca08..40036b3c3 100644 --- a/ui/admin/tests/e2e/tests/delete-resources.spec.js +++ b/ui/admin/tests/e2e/tests/delete-resources.spec.js @@ -64,7 +64,7 @@ test.beforeEach(async () => { await authenticateBoundaryCli(); }); -test('Verify resources can be deleted', async ({ page }) => { +test('Verify resources can be deleted @ce @aws @docker', async ({ page }) => { let orgId; try { // Create boundary resources using CLI @@ -189,7 +189,7 @@ test('Verify resources can be deleted', async ({ page }) => { } }); -test('Verify enterprise resources can be deleted @enterprise', async ({ +test('Verify enterprise resources can be deleted @ent @aws @docker', async ({ page, }) => { let orgId; diff --git a/ui/admin/tests/e2e/tests/dynamic-host-catalog.spec.js b/ui/admin/tests/e2e/tests/dynamic-host-catalog.spec.js index 13f3eaa8a..838295383 100644 --- a/ui/admin/tests/e2e/tests/dynamic-host-catalog.spec.js +++ b/ui/admin/tests/e2e/tests/dynamic-host-catalog.spec.js @@ -25,7 +25,7 @@ test.beforeEach(async ({ page }) => { }); test.describe('AWS', async () => { - test('Create a Dynamic Host Catalog and set up Host Sets', async ({ + test('Create a Dynamic Host Catalog and set up Host Sets @ce @ent @aws', async ({ page, }) => { await createNewOrg(page); diff --git a/ui/admin/tests/e2e/tests/group-role.spec.js b/ui/admin/tests/e2e/tests/group-role.spec.js index 5da92938f..7a47686e1 100644 --- a/ui/admin/tests/e2e/tests/group-role.spec.js +++ b/ui/admin/tests/e2e/tests/group-role.spec.js @@ -27,7 +27,7 @@ test.beforeAll(async () => { await checkBoundaryCli(); }); -test('Verify a new role can be created and associated with a group', async ({ +test('Verify a new role can be created and associated with a group @ce @ent @aws @docker', async ({ page, }) => { await page.goto('/'); diff --git a/ui/admin/tests/e2e/tests/login.spec.js b/ui/admin/tests/e2e/tests/login.spec.js index 471a455f7..2b34319b8 100644 --- a/ui/admin/tests/e2e/tests/login.spec.js +++ b/ui/admin/tests/e2e/tests/login.spec.js @@ -6,7 +6,9 @@ /* eslint-disable no-undef */ const { test, expect } = require('@playwright/test'); -test('Log in, log out, and then log back in', async ({ page }) => { +test('Log in, log out, and then log back in @ce @ent @aws @docker', async ({ + page, +}) => { await page.goto('/'); await page @@ -42,7 +44,9 @@ test.describe('Failure Cases', async () => { await page.goto('/'); }); - test('Log in with invalid password', async ({ page }) => { + test('Log in with invalid password @ce @ent @aws @docker', async ({ + page, + }) => { await page .getByLabel('Login Name') .fill(process.env.E2E_PASSWORD_ADMIN_LOGIN_NAME); @@ -55,7 +59,7 @@ test.describe('Failure Cases', async () => { ).toBeHidden(); }); - test('Log in with only username', async ({ page }) => { + test('Log in with only username @ce @ent @aws @docker', async ({ page }) => { await page.getByLabel('Login Name').fill('testuser'); await page.getByRole('button', { name: 'Sign In' }).click(); await expect(page.getByRole('alert').getByText('Error')).toBeVisible(); @@ -65,7 +69,7 @@ test.describe('Failure Cases', async () => { ).toBeHidden(); }); - test('Log in with only password', async ({ page }) => { + test('Log in with only password @ce @ent @aws @docker', async ({ page }) => { await page .getByLabel('Password', { exact: true }) .fill(process.env.E2E_PASSWORD_ADMIN_PASSWORD); diff --git a/ui/admin/tests/e2e/tests/target.spec.js b/ui/admin/tests/e2e/tests/target.spec.js index 2729bd4c6..79663583b 100644 --- a/ui/admin/tests/e2e/tests/target.spec.js +++ b/ui/admin/tests/e2e/tests/target.spec.js @@ -38,7 +38,7 @@ test.beforeAll(async () => { await checkBoundaryCli(); }); -test('Verify session created to target with host, then cancel the session', async ({ +test('Verify session created to target with host, then cancel the session @ce @aws @docker', async ({ page, }) => { await page.goto('/'); @@ -81,7 +81,7 @@ test('Verify session created to target with host, then cancel the session', asyn } }); -test('Verify session created to target with address, then cancel the session', async ({ +test('Verify session created to target with address, then cancel the session @ce @aws @docker', async ({ page, }) => { await page.goto('/'); @@ -120,7 +120,7 @@ test('Verify session created to target with address, then cancel the session', a } }); -test('Verify TCP target is updated', async ({ page }) => { +test('Verify TCP target is updated @ce @aws @docker', async ({ page }) => { await page.goto('/'); let orgName; try {