-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add playwright create/login test for all db #4369
Conversation
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.
Great idea to extract the tests.
Are they run by any CI ?
Should lines be added to .github/* workflow(s) ?
Since it's using docker to run |
604d08b
to
20a4688
Compare
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.
Tanks for the PR and the initiative. Adding a way to do some form of system testing has been on my personal todo list for a long time but I had no time to really dive into it. (I was evaluating the Rust-based options like thirtyfour but I don't think it's there yet.)
-
I'm not sure I'm a fan of the
test/scenarios
subfolder. I think it would make more sense to add it in the root directory of the project (so that testing becomes more important and not hidden away) and adding support for CI would be great too. Which is why I've also suggested some changes that would be important if we decide to make testing more of a first class citizen. (But this can be done at a later time too probably, so maybe it's enough to rename it asplaywright
directory.) -
I've not looked into playwright enough to suggest concrete changes but I think that fundamentally it's not configured correctly (i.e. instead of browsers we should use the databases as projects because vaultwarden is fundamentally a backend project). And also I'd like to have the option to only run
sqlite
tests since running the containers for the other databases takes a long time and most of the time I'd be developing against the sqlite database. (I mean so that I can runnpx playwright test --project=sqlite
to speed up the tests.) -
The setup is currently not that useful for developing Vaultwarden, so this would have to be adapted to our needs. (And also for CI.) But I think it's a great proof of concept.
-
One change I'd also like to see is the removal of the SSO specific parts because I think those should be added separately.
-
Lastly (but that's just a nit), the project is called Vaultwarden not VaultWarden. 😏
@stefan0xC hey first thanks for the review :).
Unsure if you mean to move it to
At first I wanted just a quick way to test migrations (made a broken one recently). But the projects feature look interesting will check it.
I'm unsure what you mean by that, but yes they are integration tests not made for developing more for checking non regression of the core feature of the application.
Yep sorry some stragglers. |
I'd move it to Setup wise the stuff specific for SSO could be added to a separate project (that does a
I meant in context with my other comments in regards to what assumptions we make about the integration of the tests with the rest of the project and also if this should be part of the CI. For me this is more of an open discussion point and much of it should be addressed by the maintainers and/or could probably also be addressed later. |
I know it's not practical but I'd like to settle on a layout which work with the SSO stuff since my goal with this PR is to facilitate review. If I still need to move everything in the SSO pr it defeat the purpose.
Can you give me some pointer on which stuff ?
Edit: There is a merged PR with wildcard support (but not yet released) for project all combination could be defined then the wildcard would make it more usable. |
Yeah, I get that but I think the keycloak stuff could just as well be added as a subfolder of the
Sorry, like I said I've not looked at your repository. I'm thinking about keeping your SSO changes separate for now so it will be easier to merge. Having a separate setup file for SSO specific changes (i.e. everything you've ripped out to make the web-vault compatible) can be seen as setup for a SSO project (and I was thinking that we might want do autostart keycloak like we do postgres/mariadb to test the changes - but I've not looked into it). I mean, ideally this shouldn't even be needed because the SSO stuff might use it's own official vaultwarden sso enabled web vault build which can be just pointed at with a separate |
Ok I'll move it to Do you think it would make sense to move it inside the |
e77b4c4
to
7bdef73
Compare
So moved everything and used |
7bdef73
to
ec50b5a
Compare
ec50b5a
to
70269d7
Compare
Hey, Resolved the different discussions since I believe they are mostly linked to the question of keeping the separate As I mentioned :
But of course if you are not interested in it working this way I'll make the change. |
70269d7
to
4c5f77c
Compare
4c5f77c
to
7d96067
Compare
7d96067
to
963eef7
Compare
Hey, Where do we stand with this ? Is there still interest ? Should I change the way it works ? This would probably be useful to help with faster merge/integration of the front-end. |
|
A yes I was a bit fast when I checked the release, but my point is more that there is a struggle to keep pace with the clients release. Edit: But I was just trying to point where it could be useful. So to go back to the issue :
|
Well, I am interested but like I said I don't think that the current implementation is all that useful yet for how we do things and in my view we should discuss first how this would help us and where.
The current flow is that when upstream releases a new web-vault, someone creates a PR in the bw_web_builds repository (where we keep track of our patches for the web-vault), this is then reviewed, merged and released. After the patched web-vault is released (and built and uploaded by CI), someone also has to create a PR to use the new web-vault in vaultwarden (which also needs to be merged as well to land in We certainly could improve this flow by adding playwright tests to the mix, as it would make it easier for making sure our patches stay compatible and reduce the burden of the maintainers but as I said that's a larger discussion because it might not make sense to add it to the Personally, I think that we probably could switch to a monorepo approach or alternatively have a separately managed repository for testing but that's something I'd like the input from @BlackDex and @dani-garcia on. I mean for me it would also make sense to rethink how vaultwarden is released and maybe work on multiple branches, e.g. a |
Thinking on it in this current version it would be awkward to try to use it to validate new version of the front-end since I made it to rely on something already published. Of course, it could be changed but it would still mean using something outside the project. At the same time I don't think moving this outside of Vaultwarden is a good idea since it's useful to ensure non regression from code modification in Vaultwarden and I found it quite useful to test things like database migration too (on all engines which is quite a pain manually otherwise). |
6814b52
to
0cfa462
Compare
Hey Worked on it a bit, wanted to add the ability to run against a non released version of So switched to using So running tests for postgres looks something like this export DOCKER_BUILDKIT=1
docker-compose --env-file test.env --profile postgres up -d Postgres
docker-compose --env-file test.env run Playwright test --project=postgres To run with a custom version of the web-vault: export DOCKER_BUILDKIT=1
export PW_WV_REPO_URL=https://github.com/stefan0xC/bw_web_builds
export PW_WV_COMMIT_HASH=c5b5279a8478385cee66a8cdfc804690cffe0315
docker-compose --env-file test.env up --build WebVault
docker-compose --env-file test.env run Playwright Part of the handling of dependencies could be hidden/improved with a script. |
0cfa462
to
7ec697b
Compare
Added export DOCKER_BUILDKIT=1
docker-compose --env-file test.env run Playwright |
1d857a7
to
391e7e2
Compare
391e7e2
to
b89e2fc
Compare
55601d1
to
dfa891e
Compare
Added integration with https://github.com/maildev/maildev in the tests to be able to check the mail sent. |
dfa891e
to
db23c12
Compare
Added some Organization invitation tests and switched to the |
c64242e
to
546143f
Compare
546143f
to
2618730
Compare
Rebased on main since both previously PR are merged :). |
Hey
So I extracted the Playwright tests I wrote for the SSO PR since it could be reviewed independently.
This allow to test account creation and login on all three databases.
The setup phase might be a bit verbose but I didn´t want to introduce another dependency to handle the building.
Structure could be a bit more flat but in the SSO PR it include an additional
docker-compose
to run Keycloak.