Skip to content

Commit

Permalink
fix(react-upgrade): manual test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kabaros committed Feb 6, 2025
1 parent c9eb80d commit 0774aff
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 36 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"devDependencies": {
"@dhis2/cli-app-scripts": "^12.3.0",
"@dhis2/cli-style": "^10.7.6",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/jest": "^29.5.11",
"jest": "^29.7.0",
"react-dom": "^16"
"jest": "^29.7.0"
},
"dependencies": {
"@dhis2/app-runtime": "^3.2.1",
Expand Down
15 changes: 5 additions & 10 deletions src/components/AppDetails/Versions.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useConfig } from '@dhis2/app-runtime'
import { queryAllByRole, render } from '@testing-library/react'
import { render, within } from '@testing-library/react'
import React from 'react'
import { Versions } from './Versions.jsx'

Expand Down Expand Up @@ -92,16 +92,11 @@ describe('Versions table', () => {
const [firstRow, secondRow, thirdRow] =
getAllByTestId('versions-table-row')

expect(queryAllByRole(firstRow, 'button')[0]).toHaveTextContent(
'Install'
)
expect(queryAllByRole(secondRow, 'button')[0]).toHaveTextContent(
'Install'
)
within(firstRow).getByText('Install')
within(secondRow).getByText('Install')

const thirdInstalledButton = queryAllByRole(thirdRow, 'button')[0]
expect(thirdInstalledButton).toHaveTextContent('Installed')
expect(thirdInstalledButton).toHaveAttribute('disabled')
const button = within(thirdRow).getByText('Installed')
expect(button).toHaveAttribute('disabled')
})

it('should display empty table when no compatible versions', () => {
Expand Down
21 changes: 18 additions & 3 deletions src/pages/ManualInstall/ManualInstall.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,13 @@ describe('Manual Install', () => {
<ManualInstall />
)

const user = userEvent.setup()
const file = new File(['hello'], 'hello.zip', {
type: 'application/zip',
})

const fileInput = getByTestId('file-upload')
userEvent.upload(fileInput, 'testfile')
user.upload(fileInput, file)

await findByText('App installed successfully')
await userEvent.click(getByText('View app details'))
Expand All @@ -67,8 +72,13 @@ describe('Manual Install', () => {
<ManualInstall />
)

const user = userEvent.setup()
const file = new File(['hello'], 'hello.zip', {
type: 'application/zip',
})

const fileInput = getByTestId('file-upload')
userEvent.upload(fileInput, 'testfile')
user.upload(fileInput, file)

await findByText('App installed successfully')
expect(queryByText('View app details')).not.toBeInTheDocument()
Expand All @@ -82,8 +92,13 @@ describe('Manual Install', () => {
<ManualInstall />
)

const user = userEvent.setup()
const file = new File(['hello'], 'hello.zip', {
type: 'application/zip',
})

const fileInput = getByTestId('file-upload')
userEvent.upload(fileInput, 'testfile')
user.upload(fileInput, file)

await findByText('Failed to install app:')
expect(queryByText('View app details')).not.toBeInTheDocument()
Expand Down
53 changes: 32 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
jsonpointer "^5.0.0"
leven "^3.1.0"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.2", "@babel/code-frame@^7.8.3":
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.25.9", "@babel/code-frame@^7.26.2", "@babel/code-frame@^7.8.3":
version "7.26.2"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.2.tgz#4b5fab97d33338eff916235055f0ebc21e573a85"
integrity sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==
Expand Down Expand Up @@ -3036,6 +3036,20 @@
"@tanstack/query-core" "4.36.1"
use-sync-external-store "^1.2.0"

"@testing-library/dom@^10.4.0":
version "10.4.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8"
integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/runtime" "^7.12.5"
"@types/aria-query" "^5.0.1"
aria-query "5.3.0"
chalk "^4.1.0"
dom-accessibility-api "^0.5.9"
lz-string "^1.5.0"
pretty-format "^27.0.2"

"@testing-library/jest-dom@^6.6.3":
version "6.6.3"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz#26ba906cf928c0f8172e182c6fe214eb4f9f2bd2"
Expand Down Expand Up @@ -3071,6 +3085,11 @@
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==

"@types/aria-query@^5.0.1":
version "5.0.4"
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708"
integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==

"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14", "@types/babel__core@^7.20.5":
version "7.20.5"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017"
Expand Down Expand Up @@ -3855,7 +3874,7 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==

aria-query@^5.0.0:
aria-query@5.3.0, aria-query@^5.0.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e"
integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==
Expand Down Expand Up @@ -5390,6 +5409,11 @@ doctrine@^3.0.0:
dependencies:
esutils "^2.0.2"

dom-accessibility-api@^0.5.9:
version "0.5.16"
resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453"
integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==

dom-accessibility-api@^0.6.3:
version "0.6.3"
resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz#993e925cc1d73f2c662e7d75dd5a5445259a8fd8"
Expand Down Expand Up @@ -8887,6 +8911,11 @@ lru-cache@^6.0.0:
dependencies:
yallist "^4.0.0"

lz-string@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941"
integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==

magic-string@^0.25.0, magic-string@^0.25.7:
version "0.25.9"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.9.tgz#de7f9faf91ef8a1c91d02c2e5314c8277dbcdd1c"
Expand Down Expand Up @@ -10000,7 +10029,7 @@ pretty-error@^4.0.0:
lodash "^4.17.20"
renderkid "^3.0.0"

pretty-format@^27.5.1:
pretty-format@^27.0.2, pretty-format@^27.5.1:
version "27.5.1"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e"
integrity sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==
Expand Down Expand Up @@ -10197,16 +10226,6 @@ react-dev-utils@^12.0.0:
strip-ansi "^6.0.1"
text-table "^0.2.0"

react-dom@^16:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.14.0.tgz#7ad838ec29a777fb3c75c3a190f661cf92ab8b89"
integrity sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"
prop-types "^15.6.2"
scheduler "^0.19.1"

react-dom@^18:
version "18.3.1"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4"
Expand Down Expand Up @@ -10747,14 +10766,6 @@ saxes@^5.0.1:
dependencies:
xmlchars "^2.2.0"

scheduler@^0.19.1:
version "0.19.1"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196"
integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==
dependencies:
loose-envify "^1.1.0"
object-assign "^4.1.1"

scheduler@^0.23.2:
version "0.23.2"
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3"
Expand Down

0 comments on commit 0774aff

Please sign in to comment.