-
-
Notifications
You must be signed in to change notification settings - Fork 79
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 mwApiPath (to mwActionApiPath), mwRestApiPath, mwModulePath and mwWikiPath parameters + fix regression of test render template #1939
Conversation
8bbdd42
to
9240879
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1939 +/- ##
==========================================
- Coverage 75.43% 73.27% -2.16%
==========================================
Files 37 39 +2
Lines 2984 3106 +122
Branches 653 687 +34
==========================================
+ Hits 2251 2276 +25
- Misses 633 711 +78
- Partials 100 119 +19
☔ View full report in Codecov by Sentry. |
This PR has nothing to do with VE, as such nothing regarding VE should normaly be inside... and for sure not https://phabricator.wikimedia.org/T350117 which has really nothing to do with this ticket. |
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.
Few changes to do only.
src/Downloader.ts
Outdated
@@ -175,13 +176,13 @@ class Downloader { | |||
this.baseUrl = basicURLDirector.buildDownloaderBaseUrl([ | |||
{ condition: await MediaWiki.hasWikimediaMobileApi(), value: MediaWiki.WikimediaMobileApiUrl.href }, | |||
{ condition: await MediaWiki.hasWikimediaDesktopApi(), value: MediaWiki.WikimediaDesktopApiUrl.href }, | |||
{ condition: await MediaWiki.hasVisualEditorApi(), value: MediaWiki.visualEditorApiUrl.href }, | |||
// { condition: await MediaWiki.hasVisualEditorApi(), value: MediaWiki.visualEditorApiUrl.href }, |
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.
1 - create a PR to deactivate visualeditor
2 - create a ticket requesting reintroducing it once the phabricator ist fix and rolled out
3 - put links between all of this so things are understandable
Only the VisualEditor autodetection should be deactivated
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/e2e/multimediaContent.test.ts
Outdated
rimraf.sync(`./${outFiles[0].testId}`) | ||
}) | ||
break | ||
case 'VisaulEditor': |
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.
typo
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.
Fixed.
69654c6
to
aa979c1
Compare
I like the fact that you completely removed This CLI changes are somehow a breaking change (we cannot set Good job! |
Thank you, @benoit74 , but I want to emphasize that |
99842b0
to
c2f2b87
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.
CI does not pass
Because of the regression described in #1943 |
test/unit/styles.test.ts
Outdated
@@ -13,7 +13,7 @@ describe('Styles', () => { | |||
|
|||
test('Stylesheet downloading', async () => { | |||
const { articleDetailXId } = RedisStore | |||
const { downloader } = await setupScrapeClasses() // en wikipedia | |||
const { downloader } = await setupScrapeClasses({ mwWikiPath: '/' }) // en wikipedia |
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.
We only test against Wikimedia Web site, so why not setting this once for all? Why it's not the default value in setupScrapeClasses()
?
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 fixed this issue.
test/testAllRenders.ts
Outdated
|
||
return outFiles | ||
} | ||
|
||
export async function testAllRenders(parameters: Parameters, callback) { | ||
export async function testAllRenders(parameters: Parameters, callback, optionalRenderesList?: Array<string>) { |
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.
Naming of the method is not appropriate anymore, it's not "all" Renders.
I would recommend to:
- Rename this to
TestRenders()
- Create
testAllRenders()
withRENDERERS_LIST
as argument list for then redirecting toTestRenders()
It's somehow concerning to have e2e tests not running on all renders as this is a basic requirement... but here there is maybe a special use case...
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.
Refactored.
test/e2e/forceRender.test.ts
Outdated
@@ -39,7 +40,7 @@ describe('forceRender', () => { | |||
expect(redisScan.stdout).toEqual('') | |||
}) | |||
|
|||
test('Scrape article from bm.wikipedia.org should throw error when using VisualEditor render', async () => { | |||
test.skip('Scrape article from bm.wikipedia.org should throw error when using VisualEditor render', async () => { |
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.
why skipping? Actually it should not throw an error, it should work perfectly.
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.
Fixed.
src/MediaWiki.ts
Outdated
|
||
private initApiURLDirector() { | ||
// TODO: this.webUrl probably shouldn't accept hardcoded 'wiki/' param, check test/e2e/extra.e2e.test.ts | ||
this.webUrl = this.baseUrlDirector.buildURL('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.
Yes, here the mwWikiPath
value should be taken
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.
Refactored this. Also, 'wiki/' value is default again.
…mplate and renderer builder
…sue with outputDirectory
c2f2b87
to
d3b0125
Compare
@kelson42 It looks like the root cause was not with treating Check this JS snippet:
Forward slash at the end of href prohibits building the correct URL for wikis like By using this command, the action API URL to get wiki site info will be correct: So I brought back the default 'wiki/' param for Mediawiki.webUrl. It is using only there and nowhere else. |
Fixes #1935
Depends on #1944
List of fixes:
Explicitly set{ mwWikiPath: '/' }
in the tests to prevent default wiki/ path to assigning.Default value ofDefault wikiPath is 'wiki/' as it was before.mwWikiPath
is the empty string as per discussion in [REGRESSION?] API end-point detection does not take care properly of command line argument #1935 (comment)❗ Important - this will probably affect receipts in the zimfarm because--mwWikiPath='/'
is obligated param for the Mediawiki wikis now.Check this command as an example:npm start -- --mwUrl=https://en.wikipedia.org --adminEmail=mail@mail.com --articleList=Canada --mwWikiPath=/
.See #1935 (comment) for more details.^ Upd: this is no longer valid, mwWikiPath can be default 'wiki/'