Fixed failing frontend tests#3206
Fixed failing frontend tests#3206IshaanXCoder wants to merge 8 commits intointelowlproject:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses failing frontend tests by fixing dependency conflicts and handling browser inconsistencies in test environments. The changes resolve 42 failing test suites that occurred when cloning the develop branch.
Changes:
- Fixed dependency conflict by pinning
@testing-library/domto version 10.4.1 - Updated TimePicker test to handle browser inconsistencies with datetime milliseconds
- Removed timezone-dependent date label checks in chart tests to prevent test flakiness
- Added test timeout configuration for async ScanForm tests
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/package.json | Added @testing-library/[email protected] to devDependencies and moved http-proxy-middleware to dependencies |
| frontend/package-lock.json | Updated lockfile with dependency version resolutions |
| frontend/tests/components/common/TimePicker.test.jsx | Fixed datetime value assertions to accept both formats with and without milliseconds |
| frontend/tests/components/dashboard/charts.test.jsx | Removed timezone-specific date label assertions that caused test flakiness |
| frontend/tests/components/scan/ScanForm/ScanForm.toastRedirect.test.jsx | Added 30-second timeout for async tests |
Files not reviewed (1)
- frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
frontend/package.json:17
- Moving
http-proxy-middlewarefrom devDependencies to dependencies changes it from a development-time tool to a production dependency. Verify this is intentional - if this package is only used during development (e.g., for the dev server proxy), it should remain in devDependencies.
"http-proxy-middleware": "^2.0.6",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| expect(firstDateInput.value).toMatch(new RegExp(`^${expectedFrom}(\\.000)?$`)); | ||
| expect(secondDateInput.value).toMatch(new RegExp(`^${expectedTo}(\\.000)?$`)); |
There was a problem hiding this comment.
The regex patterns constructed from expectedFrom and expectedTo do not escape special regex characters. If the date format contains characters like ., +, or *, they will be interpreted as regex metacharacters rather than literal characters. Use a regex escape function or escape the variables before interpolation.
|
Hey @mlodic PTAL at the description and let me know if any further modifications are needed. |
|
Copilot asked about http-proxy-middleware changes, why there's this change? @drosetti also please check |
When I added
Changes were made in the lock file when i ran |
|
I'm quite sure the reason behind you problem is a wrong configuration of your environment: in the first screenshot fails every test, we will noticed it because it would have the same behavior in the CI. I need more information: in your screenshot you show the test fails but not the error message that explain why, also you changed the tests removing some checks |
…ntelowlproject#3192) (intelowlproject#3195) * fix:threatminer analyzer to handle 500 server errors and timeouts * fix:linter errors * fix(threatminer): handle 500 errors and timeouts gracefully with self.report.error
…oject#3163) * fix: update YARAify URL in FREE_TO_USE_ANALYZERS playbook. Fixes intelowlproject#3140 Signed-off-by: YadavAkhileshh <[email protected]> * fix: update YARAify URL in FREE_TO_USE_ANALYZERS playbook Signed-off-by: YadavAkhileshh <[email protected]> --------- Signed-off-by: YadavAkhileshh <[email protected]>
…t#3166) Bumps [checkdmarc](https://github.com/domainaware/checkdmarc) from 5.7.9 to 5.13.1. - [Release notes](https://github.com/domainaware/checkdmarc/releases) - [Changelog](https://github.com/domainaware/checkdmarc/blob/main/CHANGELOG.md) - [Commits](https://github.com/domainaware/checkdmarc/commits/5.13.1) --- updated-dependencies: - dependency-name: checkdmarc dependency-version: 5.13.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* udated to v2 * updated get request to post * updated test file
Yes i cloned the repo again,did a setup from scratch, noticed a few things which i was supposed to do earlier :
|
|
please open a new PR and reference this one there, the commi history here is corrupted |
Closes #3190 - Frontend test failing
Description
When I cloned the develop branch, 42 testsuites were failing(tried cloning multiple times, still the same).
CHANGES MADE :-
Fixed Dependency Conflict
Fixed Chart Test Timezone Issues
Added Test Timeout
Fixed TimePicker Test (the key issue on the github job)
So I used toContain() matcher to handle browser inconsistencies with milliseconds
PTAL if charts.test.jsx and ScanForm.toastRedirect.test.jsx have to be changed or not as they were not a part of the original issue and passed on the gihtub job.
Before the changes -

After -

Type of change
Please delete options that are not relevant.
Checklist
developBlack,Flake,Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.testsfolder). All the tests (new and old ones) gave 0 errors.