Closed PaulREnglish closed 11 months ago
Thanks for this @PaulREnglish - it seems like a much more robust way to disable the welcome message than wrestling with ever-changing JS APIs and potential race conditions we were seeing across environments.
❤️
It looks like we're just setting this on the default (admin) user. It's fairly common for multiple users to be seeded with different roles/capabilities to run tests against, so Ideally this meta should be set on all users by default. Perhaps it would be better suited as a default setting in the user fixture here to cover this?
That's a good idea though there's a small chance it might not be necessary. There's a piece of user meta called show_welcome_panel
which is being set on the admin and only on the admin. It might mean that the welcome modal only appears for the admin but I am not sure about that.
The other thing worth mentioning is that the admin user isn't being created by the user fixtures - it's being created when WP is first being installed. This means we'll have to update the user meta for the admin and the other users separately within WP-Cypress.
Can the JS welcome guide toggle code be fully removed now that this method is being introduced? Has this been tested with that code removed?
It hasn't been tested but I suspect it probably could be.
Out of interest, is it still possible to toggle the welcome guide on manually using JS after this meta has been set?
Again I haven't tested it but I suspect that will still be possible. This is because the toggle only control whether the welcome guide is currently being shown on screen which has nothing to do with the user meta.
It looks like we're just setting this on the default (admin) user. It's fairly common for multiple users to be seeded with different roles/capabilities to run tests against, so Ideally this meta should be set on all users by default. Perhaps it would be better suited as a default setting in the user fixture here to cover this?
That's a good idea though there's a small chance it might not be necessary. There's a piece of user meta called
show_welcome_panel
which is being set on the admin and only on the admin. It might mean that the welcome modal only appears for the admin but I am not sure about that.The other thing worth mentioning is that the admin user isn't being created by the user fixtures - it's being created when WP is first being installed. This means we'll have to update the user meta for the admin and the other users separately within WP-Cypress.
I'm pretty certain that the welcome modal guide shows for each user, so perhaps we do need to set this in both locations. Would you be able to test this (and the fix, if needed) by seeding a user and switching to them via cy.switchUser
in an e2e test?
Can the JS welcome guide toggle code be fully removed now that this method is being introduced? Has this been tested with that code removed?
It hasn't been tested but I suspect it probably could be.
Out of interest, is it still possible to toggle the welcome guide on manually using JS after this meta has been set?
Again I haven't tested it but I suspect that will still be possible. This is because the toggle only control whether the welcome guide is currently being shown on screen which has nothing to do with the user meta.
My assumptions are the same here on both counts, but it would be worth confirming, especially regarding the JS toggle code as that should really be removed in this PR if it's now superfluous.
I'm pretty certain that the welcome modal guide shows for each user, so perhaps we do need to set this in both locations. Would you be able to test this (and the fix, if needed) by seeding a user and switching to them via
cy.switchUser
in an e2e test?
You were right. show_welcome_panel
does nothing and the welcome guide modal was popping up for other users. I have now fixed this. 😄
My assumptions are the same here on both counts, but it would be worth confirming, especially regarding the JS toggle code as that should really be removed in this PR if it's now superfluous.
Just tested it. We don't need the JS toggle code and we can still toggle the code manually using JS if need to. I did this using a setInterval
:
setInterval(() => {
console.log('hmmmm');
dispatch('core/edit-post').toggleFeature('welcomeGuide');
}, 5000)
Video proof: http://bigbite.im/v/WHF9SK
Link to previous PR: https://github.com/bigbite/wp-cypress/pull/124
Description
In WP 6.2, the default WordPress 'welcome guide' modal is appearing within the Gutenberg editor which prevents test execution. To fix this, I've updated the user meta for the admin to prevent this occuring.
Change Log
Adds an action to the
init
hook which setswp_persisted_preferences
to:This means the Welcome Message modal will no longer appear in the Gutenberg editor.
Also fixes some formatting errors in lib/cli/commands/reset.js to fix a linting error. (Commit: https://github.com/bigbite/wp-cypress/pull/126/commits/ffa083e63a5a592f26a9b9181758a895cfbaf4e9)
Types of changes (if applicable):
Checklist (if applicable):