-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
E2E Utils: Ensure deleteAllUsers does not delete current user #58320
Conversation
What do you mean by non-admin user? A user with different username that default one for tests? Should we just check against username which should be unique? Because ID = 1 isn’t always guaranteed. |
Yep! Basically a user that is currently logged in and is not
Oh, I haven't changed that bit. I thought the default root account has always id == 1, no? We can change that to compare against |
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 thought the default root account has always id == 1, no?
Auto incremented IDs are never guaranteed IMO. But logic has been working so far so no need to change it yet 😄
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.
Sorry forgot to approve.
edit: Lol nope, it's all good actually! 😅 |
What?
When calling
deleteAllUsers
, let's ensure we don't attempt to delete the current user, which can be a non-admin user.Testing Instructions
Create a non-admin account and provide the credentials (export
WP_USERNAME
andWP_PASSWORD
). Run e.g. theautocomplete-and-mentions.spec.js
suite and ensure it doesn't attempt to delete the current user in theafterAll
hook.