From d75bc81566a8fb908822a066a39c32db71efb31b Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Fri, 10 Jan 2025 15:03:29 -0600 Subject: [PATCH 1/5] add basic playwright tests --- .github/workflows/deploy-dev.yml | 5 + .github/workflows/deploy-prod.yml | 5 + .gitignore | 4 + Makefile | 3 + e2e/base.ts | 56 ++++++++++ e2e/tests/login.spec.ts | 20 ++++ package.json | 5 +- playwright.config.ts | 43 ++++++++ src/common/config.ts | 1 + yarn.lock | 175 ++++++++++++++++++++---------- 10 files changed, 261 insertions(+), 56 deletions(-) create mode 100644 e2e/base.ts create mode 100644 e2e/tests/login.spec.ts create mode 100644 playwright.config.ts diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 6a63af66..29767310 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -92,3 +92,8 @@ jobs: run: make dev_health_check - name: Run live testing run: make test_live_integration + - name: Run E2E testing + run: make test_e2e + env: + PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }} + PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }} diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index e1ed9423..0b0a42b4 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -90,6 +90,11 @@ jobs: python-version: 3.11 - name: Run live testing run: make test_live_integration + - name: Run E2E testing + run: make test_e2e + env: + PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }} + PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }} deploy-prod: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 8a4bd7ae..4be0d91e 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,7 @@ dist_ui/ *.pyc __pycache__ +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/Makefile b/Makefile index 42fb0169..da4ab6e7 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,9 @@ test_unit: install_test_deps yarn prettier yarn test:unit +test_e2e: install_test_deps + yarn test:e2e + dev_health_check: curl -f https://$(application_key).aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://manage.qa.acmuiuc.org diff --git a/e2e/base.ts b/e2e/base.ts new file mode 100644 index 00000000..f361f5a8 --- /dev/null +++ b/e2e/base.ts @@ -0,0 +1,56 @@ +import { test as base } from '@playwright/test'; +import { + SecretsManagerClient, + GetSecretValueCommand, +} from "@aws-sdk/client-secrets-manager"; + +export const getSecretValue = async ( + secretId: string, +): Promise | null> => { + const smClient = new SecretsManagerClient(); + const data = await smClient.send( + new GetSecretValueCommand({ SecretId: secretId }), + ); + if (!data.SecretString) { + return null; + } + try { + return JSON.parse(data.SecretString) as Record< + string, + string | number | boolean + >; + } catch { + return null; + } +}; + +async function getSecrets() { + let response = { PLAYWRIGHT_USERNAME: '', PLAYWRIGHT_PASSWORD: '' } + let keyData; + if (!process.env.PLAYWRIGHT_USERNAME || !process.env.PLAYWRIGHT_PASSWORD || !process.env.JwtSigningKey) { + keyData = await getSecretValue('infra-core-api-config') + } + response['PLAYWRIGHT_USERNAME'] = process.env.PLAYWRIGHT_USERNAME || keyData ? keyData['playwright_username'] : ''; + response['PLAYWRIGHT_PASSWORD'] = process.env.PLAYWRIGHT_PASSWORD || keyData ? keyData['playwright_password'] : ''; + return response; +} + +const secrets = await getSecrets(); + +async function becomeUser(page) { + await page.goto('https://manage.qa.acmuiuc.org/login'); + await page.getByRole('button', { name: 'Sign in with Illinois NetID' }).click(); + await page.getByPlaceholder('NetID@illinois.edu').click(); + await page.getByPlaceholder('NetID@illinois.edu').fill(secrets['PLAYWRIGHT_USERNAME']); + await page.getByPlaceholder('NetID@illinois.edu').press('Enter'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill(secrets['PLAYWRIGHT_PASSWORD']); + await page.getByRole('button', { name: 'Sign in' }).click(); + await page.getByRole('button', { name: 'No' }).click(); +} + +export const test = base.extend<{ becomeUser: (page) => Promise }>({ + becomeUser: async ({ }, use) => { + use(becomeUser) + }, +}); diff --git a/e2e/tests/login.spec.ts b/e2e/tests/login.spec.ts new file mode 100644 index 00000000..84531599 --- /dev/null +++ b/e2e/tests/login.spec.ts @@ -0,0 +1,20 @@ + +import { expect } from '@playwright/test'; +import { test } from '../base'; +import { describe } from 'node:test'; + +describe("Login tests", () => { + test('A user can login and view the home screen', async ({ page, becomeUser }) => { + await becomeUser(page); + await expect(page.locator('a').filter({ hasText: 'Management Portal DEV ENV' })).toBeVisible(); + await expect(page.locator('a').filter({ hasText: 'Events' })).toBeVisible(); + await expect(page.locator('a').filter({ hasText: 'Ticketing/Merch' })).toBeVisible(); + await expect(page.locator('a').filter({ hasText: 'IAM' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'ACM Logo Management Portal' })).toBeVisible(); + await expect(page.getByRole('link', { name: 'P', exact: true })).toBeVisible(); + await page.getByRole('link', { name: 'P', exact: true }).click(); + await expect(page.getByLabel('PMy Account')).toContainText('Name Playwright Core User'); + await expect(page.getByLabel('PMy Account')).toContainText('Emailcore-e2e-testing@acm.illinois.edu'); + expect(page.url()).toEqual('https://manage.qa.acmuiuc.org/home'); + }); +}) diff --git a/package.json b/package.json index cc8eee7a..b89ba266 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,9 @@ "test:unit-ui": "yarn test:unit --ui", "test:unit-watch": "vitest tests/unit", "test:live": "vitest tests/live", - "test:live-ui": "yarn test:live --ui" + "test:live-ui": "yarn test:live --ui", + "test:e2e": "playwright test", + "test:e2e-ui": "playwright test --ui" }, "dependencies": { "@aws-sdk/client-dynamodb": "^3.624.0", @@ -49,6 +51,7 @@ }, "devDependencies": { "@eslint/compat": "^1.1.1", + "@playwright/test": "^1.49.1", "@tsconfig/node20": "^20.1.4", "@types/node": "^22.1.0", "@types/pluralize": "^0.0.33", diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 00000000..31747257 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,43 @@ +import { defineConfig, devices } from '@playwright/test'; + +export default defineConfig({ + testDir: './e2e/tests', + /* Run tests in files in parallel */ + fullyParallel: false, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !!process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : undefined, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: 'html', + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + use: { + /* Base URL to use in actions like `await page.goto('/')`. */ + // baseURL: 'http://127.0.0.1:3000', + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + + { + name: 'firefox', + use: { ...devices['Desktop Firefox'] }, + }, + ], + + /* Run your local dev server before starting the tests */ + // webServer: { + // command: 'npm run start', + // url: 'http://127.0.0.1:3000', + // reuseExistingServer: !process.env.CI, + // }, +}); diff --git a/src/common/config.ts b/src/common/config.ts index b9f67113..09d1a340 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -70,6 +70,7 @@ const environmentConfig: EnvironmentConfigType = { }, UserRoleMapping: { "infra-unit-test-nogrp@acm.illinois.edu": [AppRoles.TICKETS_SCANNER], + "kLkvWTYwNnJfBkIK7mBi4niXXHYNR7ygbV8utlvFxjw": allAppRoles }, AzureRoleMapping: { AutonomousWriters: [AppRoles.EVENTS_MANAGER] }, ValidCorsOrigins: [ diff --git a/yarn.lock b/yarn.lock index 8f1f32ae..40e3f987 100644 --- a/yarn.lock +++ b/yarn.lock @@ -378,9 +378,9 @@ tslib "^2.6.2" "@aws-sdk/client-sts@^3.726.0": - version "3.726.0" - resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.726.0.tgz#d878419a0bac65f5bf975c4d94efad5029e46932" - integrity sha512-047EqXv2BAn/43eP92zsozPnR3paFFMsj5gjytx9kGNtp+WV0fUZNztCOobtouAxBY0ZQ8Xx5RFnmjpRb6Kjsg== + version "3.726.1" + resolved "https://registry.yarnpkg.com/@aws-sdk/client-sts/-/client-sts-3.726.1.tgz#49ab471db7e04792db24e181f8bb8c7787739b34" + integrity sha512-qh9Q9Vu1hrM/wMBOBIaskwnE4GTFaZu26Q6WHwyWNfj7J8a40vBxpW16c2vYXHLBtwRKM1be8uRLkmDwghpiNw== dependencies: "@aws-crypto/sha256-browser" "5.2.0" "@aws-crypto/sha256-js" "5.2.0" @@ -971,6 +971,17 @@ "@jridgewell/trace-mapping" "^0.3.25" jsesc "^3.0.2" +"@babel/generator@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.26.5.tgz#e44d4ab3176bbcaf78a5725da5f1dc28802a9458" + integrity sha512-2caSP6fN9I7HOe6nqhtft7V4g7/V/gfDsC3Ag4W7kEzzvRGKqiv0pu0HogPiZ3KaVSoNDhUws6IJjDjpfmYIXw== + dependencies: + "@babel/parser" "^7.26.5" + "@babel/types" "^7.26.5" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^3.0.2" + "@babel/helper-compilation-targets@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz#55af025ce365be3cdc0c1c1e56c6af617ce88875" @@ -1034,6 +1045,13 @@ dependencies: "@babel/types" "^7.26.3" +"@babel/parser@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.26.5.tgz#6fec9aebddef25ca57a935c86dbb915ae2da3e1f" + integrity sha512-SRJ4jYmXRqV1/Xc+TIVG84WjHBXKlxO9sHQnA2Pf12QQEAp1LOh6kDzNHXcUnbH1QI0FDoPPVOt+vyUDucxpaw== + dependencies: + "@babel/types" "^7.26.5" + "@babel/plugin-transform-react-jsx-self@^7.25.9": version "7.25.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.25.9.tgz#c0b6cae9c1b73967f7f9eb2fca9536ba2fad2858" @@ -1064,7 +1082,20 @@ "@babel/parser" "^7.25.9" "@babel/types" "^7.25.9" -"@babel/traverse@^7.18.9", "@babel/traverse@^7.25.9", "@babel/traverse@^7.7.0": +"@babel/traverse@^7.18.9": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.5.tgz#6d0be3e772ff786456c1a37538208286f6e79021" + integrity sha512-rkOSPOw+AXbgtwUga3U4u8RpoK9FEFWBNAlTpcnkLFjL5CT+oyHNuUUC/xx6XefEJ16r38r8Bc/lfp6rYuHeJQ== + dependencies: + "@babel/code-frame" "^7.26.2" + "@babel/generator" "^7.26.5" + "@babel/parser" "^7.26.5" + "@babel/template" "^7.25.9" + "@babel/types" "^7.26.5" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/traverse@^7.25.9", "@babel/traverse@^7.7.0": version "7.26.4" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.26.4.tgz#ac3a2a84b908dde6d463c3bfa2c5fdc1653574bd" integrity sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w== @@ -1077,7 +1108,7 @@ debug "^4.3.1" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.9", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.3", "@babel/types@^7.7.0": +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.25.9", "@babel/types@^7.26.0", "@babel/types@^7.26.3", "@babel/types@^7.7.0": version "7.26.3" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.3.tgz#37e79830f04c2b5687acc77db97fbc75fb81f3c0" integrity sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA== @@ -1085,6 +1116,14 @@ "@babel/helper-string-parser" "^7.25.9" "@babel/helper-validator-identifier" "^7.25.9" +"@babel/types@^7.18.9", "@babel/types@^7.26.5": + version "7.26.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.26.5.tgz#7a1e1c01d28e26d1fe7f8ec9567b3b92b9d07747" + integrity sha512-L6mZmwFDK6Cjh1nRCLXpa6no13ZIioJDz7mdkzHv399pThrTa/k0nUlNaenOeh2kWu/iaOQYElEpKPUswUa9Vg== + dependencies: + "@babel/helper-string-parser" "^7.25.9" + "@babel/helper-validator-identifier" "^7.25.9" + "@csstools/css-parser-algorithms@^3.0.4": version "3.0.4" resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.4.tgz#74426e93bd1c4dcab3e441f5cc7ba4fb35d94356" @@ -1631,19 +1670,19 @@ fast-deep-equal "^3.1.3" "@floating-ui/core@^1.6.0": - version "1.6.8" - resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.8.tgz#aa43561be075815879305965020f492cdb43da12" - integrity sha512-7XJ9cPU+yI2QeLS+FCSlqNFZJq8arvswefkZrYI1yQBbftw6FyrZOxYSh+9S7z7TpeWlRt9zJ5IhM1WIL334jA== + version "1.6.9" + resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.6.9.tgz#64d1da251433019dafa091de9b2886ff35ec14e6" + integrity sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw== dependencies: - "@floating-ui/utils" "^0.2.8" + "@floating-ui/utils" "^0.2.9" "@floating-ui/dom@^1.0.0": - version "1.6.12" - resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.12.tgz#6333dcb5a8ead3b2bf82f33d6bc410e95f54e556" - integrity sha512-NP83c0HjokcGVEMeoStg317VD9W7eDlGK7457dMBANbKA6GJZdc7rjujdgqzTaz93jkGgc5P/jeWbaCHnMNc+w== + version "1.6.13" + resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.6.13.tgz#a8a938532aea27a95121ec16e667a7cbe8c59e34" + integrity sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w== dependencies: "@floating-ui/core" "^1.6.0" - "@floating-ui/utils" "^0.2.8" + "@floating-ui/utils" "^0.2.9" "@floating-ui/react-dom@^2.1.2": version "2.1.2" @@ -1661,10 +1700,10 @@ "@floating-ui/utils" "^0.2.8" tabbable "^6.0.0" -"@floating-ui/utils@^0.2.8": - version "0.2.8" - resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.8.tgz#21a907684723bbbaa5f0974cf7730bd797eb8e62" - integrity sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig== +"@floating-ui/utils@^0.2.8", "@floating-ui/utils@^0.2.9": + version "0.2.9" + resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.9.tgz#50dea3616bc8191fb8e112283b49eaff03e78429" + integrity sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg== "@humanwhocodes/config-array@^0.13.0": version "0.13.0" @@ -1726,49 +1765,49 @@ "@jridgewell/sourcemap-codec" "^1.4.14" "@mantine/core@^7.12.0": - version "7.15.2" - resolved "https://registry.yarnpkg.com/@mantine/core/-/core-7.15.2.tgz#9c21d5afe5e43fe0a58fb4b1166ded0a67fa1eae" - integrity sha512-640ns0L/HZAXYjz3+FRffr8UNcH1fU7ENUVxKLzqNA311Dcx0qS3byVKTY/IVJYln6AkjoEfIJMiixT9fCZBiQ== + version "7.15.3" + resolved "https://registry.yarnpkg.com/@mantine/core/-/core-7.15.3.tgz#91fded05219112483d821cec46fcbb8a80964b79" + integrity sha512-8IMTq5xDJDjByDUYkDNKImikASStzrnPtVumKsrEnyEY0zhAWkAe/z/+PjTUMcN44ncJ/PrXQkJ6qMaVWzSZwA== dependencies: "@floating-ui/react" "^0.26.28" clsx "^2.1.1" - react-number-format "^5.4.2" - react-remove-scroll "^2.6.0" + react-number-format "^5.4.3" + react-remove-scroll "^2.6.2" react-textarea-autosize "8.5.6" type-fest "^4.27.0" "@mantine/dates@^7.12.0": - version "7.15.2" - resolved "https://registry.yarnpkg.com/@mantine/dates/-/dates-7.15.2.tgz#2ac38861327a9191f96fb06baaf362bccbcdf365" - integrity sha512-WeJ+a16bZC+7k9Fr6jiC5NrdZi23Hp28xGBa3kKYk0Nanz/lTgg2DTBgFB537+4MVD1kOmqso+7z1VO9uLeaEw== + version "7.15.3" + resolved "https://registry.yarnpkg.com/@mantine/dates/-/dates-7.15.3.tgz#05c67e97370530c31f5faae50c4086f30977a381" + integrity sha512-lv71dcfA8qB43v03cRELC2/G7FQXfAgj0tSMImj2p2FL3PSWWF4WRvW6byiB+hszk4lgooSo7kppzkSMVUlsdA== dependencies: clsx "^2.1.1" "@mantine/form@^7.12.0": - version "7.15.2" - resolved "https://registry.yarnpkg.com/@mantine/form/-/form-7.15.2.tgz#0f243ecef13aea6d7a6a5adf9a96280e5bd4644d" - integrity sha512-ADXLw/e0/ddNIj9EtJb5aes2VEpoR7GIVgKnzFhq8DXMfOZqaMn4rSVY8LmVOAtcMyocPR7hk8uQQ3ihmpzFaw== + version "7.15.3" + resolved "https://registry.yarnpkg.com/@mantine/form/-/form-7.15.3.tgz#edd42021e4a5ca260ce2b2bec93b056e18ef096e" + integrity sha512-E+xrY/z6Y4JoHqL4f91AoMeNspuAe+nET667wKVBSUu4yLQX0FS8uvdypoaasb3LcTk7GRmnDNYyfC37zz4zkg== dependencies: fast-deep-equal "^3.1.3" klona "^2.0.6" "@mantine/hooks@^7.12.0": - version "7.15.2" - resolved "https://registry.yarnpkg.com/@mantine/hooks/-/hooks-7.15.2.tgz#f583ecfb7b92cad17c67f7825f20f23b72e6d7ff" - integrity sha512-p8dsW0fdJxzYhULbm1noFYRHuBvJHleYviC0BlwbkVySC8AsvFI8AmC3sMssWV3dQ3yQ/SidYo9U+K/czpDpZw== + version "7.15.3" + resolved "https://registry.yarnpkg.com/@mantine/hooks/-/hooks-7.15.3.tgz#c8f65dcb9391b306c05f2b501980b21944c3263a" + integrity sha512-rZYObhrmww3OIb4O30pDox/rc+9k3AExO0FSw13t7cfz5/Di+Ho1cChswVFAshnp81ucGEod1fiDOfuyGW7JhA== "@mantine/notifications@^7.12.0": - version "7.15.2" - resolved "https://registry.yarnpkg.com/@mantine/notifications/-/notifications-7.15.2.tgz#4e5be05eec507e76c8b11c4d20c92ecc73d6a82b" - integrity sha512-SZYUJV+BMakyoURj1is5aKXyM6pHpwl3V28FVx7nExyXcHJyzmPmqaSPumo0ZjFo+ysQ8/0P9UnYP0kNRwrjdQ== + version "7.15.3" + resolved "https://registry.yarnpkg.com/@mantine/notifications/-/notifications-7.15.3.tgz#066f1f60c1fa9c7e62d35f5b2c0ec3c0268e588d" + integrity sha512-C1obM5dQsSHIB3B3Kajk0TdLnBpLXFMOIy0otG5khoL/8c8qOU4U0kHxtPVFBFvU/hw4rx7/idiiJdjp8DepDQ== dependencies: - "@mantine/store" "7.15.2" + "@mantine/store" "7.15.3" react-transition-group "4.4.5" -"@mantine/store@7.15.2": - version "7.15.2" - resolved "https://registry.yarnpkg.com/@mantine/store/-/store-7.15.2.tgz#90fb34f257a4a7514747a035eee76c41055128d6" - integrity sha512-8ZVRr6D/8GEu2VmUVU447w4H+hl9dwefl//GpSGI2vKxXBqlud5X9PJQkSwi5J7I5FAxvlG5dr/zCxC3r3nsIQ== +"@mantine/store@7.15.3": + version "7.15.3" + resolved "https://registry.yarnpkg.com/@mantine/store/-/store-7.15.3.tgz#3a361cf92903feceddf0331ac70ffaf4515bf558" + integrity sha512-E3pCEm5ozRF/iK/jM1liKntjqaKhotvPtNAqSBcx6AkWSJ8bt16JhNrmrs3J3RmWvfqzF+fftT8HI/3HYbgu9w== "@mdx-js/react@^3.0.0": version "3.1.0" @@ -1874,6 +1913,13 @@ resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== +"@playwright/test@^1.49.1": + version "1.49.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.49.1.tgz#55fa360658b3187bfb6371e2f8a64f50ef80c827" + integrity sha512-Ky+BVzPz8pL6PQxHqNRW1k3mIyv933LML7HktS8uik0bUXNCdPhoS/kLihiO1tMf/egaJb4IutXd7UywvXEW+g== + dependencies: + playwright "1.49.1" + "@polka/url@^1.0.0-next.24": version "1.0.0-next.28" resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.28.tgz#d45e01c4a56f143ee69c54dd6b12eade9e270a73" @@ -3084,16 +3130,16 @@ integrity sha512-99rgLEjf7iwfSEmdqlHkSG3AyLcK0sfExcr0jnc6rLiAkBhzuIsvcHjjUwkR210SOCgXqBPW0ZA6uhnuyppHLw== "@tabler/icons-react@^3.12.0": - version "3.26.0" - resolved "https://registry.yarnpkg.com/@tabler/icons-react/-/icons-react-3.26.0.tgz#5db95a886f3766aefea6d94b729438dd0a8dd784" - integrity sha512-t18Zmu1ROktB7M8hWQ6vJw+mNpI/LPk5PPxLuE+kNB+4Zzf38GfETL8VF98inhzcfHohsggdROzMzwSAfjcAxw== + version "3.28.1" + resolved "https://registry.yarnpkg.com/@tabler/icons-react/-/icons-react-3.28.1.tgz#6bcd85f3fb924ceeb3caf2ce5be7523e41008266" + integrity sha512-KNBpA2kbxr3/2YK5swt7b/kd/xpDP1FHYZCxDFIw54tX8slELRFEf95VMxsccQHZeIcUbdoojmUUuYSbt/sM5Q== dependencies: - "@tabler/icons" "3.26.0" + "@tabler/icons" "3.28.1" -"@tabler/icons@3.26.0": - version "3.26.0" - resolved "https://registry.yarnpkg.com/@tabler/icons/-/icons-3.26.0.tgz#7a23b2a99abda32e3b4cf00ce46dddaa5daa1923" - integrity sha512-oO3D4ss+DxzxqU1aDy0f1HmToyrO0gcQWIMpzHAfV1quPUx0BZYvNm5xz1DQb4DxNm/+xNvbBGLJy4pzTLYWag== +"@tabler/icons@3.28.1": + version "3.28.1" + resolved "https://registry.yarnpkg.com/@tabler/icons/-/icons-3.28.1.tgz#271e6d4107525dbb8622a36a9414487e734606aa" + integrity sha512-h7nqKEvFooLtFxhMOC1/2eiV+KRXhBUuDUUJrJlt6Ft6tuMw2eU/9GLQgrTk41DNmIEzp/LI83K9J9UUU8YBYQ== "@testing-library/dom@10.4.0", "@testing-library/dom@^10.4.0": version "10.4.0" @@ -5753,6 +5799,11 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== +fsevents@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" @@ -7449,6 +7500,20 @@ pino@^9.0.0: sonic-boom "^4.0.1" thread-stream "^3.0.0" +playwright-core@1.49.1: + version "1.49.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.49.1.tgz#32c62f046e950f586ff9e35ed490a424f2248015" + integrity sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg== + +playwright@1.49.1: + version "1.49.1" + resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.49.1.tgz#830266dbca3008022afa7b4783565db9944ded7c" + integrity sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA== + dependencies: + playwright-core "1.49.1" + optionalDependencies: + fsevents "2.3.2" + pluralize@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" @@ -7719,7 +7784,7 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== -react-number-format@^5.4.2: +react-number-format@^5.4.3: version "5.4.3" resolved "https://registry.yarnpkg.com/react-number-format/-/react-number-format-5.4.3.tgz#e634df907da7742faf597afab3f25f9a59689d60" integrity sha512-VCY5hFg/soBighAoGcdE+GagkJq0230qN6jcS5sp8wQX1qy1fYN/RX7/BXkrs0oyzzwqR8/+eSUrqXbGeywdUQ== @@ -7768,7 +7833,7 @@ react-remove-scroll-bar@^2.3.7: react-style-singleton "^2.2.2" tslib "^2.0.0" -react-remove-scroll@^2.6.0: +react-remove-scroll@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/react-remove-scroll/-/react-remove-scroll-2.6.2.tgz#2518d2c5112e71ea8928f1082a58459b5c7a2a97" integrity sha512-KmONPx5fnlXYJQqC62Q+lwIeAk64ws/cUw6omIumRzMRPqgnYqhSSti99nbj0Ry13bv7dF+BKn7NB+OqkdZGTw== @@ -9059,9 +9124,9 @@ type-fest@^2.13.0, type-fest@^2.19.0: integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== type-fest@^4.27.0: - version "4.31.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.31.0.tgz#a3de630c96eb77c281b6ba2affa5dae5fb3c326c" - integrity sha512-yCxltHW07Nkhv/1F6wWBr8kz+5BGMfP+RbRSYFnegVb0qV/UMT0G0ElBloPVerqn4M2ZV80Ir1FtCcYv1cT6vQ== + version "4.32.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.32.0.tgz#55bacdd6f2cf1392b7e9cde894e9b1d726807e97" + integrity sha512-rfgpoi08xagF3JSdtJlCwMq9DGNDE0IMh3Mkpc1wUypg9vPi786AiqeBBKcqvIkq42azsBM85N490fyZjeUftw== typed-array-buffer@^1.0.3: version "1.0.3" @@ -9155,9 +9220,9 @@ universalify@^0.2.0: integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== unplugin@^1.3.1: - version "1.16.0" - resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.16.0.tgz#ca0f248bf8798cd752dd02e5b381223b737cef72" - integrity sha512-5liCNPuJW8dqh3+DM6uNM2EI3MLLpCKp/KY+9pB5M2S2SR2qvvDHhKgBOaTWEbZTAws3CXfB0rKTIolWKL05VQ== + version "1.16.1" + resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-1.16.1.tgz#a844d2e3c3b14a4ac2945c42be80409321b61199" + integrity sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w== dependencies: acorn "^8.14.0" webpack-virtual-modules "^0.6.2" From 2022ba8fa8c4c81de739917da4bb60fa28585e97 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Fri, 10 Jan 2025 15:13:35 -0600 Subject: [PATCH 2/5] fix playwright env check for AWS credentials --- e2e/base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/base.ts b/e2e/base.ts index f361f5a8..8711a93b 100644 --- a/e2e/base.ts +++ b/e2e/base.ts @@ -27,7 +27,7 @@ export const getSecretValue = async ( async function getSecrets() { let response = { PLAYWRIGHT_USERNAME: '', PLAYWRIGHT_PASSWORD: '' } let keyData; - if (!process.env.PLAYWRIGHT_USERNAME || !process.env.PLAYWRIGHT_PASSWORD || !process.env.JwtSigningKey) { + if (!process.env.PLAYWRIGHT_USERNAME || !process.env.PLAYWRIGHT_PASSWORD) { keyData = await getSecretValue('infra-core-api-config') } response['PLAYWRIGHT_USERNAME'] = process.env.PLAYWRIGHT_USERNAME || keyData ? keyData['playwright_username'] : ''; From e93df83b03f6d343b469e053dbb73d74f2b6fcfe Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Fri, 10 Jan 2025 15:27:14 -0600 Subject: [PATCH 3/5] fix env prioritization --- e2e/base.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/base.ts b/e2e/base.ts index 8711a93b..f85d0856 100644 --- a/e2e/base.ts +++ b/e2e/base.ts @@ -30,8 +30,8 @@ async function getSecrets() { if (!process.env.PLAYWRIGHT_USERNAME || !process.env.PLAYWRIGHT_PASSWORD) { keyData = await getSecretValue('infra-core-api-config') } - response['PLAYWRIGHT_USERNAME'] = process.env.PLAYWRIGHT_USERNAME || keyData ? keyData['playwright_username'] : ''; - response['PLAYWRIGHT_PASSWORD'] = process.env.PLAYWRIGHT_PASSWORD || keyData ? keyData['playwright_password'] : ''; + response['PLAYWRIGHT_USERNAME'] = process.env.PLAYWRIGHT_USERNAME || (keyData ? keyData['playwright_username'] : ''); + response['PLAYWRIGHT_PASSWORD'] = process.env.PLAYWRIGHT_PASSWORD || (keyData ? keyData['playwright_password'] : ''); return response; } From 5a4bb076fae94c68b5c20150819891bb2be70627 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Fri, 10 Jan 2025 15:44:33 -0600 Subject: [PATCH 4/5] add loading overlay; fix playwright install --- Makefile | 1 + src/ui/pages/iam/GroupMemberManagement.tsx | 82 ++++++++++++---------- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/Makefile b/Makefile index da4ab6e7..92abb953 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,7 @@ test_unit: install_test_deps yarn test:unit test_e2e: install_test_deps + yarn playwright install yarn test:e2e dev_health_check: diff --git a/src/ui/pages/iam/GroupMemberManagement.tsx b/src/ui/pages/iam/GroupMemberManagement.tsx index ffc0b8b9..bdd753f0 100644 --- a/src/ui/pages/iam/GroupMemberManagement.tsx +++ b/src/ui/pages/iam/GroupMemberManagement.tsx @@ -15,6 +15,7 @@ import { import { IconTrash, IconUserPlus } from '@tabler/icons-react'; import { notifications } from '@mantine/notifications'; import { GroupMemberGetResponse, EntraActionResponse } from '@common/types/iam'; +import FullScreenLoader from '@ui/components/AuthContext/LoadingScreen'; interface GroupMemberManagementProps { fetchMembers: () => Promise; @@ -29,7 +30,7 @@ export const GroupMemberManagement: React.FC = ({ const [toAdd, setToAdd] = useState([]); const [toRemove, setToRemove] = useState([]); const [email, setEmail] = useState(''); - const [isLoading, setIsLoading] = useState(false); + const [isLoading, setIsLoading] = useState(true); const [confirmationModal, setConfirmationModal] = useState(false); useEffect(() => { @@ -46,6 +47,7 @@ export const GroupMemberManagement: React.FC = ({ } }; loadMembers(); + setIsLoading(false); }, [fetchMembers]); const handleAddMember = () => { @@ -132,7 +134,6 @@ export const GroupMemberManagement: React.FC = ({ setIsLoading(false); } }; - return ( @@ -145,44 +146,47 @@ export const GroupMemberManagement: React.FC = ({ Current Members - - {members.map((member) => ( - - - - - {member.name} ({member.email}) - - {toRemove.includes(member.email) && ( - - Queued for removal + {isLoading && } + {!isLoading && ( + + {members.map((member) => ( + + + + + {member.name} ({member.email}) + + {toRemove.includes(member.email) && ( + + Queued for removal + + )} + + handleRemoveMember(member.email)} + data-testid={`remove-exec-member-${member.email}`} + > + + + + + ))} + {toAdd.map((member) => ( + + + + {member} + + Queued for addition - )} - - handleRemoveMember(member.email)} - data-testid={`remove-exec-member-${member.email}`} - > - - - - - ))} - {toAdd.map((member) => ( - - - - {member} - - Queued for addition - - - - - ))} - + + + + ))} + + )} From ef4c05968f30a59a7db18cc1e5bc7b961f527bbd Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Fri, 10 Jan 2025 15:45:46 -0600 Subject: [PATCH 5/5] fix test stage names --- .github/workflows/deploy-dev.yml | 2 +- .github/workflows/deploy-prod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 29767310..f45adc94 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -70,7 +70,7 @@ jobs: test-dev: runs-on: ubuntu-latest - name: Run Live Integration Tests + name: Run Live Tests needs: - deploy-dev concurrency: diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 0b0a42b4..17405598 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -70,7 +70,7 @@ jobs: test-dev: runs-on: ubuntu-latest - name: Run Live Integration Tests + name: Run Live Tests needs: - deploy-dev concurrency: