You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The translator tester (accessible in the debug build of the connector extension) is supposed to run the tests for the translators specified on the URL.
This is used by the Selenium-driven test for pull requests in zotero/translators, but this test (most of the time) does not actually run:
I think the problem is that, when runURLSpecifiedTranslators() is called at the end of init(), most likely the translators have not been loaded into the global object translatorTestViewsToRun which is used by the function to identify the translator(s) to run:
init() calls haveTranslators() which returns a promise that is notawaited/then-handled. (The following snippet is the call site, and itself is inside one big initialization loop waited for by await Promise.all(...) on Line 428.
// Run translators specified in the hash params if any
runURLSpecifiedTranslators();
}
}
And by this time when runURLSpecifiedTranslators() accesses translatorTestViewsToRun, the haveTranslators() function likely has not been called (enough times) yet, so translatorTestViewsToRun is empty or incomplete.
Impact
Because of this, the following lines in runURLSpecifiedTranslators() are executed without the tests being actually run.
That is to say, the page falsely reports that the tests passed by the URL are complete. This can even happen if the URL-passed translator ID is invalid.
The text was updated successfully, but these errors were encountered:
Wait for `translatorTestViewsToRun` to be populated, and then call the
handler for the URL-specified translators' tests. If the
`translatorTestViewsToRun` object is not ready, the handler
(`runURLSpecifiedTranslators`) will silently skip the tests it is
supposed to run.
Fixeszotero#20.
Context
The translator tester (accessible in the debug build of the connector extension) is supposed to run the tests for the translators specified on the URL.
This is used by the Selenium-driven test for pull requests in zotero/translators, but this test (most of the time) does not actually run:
https://github.com/zotero/translators/blob/3a9544d7b0b6fdcb6cdcbc8c08392f91d20d99b4/.ci/pull-request-check/selenium-test.js#L128-L130
The problem
I think the problem is that, when
runURLSpecifiedTranslators()
is called at the end ofinit()
, most likely the translators have not been loaded into the global objecttranslatorTestViewsToRun
which is used by the function to identify the translator(s) to run:translate/testTranslators/testTranslators.js
Lines 580 to 590 in fcb7b8a
But the sequence of calls is like the following:
init()
callshaveTranslators()
which returns a promise that is notawait
ed/then
-handled. (The following snippet is the call site, and itself is inside one big initialization loop waited for byawait Promise.all(...)
on Line 428.translate/testTranslators/testTranslators.js
Lines 474 to 478 in fcb7b8a
Then the
init()
function runs its course, and makes the call torunURLSpecifiedTranslators()
at the very end:translate/testTranslators/testTranslators.js
Lines 532 to 536 in fcb7b8a
And by this time when
runURLSpecifiedTranslators()
accessestranslatorTestViewsToRun
, thehaveTranslators()
function likely has not been called (enough times) yet, sotranslatorTestViewsToRun
is empty or incomplete.Impact
Because of this, the following lines in
runURLSpecifiedTranslators()
are executed without the tests being actually run.translate/testTranslators/testTranslators.js
Lines 599 to 601 in fcb7b8a
That is to say, the page falsely reports that the tests passed by the URL are complete. This can even happen if the URL-passed translator ID is invalid.
The text was updated successfully, but these errors were encountered: