ui5-uiveri5
ui5-uiveri5 copied to clipboard
Long wait when using github-authenticator
We try switching from sapcloud-form
togithub-form
(v1.42.1 - e.g. latest) and found some strange behaviour:
When there is authorize
button everything is working fine.
When there is no such button the test freezes on DEBUG: Opening custom login page
and wait for ~ 2-3 minutes (the whole test takes 209.38 seconds) when using sapcloud-from
the test takes ~ 14.72 second
I suppose it freezes because of https://github.com/SAP/ui5-uiveri5/blob/master/src/authenticator/formAuthenticator.js#L97:
this._wait(function() {
return that._isPresent(that.authorizationButtonSelector).then(function(isPresent) {
if (isPresent) {
return that._getField(that.authorizationButtonSelector).click().then(function() {
return true;
});
}
});
},'Explicit authorization was not requested',this.authorizationButtonTimeout).catch(function () {
// swallow the timeout error as reauthorization is only displayed sometimes
});
Which waits for authorize
button, but the button appears only from time to time.
Consider something as in the original implementation, where if the button:
- visible, but:
- disabled -> wait for it then click it
- enabled -> click it
- not visible (not there):
- stop waiting and continue
This can be seen in: https://github.com/SAP/ui5-uiveri5/commit/9541d298e2fd6618dd32a91d9ee27cfd9f8f68aa#diff-3b06efe14e0d496e33d9216fefee54a0R92
Hi, can you please try with v1.42.1 as we did some restructuring in this code ?.
Yes, my pardon I have written in the description 1.41.2, but meaning 1.42.1
e.g. the latest.
The issues is only with github-form when there is not button authorize
in all other cases it is working as expected
That is strange as we have E2E tests that covers all scenarios of this authenticator and they are working fine. I will have a look and come back to you for details.
Again it is working (after the long wait the tests work as expected), but it waits for far too much time... more than we can spend for our Pull Request tests.
The authorizationButtonTimeout is configurable, default is 10000 ms e.g. 10 sec. https://github.com/SAP/ui5-uiveri5/blob/master/docs/config/authentication.md
The algorithm you suggested is unreliable as it depends on the current implementation in github and depends on load timing. See the E2E where we validate both the presence and visibility of the button.
Thanks, the problem seems to be that we have overridden the default timeouts:
timeouts: {
getPageTimeout: "200000",
allScriptsTimeout: "900000",
defaultTimeoutInterval: "900000"
},
Where I need to put the authorizationButtonTimeout: "10000"
, because I tried ii in the timeout
section and also under github-form
, but it seems that do not work?
I have tested it with removing the custom timeout and it wait for the default time of 10 seconds.
Check the docs: https://github.com/SAP/ui5-uiveri5/blob/master/docs/config/authentication.md
I have checked it, but it does not work. In the file - https://github.com/SAP/ui5-uiveri5/blob/master/src/authenticator/formAuthenticator.js, the timeout is used, but it is undefined (it is not assigned to this
in the constructor?)
I have tried with adding log right before the check:
that.logger.debug('timeout set to:' + this.authorizationButtonTimeout);
and I get:
DEBUG: timeout set to:undefined
ups, seems we forgot to init. And the test passes which is even worse. Will check and fix soon, sorry.