Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: [TERR-425] React Component Code Coverage and Error Validation #49

Merged

Conversation

sanchezelton
Copy link
Contributor

This PR adds code coverage reporting (using React Testing Library's use of Jest and Istanbul) to React component testing in the Network Map Grafana Plugin.

This also implements error validation to the UI for the CustomTextArea component and refactors its to utilize a controlled component implementation.

Checklist

  • PR Title format: type: [TERR-XXX] Short description
    • type is one of: 'build', 'ci', 'chore', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'
    • TERR-XXX refers to a Jira issue.
    • If this is a breaking change prefix the description with "BREAKING CHANGE:"
  • There is a related Jira issue for this pull request
  • Description should be a meaningful summary of thea changes you are proposing
  • For breaking changes prefix the title with "BREAKING CHANGE:" and include details in the description
  • This PR is as small as possible
  • This PR includes tests related to these changes, or existing tests provide coverage
  • This PR has updated documentation as appropriate

- added VS code workspace extension to gitignore
- added jest.config
- updated yarn.lock
- added dev dependencies for @testling-library/react and supporting libs
- added setupTests (for Enzyme)
- added export of CustomTextAreaSettings interface in CustomTextArea module
- added CustomTextArea spec file
- added non default prop settings for .eslintrc
- added transformIgnorePatterns for rxjs to jest.config
- added test:react script for package.json
- removed already extended include prop for tsconfig
- updated yarn lock file
- fixed bad path to jest-setup.js in setupFilesAfterEnv prop in jest.config
- added missing props onPointerEnter/LeaveCapture on
use of TextArea Grafana React component with
onPointerCapture callback for CustomTextArea component
- refactored import of render from @testing-library/react in CustomTextArea spec
- refactored expect call on CustomTextArea spec test case
to use jest expect.not.toBeUndefined
- removed unneeded type for str unescape fn parameter  in CustomTextArea
…l into test/TERR-425-react-component-code-coverage
- updated docker-compose for mitmproxy deployment
- updated jest.config to better align with Grafana panel
plugin jest.config scaffolding
- updated Makefile for E2E testing, mitmproxy support and
container spin up sleep timing
- updated package.json to better align with Grafana panel
plugin scaffolding, rollback to react 17, align types for react
and react-dom, added RTL
- updated yarn lock to reduce installed versions of react to one
- reporting and worker count now dependent on CI in
playwright.config
- tsconfing updated to allow for import and module
resolution when in ts-node context (for react testing)
- updated testing in auth.setup to support versions 9 and
10 or later of Grafana
- updated config.info to create URLs based on input
e2econfig flow sheets
- e2econfig updated to included flow sheets in google
sheets
- updated folderDashboardInit to fix dashboard setup and utilize mock panels and dashboard
- updated mock panel json
- networkMapPanel json updated to use infinity datasource
- plugin-def added to include interfaces
- plugin.spec added include test cases for end-to-end,
including updates with changes in sidebar for remote URLs
- interfaces added for DataSource, Fixtures, HostPost,
PanelParams, Threshold, Toplogy, ToplogyNode,
TopologyEdge
- untyped waitForEvent HOC added
- added basic color matcher object module
- fix for MapPanel.resolveNodeThresholds to skip
layerThreshold computation when nodeThresholds are not
an array
- added useConfigurationUrl boolean prop in MapOptions, along with IColumn and IFlowSheet interfaces
- removed unneedede onPointer*Capture prop usage and
callbacks for TextArea instance in CustomTextArea
- removed setting of text attributes in esmap since D3.js
strips non-SVG conforming attributes out
- added removeRepeats fn in test/utils module
- fixed imports for RTL screen and render in CustomTextArpea.spec
- update CI docks for E2E testing upon push and pull_request
- updated development docs to specify Node 18.x as
requirement for building
- removed watch mode from jest react test invocation from package.json
- updated playwright.config to run split off of edge coloration tests in seperate module for speed up of parallel execution
- split tests into main plugin.spec module and
edgeColoration.spec module
- renamed parent folder for untypedFn module to util
- added fixtures module to avoid repeeated invocations of
fixture instatiation code
- moved common url related fn for tests into util/urlHelpers
module
- added check on thresholds in MapPanel to allow for non-array values like null or undefined to bypass forEach invocation
- removed unused suffix input param prop in
CustomTextArea component
- added @ts-ignore flags to minimize TS type error noise
from CustomTextArea components in tests due to bad React 17 FC and VFC signatures WRT to children.
- removed unneeded comments
- removed parent entries to node and edges in index.html
- added react testing to make test:component script
- readded parent entries to node and edges in index.html
- added react testing to make target teest
- corrected check on
options.layers[layer].nodeThresholds.steps
prior to invoking forEach in MapPanel.resolveNodeThresholds
- corrected code formatting in CustomTextArea component
- added fireEvent.blur after firiing change event to trigger callback
- added sourceMap prop to tsconfig
- added doInsert, doDelete fn to support fixing of direct edit issues
- added test stub for "invokes the onChange
callback without transforming the argument's
symbols into HTML entities upon the keyDown
event" into CustomTextArea.spec
…l into test/TERR-425-react-component-code-coverage
- updated @types/react and @types/react-dom packages to target latest release of ver 17 of each
- updated lock file
- remaining keyDown test WIP
- updated CustomTextArea to be a controlled component, using state to define
- initial validation logic added to CustomTextArea, but no reporting of result to UI at present.
- type checks on validationFailedMsg in validateMapJsonStr fn.
- removed test for onKeyDown
- removed unneeded userEvent import from CustomTextArea spec
- added styling for JSON validation error
messages for coloration and reduced size of
error message text
- added import of styling to CustomTextArea
component
- added wrapper to nested TextArea
component in CustomTextArea render and
error message div
- removed unneeded output via console.log
- increased timeout for edgeColoration.spec to 120s
@sanchezelton sanchezelton changed the base branch from main to end-to-end-tests October 8, 2024 18:48
- updated development documentation
- removed commented code in
edgeColoration.spec and plugin.spec
- fixed prop for INetworkMapPanel to be a Partial
- added check on options.layers to confirm
presence of array, creating one if not present
in
folderDashboardInit.getFolderDashboardTargets
- rennamed folderDashboardInit fn
getFolderDashboardTargets to
getFolderDashboardFixtures to agree with
returned type
- fixed references to above
…workmap-panel into test/TERR-425-react-component-code-coverage
- added jsdoc for edgeColoration.spec getThresholds helper fn
@sanchezelton sanchezelton marked this pull request as ready for review October 14, 2024 20:55
- updated README to use default value of
"names" in place of "pops" for endpoint
identifier
- updated demonstration dashboard.json for above change
- updated networkMapPanel.json to align endpointId changes in initial layers
- updated module.spec commented test for alignment when the component test is fixed.
.gitignore Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/components/CustomTextArea.tsx Show resolved Hide resolved
src/types.ts Outdated Show resolved Hide resolved
tsconfig.json Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
.eslintrc Outdated Show resolved Hide resolved
- removed duplicate entry to git ignore .code-workspace
- restored includes line in tsconfig.json
- removed useConfigurationlUrl prop in MapOptions interface and usage in mock.panel.json
sanchezelton and others added 4 commits October 24, 2024 13:33
- reverted package.json and yarn.lock to end-to-end-tests revision
- reverted following packages to versions in
target branch for e2e:
@types/react
@types/react-dom
@grafana/tsconfig
- reverted yarn.lock to revision from main branch
src/components/CustomTextArea.tsx Show resolved Hide resolved
src/components/CustomTextArea.tsx Outdated Show resolved Hide resolved
src/components/CustomTextArea.tsx Outdated Show resolved Hide resolved
src/components/CustomTextArea.tsx Outdated Show resolved Hide resolved
tests/CustomTextArea.spec.tsx Outdated Show resolved Hide resolved
@jkafader-esnet jkafader-esnet merged commit bfe65b0 into end-to-end-tests Nov 6, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants