-
-
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
Modularizing e2e tests #1898
Modularizing e2e tests #1898
Conversation
Here is the first stage of applying multiple render API for tests. I realized that the best way to test multiple API is to add |
4420c39
to
ee395ed
Compare
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1898 +/- ##
==========================================
- Coverage 74.74% 74.60% -0.14%
==========================================
Files 33 33
Lines 2811 2812 +1
Branches 626 626
==========================================
- Hits 2101 2098 -3
- Misses 613 618 +5
+ Partials 97 96 -1
☔ View full report in Codecov by Sentry. |
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 have left a few comments
@VadimKovalenkoSNF Can you please:
That way, I would merge straight, as this LGTM. We could then keep this PR for focus on the testing only. |
@VadimKovalenkoSNF This PR should be rebased/revamped, now that I have merged #1901. Hopefully, then I will better understand the way how you solve the problem. |
ee395ed
to
750861e
Compare
test/e2e/treatments.e2e.test.ts
Outdated
const outFiles = await mwoffliner.execute(parameters) | ||
await expect(zimcheck(outFiles[0].outFile)).resolves.not.toThrowError() | ||
|
||
const articleFromDump = await zimdump(`show --url A/${parameters.articleList} ${outFiles[0].outFile}`) |
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.
There is the ability to get an article HTML form dump and test it directly along with other dump output. This might be useful for e2e testing.
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 really understand why yor comment come here, but zimcheck should be run everywhere, so why I have eachtime to request it? Create a test template/fonction/classs so this is part is present only once in the whole codebase.
750861e
to
5140a17
Compare
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.
Once we are at the end of the simplification, we should fix the nodet
test as well.
test/e2e/treatments.e2e.test.ts
Outdated
describe('Treatments e2e', () => { | ||
for (const renderer of renderers) { | ||
if (renderer === 'WikimediaDesktop') { | ||
test('WikimediaDesktop e2e', async () => { | ||
await commonTreatmentTest(renderer) | ||
}) | ||
} | ||
if (renderer === 'VisualEditor') { | ||
test('VisualEditor e2e', async () => { | ||
await commonTreatmentTest(renderer) | ||
}) | ||
} | ||
} | ||
}) |
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.
You can do better: should be doable in 3 lines.
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.
Done, pls check.
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.
Better, but why we have an if
on Render names? All renders should be tested.
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 made it just for safety for cases if some wiki doesn't support a specific wiki.
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 test file has been refactored and renamed to test/e2e/en.e2e.test.ts.
test/e2e/treatments.e2e.test.ts
Outdated
jest.setTimeout(200000) | ||
|
||
let zimcheckIsAvailable | ||
let zimdumpIsAvailable | ||
|
||
beforeAll(async () => { | ||
zimcheckIsAvailable = await zimcheckAvailable() | ||
zimdumpIsAvailable = await zimdumpAvailable() | ||
}) | ||
|
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.
If we could avoid to do that for each test, this would be really better. No way to do simpler?
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 beforeAll
hook is placed outside describe
blocks, so it will execute only once.
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.
The problem is not the execution time, but that we have to place this piece of code almost in all e2e test.
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 not an execution problem, it's a code problem, these lines should be only once coded in the whole codebase.
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.
Done in test/testAllRenders.ts
5140a17
to
48b6c40
Compare
I fixed this in the scope of this PR. |
There is a side effect of e2e testing of all renderers is drastically increased time of test running. |
Yes, this will be a problem and we will have to handle it at some point (but not now) to have e2e which are smaller/quicker to execute, so no scrape with many articles |
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.
Still too complex, we should have one test with no boilerplate, nothing which is repeated from test to test
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.
A lot better, but still a few things to fix
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.
Test zimcheck/zimdump only once in the whole test process!
rebase
f35066e
to
3c5a0d0
Compare
Fixes #1887