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
Introduce Playwright for simple integration tests #2455
base: devel
Are you sure you want to change the base?
Introduce Playwright for simple integration tests #2455
Conversation
dev-pihole: | ||
image: ghcr.io/pi-hole/pihole:latest | ||
volumes: | ||
- ../:/var/www/html/admin:ro |
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.
To have functional frontend tests, you need a backend too. I achieved this by using the official docker image and overlaying the repo code.
// Save signed-in state to 'storageState.json'. | ||
await page.context().storageState({ path: 'storageState.json' }); | ||
await browser.close(); | ||
} |
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.
All this setup does is log into the Pihole a single time and then extracts the cookies so that the different browsers and tests do not also have to login multiple times
6637e26
to
85e52c0
Compare
fc02f17
to
a41fb49
Compare
…sons Signed-off-by: Daniel <daniel@developerdan.com>
a41fb49
to
4d33966
Compare
I've been playing around with Playwright E2E testing at work, and I thought it might be fun to see if I could add some tests here. I have absolutely no idea if this appeals to anyone here, and I realize that I didn't really discuss it first, but perhaps we can discuss it now, and no hard feelings if it isn't really inline with the project.
There is a lot in here, and so I'm going to make a bunch of comments on the individual files to perhaps make it more clear. The overall idea is to start up a Pihole docker container with this repo volume-mounted within it. Next, startup a playwright docker container to run tests against the Pihole. Playwright does not have to be ran from docker, but I thought it made networking simple in this case.
There are only two tests in here at the moment, and they are very basic. The majority of this PR is just all setup, if y'all like this PR and accept the changes, then it wouldn't be much more work to expand out the tests to hit more pages.
n/a, or perhaps make a note about having docker-compose and running
./tests/run
By submitting this pull request, I confirm the following:
git rebase
)