-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
date based electron tests are using today instead of specific date #3597
Comments
yes, the 'work around' is to code the Date() setting IN the config.js file for the tescase instead of in the calendar_spec.js runner (which uses helper) in the config.js for the testcase works for local debugging |
but you have to be careful coding this in config because there are config's which are used in several tests ... |
yes, this one (ICS)
but each has diff .js file, which contains the Date() function |
those other tests are used in e2e and do not care about the number of events posted.. |
fixes #3597 Changes: - electron tests: add mocking to `electron.js` for mocking the server side, before only the browser side was mocked - publish "/tests/configs" and "/tests/mocks" always in `server.js`, this reverts a change done with latest release, we need this for debugging (otherwise you get on the screen that your config has errors but config check is successful ...) - revert hotfix in `tests/configs/modules/calendar/show-duplicates-in-calendar.js` - fix `tests/configs/modules/calendar/custom.js` to allow events in the past (~~I don't know how this could work before~~ when testing css classes `yesterday` and `dayBeforeYesterday` --> it worked before because the server side did not mock and therefore was not in the past)
i have merged develop now that #3599 is merged BUT the testcases in Electron still have Date().... in them did you intend for these to be changed too so that only date in runner applies?
|
also in helper
|
this will fix all the testcases.. in the tests/config/modules/calendar folder grep Date.now *.js | awk -F: '{print $1}' | xargs sed -i -e '/Date.now/,+3d' |
my helper suggestion however causes failure to locate content |
I did several tests yesterday and as I wrote already in the PR, I think we need both, the date mocking in the browser and the date mocking in the backend (maybe except for modules running completly in the browser as weather). But I'm happy to merge a simpler solution ... |
sorry,, I missed the implementation detail of mocking on both. I 'assumed' that mocking on the server would set the date for the browser that was started later. i removed all the config Date.now from the testcases.... and all were executed correctly, regarless of my system timezone so I think the env sets the side for node_helpers.. and the helper global setup still does the same for the browser.. this way there is only ONE place for the execution date( the runner) |
do you mean this e.g. in Date.now = () => {
return new Date("19 Oct 2023 12:30:00 GMT-07:00").valueOf();
}; was not aware of setting dates in the configs. So now I understand your grep statement, will you provide a PR for removing this? Otherwise I can do this ... |
see #3600 |
as test stuff is running on |
see #3596
The helper is not working (anymore) so every (electron) test running with a specific date does not run with this date but uses today.
Above PR should be reverted if this is solved.
The text was updated successfully, but these errors were encountered: