Improve frontend/specs/issue specs.js
What does this MR do?
This MR attempts to make improvements on specs/frontend/issue_spec.js on top of the already beneficial changes made with a previous MR specs/frontend/issue_spec.js legacy specs. This MR was inspired by previous discussions on a recently closed issue and MR where we were exploring ways to remove some tech debt in the legacy code and improve the related testing. The end result will make the tests more easily maintainable by making them more consistent with other front-end specs (search for: from '@testing-library/dom';
in your favorite editor), as well as encouraging better DOM coding practices supported by the @testing-library/*
set of dependencies in future tested features.
The specific goals achieved in the MR are:
- Keep coverage equivalent
- Scope assertions to test functions
- Leverage jest life-cycle test functions vs. custom functions/iterators where possible
- Ration DRYing of the test code to keep the testing intent clear and easily understandable
- Remove the jQuery dependency in order to leverage @testing-libary/dom paradigm implemented in many other front-end specs
- Introduce @testing-library/jest-dom dependency to leverage its helper functions for testing element visibility and presence
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines - [-] Merge request performance guidelines
-
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
This MR is low risk as no functional changes to the product shipped to customers, but is intended to reduce technical debt in legacy code to support future development. Test coverage is intended to be kept exactly the same.
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team