-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Refactor unit tests to unblock CI #1862
Conversation
VadimKovalenkoSNF
commented
Jul 19, 2023
•
edited
Loading
edited
- Removed test related to MCS.
- Removed tests that handle elements with the details tag.
- Refactored test that calculates article categories.
- Refactored e2e tests.
c9dfa1b
to
fa26471
Compare
fa26471
to
04accc2
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1862 +/- ##
==========================================
- Coverage 71.42% 70.29% -1.14%
==========================================
Files 24 24
Lines 2625 2626 +1
Branches 595 596 +1
==========================================
- Hits 1875 1846 -29
- Misses 644 667 +23
- Partials 106 113 +7
☔ View full report in Codecov by Sentry. |
@VadimKovalenkoSNF When you are ready, please request review to me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the test does not sound to be the appropriate approach to me. Improving or updating test is the approach to follow.
Failed tests with error:
Need to investigate, local test went OK. |
Please comment out and open a ticket to be treated later in the milestone |
The ticket about empty sections handling is here - #1866 |
0f218f2
to
460b3fa
Compare
@kelson42 To fix test pipeline, I had to roll back |
I updated the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature --keepEmptyParagraphs
(and the way how it should work when unset) seems not understood.
if (hasNoMediaContent) { | ||
if (!paragraph.textContent || (paragraph.textContent && paragraph.textContent.trim().length === 0)) { | ||
DU.deleteNode(paragraph) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not behave like it should. Either it removes user visible empty parapgraph (<h*>
DOM node or similar or it's wrong). Here it just removes <p>
elements under certain conditions which is neither what is expected or what it was doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I brought back the original implementation of this for now.
const doc = domino.createDocument(LondonHtml) | ||
const imgToGet = Array.from(doc.querySelectorAll('[data-mw-section-id="0"] img'))[0] | ||
let imgToGetSrc = '' | ||
if (imgToGet.getAttribute('src')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why there is a if
here? Don't assume the HTML could change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good practice to check whether DOM element has a specific attribute before calling it directly.
test/unit/saveArticles.test.ts
Outdated
} | ||
expect(fewestChildren).toBeGreaterThan(0) | ||
const paragraphs = Array.from(doc.querySelectorAll('p')) | ||
expect(paragraphs.length).toEqual(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here same feedback as earlier, the feauture seems to be not understood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rollbacked tests and commented on them. We'll refer to this functionality later.
8eea14a
to
a23144f
Compare