From 460d9cf205459f50441fc80309439634a88e58a4 Mon Sep 17 00:00:00 2001 From: Christoph Jerolimov Date: Wed, 17 Jan 2024 01:52:23 +0100 Subject: [PATCH 1/3] test(web-terminal): remove TerminalComponent test race condition issue Signed-off-by: Christoph Jerolimov --- .../TerminalComponent.test.tsx | 79 +++++++++---------- 1 file changed, 37 insertions(+), 42 deletions(-) diff --git a/plugins/web-terminal/src/components/TerminalComponent/TerminalComponent.test.tsx b/plugins/web-terminal/src/components/TerminalComponent/TerminalComponent.test.tsx index 440f07e04f..5dc4c6be95 100644 --- a/plugins/web-terminal/src/components/TerminalComponent/TerminalComponent.test.tsx +++ b/plugins/web-terminal/src/components/TerminalComponent/TerminalComponent.test.tsx @@ -8,6 +8,7 @@ import { TestApiProvider, } from '@backstage/test-utils'; +import { createTheme, ThemeProvider } from '@material-ui/core'; import { fireEvent, render, waitFor } from '@testing-library/react'; import { rest } from 'msw'; import { setupServer } from 'msw/node'; @@ -41,6 +42,24 @@ const mockConfig = new MockConfigApi({ }, }); +const theme = createTheme({ + transitions: { + duration: { + // Disable visibility fade-in delay + // https://github.com/backstage/backstage/blob/master/packages/core-components/src/components/Progress/Progress.tsx + short: 0, + }, + }, +}); + +const Providers: React.FC = ({ children }) => ( + + + {children} + + +); + describe('TerminalComponent', () => { const server = setupServer(); const VALID_TOKEN = 'valid-token'; @@ -81,7 +100,6 @@ describe('TerminalComponent', () => { ); } return res( - ctx.delay(800), ctx.status(200), ctx.json(require('./__fixtures__/createWorkspace.json')), ); @@ -90,49 +108,25 @@ describe('TerminalComponent', () => { }), ); }); + afterEach(() => { server.resetHandlers(); }); + it('should render form for the Web Terminal', async () => { const rendered = render( - - - - - , + + + , ); expect(rendered.getByText('Web Terminal')).toBeInTheDocument(); }); - it('should start loading', async () => { - const rendered = render( - - - - - , - ); - const inputField = rendered - .getByTestId('token-input') - .querySelector('input'); - if (!inputField) { - throw new Error('Input field not found'); - } - fireEvent.change(inputField, { target: { value: VALID_TOKEN } }); - expect(inputField.value).toBe(VALID_TOKEN); - const submit = rendered.getByTestId('submit-token-button'); - fireEvent.click(submit); - await waitFor(() => - expect(rendered.getByTestId('progress')).toBeInTheDocument(), - ); - }); it('should render popup on token without valid permissions', async () => { const rendered = render( - - - - - , + + + , ); const inputField = rendered .getByTestId('token-input') @@ -140,12 +134,12 @@ describe('TerminalComponent', () => { if (!inputField) { throw new Error('Input field not found'); } - fireEvent.change(inputField, { + await fireEvent.change(inputField, { target: { value: NOT_VALID_PERMISSIONS_TOKEN }, }); expect(inputField.value).toBe(NOT_VALID_PERMISSIONS_TOKEN); const submit = rendered.getByTestId('submit-token-button'); - fireEvent.click(submit); + await fireEvent.click(submit); await waitFor(() => expect(rendered.getByTestId('namespace-picker')).toBeInTheDocument(), ); @@ -163,11 +157,9 @@ describe('TerminalComponent', () => { })), }); const rendered = render( - - - - - , + + + , ); const inputField = rendered .getByTestId('token-input') @@ -175,10 +167,13 @@ describe('TerminalComponent', () => { if (!inputField) { throw new Error('Input field not found'); } - fireEvent.change(inputField, { target: { value: VALID_TOKEN } }); + await fireEvent.change(inputField, { target: { value: VALID_TOKEN } }); expect(inputField.value).toBe(VALID_TOKEN); const submit = rendered.getByTestId('submit-token-button'); - fireEvent.click(submit); + await fireEvent.click(submit); + await waitFor(() => + expect(rendered.getByTestId('progress')).toBeInTheDocument(), + ); await waitFor(() => expect(rendered.getByTestId('terminal')).toBeInTheDocument(), ); From 171735a33a3ad12a864cad3364431750fa5cf85a Mon Sep 17 00:00:00 2001 From: Christoph Jerolimov Date: Wed, 17 Jan 2024 09:18:29 +0100 Subject: [PATCH 2/3] Revert "chore: updates jest timeout (#1070)" This reverts commit ca2b119e3b44ec9dcf8973d7c363abf7369508b9. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c72897acff..0174e19094 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "*.{js,jsx,ts,tsx,mjs,cjs}": "turbo run lint:fix --" }, "jest": { - "testTimeout": 25000 + "testTimeout": 15000 }, "release": { "branches": "main", From fd17aec9fe922f35b173fd7cda781cbab62687fa Mon Sep 17 00:00:00 2001 From: Jaivardhan Kumar Date: Wed, 17 Jan 2024 12:21:59 +0530 Subject: [PATCH 3/3] chore: update plugin dep --- plugins/acr/CHANGELOG.md | 1 - plugins/acr/package.json | 2 +- plugins/jfrog-artifactory/CHANGELOG.md | 1 - plugins/jfrog-artifactory/package.json | 2 +- plugins/nexus-repository-manager/CHANGELOG.md | 1 - plugins/nexus-repository-manager/package.json | 2 +- yarn.lock | 63 +++++++++++++++++++ 7 files changed, 66 insertions(+), 6 deletions(-) diff --git a/plugins/acr/CHANGELOG.md b/plugins/acr/CHANGELOG.md index 61c1f95788..06babcee24 100644 --- a/plugins/acr/CHANGELOG.md +++ b/plugins/acr/CHANGELOG.md @@ -4,7 +4,6 @@ ### Dependencies -* **@janus-idp/shared-react:** upgraded to 2.4.0 * **@janus-idp/cli:** upgraded to 1.5.0 ## @janus-idp/backstage-plugin-acr [1.2.17](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-acr@1.2.16...@janus-idp/backstage-plugin-acr@1.2.17) (2023-12-22) diff --git a/plugins/acr/package.json b/plugins/acr/package.json index 94cd4bc890..640583dea1 100644 --- a/plugins/acr/package.json +++ b/plugins/acr/package.json @@ -33,7 +33,7 @@ "@material-ui/core": "^4.9.13", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "^4.0.0-alpha.45", - "@janus-idp/shared-react": "2.4.0", + "@janus-idp/shared-react": "2.3.0", "react-use": "^17.4.0" }, "peerDependencies": { diff --git a/plugins/jfrog-artifactory/CHANGELOG.md b/plugins/jfrog-artifactory/CHANGELOG.md index 1684a0a94f..4443706efb 100644 --- a/plugins/jfrog-artifactory/CHANGELOG.md +++ b/plugins/jfrog-artifactory/CHANGELOG.md @@ -4,7 +4,6 @@ ### Dependencies -* **@janus-idp/shared-react:** upgraded to 2.4.0 * **@janus-idp/cli:** upgraded to 1.5.0 ## @janus-idp/backstage-plugin-jfrog-artifactory [1.2.17](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-jfrog-artifactory@1.2.16...@janus-idp/backstage-plugin-jfrog-artifactory@1.2.17) (2023-12-22) diff --git a/plugins/jfrog-artifactory/package.json b/plugins/jfrog-artifactory/package.json index a3e51033a1..7ce59d48d0 100644 --- a/plugins/jfrog-artifactory/package.json +++ b/plugins/jfrog-artifactory/package.json @@ -33,7 +33,7 @@ "@material-ui/core": "^4.9.13", "@material-ui/icons": "^4.11.3", "@material-ui/lab": "^4.0.0-alpha.45", - "@janus-idp/shared-react": "2.4.0", + "@janus-idp/shared-react": "2.3.0", "react-use": "^17.4.0" }, "peerDependencies": { diff --git a/plugins/nexus-repository-manager/CHANGELOG.md b/plugins/nexus-repository-manager/CHANGELOG.md index 89c7535739..c3a1f470e7 100644 --- a/plugins/nexus-repository-manager/CHANGELOG.md +++ b/plugins/nexus-repository-manager/CHANGELOG.md @@ -4,7 +4,6 @@ ### Dependencies -* **@janus-idp/shared-react:** upgraded to 2.4.0 * **@janus-idp/cli:** upgraded to 1.5.0 ## @janus-idp/backstage-plugin-nexus-repository-manager [1.4.17](https://github.com/janus-idp/backstage-plugins/compare/@janus-idp/backstage-plugin-nexus-repository-manager@1.4.16...@janus-idp/backstage-plugin-nexus-repository-manager@1.4.17) (2023-12-22) diff --git a/plugins/nexus-repository-manager/package.json b/plugins/nexus-repository-manager/package.json index 5bf93baceb..a6f5eda640 100644 --- a/plugins/nexus-repository-manager/package.json +++ b/plugins/nexus-repository-manager/package.json @@ -30,7 +30,7 @@ "@backstage/core-components": "^0.13.6", "@backstage/core-plugin-api": "^1.7.0", "@backstage/plugin-catalog-react": "^1.8.5", - "@janus-idp/shared-react": "2.4.0", + "@janus-idp/shared-react": "2.3.0", "@backstage/theme": "^0.4.3", "@material-ui/core": "^4.9.13", "@material-ui/icons": "^4.11.3", diff --git a/yarn.lock b/yarn.lock index 3b4d892de7..315e107195 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6426,6 +6426,69 @@ "@backstage/config" "^1.1.1" deep-freeze "^0.0.1" +"@janus-idp/cli@1.4.7": + version "1.4.7" + resolved "https://registry.yarnpkg.com/@janus-idp/cli/-/cli-1.4.7.tgz#2f013d68f768bc3d5b930c9527e032a1dd90c379" + integrity sha512-7lnmkTvcxT/iFXE3or5exgQ3CXd+VR9gJtCAXzjcFfpf8LfTQ4SgS7xRiijaQSZJacg/JSpRoIxuIH0sOHAvvw== + dependencies: + "@backstage/cli-common" "^0.1.13" + "@backstage/cli-node" "^0.1.5" + "@backstage/config" "^1.1.1" + "@backstage/config-loader" "^1.5.1" + "@backstage/errors" "^1.2.3" + "@backstage/eslint-plugin" "^0.1.3" + "@backstage/types" "^1.1.1" + "@manypkg/get-packages" "^1.1.3" + "@openshift/dynamic-plugin-sdk-webpack" "^3.0.0" + "@pmmmwh/react-refresh-webpack-plugin" "^0.5.7" + "@rollup/plugin-commonjs" "^25.0.4" + "@rollup/plugin-json" "^6.0.0" + "@rollup/plugin-node-resolve" "^15.2.1" + "@rollup/plugin-yaml" "^4.0.0" + "@svgr/rollup" "^8.1.0" + "@svgr/webpack" "^6.5.1" + "@yarnpkg/lockfile" "^1.1.0" + "@yarnpkg/parsers" "^3.0.0-rc.4" + bfj "^7.0.2" + chalk "^4.0.0" + chokidar "^3.3.1" + commander "^9.1.0" + css-loader "^6.5.1" + esbuild "^0.19.0" + esbuild-loader "^2.18.0" + eslint "^8.49.0" + eslint-config-prettier "^8.10.0" + eslint-webpack-plugin "^3.2.0" + express "^4.18.2" + fork-ts-checker-webpack-plugin "^7.0.0-alpha.8" + fs-extra "^10.1.0" + handlebars "^4.7.7" + html-webpack-plugin "^5.3.1" + inquirer "^8.2.0" + lodash "^4.17.21" + mini-css-extract-plugin "^2.4.2" + node-libs-browser "^2.2.1" + npm-packlist "^5.0.0" + ora "^5.3.0" + postcss "^8.2.13" + process "^0.11.10" + react-dev-utils "^12.0.0-next.60" + react-refresh "^0.14.0" + recursive-readdir "^2.2.2" + rollup "^2.78.0" + rollup-plugin-dts "^4.0.1" + rollup-plugin-esbuild "^4.7.2" + rollup-plugin-postcss "^4.0.0" + rollup-pluginutils "^2.8.2" + semver "^7.5.4" + style-loader "^3.3.1" + swc-loader "^0.2.3" + typescript-json-schema "^0.62.0" + webpack "^5.89.0" + webpack-dev-server "^4.15.1" + yml-loader "^2.1.0" + yn "^4.0.0" + "@jest/console@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc"